Revision 7fe62d1f
Added by Leszek Koltunski almost 4 years ago
| src/main/java/org/distorted/external/RubikFiles.java | ||
|---|---|---|
| 27 | 27 |
|
| 28 | 28 |
import android.content.Context; |
| 29 | 29 |
import android.graphics.Bitmap; |
| 30 |
import android.graphics.BitmapFactory; |
|
| 30 | 31 |
|
| 31 | 32 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 32 | 33 |
|
| ... | ... | |
| 51 | 52 |
return mThis; |
| 52 | 53 |
} |
| 53 | 54 |
|
| 55 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 56 |
|
|
| 57 |
public Bitmap getIcon(Context context, String name) |
|
| 58 |
{
|
|
| 59 |
File file = new File(context.getFilesDir(), name); |
|
| 60 |
|
|
| 61 |
if( file.exists() ) |
|
| 62 |
{
|
|
| 63 |
String fname = context.getFilesDir().getAbsolutePath()+"/"+name; |
|
| 64 |
return BitmapFactory.decodeFile(fname); |
|
| 65 |
} |
|
| 66 |
|
|
| 67 |
return null; |
|
| 68 |
} |
|
| 69 |
|
|
| 54 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 55 | 71 |
|
| 56 | 72 |
public boolean saveFile(Context context, InputStream stream, String name) |
| ... | ... | |
| 79 | 95 |
|
| 80 | 96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 81 | 97 |
|
| 82 |
public boolean saveFile(Context context, Bitmap bmp, String name)
|
|
| 98 |
public boolean saveIcon(Context context, Bitmap bmp, String name)
|
|
| 83 | 99 |
{
|
| 84 | 100 |
try |
| 85 | 101 |
{
|
Also available in: Unified diff
Download the icons only once and save to local storage.