Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot stop; suffer from vpn connection problems. #21

Closed
1 task done
KnIfER opened this issue Oct 5, 2019 · 2 comments
Closed
1 task done

cannot stop; suffer from vpn connection problems. #21

KnIfER opened this issue Oct 5, 2019 · 2 comments

Comments

@KnIfER
Copy link

KnIfER commented Oct 5, 2019

Issue details

Hit 'convert to oher languages' will start a background process that user cannot stop.

Further, if user's network cannot connect to google translate, then this process will wait minutes for timeout for each language and create several empty tags.

Thus, we need 1. Better control over the background process. 2. Save and load for selected languages .

Please select the affected platforms

  • Android Studio

Version of Plugin and IDE

  • Plugin Version: AndroidLocalizePluginv1.3
  • IDE Version: Android Studio3.5
@KnIfER
Copy link
Author

KnIfER commented Oct 5, 2019

static fields are useful to sovle this issue :

public class Util {
    public static boolean stopped;
    public static void Stop() {
        stopped=true;
        try {
            Util.httpClient.close();
            Util.httpClient=null;
        } catch (Exception ignored) { }
    }
}

翻译器

    @Override
    public String query() throws Exception {
        if(Util.stopped)  return "";
        ……
        HttpGet request = new HttpGet(uri.toString());
        RequestConfig.Builder builder = RequestConfig.copy(RequestConfig.DEFAULT);
        if(Util.hostName!=null)
            builder.setProxy(new HttpHost(Util.hostName, Util.hostPort));
        request.setConfig(builder.build());
        ……
    }


对话框

Button btnStop = new Button("Stop");
        centerpanel.add(btnStop);
        btnStop.addActionListener(e -> {
            Util.Stop();    //yes it's useful
        });



@KnIfER
Copy link
Author

KnIfER commented Oct 5, 2019

now it's working for the ladder of lamp .

Screenshot (8)
:)
SuperLocalizationPlugin.zip
Enjoy~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant