Nextrek
Diff Revisions
686
vs
697
for /Android/SmartCharging/SmartCharging/app/src/main/java/it/fedeloper/smartcharging/Controller/FullInfoFragment.java
|
@@ -6,8 +6,10 @@ |
6 |
6 |
|
import android.content.Intent; |
7 |
7 |
|
import android.content.res.Resources; |
8 |
8 |
|
import android.graphics.Bitmap; |
|
9 |
+ |
import android.graphics.BitmapFactory; |
9 |
10 |
|
import android.net.Uri; |
10 |
11 |
|
import android.os.Bundle; |
|
12 |
+ |
import android.os.Environment; |
11 |
13 |
|
import android.provider.MediaStore; |
12 |
14 |
|
import android.util.DisplayMetrics; |
13 |
15 |
|
import android.util.Log; |
|
@@ -26,6 +28,10 @@ |
26 |
28 |
|
import org.json.JSONObject; |
27 |
29 |
|
|
28 |
30 |
|
import java.io.ByteArrayOutputStream; |
|
31 |
+ |
import java.io.File; |
|
32 |
+ |
import java.io.FileOutputStream; |
|
33 |
+ |
import java.io.IOException; |
|
34 |
+ |
import java.util.Random; |
29 |
35 |
|
|
30 |
36 |
|
|
31 |
37 |
|
public class FullInfoFragment extends Fragment { |
|
@@ -47,12 +53,8 @@ |
47 |
53 |
|
return px; |
48 |
54 |
|
} |
49 |
55 |
|
|
50 |
|
- |
public Uri getImageUri(Context inContext, Bitmap inImage) { |
51 |
|
- |
ByteArrayOutputStream bytes = new ByteArrayOutputStream(); |
52 |
|
- |
inImage.compress(Bitmap.CompressFormat.JPEG, 100, bytes); |
53 |
|
- |
String path = MediaStore.Images.Media.insertImage(inContext.getContentResolver(), inImage, "Title", null); |
54 |
|
- |
return Uri.parse(path); |
55 |
|
- |
} |
|
56 |
+ |
|
|
57 |
+ |
|
56 |
58 |
|
|
57 |
59 |
|
public View onCreateView(LayoutInflater inflater, |
58 |
60 |
|
ViewGroup container, |
|
@@ -130,7 +132,7 @@ |
130 |
132 |
|
@Override |
131 |
133 |
|
public void onClick(View view) { |
132 |
134 |
|
|
133 |
|
- |
startActivity(new Intent(Intent.ACTION_VIEW, getImageUri(c, imgweb))); |
|
135 |
+ |
startActivity(new Intent(Intent.ACTION_VIEW, Utils.getImageUri(c, imgweb))); |
134 |
136 |
|
} |
135 |
137 |
|
}); |
136 |
138 |
|
} |
|
@@ -242,7 +244,7 @@ |
242 |
244 |
|
@Override |
243 |
245 |
|
public void onClick(View view) { |
244 |
246 |
|
|
245 |
|
- |
startActivity(new Intent(Intent.ACTION_VIEW, getImageUri(c, imgweb))); |
|
247 |
+ |
startActivity(new Intent(Intent.ACTION_VIEW, Utils.getImageUri(c, imgweb))); |
246 |
248 |
|
} |
247 |
249 |
|
}); |
248 |
250 |
|
} |