|
@@ -1,12 +1,14 @@
|
|
|
package com.example.mytest;
|
|
|
|
|
|
import android.app.Activity;
|
|
|
+import android.graphics.Bitmap;
|
|
|
import android.graphics.Color;
|
|
|
import android.os.Bundle;
|
|
|
import android.text.TextUtils;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
|
import android.widget.Button;
|
|
|
+import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
@@ -72,6 +74,18 @@ public class MainActivity extends Activity implements Interface {
|
|
|
preview.setEllipsize(TextUtils.TruncateAt.END);
|
|
|
newsContainer.addView(preview);
|
|
|
|
|
|
+ ImageView image = new ImageView(getApplicationContext());
|
|
|
+ LinearLayout.LayoutParams imageLayout =
|
|
|
+ new LinearLayout.LayoutParams(
|
|
|
+ LinearLayout.LayoutParams.MATCH_PARENT,
|
|
|
+ 600
|
|
|
+ );
|
|
|
+ image.setLayoutParams(imageLayout);
|
|
|
+ image.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
|
|
+ newsContainer.addView(image);
|
|
|
+
|
|
|
+ new ImageDownload(o.getString("Image"), image, context).start();
|
|
|
+
|
|
|
news.addView(newsContainer);
|
|
|
|
|
|
}
|
|
@@ -83,6 +97,16 @@ public class MainActivity extends Activity implements Interface {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void SetImage(final ImageView img, final Bitmap src) {
|
|
|
+ runOnUiThread(new Runnable() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ img.setImageBitmap(src);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|