Back to project page FrameLite.
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.
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; } }