Java Code Examples for android.preference.PreferenceScreen#setIntent()

The following examples show how to use android.preference.PreferenceScreen#setIntent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CameraSettingsActivity.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
/**
 * Configure home-as-up for sub-screens.
 */
private void setPreferenceScreenIntent(final PreferenceScreen preferenceScreen)
{
    Intent intent = new Intent(getActivity(), CameraSettingsActivity.class);
    intent.putExtra(PREF_SCREEN_EXTRA, preferenceScreen.getKey());
    preferenceScreen.setIntent(intent);
}
 
Example 2
Source File: ResourceSettings.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Sets the default values for the preference screen
 */
private void initPreferences() {

    // Binary file location
    EditTextPreference binaryFileLocation = (EditTextPreference) findPreference(Constants.PREFERENCE_STORAGE_DIRECTORY);
    if (TextUtils.isEmpty(binaryFileLocation.getText())) {
        binaryFileLocation.setText(EnvironmentUtil.getProcedureDirectory());
    }

    // Image downscale factor
    EditTextPreference imageDownscale = (EditTextPreference) findPreference(Constants.PREFERENCE_IMAGE_SCALE);
    if (TextUtils.isEmpty(imageDownscale.getText())) {
        imageDownscale.setText("" + Constants.IMAGE_SCALE_FACTOR);
    }
    imageDownscale.getEditText().setKeyListener(new DigitsKeyListener());

    // View all edu resources
    PreferenceScreen resourcePref = (PreferenceScreen) findPreference("s_education_resource");
    Intent intent = EducationResourceList.getIntent(Intent.ACTION_PICK,
            Audience.ALL);
    intent.putExtra(Intent.EXTRA_INTENT, new Intent(Intent.ACTION_VIEW));
    resourcePref.setIntent(intent);

    // SD card loading procedures
    PreferenceScreen intentPref = (PreferenceScreen) findPreference("s_procedures");
    intentPref.setIntent(new Intent("org.sana.android.activity.IMPORT_PROCEDURE"));
    //intentPref.setIntent(new Intent(ResourceSettings.this, 
    //		ProcedureSdImporter.class));
}
 
Example 3
Source File: Settings.java    From sana.mobile with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Sets the default values for the the preferences
 */
private void initPreferences() {

    // Health worker username for OpenMRS
    EditTextPreference prefEmrUsername = (EditTextPreference) findPreference(Constants.PREFERENCE_EMR_USERNAME);
    if (TextUtils.isEmpty(prefEmrUsername.getText())) {
        prefEmrUsername.setText(Constants.DEFAULT_USERNAME);
    }

    // Health worker password for OpenMRS
    EditTextPreference prefEmrPassword = (EditTextPreference) findPreference(Constants.PREFERENCE_EMR_PASSWORD);
    prefEmrPassword.getEditText().setTransformationMethod(
            new PasswordTransformationMethod());
    if (TextUtils.isEmpty(prefEmrPassword.getText())) {
        prefEmrPassword.setText(Constants.DEFAULT_PASSWORD);
    }

    // Whether barcode reading is enabled on the phone
    /*
     * CheckBoxPreference barcodeEnabled = new CheckBoxPreference(this);
     * barcodeEnabled.setKey(Constants.PREFERENCE_BARCODE_ENABLED);
     * barcodeEnabled.setTitle("Enable barcode reading");
     * barcodeEnabled.setSummary
     * ("Enable barcode reading of patient and physician ids");
     * barcodeEnabled.setDefaultValue(false);
     * dialogBasedPrefCat.addPreference(barcodeEnabled);
     */

    // Launches network preferences
    PreferenceScreen prefNetwork = (PreferenceScreen) findPreference("s_network_settings");
    if (prefNetwork != null) {
        prefNetwork.setIntent(new Intent(this, NetworkSettings.class));
    }

    // Launches resource preferences
    PreferenceScreen prefResource = (PreferenceScreen) findPreference("s_resource_settings");
    if (prefResource != null) {
        prefResource.setIntent(new Intent(this, ResourceSettings.class));
    }
}