List of usage examples for android.content Intent getCharArrayExtra
public char[] getCharArrayExtra(String name)
From source file:Main.java
public static char[] getCharArrayExtra(Intent intent, String name) { if (!hasIntent(intent) || !hasExtra(intent, name)) return null; return intent.getCharArrayExtra(name); }
From source file:com.mplayer_remote.SettingsForAPP.java
/** * Metoda wywoywana przez system Android przy starcie aktywnoci. * Tu nastpuje wyczytanie ustawie aplikacji i zainicjowanie GUI aktywnoci. * @see android.app.Activity#onCreate(android.os.Bundle) */// w w w. jav a 2 s . co m @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getActionBar().setDisplayHomeAsUpEnabled(false); //ustawianie GUI setContentView(R.layout.layout_for_settingsforserverlist); settingsForAPPSharedPreferences = getSharedPreferences("settings_for_APP", 0); isThisFirstRunboolean = settingsForAPPSharedPreferences.getBoolean("is_this_first_run", true); isCryptoEnabledboolean = settingsForAPPSharedPreferences.getBoolean("is_crypto_enabled", true); //byo false showOnlyMediaTypeFilesBoolean = settingsForAPPSharedPreferences.getBoolean(SHOW_ONLY_MEDIA_TYPE_FILES, true); if (savedInstanceState == null) { Intent intent_from_ServerList = getIntent(); //getIntent() zwraca obiekt Intent ktry wystartowa Activity appPasswordcharArray = intent_from_ServerList.getCharArrayExtra("app_password"); } else { appPasswordcharArray = savedInstanceState.getCharArray("appPasswordcharArray"); } Log.v(TAG, "aktualny isThisFirstRunboolean: " + isThisFirstRunboolean); Log.v(TAG, "aktualny isCryptoEnabledboolean: " + isCryptoEnabledboolean); if (appPasswordcharArray != null) { String appPasswordcharArrayConvertedToString = new String(appPasswordcharArray); Log.v(TAG, "Aktuane appPasswordcharArray: " + appPasswordcharArrayConvertedToString); } //creating a XML Context mContext = getApplicationContext(); aXMLReaderWriter = new XMLReaderWriter(mContext); if (isCryptoEnabledboolean == true && appPasswordcharArray != null) { //appPasswordcharArray == null try { serverListArrayList = aXMLReaderWriter .decryptFileWithXMLAndParseItToServerList(appPasswordcharArray); } catch (WrongPasswordException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getApplicationContext(), R.string.wrong_app_password_exeption, Toast.LENGTH_SHORT) .show(); finish(); //something is wrong } } else { try { serverListArrayList = aXMLReaderWriter .decryptFileWithXMLAndParseItToServerList("default_password".toCharArray()); } catch (WrongPasswordException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(getApplicationContext(), R.string.wrong_app_password_exeption, Toast.LENGTH_SHORT) .show(); finish(); //something is wrong } } useEencryptionCheckBox = (CheckBox) findViewById(R.id.use_encryption_in_SettingForServer_checkBox); useEencryptionCheckBox.setChecked(isCryptoEnabledboolean); useEencryptionCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (useEencryptionCheckBox.isChecked() == true) { isCryptoEnabledboolean = true; isThisFirstRunboolean = true; } else { isCryptoEnabledboolean = false; } SharedPreferences settings_for_activity_ServerList = getSharedPreferences("settings_for_APP", 0); SharedPreferences.Editor editor = settings_for_activity_ServerList.edit(); editor.putBoolean("is_crypto_enabled", isCryptoEnabledboolean); editor.putBoolean("is_this_first_run", isThisFirstRunboolean); // Commit the edits! editor.commit(); if (useEencryptionCheckBox.isChecked() == true) { Toast.makeText(getApplicationContext(), R.string.text_for_toast_Edit_server_data_fill_server_password_field, Toast.LENGTH_LONG) .show(); aXMLReaderWriter.createEncryptedXMLFileWithServerList(serverListArrayList, appPasswordcharArray); } else { //appPasswordcharArray = "default_password".toCharArray(); for (int i = 0; i < serverListArrayList.size(); i++) { serverListArrayList.get(i).setPassword("".toCharArray()); } aXMLReaderWriter.createEncryptedXMLFileWithServerList(serverListArrayList, "default_password".toCharArray()); } } }); showOnlyMediaTypeFilesCheckBox = (CheckBox) findViewById((R.id.show_only_media_type_files_checkBox)); showOnlyMediaTypeFilesCheckBox.setChecked(showOnlyMediaTypeFilesBoolean); showOnlyMediaTypeFilesCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (showOnlyMediaTypeFilesCheckBox.isChecked() == true) { showOnlyMediaTypeFilesBoolean = true; } else { showOnlyMediaTypeFilesBoolean = false; } SharedPreferences settings_for_activity_ServerList = getSharedPreferences("settings_for_APP", 0); SharedPreferences.Editor editor = settings_for_activity_ServerList.edit(); editor.putBoolean(SHOW_ONLY_MEDIA_TYPE_FILES, showOnlyMediaTypeFilesBoolean); //Commit the edits! editor.commit(); } }); knowFileExtensionsTextView = (TextView) findViewById(R.id.know_file_extensions); knowFileExtensionsTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.v(TAG, "klikem knowFileExtensionsTextView"); DialogFragment newFragment = new KnowFileExtensionsDialogFragment(); newFragment.show(getSupportFragmentManager(), "KnowFileExtensionsDialogFragment"); } }); }
From source file:de.Maxr1998.xposed.maxlock.ui.settings.appslist.AppListFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (String.valueOf(requestCode).startsWith(String.valueOf(Util.PATTERN_CODE_APP))) { if (resultCode == LockPatternActivity.RESULT_OK) { String app = (String) finalList.get(Integer.parseInt(String.valueOf(requestCode).substring(1))) .get("key"); Util.receiveAndSetPattern(getActivity(), data.getCharArrayExtra(LockPatternActivity.EXTRA_PATTERN), app);//from w ww .jav a 2 s .co m } } else super.onActivityResult(requestCode, resultCode, data); }
From source file:com.fenlisproject.elf.core.framework.ElfBinder.java
public static void bindIntentExtra(Object receiver) { Field[] fields = receiver.getClass().getDeclaredFields(); for (Field field : fields) { field.setAccessible(true);/* w w w. j a va2 s . co m*/ IntentExtra intentExtra = field.getAnnotation(IntentExtra.class); if (intentExtra != null) { try { Intent intent = null; if (receiver instanceof Activity) { intent = ((Activity) receiver).getIntent(); } else if (receiver instanceof Fragment) { intent = ((Fragment) receiver).getActivity().getIntent(); } if (intent != null) { Class<?> type = field.getType(); if (type == Boolean.class || type == boolean.class) { field.set(receiver, intent.getBooleanExtra(intentExtra.value(), false)); } else if (type == Byte.class || type == byte.class) { field.set(receiver, intent.getByteExtra(intentExtra.value(), (byte) 0)); } else if (type == Character.class || type == char.class) { field.set(receiver, intent.getCharExtra(intentExtra.value(), '\u0000')); } else if (type == Double.class || type == double.class) { field.set(receiver, intent.getDoubleExtra(intentExtra.value(), 0.0d)); } else if (type == Float.class || type == float.class) { field.set(receiver, intent.getFloatExtra(intentExtra.value(), 0.0f)); } else if (type == Integer.class || type == int.class) { field.set(receiver, intent.getIntExtra(intentExtra.value(), 0)); } else if (type == Long.class || type == long.class) { field.set(receiver, intent.getLongExtra(intentExtra.value(), 0L)); } else if (type == Short.class || type == short.class) { field.set(receiver, intent.getShortExtra(intentExtra.value(), (short) 0)); } else if (type == String.class) { field.set(receiver, intent.getStringExtra(intentExtra.value())); } else if (type == Boolean[].class || type == boolean[].class) { field.set(receiver, intent.getBooleanArrayExtra(intentExtra.value())); } else if (type == Byte[].class || type == byte[].class) { field.set(receiver, intent.getByteArrayExtra(intentExtra.value())); } else if (type == Character[].class || type == char[].class) { field.set(receiver, intent.getCharArrayExtra(intentExtra.value())); } else if (type == Double[].class || type == double[].class) { field.set(receiver, intent.getDoubleArrayExtra(intentExtra.value())); } else if (type == Float[].class || type == float[].class) { field.set(receiver, intent.getFloatArrayExtra(intentExtra.value())); } else if (type == Integer[].class || type == int[].class) { field.set(receiver, intent.getIntArrayExtra(intentExtra.value())); } else if (type == Long[].class || type == long[].class) { field.set(receiver, intent.getLongArrayExtra(intentExtra.value())); } else if (type == Short[].class || type == short[].class) { field.set(receiver, intent.getShortArrayExtra(intentExtra.value())); } else if (type == String[].class) { field.set(receiver, intent.getStringArrayExtra(intentExtra.value())); } else if (Serializable.class.isAssignableFrom(type)) { field.set(receiver, intent.getSerializableExtra(intentExtra.value())); } else if (type == Bundle.class) { field.set(receiver, intent.getBundleExtra(intentExtra.value())); } } } catch (IllegalAccessException e) { e.printStackTrace(); } } } }