mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-23 07:50:36 +01:00
Major Enhancements
This commit is contained in:
parent
69aed98868
commit
0b144b9b7d
@ -13,7 +13,7 @@ public class ImageDownloader extends AsyncTask<String, Void, Bitmap>
|
||||
{
|
||||
private ImageView imgView;
|
||||
|
||||
public ImageDownloader( ImageView imgView){
|
||||
public ImageDownloader(ImageView imgView){
|
||||
this.imgView = imgView;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
package org.nuclearfog.twidda.Engine;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.nuclearfog.twidda.R;
|
||||
@ -12,16 +14,20 @@ import twitter4j.User;
|
||||
|
||||
public class ProfileInformation extends AsyncTask<Long,Void,Void>
|
||||
{
|
||||
private Context context,toClass;
|
||||
private String screenName, username, description, location, follower, following;
|
||||
private TextView txtUser,txtScrName, txtBio,txtLocation,txtFollowing,txtFollower;
|
||||
private ImageView profile, banner;
|
||||
private String imageLink, bannerLink;
|
||||
private Context context;
|
||||
private boolean imgEnabled = false;
|
||||
|
||||
/**
|
||||
* @param context "this" Context
|
||||
*/
|
||||
public ProfileInformation(Context context) {
|
||||
this.context=context;
|
||||
this.toClass = toClass;
|
||||
SharedPreferences settings = context.getSharedPreferences("settings", 0);
|
||||
imgEnabled = settings.getBoolean("image_load",false);
|
||||
}
|
||||
|
||||
|
||||
@ -33,11 +39,13 @@ public class ProfileInformation extends AsyncTask<Long,Void,Void>
|
||||
txtLocation = (TextView)((Profile)context).findViewById(R.id.location);
|
||||
txtFollowing = (TextView)((Profile)context).findViewById(R.id.following);
|
||||
txtFollower = (TextView)((Profile)context).findViewById(R.id.follower);
|
||||
profile = (ImageView)((Profile)context).findViewById(R.id.profile_img);
|
||||
banner = (ImageView)((Profile)context).findViewById(R.id.banner);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param args [0] Username
|
||||
* @param args [0] Twitter User ID
|
||||
*/
|
||||
@Override
|
||||
protected Void doInBackground(Long... args) {
|
||||
@ -51,6 +59,8 @@ public class ProfileInformation extends AsyncTask<Long,Void,Void>
|
||||
location = user.getLocation();
|
||||
follower = "Follower: "+ user.getFollowersCount();
|
||||
following = "Following: "+user.getFriendsCount();
|
||||
imageLink = user.getProfileImageURL();
|
||||
bannerLink = user.getProfileBannerURL();
|
||||
} catch(Exception err){err.printStackTrace();}
|
||||
return null;
|
||||
}
|
||||
@ -58,11 +68,18 @@ public class ProfileInformation extends AsyncTask<Long,Void,Void>
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void v) {
|
||||
ImageDownloader profileImg, bannerImg;
|
||||
txtUser.setText(username);
|
||||
txtScrName.setText(screenName);
|
||||
txtBio.setText(description);
|
||||
txtLocation.setText(location);
|
||||
txtFollower.setText(follower);
|
||||
txtFollowing.setText(following);
|
||||
profileImg = new ImageDownloader(profile);
|
||||
bannerImg = new ImageDownloader(banner);
|
||||
if(imgEnabled) {
|
||||
profileImg.execute(imageLink);
|
||||
bannerImg.execute(bannerLink);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user