mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-02 20:26:53 +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;
|
private ImageView imgView;
|
||||||
|
|
||||||
public ImageDownloader( ImageView imgView){
|
public ImageDownloader(ImageView imgView){
|
||||||
this.imgView = imgView;
|
this.imgView = imgView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package org.nuclearfog.twidda.Engine;
|
package org.nuclearfog.twidda.Engine;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.nuclearfog.twidda.R;
|
import org.nuclearfog.twidda.R;
|
||||||
@ -12,16 +14,20 @@ import twitter4j.User;
|
|||||||
|
|
||||||
public class ProfileInformation extends AsyncTask<Long,Void,Void>
|
public class ProfileInformation extends AsyncTask<Long,Void,Void>
|
||||||
{
|
{
|
||||||
private Context context,toClass;
|
|
||||||
private String screenName, username, description, location, follower, following;
|
private String screenName, username, description, location, follower, following;
|
||||||
private TextView txtUser,txtScrName, txtBio,txtLocation,txtFollowing,txtFollower;
|
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
|
* @param context "this" Context
|
||||||
*/
|
*/
|
||||||
public ProfileInformation(Context context) {
|
public ProfileInformation(Context context) {
|
||||||
this.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);
|
txtLocation = (TextView)((Profile)context).findViewById(R.id.location);
|
||||||
txtFollowing = (TextView)((Profile)context).findViewById(R.id.following);
|
txtFollowing = (TextView)((Profile)context).findViewById(R.id.following);
|
||||||
txtFollower = (TextView)((Profile)context).findViewById(R.id.follower);
|
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
|
@Override
|
||||||
protected Void doInBackground(Long... args) {
|
protected Void doInBackground(Long... args) {
|
||||||
@ -51,6 +59,8 @@ public class ProfileInformation extends AsyncTask<Long,Void,Void>
|
|||||||
location = user.getLocation();
|
location = user.getLocation();
|
||||||
follower = "Follower: "+ user.getFollowersCount();
|
follower = "Follower: "+ user.getFollowersCount();
|
||||||
following = "Following: "+user.getFriendsCount();
|
following = "Following: "+user.getFriendsCount();
|
||||||
|
imageLink = user.getProfileImageURL();
|
||||||
|
bannerLink = user.getProfileBannerURL();
|
||||||
} catch(Exception err){err.printStackTrace();}
|
} catch(Exception err){err.printStackTrace();}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -58,11 +68,18 @@ public class ProfileInformation extends AsyncTask<Long,Void,Void>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void v) {
|
protected void onPostExecute(Void v) {
|
||||||
|
ImageDownloader profileImg, bannerImg;
|
||||||
txtUser.setText(username);
|
txtUser.setText(username);
|
||||||
txtScrName.setText(screenName);
|
txtScrName.setText(screenName);
|
||||||
txtBio.setText(description);
|
txtBio.setText(description);
|
||||||
txtLocation.setText(location);
|
txtLocation.setText(location);
|
||||||
txtFollower.setText(follower);
|
txtFollower.setText(follower);
|
||||||
txtFollowing.setText(following);
|
txtFollowing.setText(following);
|
||||||
|
profileImg = new ImageDownloader(profile);
|
||||||
|
bannerImg = new ImageDownloader(banner);
|
||||||
|
if(imgEnabled) {
|
||||||
|
profileImg.execute(imageLink);
|
||||||
|
bannerImg.execute(bannerLink);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user