Android Open Source - fruit.thememanager Theme Resource Custom Loader






From Project

Back to project page fruit.thememanager.

License

The source code is released under:

Apache License

If you think the Android project fruit.thememanager 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.fruit.thememanager.helper;
// w w  w  .j ava2s.c o m
import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.util.Log;

public class ThemeResourceCustomLoader implements ThemeResourceLoader {

  private ThemeInfo mThemeInfo;
  private ThemeResources mThemeRes;

  public ThemeResourceCustomLoader(Context context, ThemeInfo info) {
    this.mThemeInfo = info;
    try {
      mThemeRes = new ThemeResources(context, mThemeInfo.mPkgName);
    } catch (PackageManager.NameNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }

  @Override
  public Drawable loadDrawable(String resName) {
    // TODO Auto-generated method stub
    Drawable d = null;
    
    try {
      d =  mThemeRes.loadDrawable(resName);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      d = null;
    } catch (OutOfMemoryError e) {
      e.printStackTrace();
      d = null;      
    }
    
    return d;
  }

  @Override
  public Bitmap loadBitmap(String resName) {
    // TODO Auto-generated method stub
    Bitmap bmp = null;
    try {
      bmp = mThemeRes.loadBitmap(resName);
    } catch (OutOfMemoryError e) {
      e.printStackTrace();
      bmp = null;
    }
    return bmp;
  }

  @Override
  public String loadString(String resName) {
    // TODO Auto-generated method stub
    return mThemeRes.loadString(resName);
  }

  @Override
  public int loadColor(String resName) {
    // TODO Auto-generated method stub
    return mThemeRes.loadColor(resName);
  }

  @Override
  public String[] loadStringArray(String resName) {
    // TODO Auto-generated method stub
    return mThemeRes.loadStringArray(resName);
  }
}




Java Source Code List

com.fruit.thememanager.ListItemThemeElement.java
com.fruit.thememanager.ListItem.java
com.fruit.thememanager.ThemeApplyActivity.java
com.fruit.thememanager.ThemeCustomActivity.java
com.fruit.thememanager.ThemeCustomOptActivity.java
com.fruit.thememanager.ThemeManager.java
com.fruit.thememanager.ThemeProvider.java
com.fruit.thememanager.ThemeSettingActivity.java
com.fruit.thememanager.ThemeShowAdapter.java
com.fruit.thememanager.ThemeShowImageAdapter.java
com.fruit.thememanager.ThemeUtils.java
com.fruit.thememanager.helper.ThemeInfoCustomLoader.java
com.fruit.thememanager.helper.ThemeInfoDefaultLoader.java
com.fruit.thememanager.helper.ThemeInfoLoader.java
com.fruit.thememanager.helper.ThemeInfo.java
com.fruit.thememanager.helper.ThemeLoaderHelper.java
com.fruit.thememanager.helper.ThemeResourceCustomLoader.java
com.fruit.thememanager.helper.ThemeResourceDefaultLoader.java
com.fruit.thememanager.helper.ThemeResourceLoader.java
com.fruit.thememanager.helper.ThemeResources.java