Example #1
0
    @Override
    public void onHandleFatalError(String message) {
        blinkingImageViews.clear();
        stopBlinkingStatus();
        disableAll();
        updateStatus("Error: " + message);
        checkAll();
        checkUpdate();
        if (ApkUtils.isInstalled(this, "fq.router")) {
            new AlertDialog.Builder(this)
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .setTitle(R.string.old_version_alert_title)
                    .setMessage(R.string.old_version_alert_message)
                    .setPositiveButton(R.string.old_version_alert_button, new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            clearNotification();
                            MainActivity.this.finish();
                        }

                    })
                    .setOnCancelListener(new DialogInterface.OnCancelListener() {
                        @Override
                        public void onCancel(DialogInterface dialogInterface) {
                            clearNotification();
                            MainActivity.this.finish();
                        }
                    })
                    .show();
        }
    }
Example #2
0
    @Override
    public void onLaunched(boolean isVpnMode) {
        isLaunched = true;
        ActivityCompat.invalidateOptionsMenu(this);

        ImageView star = (ImageView) findViewById(R.id.star);
        stopBlinkingImage(star);
        enableImage(star);
        stopBlinkingStatus();

        startBlinkingImage((ImageView) findViewById(R.id.freeInternetArrow));
        startBlinkingStatus(_(R.string.status_free_internet_connecting));
        if (isVpnMode) {
            clearNotification();
            if (LaunchService.isVpnRunning()) {
                onFreeInternetChanged(true);
            } else {
                startVpn();
            }
        } else {
            if (ApkUtils.isInstalled(this, "fq.router")) {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        ApkUtils.uninstall(MainActivity.this, "fq.router");
                    }
                }).start();
            }
            checkWifiRepeater();
            checkPickAndPlay();
            ConnectFreeInternetService.execute(this);
        }
    }
Example #3
0
 @Override
 public void onDownloaded(String url, String downloadTo) {
     downloaded = true;
     ActivityCompat.invalidateOptionsMenu(this);
     updateStatus(_(R.string.status_downloaded) + " " + Uri.parse(url).getLastPathSegment());
     setExiting();
     try {
         ManagerProcess.kill();
     } catch (Exception e) {
         LogUtils.e("failed to kill manager", e);
     }
     ApkUtils.install(this, downloadTo);
 }
Example #4
0
    private void uninstallOldVersion() {
        boolean isOldVersionInstalled = ApkUtils.isInstalled(this, "fq.router");
        LogUtils.i("old version is installed: " + isOldVersionInstalled);
        if (isOldVersionInstalled) {
            new AlertDialog.Builder(this)
                    .setIcon(android.R.drawable.ic_dialog_alert)
                    .setTitle(R.string.uninstall_old_version_alert_title)
                    .setMessage(R.string.uninstall_old_version_alert_message)
                    .setPositiveButton(R.string.uninstall_old_version_alert_button, new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            ApkUtils.uninstall(MainActivity.this, "fq.router");
                        }

                    })
                    .show();
        }
    }