Search in sources :

Example 1 with MagicUserInputModule

use of com.nextcloud.talk.utils.preferences.MagicUserInputModule in project talk-android by nextcloud.

the class SettingsController method onViewBound.

@Override
protected void onViewBound(@NonNull View view) {
    super.onViewBound(view);
    NextcloudTalkApplication.getSharedApplication().getComponentApplication().inject(this);
    userEntity = userUtils.getCurrentUser();
    appPreferences.registerProxyTypeListener(proxyTypeChangeListener = new ProxyTypeChangeListener());
    appPreferences.registerProxyCredentialsListener(proxyCredentialsChangeListener = new ProxyCredentialsChangeListener());
    List<String> listWithIntFields = new ArrayList<>();
    listWithIntFields.add("proxy_port");
    settingsScreen.setUserInputModule(new MagicUserInputModule(getActivity(), listWithIntFields));
    settingsScreen.setVisibilityController(R.id.settings_proxy_use_credentials, Arrays.asList(R.id.settings_proxy_username_edit, R.id.settings_proxy_password_edit), true);
    if (!TextUtils.isEmpty(getResources().getString(R.string.nc_gpl3_url))) {
        licenceButton.addPreferenceClickListener(view1 -> {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.nc_gpl3_url)));
            startActivity(browserIntent);
        });
    } else {
        licenceButton.setVisibility(View.GONE);
    }
    if (!TextUtils.isEmpty(getResources().getString(R.string.nc_privacy_url))) {
        privacyButton.addPreferenceClickListener(view12 -> {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.nc_privacy_url)));
            startActivity(browserIntent);
        });
    } else {
        privacyButton.setVisibility(View.GONE);
    }
    if (!TextUtils.isEmpty(getResources().getString(R.string.nc_source_code_url))) {
        sourceCodeButton.addPreferenceClickListener(view13 -> {
            Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.nc_source_code_url)));
            startActivity(browserIntent);
        });
    } else {
        sourceCodeButton.setVisibility(View.GONE);
    }
    versionInfo.setSummary("v" + BuildConfig.VERSION_NAME);
    addAccountButton.addPreferenceClickListener(view15 -> {
        getParentController().getRouter().pushController(RouterTransaction.with(new ServerSelectionController()).pushChangeHandler(new VerticalChangeHandler()).popChangeHandler(new VerticalChangeHandler()));
    });
    switchAccountButton.addPreferenceClickListener(view16 -> {
        getParentController().getRouter().pushController(RouterTransaction.with(new SwitchAccountController()).pushChangeHandler(new VerticalChangeHandler()).popChangeHandler(new VerticalChangeHandler()));
    });
}
Also used : MagicUserInputModule(com.nextcloud.talk.utils.preferences.MagicUserInputModule) ArrayList(java.util.ArrayList) Intent(android.content.Intent) VerticalChangeHandler(com.bluelinelabs.conductor.changehandler.VerticalChangeHandler)

Aggregations

Intent (android.content.Intent)1 VerticalChangeHandler (com.bluelinelabs.conductor.changehandler.VerticalChangeHandler)1 MagicUserInputModule (com.nextcloud.talk.utils.preferences.MagicUserInputModule)1 ArrayList (java.util.ArrayList)1