Android Open Source - FrameLite Frame Application






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;
//w  ww  .jav a 2  s .  c om
import com.miku.framelite.services.CrashHandler;
import com.miku.framelite.utils.Log;
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;

import android.app.Application;
import android.content.Context;
import android.os.Environment;
import android.os.Handler;

/**
 * 
 * @author xr.lee
 *
 */
public abstract class FrameApplication extends Application {
  
  private static Handler mGlobalHandler;
  
  @Override
  public void onCreate() {
    super.onCreate();
    mGlobalHandler=new Handler();
    init(getAppConfig(new AppConfig()));
  }
  
  public static void runOnUiThread(Runnable runnable){
    mGlobalHandler.post(runnable);
  }
  
  private void init(AppConfig config){
    Log.setLogLevel(config.log_level);
    Log.setLogDir(config.log_dir);
    //??5??????
    Log.clearLogFile(config.log_save_day);
    
    CrashHandler.Init(this);
    
    if(config.isUseImageLoader){
      initImageLoader(this);
    }
  }
  
  private void initImageLoader(Context context) {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
        .threadPriority(Thread.NORM_PRIORITY - 2)
        .denyCacheImageMultipleSizesInMemory()
        .discCacheFileNameGenerator(new Md5FileNameGenerator())
        .tasksProcessingOrder(QueueProcessingType.LIFO)
        //.writeDebugLogs() // Remove for release app
        .build();
    ImageLoader.getInstance().init(config);
  }
  
  /**
   * ?????
   * @param config
   * @return
   */
  protected abstract AppConfig getAppConfig(AppConfig config);
  
  public class AppConfig{
    
    /**
     * ???????????
     */
    public int log_level=Log.VERBOSE;
    /**
     * (????)???????????????????????????????????
     */
    public String log_dir=Environment
        .getExternalStorageDirectory().getAbsolutePath()+"/framelite/logs";
    
    /**
     * ??????????????5?,???????????log,?????
     */
    public int log_save_day=5;
    
    /**
     * ????????????
     */
    public boolean isUseImageLoader=true;
  }
  
  
}




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