当前位置: 首页>>代码示例>>Java>>正文


Java OrbotHelper类代码示例

本文整理汇总了Java中info.guardianproject.netcipher.proxy.OrbotHelper的典型用法代码示例。如果您正苦于以下问题:Java OrbotHelper类的具体用法?Java OrbotHelper怎么用?Java OrbotHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OrbotHelper类属于info.guardianproject.netcipher.proxy包,在下文中一共展示了OrbotHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initUseTorPreference

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
/**
 * The default for "Use Tor" is dynamically set based on whether Orbot is installed.
 */
private void initUseTorPreference() {
    boolean useTor = Preferences.get().isTorEnabled();
    useTorCheckPref.setDefaultValue(useTor);
    useTorCheckPref.setChecked(useTor);
    useTorCheckPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object enabled) {
            if ((Boolean) enabled) {
                final Activity activity = getActivity();
                enableProxyCheckPref.setEnabled(false);
                if (OrbotHelper.isOrbotInstalled(activity)) {
                    NetCipher.useTor();
                } else {
                    Intent intent = OrbotHelper.getOrbotInstallIntent(activity);
                    activity.startActivityForResult(intent, REQUEST_INSTALL_ORBOT);
                }
            } else {
                enableProxyCheckPref.setEnabled(true);
                NetCipher.clearProxy();
            }
            return true;
        }
    });
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:28,代码来源:PreferencesFragment.java

示例2: setProxyChoice

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
@Constants.Proxy
public static int setProxyChoice(int choice, @NonNull Activity activity) {
    switch (choice) {
        case Constants.PROXY_ORBOT:
            if (!OrbotHelper.isOrbotInstalled(activity)) {
                choice = Constants.NO_PROXY;
                Utils.showSnackbar(activity, R.string.install_orbot);
            }
            break;
        case Constants.PROXY_I2P:
            I2PAndroidHelper ih = new I2PAndroidHelper(activity.getApplication());
            if (!ih.isI2PAndroidInstalled()) {
                choice = Constants.NO_PROXY;
                ih.promptToInstall(activity);
            }
            break;
        case Constants.PROXY_MANUAL:
            break;
    }
    return choice;
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:22,代码来源:ProxyUtils.java

示例3: torEnable

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
public void torEnable() {
    CookieHelper.acceptCookies(webView, false);
    CookieHelper.deleteCookies();
    //Make sure that all cookies are really deleted
    if (!CookieManager.getInstance().hasCookies()) {
        if (!OrbotHelper.isOrbotRunning(mApplicationContext))
            OrbotHelper.requestStartTor(mApplicationContext);
        try {
            WebkitProxy.setProxy(MainActivity.class.getName(), mApplicationContext, null, "localhost", PORT_TOR);
            SharedPreferences.Editor spEdit = sp.edit();
            spEdit.putBoolean(PREF_TOR_ENABLED, true);
            spEdit.commit();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    webView.reload();
}
 
开发者ID:martykan,项目名称:webTube,代码行数:19,代码来源:TorHelper.java

示例4: setProxyChoice

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
public static int setProxyChoice(int choice, Activity activity) {
    switch (choice) {
        case Constants.PROXY_ORBOT:
            if (!OrbotHelper.isOrbotInstalled(activity)) {
                choice = Constants.NO_PROXY;
                Utils.showSnackbar(activity, R.string.install_orbot);
            }
            break;

        case Constants.PROXY_I2P:
            I2PAndroidHelper ih = new I2PAndroidHelper(activity.getApplicationContext());
            if (!ih.isI2PAndroidInstalled()) {
                choice = Constants.NO_PROXY;
                ih.promptToInstall(activity);
            }
            break;
        case Constants.PROXY_MANUAL:
            break;
    }
    return choice;
}
 
开发者ID:javadtaghia,项目名称:DeeBrowser,代码行数:22,代码来源:ProxyUtils.java

示例5: processIntent

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
boolean processIntent() {
    // must be overridden in the subclasses to do anything useful
    intent = getIntent();
    if (intent == null) {
        return false;
    }
    if (TextUtils.equals(OrbotHelper.ACTION_STATUS, intent.getAction())) {
        // sometimes one of these slips in here, but it should not!
        return false;
    }
    uri = intent.getData();
    if (uri == null) {
        return false;
    }
    return true;
}
 
开发者ID:guardianproject,项目名称:LocationPrivacy,代码行数:17,代码来源:UseTorActivity.java

示例6: checkRemoteAccessOnion

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
private void checkRemoteAccessOnion() {
    if (OrbotHelper.isOrbotInstalled(mActivity)) {
        OrbotHelper.requestStartTor(mActivity);

        if (preferences.getRemoteAccessOnion() != null && TextUtils.isEmpty(preferences.getRemoteAccessOnion().trim())) {
            OrbotHelper.requestHiddenServiceOnPort(mActivity, WebServer.LOCAL_PORT);
        }
    } else {
        Toast.makeText(mActivity, R.string.remote_access_onion_error, Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:guardianproject,项目名称:haven,代码行数:12,代码来源:SettingsFragment.java

示例7: initializeProxy

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
private void initializeProxy(@NonNull Activity activity) {
    String host;
    int port;

    switch (mPreferences.getProxyChoice()) {
        case Constants.NO_PROXY:
            // We shouldn't be here
            return;
        case Constants.PROXY_ORBOT:
            if (!OrbotHelper.isOrbotRunning(activity)) {
                OrbotHelper.requestStartTor(activity);
            }
            host = "localhost";
            port = 8118;
            break;
        case Constants.PROXY_I2P:
            mI2PProxyInitialized = true;
            if (mI2PHelperBound && !mI2PHelper.isI2PAndroidRunning()) {
                mI2PHelper.requestI2PAndroidStart(activity);
            }
            host = "localhost";
            port = 4444;
            break;
        default:
            host = mPreferences.getProxyHost();
            port = mPreferences.getProxyPort();
            break;
        case Constants.PROXY_MANUAL:
            host = mPreferences.getProxyHost();
            port = mPreferences.getProxyPort();
            break;
    }

    try {
        WebkitProxy.setProxy(BrowserApp.class.getName(), activity.getApplicationContext(), null, host, port);
    } catch (Exception e) {
        Log.d(TAG, "error enabling web proxying", e);
    }

}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:41,代码来源:ProxyUtils.java

示例8: onCreate

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
@Override
public void onCreate() {
  super.onCreate();
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);

  if (prefs.getBoolean("netcipher", false)) {
    OrbotHelper.get(this).init();
  }
}
 
开发者ID:commonsguy,项目名称:cwac-netsecurity,代码行数:10,代码来源:DemoApplication.java

示例9: checkTorRunning

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
public static boolean checkTorRunning(Context context, boolean notifyUser) {
    if (Config.values.useProxy
            && Config.values.useTor
            && OrbotHelper.isOrbotInstalled(context)
            && !OrbotHelper.isOrbotRunning(context)) {
        if (!notifyUser) {
            OrbotHelper.requestStartTor(context);
            return true;
        } else return false;
    } else return true;
}
 
开发者ID:vit1-irk,项目名称:idec-mobile,代码行数:12,代码来源:SimpleFunctions.java

示例10: setUpMenu

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
public void setUpMenu(final ActionMenuView actionMenu, final DrawerLayout drawerLayout, final View bookmarksPanel ) {
    this.drawerLayout = drawerLayout;
    this.bookmarksPanel = bookmarksPanel;
    this.actionMenu = actionMenu;

    actionMenu.setOnMenuItemClickListener(this);

    // Enable special buttons
    Menu menu = actionMenu.getMenu();
    PackageManager pm = context.getPackageManager();

    menu.findItem(R.id.action_backgroundPlay).setChecked(sp.getBoolean(BackgroundPlayHelper.PREF_BACKGROUND_PLAY_ENABLED, true));
    menu.findItem(R.id.action_accept_cookies).setChecked(sp.getBoolean(PREF_COOKIES_ENABLED,true));

    // Tor button
    if (OrbotHelper.isOrbotInstalled(context.getApplicationContext())) {
        menu.findItem(R.id.action_tor)
                .setEnabled(true)
                .setChecked(sp.getBoolean(TorHelper.PREF_TOR_ENABLED, false));
    }

    // Add Kodi button
    try {
        pm.getPackageInfo("org.xbmc.kore", PackageManager.GET_ACTIVITIES);
        menu.findItem(R.id.action_cast_to_kodi).setEnabled(true);
    } catch (PackageManager.NameNotFoundException e) {
        /* Kodi is not installed */
    }
}
 
开发者ID:martykan,项目名称:webTube,代码行数:30,代码来源:MenuHelper.java

示例11: setUpTor

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
public void setUpTor() {
    // Tor
    if (OrbotHelper.isOrbotInstalled(mApplicationContext)) {
        if (sp.getBoolean(PREF_TOR_ENABLED, false)) {
            torEnable();
        }
    }
}
 
开发者ID:martykan,项目名称:webTube,代码行数:9,代码来源:TorHelper.java

示例12: initializeProxy

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
private void initializeProxy(Activity activity) {
    String host;
    int port;

    switch (mPreferences.getProxyChoice()) {
        case Constants.NO_PROXY:
            // We shouldn't be here
            return;

        case Constants.PROXY_ORBOT:
            if (!OrbotHelper.isOrbotRunning(activity))
                OrbotHelper.requestStartTor(activity);
            host = "localhost";
            port = 8118;
            break;

        case Constants.PROXY_I2P:
            mI2PProxyInitialized = true;
            if (mI2PHelperBound && !mI2PHelper.isI2PAndroidRunning()) {
                mI2PHelper.requestI2PAndroidStart(activity);
            }
            host = "localhost";
            port = 4444;
            break;

        default:
            host = mPreferences.getProxyHost();
            port = mPreferences.getProxyPort();
    }

    try {
        WebkitProxy.setProxy(BrowserApp.class.getName(), activity.getApplicationContext(), null, host, port);
    } catch (Exception e) {
        Log.d(Constants.TAG, "error enabling web proxying", e);
    }

}
 
开发者ID:javadtaghia,项目名称:DeeBrowser,代码行数:38,代码来源:ProxyUtils.java

示例13: onResume

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
@Override
public void onResume() {
    super.onResume();

    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);

    for (final String key : SUMMARIES_TO_UPDATE) {
        updateSummary(key, false);
    }

    initPrivilegedInstallerPreference();
    initManagePrivilegedAppPreference();
    // this pref's default is dynamically set based on whether Orbot is installed
    boolean useTor = Preferences.get().isTorEnabled();
    useTorCheckPref.setDefaultValue(useTor);
    useTorCheckPref.setChecked(useTor);
    useTorCheckPref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object enabled) {
            if ((Boolean) enabled) {
                final Activity activity = getActivity();
                enableProxyCheckPref.setEnabled(false);
                if (OrbotHelper.isOrbotInstalled(activity)) {
                    NetCipher.useTor();
                } else {
                    Intent intent = OrbotHelper.getOrbotInstallIntent(activity);
                    activity.startActivityForResult(intent, REQUEST_INSTALL_ORBOT);
                }
            } else {
                enableProxyCheckPref.setEnabled(true);
                NetCipher.clearProxy();
            }
            return true;
        }
    });
}
 
开发者ID:CmDnoEdition,项目名称:fdroid,代码行数:37,代码来源:PreferencesFragment.java

示例14: onReceive

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
@Override
public void onReceive(android.content.Context context, Intent intent) {
    if (TextUtils.equals(intent.getAction(), OrbotHelper.ACTION_STATUS)) {
        String torStatus = intent.getStringExtra(OrbotHelper.EXTRA_STATUS);
        if (OrbotHelper.STATUS_ON.equals(torStatus)) {
            processIntent();
        } else if (OrbotHelper.STATUS_STARTING.equals(torStatus)) {
            Toast.makeText(context, R.string.waiting_for_orbot, Toast.LENGTH_LONG).show();
        } else {
            Toast.makeText(context, R.string.orbot_stopped, Toast.LENGTH_LONG).show();
            UseTorActivity.this.finish();
        }
    }
}
 
开发者ID:guardianproject,项目名称:LocationPrivacy,代码行数:15,代码来源:UseTorActivity.java

示例15: onCreate

import info.guardianproject.netcipher.proxy.OrbotHelper; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_use_tor);

    registerReceiver(torStatusReceiver, new IntentFilter(OrbotHelper.ACTION_STATUS));
    if (!OrbotHelper.requestStartTor(this)) {
        // Orbot needs to be installed, so ignore this request
        Toast.makeText(this, R.string.you_must_have_orbot, Toast.LENGTH_LONG).show();
        finish();
    }
    isReceiverRegistered = true;
}
 
开发者ID:guardianproject,项目名称:LocationPrivacy,代码行数:15,代码来源:UseTorActivity.java


注:本文中的info.guardianproject.netcipher.proxy.OrbotHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。