Performance Bugfix

This commit is contained in:
NudeDude 2018-03-27 15:41:01 +02:00
parent ed3ab20e46
commit 2c9ca20208
4 changed files with 15 additions and 8 deletions

View File

@ -114,7 +114,6 @@ public class MainActivity extends AppCompatActivity implements
intent = new Intent(this, UserProfile.class);
Bundle bundle = new Bundle();
bundle.putLong("userID",homeId);
bundle.putBoolean("home", true);
intent.putExtras(bundle);
startActivity(intent);
return true;
@ -251,8 +250,6 @@ public class MainActivity extends AppCompatActivity implements
if(!mentionReload.isRefreshing()) {
TimelineRecycler tlAdp = (TimelineRecycler) mentionList.getAdapter();
Tweet tweet = tlAdp.getData().get(position);
if(tweet.embedded != null)
tweet = tweet.embedded;
long tweetID = tweet.tweetID;
long userID = tweet.user.userID;
String username = tweet.user.screenname;

View File

@ -23,6 +23,8 @@ import java.util.Date;
import java.util.List;
import com.squareup.picasso.Picasso;
import twitter4j.TwitterException;
public class ProfileLoader extends AsyncTask<Long,Void,Long> {
public static final long GET_INFORMATION = 0x0;
@ -38,6 +40,7 @@ public class ProfileLoader extends AsyncTask<Long,Void,Long> {
private TimelineRecycler homeTl, homeFav;
private WeakReference<UserProfile> ui;
private TwitterEngine mTwitter;
private String errMsg = "";
private int font, highlight;
private boolean isHome = false;
private boolean imgEnabled = false;
@ -147,7 +150,16 @@ public class ProfileLoader extends AsyncTask<Long,Void,Long> {
muted = mTwitter.toggleBlock(userId);
}
}
} catch(Exception err) {
} catch (TwitterException err) {
int errCode = err.getErrorCode();
if(errCode != 136 && errCode != -1){
errMsg = err.getMessage();
return FAILURE;
}
err.printStackTrace();
}
catch(Exception err) {
errMsg = err.getMessage();
err.printStackTrace();
return FAILURE;
}
@ -223,7 +235,7 @@ public class ProfileLoader extends AsyncTask<Long,Void,Long> {
}
else if(mode == FAILURE)
{
Toast.makeText(context,"Fehler beim Laden des Profils",Toast.LENGTH_LONG).show();
Toast.makeText(context,"Fehler: "+errMsg,Toast.LENGTH_LONG).show();
tweetsReload.setRefreshing(false);
favoritsReload.setRefreshing(false);
}

View File

@ -37,7 +37,7 @@ import twitter4j.conf.ConfigurationBuilder;
public class TwitterEngine {
private final String TWITTER_CONSUMER_KEY = "1JwXJbVrvGWrc9SSKPnnEWslJ";
private final String TWITTER_CONSUMER_SECRET = "4SNMCHbg68LM14X2wYDjWkmzuNqq5dnB7tfAj2b4Muu8uPQ2QE";
private final String TWITTER_CONSUMER_SECRET = "xxx";
private static TwitterEngine mTwitter;
private static long twitterID = -1L;

View File

@ -175,8 +175,6 @@ public class UserProfile extends AppCompatActivity implements View.OnClickListen
tlAdp = (TimelineRecycler) favoritList.getAdapter();
}
Tweet tweet = tlAdp.getData().get(position);
if(tweet.embedded != null)
tweet = tweet.embedded;
long tweetID = tweet.tweetID;
long userID = tweet.user.userID;
String username = tweet.user.screenname;