mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-02-03 12:37:33 +01:00
Bugfix
Major Cleanup
This commit is contained in:
parent
6296179746
commit
3f82373613
@ -351,9 +351,13 @@ public class MainActivity extends AppCompatActivity implements
|
|||||||
TrendDatabase trendDeck = new TrendDatabase(con);
|
TrendDatabase trendDeck = new TrendDatabase(con);
|
||||||
trendRc = new TrendRecycler(trendDeck, MainActivity.this);
|
trendRc = new TrendRecycler(trendDeck, MainActivity.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean imageload = settings.getBoolean("image_load", true);
|
||||||
rlRc.setColor(highlight,font_color);
|
rlRc.setColor(highlight,font_color);
|
||||||
trendRc.setColor(background,font_color);
|
trendRc.setColor(background,font_color);
|
||||||
mentRc.setColor(highlight,font_color);
|
mentRc.setColor(highlight,font_color);
|
||||||
|
rlRc.toggleImage(imageload);
|
||||||
|
mentRc.toggleImage(imageload);
|
||||||
timelineList.setAdapter(rlRc);
|
timelineList.setAdapter(rlRc);
|
||||||
trendList.setAdapter(trendRc);
|
trendList.setAdapter(trendRc);
|
||||||
mentionList.setAdapter(mentRc);
|
mentionList.setAdapter(mentRc);
|
||||||
|
@ -111,6 +111,7 @@ public class ProfileLoader extends AsyncTask<Long,Void,Long> {
|
|||||||
}
|
}
|
||||||
homeTl = new TimelineRecycler(tweets,ui.get());
|
homeTl = new TimelineRecycler(tweets,ui.get());
|
||||||
homeTl.setColor(highlight,font);
|
homeTl.setColor(highlight,font);
|
||||||
|
homeTl.toggleImage(imgEnabled);
|
||||||
}
|
}
|
||||||
else if(MODE == GET_FAVS)
|
else if(MODE == GET_FAVS)
|
||||||
{
|
{
|
||||||
@ -128,6 +129,7 @@ public class ProfileLoader extends AsyncTask<Long,Void,Long> {
|
|||||||
}
|
}
|
||||||
homeFav = new TimelineRecycler(favorits,ui.get());
|
homeFav = new TimelineRecycler(favorits,ui.get());
|
||||||
homeFav.setColor(highlight,font);
|
homeFav.setColor(highlight,font);
|
||||||
|
homeFav.toggleImage(imgEnabled);
|
||||||
}
|
}
|
||||||
else if(MODE == ACTION_FOLLOW)
|
else if(MODE == ACTION_FOLLOW)
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ import android.content.SharedPreferences;
|
|||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.text.SpannableStringBuilder;
|
import android.text.SpannableStringBuilder;
|
||||||
@ -32,6 +33,7 @@ import org.nuclearfog.twidda.viewadapter.TimelineRecycler;
|
|||||||
import org.nuclearfog.twidda.window.ColorPreferences;
|
import org.nuclearfog.twidda.window.ColorPreferences;
|
||||||
import org.nuclearfog.twidda.window.TweetDetail;
|
import org.nuclearfog.twidda.window.TweetDetail;
|
||||||
import org.nuclearfog.twidda.backend.listitems.*;
|
import org.nuclearfog.twidda.backend.listitems.*;
|
||||||
|
import org.nuclearfog.twidda.window.UserProfile;
|
||||||
|
|
||||||
public class StatusLoader extends AsyncTask<Long, Void, Long> {
|
public class StatusLoader extends AsyncTask<Long, Void, Long> {
|
||||||
|
|
||||||
@ -52,7 +54,7 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
|
|||||||
private String errMSG = "";
|
private String errMSG = "";
|
||||||
private boolean retweeted, favorited, toggleImg, verified;
|
private boolean retweeted, favorited, toggleImg, verified;
|
||||||
private boolean rtFlag = false;
|
private boolean rtFlag = false;
|
||||||
private long userReply, tweetReplyID;
|
private long tweetReplyID, userID;
|
||||||
private int rt, fav;
|
private int rt, fav;
|
||||||
private int highlight, font;
|
private int highlight, font;
|
||||||
|
|
||||||
@ -97,6 +99,7 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
|
|||||||
verified = tweet.verified;
|
verified = tweet.verified;
|
||||||
tweetStr = tweet.tweet;
|
tweetStr = tweet.tweet;
|
||||||
usernameStr = tweet.username;
|
usernameStr = tweet.username;
|
||||||
|
userID = tweet.userID;
|
||||||
scrNameStr = '@'+tweet.screenname;
|
scrNameStr = '@'+tweet.screenname;
|
||||||
apiName = formatString(tweet.source);
|
apiName = formatString(tweet.source);
|
||||||
dateString = DateFormat.getDateTimeInstance().format(new Date(tweet.time));
|
dateString = DateFormat.getDateTimeInstance().format(new Date(tweet.time));
|
||||||
@ -154,9 +157,8 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
|
|||||||
int err = e.getErrorCode();
|
int err = e.getErrorCode();
|
||||||
if(err == 144) { // gelöscht
|
if(err == 144) { // gelöscht
|
||||||
TweetDatabase.removeStatus(ui.get(),tweetID);
|
TweetDatabase.removeStatus(ui.get(),tweetID);
|
||||||
errMSG = e.getMessage();
|
|
||||||
}
|
}
|
||||||
e.printStackTrace();
|
errMSG = e.getMessage();
|
||||||
return ERROR;
|
return ERROR;
|
||||||
} catch(Exception err) {
|
} catch(Exception err) {
|
||||||
errMSG = err.getMessage();
|
errMSG = err.getMessage();
|
||||||
@ -171,7 +173,6 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
|
|||||||
if(connect == null)
|
if(connect == null)
|
||||||
return;
|
return;
|
||||||
final Context c = connect;
|
final Context c = connect;
|
||||||
|
|
||||||
TextView tweet = (TextView)connect.findViewById(R.id.tweet_detailed);
|
TextView tweet = (TextView)connect.findViewById(R.id.tweet_detailed);
|
||||||
TextView username = (TextView)connect.findViewById(R.id.usernamedetail);
|
TextView username = (TextView)connect.findViewById(R.id.usernamedetail);
|
||||||
TextView scrName = (TextView)connect.findViewById(R.id.scrnamedetail);
|
TextView scrName = (TextView)connect.findViewById(R.id.scrnamedetail);
|
||||||
@ -230,11 +231,21 @@ public class StatusLoader extends AsyncTask<Long, Void, Long> {
|
|||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Intent intent = new Intent(c, TweetDetail.class);
|
Intent intent = new Intent(c, TweetDetail.class);
|
||||||
intent.putExtra("tweetID",tweetReplyID);
|
intent.putExtra("tweetID",tweetReplyID);
|
||||||
intent.putExtra("userID",userReply);
|
|
||||||
intent.putExtra("username", repliedUsername);
|
intent.putExtra("username", repliedUsername);
|
||||||
c.startActivity(intent);
|
c.startActivity(intent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
profile_img.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Intent intent = new Intent(ui.get(), UserProfile.class);
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.putLong("userID",userID);
|
||||||
|
b.putString("username", usernameStr);
|
||||||
|
intent.putExtras(b);
|
||||||
|
c.startActivity(intent);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if(mode == RETWEET) {
|
else if(mode == RETWEET) {
|
||||||
String rtStr = Integer.toString(rt);
|
String rtStr = Integer.toString(rt);
|
||||||
|
@ -446,7 +446,7 @@ public class TwitterEngine {
|
|||||||
Tweet embeddedStat = getStatus(tweetID).embedded;
|
Tweet embeddedStat = getStatus(tweetID).embedded;
|
||||||
if(embeddedStat != null)
|
if(embeddedStat != null)
|
||||||
tweetID = embeddedStat.tweetID;
|
tweetID = embeddedStat.tweetID;
|
||||||
long[] userIds = twitter.getRetweeterIds(tweetID,load).getIDs();
|
long[] userIds = twitter.getRetweeterIds(tweetID,load,cursor).getIDs();
|
||||||
if(userIds.length == 0) {
|
if(userIds.length == 0) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.nuclearfog.twidda.backend;
|
package org.nuclearfog.twidda.backend;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.support.v4.widget.SwipeRefreshLayout;
|
import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
@ -27,6 +28,7 @@ public class TwitterSearch extends AsyncTask<String, Void, Void> {
|
|||||||
private WeakReference<SearchPage> ui;
|
private WeakReference<SearchPage> ui;
|
||||||
private int background, highlight, font_color;
|
private int background, highlight, font_color;
|
||||||
private String error;
|
private String error;
|
||||||
|
boolean imageload;
|
||||||
|
|
||||||
public TwitterSearch(Context context) {
|
public TwitterSearch(Context context) {
|
||||||
ui = new WeakReference<>((SearchPage)context);
|
ui = new WeakReference<>((SearchPage)context);
|
||||||
@ -37,6 +39,8 @@ public class TwitterSearch extends AsyncTask<String, Void, Void> {
|
|||||||
background = mcolor.getColor(ColorPreferences.BACKGROUND);
|
background = mcolor.getColor(ColorPreferences.BACKGROUND);
|
||||||
highlight = mcolor.getColor(ColorPreferences.HIGHLIGHTING);
|
highlight = mcolor.getColor(ColorPreferences.HIGHLIGHTING);
|
||||||
font_color = mcolor.getColor(ColorPreferences.FONT_COLOR);
|
font_color = mcolor.getColor(ColorPreferences.FONT_COLOR);
|
||||||
|
SharedPreferences settings = ui.get().getSharedPreferences("settings", 0);
|
||||||
|
imageload = settings.getBoolean("image_load", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -63,7 +67,8 @@ public class TwitterSearch extends AsyncTask<String, Void, Void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tlRc.setColor(highlight,font_color);
|
tlRc.setColor(highlight,font_color);
|
||||||
uAdp.setColor(background,font_color);
|
tlRc.toggleImage(imageload);
|
||||||
|
uAdp.toggleImage(imageload);
|
||||||
|
|
||||||
} catch(Exception err) {
|
} catch(Exception err) {
|
||||||
error = err.getMessage();
|
error = err.getMessage();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package org.nuclearfog.twidda.backend;
|
package org.nuclearfog.twidda.backend;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -9,6 +10,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
import org.nuclearfog.twidda.R;
|
import org.nuclearfog.twidda.R;
|
||||||
import org.nuclearfog.twidda.viewadapter.UserRecycler;
|
import org.nuclearfog.twidda.viewadapter.UserRecycler;
|
||||||
|
import org.nuclearfog.twidda.window.ColorPreferences;
|
||||||
import org.nuclearfog.twidda.window.UserDetail;
|
import org.nuclearfog.twidda.window.UserDetail;
|
||||||
import org.nuclearfog.twidda.backend.listitems.*;
|
import org.nuclearfog.twidda.backend.listitems.*;
|
||||||
|
|
||||||
@ -28,6 +30,8 @@ public class UserLists extends AsyncTask <Long, Void, Void> {
|
|||||||
private RecyclerView userList;
|
private RecyclerView userList;
|
||||||
private ProgressBar uProgress;
|
private ProgressBar uProgress;
|
||||||
private String errmsg;
|
private String errmsg;
|
||||||
|
private boolean imageload;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@see UserDetail
|
*@see UserDetail
|
||||||
@ -37,6 +41,8 @@ public class UserLists extends AsyncTask <Long, Void, Void> {
|
|||||||
mTwitter = TwitterEngine.getInstance(context);
|
mTwitter = TwitterEngine.getInstance(context);
|
||||||
userList = (RecyclerView) ui.get().findViewById(R.id.userlist);
|
userList = (RecyclerView) ui.get().findViewById(R.id.userlist);
|
||||||
uProgress = (ProgressBar) ui.get().findViewById(R.id.user_progress);
|
uProgress = (ProgressBar) ui.get().findViewById(R.id.user_progress);
|
||||||
|
SharedPreferences settings = context.getSharedPreferences("settings", 0);
|
||||||
|
imageload = settings.getBoolean("image_load", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -60,9 +66,7 @@ public class UserLists extends AsyncTask <Long, Void, Void> {
|
|||||||
List<TwitterUser> user = mTwitter.getRetweeter(id,cursor);
|
List<TwitterUser> user = mTwitter.getRetweeter(id,cursor);
|
||||||
usrAdp = new UserRecycler(user,ui.get());
|
usrAdp = new UserRecycler(user,ui.get());
|
||||||
}
|
}
|
||||||
/*else if(mode == FAVORISER) {
|
usrAdp.toggleImage(imageload);
|
||||||
// GET FAV USERS TODO
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
catch(Exception err) {
|
catch(Exception err) {
|
||||||
errmsg = "Fehler: "+err.getMessage();
|
errmsg = "Fehler: "+err.getMessage();
|
||||||
|
@ -73,7 +73,6 @@ public class TweetDatabase {
|
|||||||
"INNER JOIN tweet ON timeline.mTweetID = tweet.tweetID " +
|
"INNER JOIN tweet ON timeline.mTweetID = tweet.tweetID " +
|
||||||
"INNER JOIN user ON tweet.userID=user.userID ORDER BY tweetID ASC";
|
"INNER JOIN user ON tweet.userID=user.userID ORDER BY tweetID ASC";
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(mode == TWEET) {
|
else if(mode == TWEET) {
|
||||||
SQL_GET_HOME = "SELECT * FROM user " +
|
SQL_GET_HOME = "SELECT * FROM user " +
|
||||||
"INNER JOIN tweet ON tweet.userID = user.userID"+
|
"INNER JOIN tweet ON tweet.userID = user.userID"+
|
||||||
@ -88,9 +87,6 @@ public class TweetDatabase {
|
|||||||
if(cursor.moveToFirst()) {
|
if(cursor.moveToFirst()) {
|
||||||
do {
|
do {
|
||||||
Tweet tweet = getTweet(cursor);
|
Tweet tweet = getTweet(cursor);
|
||||||
/* if(tweet.embedded != null)
|
|
||||||
tweetlist.add(tweet.embedded);
|
|
||||||
else*/
|
|
||||||
tweetlist.add(tweet);
|
tweetlist.add(tweet);
|
||||||
} while(cursor.moveToNext());
|
} while(cursor.moveToNext());
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ public class TimelineRecycler extends Adapter<TimelineRecycler.ItemHolder> imple
|
|||||||
private List<Tweet> tweets;
|
private List<Tweet> tweets;
|
||||||
private int highlight = 0xFFFFFFFF;
|
private int highlight = 0xFFFFFFFF;
|
||||||
private int font_color = 0xFFFFFFFF;
|
private int font_color = 0xFFFFFFFF;
|
||||||
|
private boolean img_ldr = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mListener Item Click Listener
|
* @param mListener Item Click Listener
|
||||||
@ -43,6 +44,10 @@ public class TimelineRecycler extends Adapter<TimelineRecycler.ItemHolder> imple
|
|||||||
this.font_color = font_color;
|
this.font_color = font_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void toggleImage(boolean image_load) {
|
||||||
|
img_ldr = image_load;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<Tweet> getData() {
|
public List<Tweet> getData() {
|
||||||
return tweets;
|
return tweets;
|
||||||
@ -82,7 +87,7 @@ public class TimelineRecycler extends Adapter<TimelineRecycler.ItemHolder> imple
|
|||||||
vh.retweet.setText(retweet);
|
vh.retweet.setText(retweet);
|
||||||
vh.favorite.setText(favorit);
|
vh.favorite.setText(favorit);
|
||||||
vh.time.setText(stringTime(tweet.time));
|
vh.time.setText(stringTime(tweet.time));
|
||||||
if(tweet.profileImg != null) {
|
if(img_ldr) {
|
||||||
Picasso.with(parent.getContext()).load(tweet.profileImg).into(vh.profile);
|
Picasso.with(parent.getContext()).load(tweet.profileImg).into(vh.profile);
|
||||||
}
|
}
|
||||||
if(tweet.verified) {
|
if(tweet.verified) {
|
||||||
|
@ -18,8 +18,7 @@ public class UserRecycler extends RecyclerView.Adapter<UserRecycler.ItemHolder>
|
|||||||
private List<TwitterUser> mUser;
|
private List<TwitterUser> mUser;
|
||||||
private OnItemClicked mListener;
|
private OnItemClicked mListener;
|
||||||
private ViewGroup parent;
|
private ViewGroup parent;
|
||||||
private int background = 0x00000000;
|
private boolean loadImage = true;
|
||||||
private int font_color = 0xFFFFFFFF;
|
|
||||||
|
|
||||||
public UserRecycler(List<TwitterUser> mUser, OnItemClicked mListener) {
|
public UserRecycler(List<TwitterUser> mUser, OnItemClicked mListener) {
|
||||||
this.mListener = mListener;
|
this.mListener = mListener;
|
||||||
@ -30,9 +29,8 @@ public class UserRecycler extends RecyclerView.Adapter<UserRecycler.ItemHolder>
|
|||||||
public List<TwitterUser> getData(){return mUser; }
|
public List<TwitterUser> getData(){return mUser; }
|
||||||
|
|
||||||
|
|
||||||
public void setColor(int background, int font_color) {
|
public void toggleImage(boolean image) {
|
||||||
this.background = background;
|
loadImage = image;
|
||||||
this.font_color = font_color;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,7 +50,6 @@ public class UserRecycler extends RecyclerView.Adapter<UserRecycler.ItemHolder>
|
|||||||
public ItemHolder onCreateViewHolder(ViewGroup parent, int index) {
|
public ItemHolder onCreateViewHolder(ViewGroup parent, int index) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.useritem, parent,false);
|
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.useritem, parent,false);
|
||||||
v.setBackgroundColor(background);
|
|
||||||
v.setOnClickListener(this);
|
v.setOnClickListener(this);
|
||||||
return new ItemHolder(v);
|
return new ItemHolder(v);
|
||||||
}
|
}
|
||||||
@ -63,7 +60,7 @@ public class UserRecycler extends RecyclerView.Adapter<UserRecycler.ItemHolder>
|
|||||||
TwitterUser user = mUser.get(index);
|
TwitterUser user = mUser.get(index);
|
||||||
vh.screenname.setText(user.screenname);
|
vh.screenname.setText(user.screenname);
|
||||||
vh.username.setText(user.username);
|
vh.username.setText(user.username);
|
||||||
if(user.profileImg != null) {
|
if(loadImage) {
|
||||||
Picasso.with(parent.getContext()).load(user.profileImg).into(vh.profileImg);
|
Picasso.with(parent.getContext()).load(user.profileImg).into(vh.profileImg);
|
||||||
}
|
}
|
||||||
if(user.isVerified) {
|
if(user.isVerified) {
|
||||||
|
@ -165,7 +165,7 @@ public class AppSettings extends AppCompatActivity implements View.OnClickListen
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton b, boolean checked) {
|
public void onCheckedChanged(CompoundButton b, boolean checked) {
|
||||||
imgEnabled = true;
|
imgEnabled = checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadSettings() {
|
private void loadSettings() {
|
||||||
|
@ -50,7 +50,6 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
|||||||
Button retweet = (Button) findViewById(R.id.rt_button_detail);
|
Button retweet = (Button) findViewById(R.id.rt_button_detail);
|
||||||
Button favorite = (Button) findViewById(R.id.fav_button_detail);
|
Button favorite = (Button) findViewById(R.id.fav_button_detail);
|
||||||
Button delete = (Button) findViewById(R.id.delete);
|
Button delete = (Button) findViewById(R.id.delete);
|
||||||
ImageView pb =(ImageView) findViewById(R.id.profileimage_detail);
|
|
||||||
SwipeRefreshLayout answerReload = (SwipeRefreshLayout) findViewById(R.id.answer_reload);
|
SwipeRefreshLayout answerReload = (SwipeRefreshLayout) findViewById(R.id.answer_reload);
|
||||||
TextView txtRt = (TextView) findViewById(R.id.no_rt_detail);
|
TextView txtRt = (TextView) findViewById(R.id.no_rt_detail);
|
||||||
TextView txtFav = (TextView) findViewById(R.id.no_fav_detail);
|
TextView txtFav = (TextView) findViewById(R.id.no_fav_detail);
|
||||||
@ -67,7 +66,6 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
|||||||
txtRt.setOnClickListener(this);
|
txtRt.setOnClickListener(this);
|
||||||
date.setOnClickListener(this);
|
date.setOnClickListener(this);
|
||||||
delete.setOnClickListener(this);
|
delete.setOnClickListener(this);
|
||||||
pb.setOnClickListener(this);
|
|
||||||
setContent();
|
setContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,14 +126,6 @@ public class TweetDetail extends AppCompatActivity implements View.OnClickListen
|
|||||||
alerta.setNegativeButton(R.string.no_confirm, this);
|
alerta.setNegativeButton(R.string.no_confirm, this);
|
||||||
alerta.show();
|
alerta.show();
|
||||||
break;
|
break;
|
||||||
case R.id.profileimage_detail:
|
|
||||||
intent = new Intent(getApplicationContext(), UserProfile.class);
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
b.putLong("userID",userID);
|
|
||||||
b.putString("username", username);
|
|
||||||
intent.putExtras(b);
|
|
||||||
startActivity(intent);
|
|
||||||
break;
|
|
||||||
case R.id.timedetail:
|
case R.id.timedetail:
|
||||||
intent = new Intent(Intent.ACTION_VIEW);
|
intent = new Intent(Intent.ACTION_VIEW);
|
||||||
String tweetlink = "https://twitter.com/"+username+"/status/"+tweetID;
|
String tweetlink = "https://twitter.com/"+username+"/status/"+tweetID;
|
||||||
|
@ -37,6 +37,8 @@ public class UserDetail extends AppCompatActivity implements UserRecycler.OnItem
|
|||||||
userListview.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
userListview.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||||
Toolbar toolbar = (Toolbar) findViewById(R.id.user_toolbar);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.user_toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
int background = ColorPreferences.getInstance(this).getColor(ColorPreferences.BACKGROUND);
|
||||||
|
userListview.setBackgroundColor(background);
|
||||||
getUsers();
|
getUsers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||||||
private SwipeRefreshLayout homeReload, favoriteReload;
|
private SwipeRefreshLayout homeReload, favoriteReload;
|
||||||
private RecyclerView homeTweets, homeFavorits;
|
private RecyclerView homeTweets, homeFavorits;
|
||||||
private long userId;
|
private long userId;
|
||||||
private boolean home;
|
private boolean home, imageload;
|
||||||
private String username = "";
|
private String username = "";
|
||||||
private String currentTab = "tweets";
|
private String currentTab = "tweets";
|
||||||
|
|
||||||
@ -51,6 +51,7 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||||||
|
|
||||||
SharedPreferences settings = getSharedPreferences("settings", 0);
|
SharedPreferences settings = getSharedPreferences("settings", 0);
|
||||||
home = userId == settings.getLong("userID", -1);
|
home = userId == settings.getLong("userID", -1);
|
||||||
|
imageload = settings.getBoolean("image_load", true);
|
||||||
homeTweets = (RecyclerView) findViewById(R.id.ht_list);
|
homeTweets = (RecyclerView) findViewById(R.id.ht_list);
|
||||||
homeFavorits = (RecyclerView)findViewById(R.id.hf_list);
|
homeFavorits = (RecyclerView)findViewById(R.id.hf_list);
|
||||||
homeTweets.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
homeTweets.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
|
||||||
@ -181,12 +182,10 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||||||
|
|
||||||
private void setTabs(TabHost mTab) {
|
private void setTabs(TabHost mTab) {
|
||||||
mTab.setup();
|
mTab.setup();
|
||||||
// Tab #1
|
|
||||||
TabHost.TabSpec tab1 = mTab.newTabSpec("tweets");
|
TabHost.TabSpec tab1 = mTab.newTabSpec("tweets");
|
||||||
tab1.setContent(R.id.hometweets);
|
tab1.setContent(R.id.hometweets);
|
||||||
tab1.setIndicator("",getResources().getDrawable(R.drawable.home));
|
tab1.setIndicator("",getResources().getDrawable(R.drawable.home));
|
||||||
mTab.addTab(tab1);
|
mTab.addTab(tab1);
|
||||||
// Tab #2
|
|
||||||
TabHost.TabSpec tab2 = mTab.newTabSpec("favorites");
|
TabHost.TabSpec tab2 = mTab.newTabSpec("favorites");
|
||||||
tab2.setContent(R.id.homefavorits);
|
tab2.setContent(R.id.homefavorits);
|
||||||
tab2.setIndicator("",getResources().getDrawable(R.drawable.favorite));
|
tab2.setIndicator("",getResources().getDrawable(R.drawable.favorite));
|
||||||
@ -202,6 +201,7 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ColorPreferences mcolor = ColorPreferences.getInstance(getApplicationContext());
|
ColorPreferences mcolor = ColorPreferences.getInstance(getApplicationContext());
|
||||||
|
|
||||||
int highlight = mcolor.getColor(ColorPreferences.HIGHLIGHTING);
|
int highlight = mcolor.getColor(ColorPreferences.HIGHLIGHTING);
|
||||||
int background = mcolor.getColor(ColorPreferences.BACKGROUND);
|
int background = mcolor.getColor(ColorPreferences.BACKGROUND);
|
||||||
int font_color = mcolor.getColor(ColorPreferences.FONT_COLOR);
|
int font_color = mcolor.getColor(ColorPreferences.FONT_COLOR);
|
||||||
@ -215,9 +215,11 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||||||
mFavorits = new ProfileLoader(UserProfile.this);
|
mFavorits = new ProfileLoader(UserProfile.this);
|
||||||
homeTweets.setBackgroundColor(background);
|
homeTweets.setBackgroundColor(background);
|
||||||
homeFavorits.setBackgroundColor(background);
|
homeFavorits.setBackgroundColor(background);
|
||||||
|
|
||||||
if( userTweets.size() > 0 ) {
|
if( userTweets.size() > 0 ) {
|
||||||
TimelineRecycler tlRc = new TimelineRecycler(userTweets,UserProfile.this);
|
TimelineRecycler tlRc = new TimelineRecycler(userTweets,UserProfile.this);
|
||||||
tlRc.setColor(highlight,font_color);
|
tlRc.setColor(highlight,font_color);
|
||||||
|
tlRc.toggleImage(imageload);
|
||||||
homeTweets.setAdapter(tlRc);
|
homeTweets.setAdapter(tlRc);
|
||||||
} else {
|
} else {
|
||||||
mTweets.execute(userId, ProfileLoader.GET_TWEETS,1L);
|
mTweets.execute(userId, ProfileLoader.GET_TWEETS,1L);
|
||||||
@ -225,6 +227,7 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
|
|||||||
if( userFavorit.size() > 0 ) {
|
if( userFavorit.size() > 0 ) {
|
||||||
TimelineRecycler tlRc = new TimelineRecycler(userFavorit,UserProfile.this);
|
TimelineRecycler tlRc = new TimelineRecycler(userFavorit,UserProfile.this);
|
||||||
tlRc.setColor(highlight,font_color);
|
tlRc.setColor(highlight,font_color);
|
||||||
|
tlRc.toggleImage(imageload);
|
||||||
homeFavorits.setAdapter(tlRc);
|
homeFavorits.setAdapter(tlRc);
|
||||||
} else {
|
} else {
|
||||||
mFavorits.execute(userId, ProfileLoader.GET_FAVS,1L);
|
mFavorits.execute(userId, ProfileLoader.GET_FAVS,1L);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user