Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

become the big image after it clicked

  • Loading branch information...
commit 4a154a3574efa24a97f34aaae8358937674adf0e 1 parent b2cfa56
regrecall authored
Showing with 73 additions and 12 deletions.
  1. BIN  WeiboA/bin/WeiboA.apk
  2. BIN  WeiboA/bin/classes.dex
  3. BIN  WeiboA/bin/classes/com/weiboa/activity/TimeLineActivity$DownLoadStatus.class
  4. BIN  WeiboA/bin/classes/com/weiboa/activity/TimeLineActivity.class
  5. BIN  WeiboA/bin/classes/com/weiboa/data/DownLoadPircuter.class
  6. BIN  WeiboA/bin/classes/com/weiboa/data/StatusAdapter$StatusWrapper.class
  7. BIN  WeiboA/bin/classes/com/weiboa/data/StatusProvider$DbHelper.class
  8. BIN  WeiboA/bin/classes/com/weiboa/data/StatusProvider.class
  9. BIN  WeiboA/bin/classes/com/weiboa/data/TweetStatus.class
  10. BIN  WeiboA/bin/classes/com/weiboa/util/ImageUtil$1.class
  11. BIN  WeiboA/bin/classes/com/weiboa/util/ImageUtil.class
  12. BIN  WeiboA/bin/classes/com/weiboa/util/WeiboUserUtil.class
  13. BIN  WeiboA/bin/resources.ap_
  14. +1 −0  WeiboA/res/layout/row.xml
  15. +2 −5 WeiboA/src/com/weiboa/activity/TimeLineActivity.java
  16. +13 −1 WeiboA/src/com/weiboa/data/DownLoadPircuter.java
  17. +4 −1 WeiboA/src/com/weiboa/data/StatusAdapter.java
  18. +3 −2 WeiboA/src/com/weiboa/data/StatusProvider.java
  19. +11 −1 WeiboA/src/com/weiboa/data/TweetStatus.java
  20. +38 −2 WeiboA/src/com/weiboa/util/ImageUtil.java
  21. +1 −0  WeiboA/src/com/weiboa/util/WeiboUserUtil.java
BIN  WeiboA/bin/WeiboA.apk
View
Binary file not shown
BIN  WeiboA/bin/classes.dex
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/activity/TimeLineActivity$DownLoadStatus.class
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/activity/TimeLineActivity.class
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/data/DownLoadPircuter.class
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/data/StatusAdapter$StatusWrapper.class
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/data/StatusProvider$DbHelper.class
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/data/StatusProvider.class
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/data/TweetStatus.class
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/util/ImageUtil$1.class
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/util/ImageUtil.class
View
Binary file not shown
BIN  WeiboA/bin/classes/com/weiboa/util/WeiboUserUtil.class
View
Binary file not shown
BIN  WeiboA/bin/resources.ap_
View
Binary file not shown
1  WeiboA/res/layout/row.xml
View
@@ -41,6 +41,7 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
+ android:clickable="true"
android:id="@+id/tlPircture"
/>
</LinearLayout>
7 WeiboA/src/com/weiboa/activity/TimeLineActivity.java
View
@@ -113,7 +113,7 @@ protected void onCreate(Bundle savedInstanceState) {
startManagingCursor(cursor);
List<TweetStatus> ret = new ArrayList<TweetStatus>();
for(cursor.moveToFirst();!cursor.isAfterLast();cursor.moveToNext()){
- TweetStatus status = new TweetStatus((new Long(cursor.getLong(0))), cursor.getString(1), cursor.getString(2), cursor.getLong(3), cursor.getString(4));
+ TweetStatus status = new TweetStatus((new Long(cursor.getLong(0))), cursor.getString(1), cursor.getString(2), cursor.getLong(3), cursor.getString(4), cursor.getString(5));
ret.add(status);
}
return ret;
@@ -128,7 +128,7 @@ protected void onCreate(Bundle savedInstanceState) {
}
int i = 0;
for(cursor.moveToFirst();!cursor.isAfterLast() && i < num; cursor.moveToNext(), i++){
- TweetStatus status = new TweetStatus((new Long(cursor.getLong(0))), cursor.getString(1), cursor.getString(2), cursor.getLong(3), cursor.getString(4));
+ TweetStatus status = new TweetStatus((new Long(cursor.getLong(0))), cursor.getString(1), cursor.getString(2), cursor.getLong(3), cursor.getString(4), cursor.getString(5));
ret.add(status);
}
return ret;
@@ -144,9 +144,6 @@ private void setupList()
mListView.setOnItemClickListener(this);
mListView.setOnItemLongClickListener(this);
- // mStatusAdapter = new StatusAdapter<TweetStatus>(this, R.layout.row, getStatus());
- // mListView.setAdapter(mStatusAdapter);
-
//Register the receiver
registerReceiver(mReceiver, mFilter, SEND_TIMELINE_NOTIFICATIONS, null);
}
14 WeiboA/src/com/weiboa/data/DownLoadPircuter.java
View
@@ -25,11 +25,19 @@
String name;
AnimationDrawable animation = null;
URL url;
+ URL original_url;
public DownLoadPircuter(JSONObject jObject){
try {
url = new URL(jObject.getString("url"));
+ String orString = jObject.getString("original_url");
+
+ if(orString.isEmpty()){
+ original_url = null;
+ }else{
+ original_url = new URL(orString);
+ }
name = ImageUtil.getImageName(jObject.getString("url"));
mImageView = (ImageView)jObject.get("imageview");
} catch (Exception e) {
@@ -49,7 +57,11 @@ protected void onPreExecute() {
@Override
protected void onPostExecute(Void result) {
AnimationUtil.stopAnimation(mImageView);
- ImageUtil.loadImageToView(mImageView, name);
+ if(original_url == null){
+ ImageUtil.loadImageToView(mImageView, name, null);
+ }else{
+ ImageUtil.loadImageToView(mImageView, name, original_url.toString());
+ }
}
@Override
5 WeiboA/src/com/weiboa/data/StatusAdapter.java
View
@@ -106,6 +106,7 @@ void populateFrom(TweetStatus status){
String text = Html.fromHtml(status.getText()).toString();
getText().setText(text);
String url = status.getUrl();
+ String original_url = status.getOriginal_url();
// Log.d(TAG, "URl: "+ url);
if(url.equals("")){
getImage().setVisibility(View.GONE);
@@ -114,12 +115,14 @@ void populateFrom(TweetStatus status){
if(ImageUtil.checkImageExist(url)){
AnimationUtil.stopAnimation(getImage());
String name = ImageUtil.getImageName(url);
- ImageUtil.loadImageToView(getImage(), name);
+
+ ImageUtil.loadImageToView(getImage(), name, original_url);
}else{
getImage().setVisibility(View.VISIBLE);
JSONObject tObject = new JSONObject();
try {
tObject.put("url", url);
+ tObject.put("original_url", original_url);
tObject.put("imageview", getImage());
new DownLoadPircuter(tObject).execute();
} catch (JSONException e) {
5 WeiboA/src/com/weiboa/data/StatusProvider.java
View
@@ -39,10 +39,11 @@
public static final String C_USER = "user";
public static final String C_USER_ID = "user_id";
public static final String C_PIRCTURE = "pircture";
+ public static final String C_ORIGINAL_PIC = "original_pic";
public static final String GET_ALL_ORDER_BY = C_CREATED_AT + " DESC ";
- public static final String[] DB_QUERYBASIC_COLUMNS = {C_ID, C_TEXT, C_USER, C_CREATED_AT, C_PIRCTURE};
+ public static final String[] DB_QUERYBASIC_COLUMNS = {C_ID, C_TEXT, C_USER, C_CREATED_AT, C_PIRCTURE, C_ORIGINAL_PIC};
static final String[] MAX_CREATED_AT_COLUMNS = {"max("
+ C_CREATED_AT + ")"};
@@ -59,7 +60,7 @@ public DbHelper(Context context) {
@Override
public void onCreate(SQLiteDatabase db) {
String sql = "create table " + TABLE + "(" + C_ID + " long primary key, "
- + C_CREATED_AT + " long, " + C_USER + " text, " + C_SOURCE + " text, " + C_TEXT + " text, " + C_PIRCTURE + " text, " + C_USER_ID+ " integer)";
+ + C_CREATED_AT + " long, " + C_USER + " text, " + C_SOURCE + " text, " + C_TEXT + " text, " + C_PIRCTURE + " text, " + C_ORIGINAL_PIC + " text, " + C_USER_ID+ " integer)";
db.execSQL(sql);
12 WeiboA/src/com/weiboa/data/TweetStatus.java
View
@@ -7,17 +7,27 @@
private String userName;
private long time;
private String url;
+ private String original_url;
- public TweetStatus(Long id, String text, String username, long time, String url){
+ public TweetStatus(Long id, String text, String username, long time, String url, String original_url){
this.id = id;
this.text = text;
this.userName = username;
this.time = time;
this.url = url;
+ this.original_url = original_url;
}
+ public String getOriginal_url() {
+ return original_url;
+ }
+
+ public void setOriginal_url(String original_url) {
+ this.original_url = original_url;
+ }
+
public String getUrl() {
return url;
}
40 WeiboA/src/com/weiboa/util/ImageUtil.java
View
@@ -5,22 +5,58 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
+import android.graphics.Matrix;
+import android.view.FocusFinder;
import android.view.View;
+import android.view.View.OnClickListener;
import android.widget.ImageView;
+import android.widget.ImageView.ScaleType;
import com.weiboa.activity.WeiboAApplication;
+import com.weiboa.data.DownLoadPircuter;
public class ImageUtil {
- public static void loadImageToView(ImageView view, String name){
+ public static void loadImageToView(ImageView view, String name, final String original_url){
BufferedInputStream buf;
try {
buf = new BufferedInputStream(new FileInputStream(new File(WeiboAApplication.Dir + name)));
- Bitmap bitmap = BitmapFactory.decodeStream(buf);
+ final Bitmap bitmap = BitmapFactory.decodeStream(buf);
view.setImageBitmap(bitmap);
view.setVisibility(View.VISIBLE);
+ view.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ ImageView imageView = (ImageView)v;
+ if(original_url == null){
+ return;
+ }
+ if(ImageUtil.checkImageExist(original_url)){
+ AnimationUtil.stopAnimation(imageView);
+ String name = ImageUtil.getImageName(original_url);
+ ImageUtil.loadImageToView(imageView, name, null);
+ }else{
+
+ imageView.setVisibility(View.VISIBLE);
+ JSONObject tObject = new JSONObject();
+ try {
+ tObject.put("url", original_url);
+ tObject.put("imageview", imageView);
+ tObject.put("original_url", "");
+ new DownLoadPircuter(tObject).execute();
+ } catch (JSONException e) {
+ tObject = null;
+ e.printStackTrace();
+ }
+ }
+ }
+ });
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
1  WeiboA/src/com/weiboa/util/WeiboUserUtil.java
View
@@ -113,6 +113,7 @@ private static Uri insertTweet(JSONObject jObject, Application mApplication){
values.put(StatusProvider.C_USER_ID, user.getString("id"));
if(jObject.has("thumbnail_pic")){
values.put(StatusProvider.C_PIRCTURE, jObject.getString("thumbnail_pic"));
+ values.put(StatusProvider.C_ORIGINAL_PIC, jObject.getString("original_pic"));
}else {
values.put(StatusProvider.C_PIRCTURE, "");
}
Please sign in to comment.
Something went wrong with that request. Please try again.