Android Open Source - FrameLite Frame Base Activity






From Project

Back to project page FrameLite.

License

The source code is released under:

GNU General Public License

If you think the Android project FrameLite 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.miku.framelite;
/*from   w  w  w  .  j a va2s  . com*/
import com.miku.framelite.utils.ViewUtils;

import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface.OnCancelListener;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.Toast;

/**
 * 
 * ????activity,????activity??????id??click?????????
 * 
 * @author xr.lee
 * 
 */
public class FrameBaseActivity extends Activity {
  protected final static int PROGRESS_DIALOG = 20140317;

  protected final static String DIALOG_TITLE = "DIALOG_TITLE";
  protected final static String DIALOG_MSG = "DIALOG_MSG";
  protected final static String DIALOG_CANCELABLE = "DIALOG_CANCELABLE";

  private OnCancelListener mProgressDialogCancelListener;
  
  protected Context mContext;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext=this;
  }

  public void setContentView(int layoutResID) {
    super.setContentView(layoutResID);
    init();
  }

  public void setContentView(View view, LayoutParams params) {
    super.setContentView(view, params);
    init();
  }

  public void setContentView(View view) {
    super.setContentView(view);
    init();
  }

  private void init() {
    if (this instanceof OnClickListener) {
      ViewUtils.bindViewIds(this, FrameBaseActivity.class,null, (OnClickListener) this);
    } else {
      ViewUtils.bindViewIds(this, FrameBaseActivity.class,null, null);
    }
  }

  @Override
  @Deprecated
  protected Dialog onCreateDialog(int id, Bundle args) {
    switch (id) {
    case PROGRESS_DIALOG: {
      ProgressDialog progressDialog = new ProgressDialog(this);
      progressDialog.setTitle("");
      progressDialog.setIndeterminate(true);
      progressDialog.setCancelable(true);
      return progressDialog;
    }
    default:
      return super.onCreateDialog(id, args);
    }

  }

  @Override
  @Deprecated
  protected void onPrepareDialog(int id, Dialog dialog, Bundle args) {
    switch (id) {
    case PROGRESS_DIALOG: {
      if (args != null) {
        String msg = args.getString(DIALOG_MSG);
        ProgressDialog d = (ProgressDialog) dialog;
        try {
          d.setOnCancelListener(mProgressDialogCancelListener);
        } catch (Exception e) {
          e.printStackTrace();
        }
        d.setMessage(msg == null ? "" : msg);
        d.setCancelable(args.getBoolean(DIALOG_CANCELABLE, true));
      }
    }
      break;
    default: {
      super.onPrepareDialog(id, dialog, args);
    }
      break;
    }

  }

  /**
   * ???????
   * 
   * @param msg
   */
  protected void showProgressDialog(String msg) {
    showProgressDialog(msg, true, null);
  }

  /**
   * ???????
   * 
   * @param msg
   * @param isCancelable
   */
  protected void showProgressDialog(String msg, boolean isCancelable) {
    showProgressDialog(msg, isCancelable, null);
  }

  protected void showProgressDialog(String msg, boolean isCancelable, OnCancelListener listener) {
    Bundle b = new Bundle();
    b.putString(DIALOG_MSG, msg);
    b.putBoolean(DIALOG_CANCELABLE, isCancelable);
    mProgressDialogCancelListener = listener;
    showDialog(PROGRESS_DIALOG, b);
  }

  /**
   * ?????????
   */
  protected void dismissProgressDialog() {
    try {
      dismissDialog(PROGRESS_DIALOG);
    } catch (Exception e) {
    }
  }

  /**
   * ??????
   * 
   * @param msg
   */
  protected void showToast(String msg) {
    Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
  }

}




Java Source Code List

com.miku.framelite.FrameApplication.java
com.miku.framelite.FrameBaseActivity.java
com.miku.framelite.FrameOrmBaseActivity.java
com.miku.framelite.adapter.FrameBaseAdapter.java
com.miku.framelite.annotations.ViewInject.java
com.miku.framelite.api.BaseRequest.java
com.miku.framelite.api.IRequest.java
com.miku.framelite.api.RetResult.java
com.miku.framelite.api.core.Executor.java
com.miku.framelite.api.database.AbstractDatabaseRequest.java
com.miku.framelite.api.database.AbstractOrmDatabaseRequest.java
com.miku.framelite.api.database.DatabaseQueryRequest.java
com.miku.framelite.api.database.DatabaseType.java
com.miku.framelite.api.http.AbstractHttpRequest.java
com.miku.framelite.api.http.HttpStringGetRequest.java
com.miku.framelite.api.http.HttpStringPostRequest.java
com.miku.framelite.api.http.HttpType.java
com.miku.framelite.api.webservice.AbstractWebServiceRequest.java
com.miku.framelite.api.webservice.WebServiceConnectionSE.java
com.miku.framelite.api.webservice.WebServiceHttpTransportSE.java
com.miku.framelite.api.webservice.WebServiceJsonRequest.java
com.miku.framelite.api.webservice.WebServiceStringRequest.java
com.miku.framelite.httpx.IDownloadHandler.java
com.miku.framelite.httpx.IHttpX.java
com.miku.framelite.httpx.core.DownloadHandler.java
com.miku.framelite.httpx.core.HttpX.java
com.miku.framelite.services.CrashHandler.java
com.miku.framelite.utils.BitmapUtils.java
com.miku.framelite.utils.DateUtils.java
com.miku.framelite.utils.DimensionUtils.java
com.miku.framelite.utils.EncryptionUtils.java
com.miku.framelite.utils.HttpUtils.java
com.miku.framelite.utils.Log.java
com.miku.framelite.utils.TelePhoneUtils.java
com.miku.framelite.utils.ViewUtils.java