Android Open Source - amanaje Activity Helper






From Project

Back to project page amanaje.

License

The source code is released under:

Apache License

If you think the Android project amanaje listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.amanaje.commons;
/*from  w  w w .j  a  va 2 s.c o m*/
import com.amanaje.R;
import com.amanaje.activities.ContactDetailActivity;
import com.amanaje.activities.MainActivity;
import com.amanaje.activities.MessageActivity;
import com.amanaje.activities.PrivContactsActivity;
import com.amanaje.activities.SettingsActivity;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.MenuItem;

public class ActivityHelper {

  private static ActivityHelper INSTANCE = null;

  private ActivityHelper(){}

  public static ActivityHelper getInstance(){
    if(null == INSTANCE) INSTANCE = new ActivityHelper();
    return INSTANCE;
  }
  
  
  public void showAlertDialog(Activity srcActivity, String title, String message){
    AlertDialog.Builder builder = new AlertDialog.Builder(srcActivity);
    builder.setMessage(message)
    .setTitle(title)
    .setCancelable(false)
    .setPositiveButton("OK", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int id) {
        return;
      }
    });
    AlertDialog alert = builder.create();
    alert.show();
  }
  
  public boolean onOptionsItemSelected(Activity srcActivity, MenuItem item) {
    boolean ret = false;
    int id = item.getItemId();
    if (id == R.id.action_settings) {
      Intent intent = new Intent(srcActivity, SettingsActivity.class);
      srcActivity.startActivityForResult(intent, 0);
      ret = true;
      
    } else if (id == R.id.action_add) {
      Intent intent = new Intent(srcActivity, ContactDetailActivity.class);
      srcActivity.startActivityForResult(intent, 0);
      ret = true;
      
    } else if (id == R.id.action_contacts) {
      Intent intent = new Intent(srcActivity, PrivContactsActivity.class);
      srcActivity.startActivityForResult(intent, 0);
      ret = true;
      
    } else if (id == R.id.action_messages) {
      Intent intent = new Intent(srcActivity, MainActivity.class);
      srcActivity.startActivityForResult(intent, 0);
      ret = true;
      
    } 
    return ret;

  }
}




Java Source Code List

com.amanaje.activities.ContactDetailActivity.java
com.amanaje.activities.MainActivity.java
com.amanaje.activities.MessageActivity.java
com.amanaje.activities.NewSmsActivity.java
com.amanaje.activities.PrivContactsActivity.java
com.amanaje.activities.SettingsActivity.java
com.amanaje.activities.package-info.java
com.amanaje.asynctasks.AsyncTaskManager.java
com.amanaje.asynctasks.package-info.java
com.amanaje.commons.ActivityHelper.java
com.amanaje.commons.AppException.java
com.amanaje.commons.AppMessages.java
com.amanaje.commons.Constants.java
com.amanaje.commons.StaticObj.java
com.amanaje.commons.Utils.java
com.amanaje.commons.package-info.java
com.amanaje.crypto.CryptoUtils.java
com.amanaje.crypto.TotpImpl.java
com.amanaje.crypto.package-info.java
com.amanaje.entities.ConfigEntity.java
com.amanaje.entities.CryptoAlgoEntity.java
com.amanaje.entities.OpenPgpEntity.java
com.amanaje.entities.SmsEntity.java
com.amanaje.entities.package-info.java
com.amanaje.view.adapters.RowContactAdapter.java
com.amanaje.view.adapters.StableArrayAdapter.java
com.amanaje.view.adapters.package-info.java
org.jdamico.bc.openpgp.utils.PgpHelper.java
org.jdamico.bc.openpgp.utils.RSAKeyPairGenerator.java
org.jdamico.bc.openpgp.utils.package-info.java