
/*
 Copyright 2012-2013, Polyvi Inc. (http://polyvi.github.io/openxface)
 This program is distributed under the terms of the GNU General Public License.

 This file is part of xFace.

 xFace is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 xFace is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with xFace.  If not, see <http://www.gnu.org/licenses/>.
*/

package org.apache.cordova.camera;

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;

/**
 * 图片资源的管理
 */
public class XResourceManager {

    protected static XResourceManager instance = null;
    private static Activity mActivity;

    public static XResourceManager getInstance() {
        if (instance == null) {
            instance = new XResourceManager();
        }
        return instance;
    }

    public static void init(Activity activity) {
        mActivity = activity;
    }

    public Drawable getCameraCropWidthResource(Resources res) {
        return res.getDrawable(mActivity.getResources().getIdentifier(
                "camera_crop_width", "drawable",
                mActivity.getClass().getPackage().getName()));
    }

    public Drawable getCameraCropHeightResource(Resources res) {
        return res.getDrawable(mActivity.getResources().getIdentifier(
                "camera_crop_height", "drawable",
                mActivity.getClass().getPackage().getName()));
    }

    public Drawable getCameraCropIndicatorResource(Resources res) {
        return res.getDrawable(mActivity.getResources().getIdentifier(
                "indicator_autocrop", "drawable",
                mActivity.getClass().getPackage().getName()));
    }
}

@@ -1,9 +1,8 @@
-%0A
 /*%0A Copy
@@ -778,16 +778,17 @@
 nses/%3E.%0A
+ 
 */%0A%0Apack
@@ -982,20 +982,17 @@
 ager %7B%0A%0A
-    
+%09
 protecte
@@ -1034,20 +1034,17 @@
 = null;%0A
-    
+%09
 private 
@@ -1071,20 +1071,17 @@
 ivity;%0A%0A
-    
+%09
 public s
@@ -1119,24 +1119,18 @@
 nce() %7B%0A
-        
+%09%09
 if (inst
@@ -1145,28 +1145,19 @@
 null) %7B%0A
-            
+%09%09%09
 instance
@@ -1187,26 +1187,14 @@
 ();%0A
-        %7D%0A        
+%09%09%7D%0A%09%09
 retu
@@ -1206,27 +1206,21 @@
 stance;%0A
-    %7D%0A%0A    
+%09%7D%0A%0A%09
 public s
@@ -1256,24 +1256,18 @@
 vity) %7B%0A
-        
+%09%09
 mActivit
@@ -1280,27 +1280,21 @@
 tivity;%0A
-    %7D%0A%0A    
+%09%7D%0A%0A%09
 public D
@@ -1341,32 +1341,26 @@
 rces res) %7B%0A
-        
+%09%09
 return res.g
@@ -1410,32 +1410,20 @@
 tifier(%0A
-                
+%09%09%09%09
 %22camera_
@@ -1446,32 +1446,16 @@
 awable%22,
-%0A               
  mActivi
@@ -1453,35 +1453,24 @@
 , mActivity.
-getClass().
 getPackage()
@@ -1459,38 +1459,32 @@
 ivity.getPackage
-().get
 Name()));%0A    %7D%0A
@@ -1473,35 +1473,29 @@
 geName()));%0A
-    %7D%0A%0A    
+%09%7D%0A%0A%09
 public Drawa
@@ -1539,32 +1539,26 @@
 rces res) %7B%0A
-        
+%09%09
 return res.g
@@ -1608,32 +1608,20 @@
 tifier(%0A
-                
+%09%09%09%09
 %22camera_
@@ -1645,32 +1645,16 @@
 awable%22,
-%0A               
  mActivi
@@ -1652,35 +1652,24 @@
 , mActivity.
-getClass().
 getPackage()
@@ -1658,38 +1658,32 @@
 ivity.getPackage
-().get
 Name()));%0A    %7D%0A
@@ -1680,19 +1680,13 @@
 ));%0A
-    %7D%0A%0A    
+%09%7D%0A%0A%09
 publ
@@ -1745,24 +1745,18 @@
  res) %7B%0A
-        
+%09%09
 return r
@@ -1810,32 +1810,20 @@
 tifier(%0A
-                
+%09%09%09%09
 %22indicat
@@ -1851,24 +1851,8 @@
 le%22,
-%0A               
  mAc
@@ -1862,19 +1862,8 @@
 ity.
-getClass().
 getP
@@ -1868,22 +1868,16 @@
 tPackage
-().get
 Name()))
@@ -1882,12 +1882,9 @@
 ));%0A
-    
+%09
 %7D%0A%7D%0A

fix the xfaceLib is not can read the picture info