Android Open Source - fruit.thememanager Theme Resource Default 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  ww  .  jav  a  2 s  .c o m

import android.content.Context;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;

public class ThemeResourceDefaultLoader implements ThemeResourceLoader {

  @SuppressWarnings("unused")
  private ThemeInfo mThemeInfo;
  private ThemeResources mThemeRes;

  public ThemeResourceDefaultLoader(Context context, ThemeInfo info) {
    this.mThemeInfo = info;
    try {
      mThemeRes = new ThemeResources(context, context.getPackageName());
    } 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 null;
  }

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

  @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