|
@@ -118,6 +118,7 @@ |
118 |
118 |
|
Log.e("wwwwwwwwwwwwwwwwwww", filename); |
119 |
119 |
|
final Bitmap imgweb = Utils.getBitmapFromURL(filename); |
120 |
120 |
|
if (imgweb != null) { |
|
121 |
+ |
if (getActivity()!=null) |
121 |
122 |
|
getActivity().runOnUiThread(new Runnable() { |
122 |
123 |
|
@Override |
123 |
124 |
|
public void run() { |
|
@@ -192,67 +193,67 @@ |
192 |
193 |
|
((LinearLayout) v.findViewById(R.id.commentiView)).addView(child); |
193 |
194 |
|
|
194 |
195 |
|
final JSONArray jArray1 = jdata.getJSONArray("imgs"); |
195 |
|
- |
// for (int i = 0; i < jArray1.length(); i++) { |
196 |
|
- |
// |
197 |
|
- |
// final String filename = (String) jArray1.get(i); |
198 |
|
- |
// |
199 |
|
- |
// new Thread(new Runnable() { |
200 |
|
- |
// public void run() { |
201 |
|
- |
// |
202 |
|
- |
// final ImageButton image = new ImageButton(c); |
203 |
|
- |
// if (getActivity() != null) { |
204 |
|
- |
// getActivity().runOnUiThread(new Runnable() { |
205 |
|
- |
// @Override |
206 |
|
- |
// public void run() { |
207 |
|
- |
// |
208 |
|
- |
// image.setScaleType(ImageView.ScaleType.FIT_CENTER); |
209 |
|
- |
// image.setLayoutParams(new LinearLayout.LayoutParams((int) convertDpToPixel(80), (int) convertDpToPixel(80))); |
210 |
|
- |
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) convertDpToPixel(80), (int) convertDpToPixel(80)); |
211 |
|
- |
// |
212 |
|
- |
// |
213 |
|
- |
// image.setBackgroundColor(getResources().getColor(R.color.btn_background)); |
214 |
|
- |
// ((LinearLayout) child.findViewById(R.id.image)).addView(image); |
215 |
|
- |
// Animation aAnimation = (Animation) AnimationUtils.loadAnimation(c, R.anim.zoom); |
216 |
|
- |
// |
217 |
|
- |
// image.startAnimation(aAnimation); |
218 |
|
- |
// if (haveScrolled == false) { |
219 |
|
- |
// ObjectAnimator objectAnimator = ObjectAnimator.ofInt(((ScrollView) getActivity().findViewById(R.id.scrollView)), "scrollY", 0, ((ScrollView) getActivity().findViewById(R.id.scrollView)).getBottom()).setDuration(500); |
220 |
|
- |
// objectAnimator.start(); |
221 |
|
- |
// // ((ScrollView)getActivity().findViewById(R.id.scrollView)).fullScroll(ScrollView.FOCUS_DOWN); |
222 |
|
- |
// haveScrolled = true; |
223 |
|
- |
// } |
224 |
|
- |
// } |
225 |
|
- |
// }); |
226 |
|
- |
// } |
227 |
|
- |
// |
228 |
|
- |
// Log.e("ciaooooo", "http://svm19842.vps.tagadab.it:8084" + filename); |
229 |
|
- |
// final Bitmap imgweb = Utils.getBitmapFromURL("http://svm19842.vps.tagadab.it:8084" + filename); |
230 |
|
- |
// if (imgweb != null) { |
231 |
|
- |
// if (getActivity() != null) { |
232 |
|
- |
// getActivity().runOnUiThread(new Runnable() { |
233 |
|
- |
// @Override |
234 |
|
- |
// public void run() { |
235 |
|
- |
// image.clearAnimation(); |
236 |
|
- |
// |
237 |
|
- |
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) (convertDpToPixel(80) * imgweb.getWidth() / imgweb.getHeight()), (int) convertDpToPixel(80)); |
238 |
|
- |
// params.setMargins(6, 3, 0, 3); |
239 |
|
- |
// image.setLayoutParams(params); |
240 |
|
- |
// image.setImageBitmap(imgweb); |
241 |
|
- |
// |
242 |
|
- |
// image.setOnClickListener(new View.OnClickListener() { |
243 |
|
- |
// @Override |
244 |
|
- |
// public void onClick(View view) { |
245 |
|
- |
// |
246 |
|
- |
// startActivity(new Intent(Intent.ACTION_VIEW, getImageUri(c, imgweb))); |
247 |
|
- |
// } |
248 |
|
- |
// }); |
249 |
|
- |
// } |
250 |
|
- |
// }); |
251 |
|
- |
// } |
252 |
|
- |
// } |
253 |
|
- |
// } |
254 |
|
- |
// }).start(); |
255 |
|
- |
// } |
|
196 |
+ |
for (int i = 0; i < jArray1.length(); i++) { |
|
197 |
+ |
|
|
198 |
+ |
final String filename = (String) jArray1.get(i); |
|
199 |
+ |
new Thread(new Runnable() { |
|
200 |
+ |
public void run() { |
|
201 |
+ |
|
|
202 |
+ |
final ImageButton image = new ImageButton(c); |
|
203 |
+ |
if (getActivity() != null) { |
|
204 |
+ |
getActivity().runOnUiThread(new Runnable() { |
|
205 |
+ |
@Override |
|
206 |
+ |
public void run() { |
|
207 |
+ |
|
|
208 |
+ |
image.setScaleType(ImageView.ScaleType.FIT_CENTER); |
|
209 |
+ |
image.setLayoutParams(new LinearLayout.LayoutParams((int) convertDpToPixel(80), (int) convertDpToPixel(80))); |
|
210 |
+ |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) convertDpToPixel(80), (int) convertDpToPixel(80)); |
|
211 |
+ |
|
|
212 |
+ |
|
|
213 |
+ |
image.setBackgroundColor(getResources().getColor(R.color.btn_background)); |
|
214 |
+ |
((LinearLayout) child.findViewById(R.id.image)).addView(image); |
|
215 |
+ |
Animation aAnimation = (Animation) AnimationUtils.loadAnimation(c, R.anim.zoom); |
|
216 |
+ |
|
|
217 |
+ |
image.startAnimation(aAnimation); |
|
218 |
+ |
if (haveScrolled == false) { |
|
219 |
+ |
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(((ScrollView) getActivity().findViewById(R.id.scrollView)), "scrollY", 0, ((ScrollView) getActivity().findViewById(R.id.scrollView)).getBottom()).setDuration(500); |
|
220 |
+ |
objectAnimator.start(); |
|
221 |
+ |
// ((ScrollView)getActivity().findViewById(R.id.scrollView)).fullScroll(ScrollView.FOCUS_DOWN); |
|
222 |
+ |
haveScrolled = true; |
|
223 |
+ |
} |
|
224 |
+ |
} |
|
225 |
+ |
}); |
|
226 |
+ |
|
|
227 |
+ |
|
|
228 |
+ |
Log.e("ciaooooo", filename); |
|
229 |
+ |
final Bitmap imgweb = Utils.getBitmapFromURL( filename); |
|
230 |
+ |
if (imgweb != null) { |
|
231 |
+ |
if (getActivity() != null) { |
|
232 |
+ |
getActivity().runOnUiThread(new Runnable() { |
|
233 |
+ |
@Override |
|
234 |
+ |
public void run() { |
|
235 |
+ |
image.clearAnimation(); |
|
236 |
+ |
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams((int) (convertDpToPixel(80) * imgweb.getWidth() / imgweb.getHeight()), (int) convertDpToPixel(80)); |
|
237 |
+ |
params.setMargins(6, 3, 0, 3); |
|
238 |
+ |
image.setLayoutParams(params); |
|
239 |
+ |
image.setImageBitmap(imgweb); |
|
240 |
+ |
|
|
241 |
+ |
image.setOnClickListener(new View.OnClickListener() { |
|
242 |
+ |
@Override |
|
243 |
+ |
public void onClick(View view) { |
|
244 |
+ |
|
|
245 |
+ |
startActivity(new Intent(Intent.ACTION_VIEW, getImageUri(c, imgweb))); |
|
246 |
+ |
} |
|
247 |
+ |
}); |
|
248 |
+ |
} |
|
249 |
+ |
}); |
|
250 |
+ |
} |
|
251 |
+ |
} |
|
252 |
+ |
} |
|
253 |
+ |
|
|
254 |
+ |
} |
|
255 |
+ |
}).start(); |
|
256 |
+ |
} |
256 |
257 |
|
} catch (JSONException e) { |
257 |
258 |
|
Log.e("errore", "1111" + e.getMessage()); |
258 |
259 |
|
} |