/* * (non-Javadoc) * * @see android.app.Activity#onResume() */ @Override public void onResume() { super.onResume(); // check if keyboard is connected and accessibility services are // disabled if (!Utils.isAccessibilityEnabled(getApplicationContext()) && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) { TTS.speak(getResources().getString(R.string.otheroptions)); } // get the root layout LinearLayout layout = (LinearLayout) findViewById(R.id.contactsotheroptions); Utils.applyFontColorChanges(getApplicationContext(), layout); Utils.applyFontSizeChanges(getApplicationContext(), layout); Utils.applyFontTypeChanges(getApplicationContext(), layout); }
/** * Create the Contact Details menu activity (non-Javadoc) * * @see org.easyaccess.EasyAccessActivity#onCreate(android.os.Bundle) */ @SuppressLint("HandlerLeak") @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.contactsotheroptions); super.onCreate(savedInstanceState); // get UI elements contactName = (TextView) findViewById(R.id.txtContactsName); btnDelete = (Button) findViewById(R.id.btnDelete); btnCopyToSD = (Button) findViewById(R.id.btnCopyToSD); btnImport = (Button) findViewById(R.id.btnImportFromSD); btnExport = (Button) findViewById(R.id.btnExportToSD); // get the details of the contact from the number if (getIntent().getExtras() != null) { this.id = getIntent().getExtras().getString("id"); this.contactNumber = getIntent().getExtras().getString("number"); } HashMap<String, ArrayList<String>> contactDetails = new ContactManager(getApplicationContext()).getDetailsFromId(this.id); contactName.setText(contactDetails.get("name").get(0)); contactName.setContentDescription( contactDetails.get("name").get(0).replaceAll(".(?=[0-9])", "$0 ")); contactName.setOnFocusChangeListener( new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean hasFocus) { if (hasFocus) { giveFeedback(((TextView) view).getText().toString()); } } }); attachListener(btnDelete); attachListener(btnCopyToSD); attachListener(btnImport); attachListener(btnExport); attachKeyListener(btnDelete, 1); btnDelete.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { confirmDelete("Are you sure you want to delete the contact?"); } }); attachKeyListener(btnCopyToSD, 2); btnCopyToSD.setOnClickListener( new OnClickListener() { @Override public void onClick(View view) { copyToSDcard(); } }); btnExport.setOnClickListener( new OnClickListener() { @Override public void onClick(View view) { export(); } }); attachKeyListener(btnExport, 3); btnImport.setOnClickListener( new OnClickListener() { @Override public void onClick(View view) { importContact(); } }); attachKeyListener(btnImport, 4); handler = new Handler() { public void handleMessage(Message message) { if (message.getData().getInt("type") == EXPORTONECONTACT) { if (message.getData().getBoolean("success") == true) { TTS.stop(); // check if keyboard is connected but accessibility // services are disabled if (!Utils.isAccessibilityEnabled(getApplicationContext()) && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) TTS.speak(getResources().getString(R.string.copycontactsuccess)); Toast.makeText( getApplicationContext(), getResources().getString(R.string.copycontactsuccess), Toast.LENGTH_SHORT) .show(); } else { TTS.stop(); // check if keyboard is connected but accessibility // services are disabled if (!Utils.isAccessibilityEnabled(getApplicationContext()) && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) TTS.speak(getResources().getString(R.string.copycontactfailure)); Toast.makeText( getApplicationContext(), getResources().getString(R.string.copycontactfailure), Toast.LENGTH_SHORT) .show(); } } else if (message.getData().getInt("type") == EXPORTALLCONTACTS) { if (message.getData().getBoolean("success") == true) { TTS.stop(); // check if keyboard is connected but accessibility // services are disabled if (!Utils.isAccessibilityEnabled(getApplicationContext()) && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) TTS.speak(getResources().getString(R.string.copyallcontactssuccess)); Toast.makeText( getApplicationContext(), getResources().getString(R.string.copyallcontactssuccess), Toast.LENGTH_SHORT) .show(); } else { TTS.stop(); // check if keyboard is connected but accessibility // services are disabled if (!Utils.isAccessibilityEnabled(getApplicationContext()) && getResources().getConfiguration().keyboard != Configuration.KEYBOARD_NOKEYS) TTS.speak(getResources().getString(R.string.copyallcontactsfailure)); Toast.makeText( getApplicationContext(), getResources().getString(R.string.copyallcontactsfailure), Toast.LENGTH_SHORT) .show(); } } } }; }