mirror of
https://github.com/nuclearfog/Shitter.git
synced 2025-01-29 02:19:35 +01:00
removed unnecessary code
This commit is contained in:
parent
2048dba4e3
commit
655192f17b
@ -29,7 +29,6 @@ public class StatusUpload extends AsyncTask<Object, Void, Boolean> implements On
|
||||
private Dialog popup;
|
||||
private String[] path;
|
||||
|
||||
|
||||
public StatusUpload(Context context, String[] path) {
|
||||
ui = new WeakReference<>((TweetPopup)context);
|
||||
mTwitter = TwitterEngine.getInstance(context);
|
||||
@ -54,13 +53,11 @@ public class StatusUpload extends AsyncTask<Object, Void, Boolean> implements On
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
popup.dismiss();
|
||||
if (!isCancelled())
|
||||
cancel(true);
|
||||
}
|
||||
});
|
||||
popup.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
popup.setOnDismissListener(new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
public void onDismiss(DialogInterface dialog) {
|
||||
if (!isCancelled())
|
||||
cancel(true);
|
||||
}
|
||||
@ -68,7 +65,6 @@ public class StatusUpload extends AsyncTask<Object, Void, Boolean> implements On
|
||||
popup.show();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Object... args) {
|
||||
try {
|
||||
|
@ -82,25 +82,14 @@ public class SearchPage extends AppCompatActivity implements UserRecycler.OnItem
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if (mSearch != null && !mSearch.isCancelled()) {
|
||||
if (tweetReload.isRefreshing()) {
|
||||
mSearch.cancel(true);
|
||||
tweetReload.setRefreshing(false);
|
||||
}
|
||||
mSearch.cancel(true);
|
||||
tweetReload.setRefreshing(false);
|
||||
}
|
||||
if (popup.isShowing())
|
||||
popup.dismiss();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mSearch != null && !mSearch.isCancelled()) {
|
||||
mSearch.cancel(true);
|
||||
tweetReload.setRefreshing(false);
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(tabIndex == 1) {
|
||||
@ -154,25 +143,29 @@ public class SearchPage extends AppCompatActivity implements UserRecycler.OnItem
|
||||
switch(parent.getId()) {
|
||||
case R.id.tweet_result:
|
||||
if(!tweetReload.isRefreshing()) {
|
||||
TimelineRecycler tlAdp = (TimelineRecycler) tweetSearch.getAdapter();
|
||||
Tweet tweet = tlAdp.getData().get(position);
|
||||
TimelineRecycler tweetAdapter = (TimelineRecycler) tweetSearch.getAdapter();
|
||||
if (tweetAdapter != null) {
|
||||
Tweet tweet = tweetAdapter.getData().get(position);
|
||||
|
||||
intent = new Intent(this, TweetDetail.class);
|
||||
intent.putExtra("tweetID", tweet.tweetID);
|
||||
intent.putExtra("userID", tweet.user.userID);
|
||||
intent.putExtra("username", tweet.user.screenname);
|
||||
startActivity(intent);
|
||||
intent = new Intent(this, TweetDetail.class);
|
||||
intent.putExtra("tweetID", tweet.tweetID);
|
||||
intent.putExtra("userID", tweet.user.userID);
|
||||
intent.putExtra("username", tweet.user.screenname);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case R.id.user_result:
|
||||
UserRecycler uAdp = (UserRecycler) userSearch.getAdapter();
|
||||
TwitterUser user = uAdp.getData().get(position);
|
||||
UserRecycler userAdapter = (UserRecycler) userSearch.getAdapter();
|
||||
if (userAdapter != null) {
|
||||
TwitterUser user = userAdapter.getData().get(position);
|
||||
|
||||
intent = new Intent(getApplicationContext(), UserProfile.class);
|
||||
intent.putExtra("userID", user.userID);
|
||||
intent.putExtra("username", user.screenname);
|
||||
startActivity(intent);
|
||||
intent = new Intent(getApplicationContext(), UserProfile.class);
|
||||
intent.putExtra("userID", user.userID);
|
||||
intent.putExtra("username", user.screenname);
|
||||
startActivity(intent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -229,6 +222,9 @@ public class SearchPage extends AppCompatActivity implements UserRecycler.OnItem
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
private void getContent() {
|
||||
mSearch = new TwitterSearch(this);
|
||||
mSearch.execute(search);
|
||||
|
||||
popup.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
popup.setCanceledOnTouchOutside(false);
|
||||
if (popup.getWindow() != null)
|
||||
@ -236,7 +232,6 @@ public class SearchPage extends AppCompatActivity implements UserRecycler.OnItem
|
||||
View load = getLayoutInflater().inflate(R.layout.item_load, null, false);
|
||||
View cancelButton = load.findViewById(R.id.kill_button);
|
||||
popup.setContentView(load);
|
||||
|
||||
cancelButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@ -246,9 +241,6 @@ public class SearchPage extends AppCompatActivity implements UserRecycler.OnItem
|
||||
}
|
||||
});
|
||||
popup.show();
|
||||
|
||||
mSearch = new TwitterSearch(this);
|
||||
mSearch.execute(search);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -89,6 +89,9 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
if (mStat != null && !mStat.isCancelled()) {
|
||||
mStat.cancel(true);
|
||||
}
|
||||
if (mReply != null && !mReply.isCancelled()) {
|
||||
mReply.cancel(true);
|
||||
answerReload.setRefreshing(false);
|
||||
@ -96,14 +99,6 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mStat != null && !mStat.isCancelled()) {
|
||||
mStat.cancel(true);
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu m) {
|
||||
getMenuInflater().inflate(R.menu.tweet, m);
|
||||
@ -190,14 +185,15 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
|
||||
|
||||
@Override
|
||||
public void onItemClick(View view, ViewGroup parent, int position) {
|
||||
TimelineRecycler tlAdp = (TimelineRecycler) answer_list.getAdapter();
|
||||
Tweet tweet = tlAdp.getData().get(position);
|
||||
|
||||
Intent intent = new Intent(this,TweetDetail.class);
|
||||
intent.putExtra("tweetID", tweet.tweetID);
|
||||
intent.putExtra("userID", tweet.user.userID);
|
||||
intent.putExtra("username", tweet.user.screenname);
|
||||
startActivity(intent);
|
||||
TimelineRecycler timeLineAdapter = (TimelineRecycler) answer_list.getAdapter();
|
||||
if (timeLineAdapter != null) {
|
||||
Tweet tweet = timeLineAdapter.getData().get(position);
|
||||
Intent intent = new Intent(this, TweetDetail.class);
|
||||
intent.putExtra("tweetID", tweet.tweetID);
|
||||
intent.putExtra("userID", tweet.user.userID);
|
||||
intent.putExtra("username", tweet.user.screenname);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,11 +19,12 @@ import org.nuclearfog.twidda.R;
|
||||
import org.nuclearfog.twidda.backend.GlobalSettings;
|
||||
import org.nuclearfog.twidda.backend.ImagePopup;
|
||||
import org.nuclearfog.twidda.backend.StatusUpload;
|
||||
import org.nuclearfog.twidda.backend.StatusUpload.OnTweetSending;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TweetPopup extends AppCompatActivity implements OnClickListener, StatusUpload.OnTweetSending {
|
||||
public class TweetPopup extends AppCompatActivity implements OnClickListener, OnTweetSending {
|
||||
|
||||
private StatusUpload sendTweet;
|
||||
private View imageButton, previewBtn;
|
||||
@ -143,7 +144,6 @@ public class TweetPopup extends AppCompatActivity implements OnClickListener, St
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
closeDialog.show();
|
||||
} else {
|
||||
finish();
|
||||
|
@ -50,10 +50,10 @@ public class UserDetail extends AppCompatActivity implements OnItemClicked {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
protected void onPause() {
|
||||
if (uList != null && !uList.isCancelled())
|
||||
uList.cancel(true);
|
||||
super.onDestroy();
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -73,15 +73,17 @@ public class UserDetail extends AppCompatActivity implements OnItemClicked {
|
||||
|
||||
@Override
|
||||
public void onItemClick(View view, ViewGroup parent, int position) {
|
||||
UserRecycler uAdp = (UserRecycler) userList.getAdapter();
|
||||
TwitterUser user = uAdp.getData().get(position);
|
||||
long userID = user.userID;
|
||||
String username = user.screenname;
|
||||
UserRecycler userListAdapter = (UserRecycler) userList.getAdapter();
|
||||
if (userListAdapter != null) {
|
||||
TwitterUser user = userListAdapter.getData().get(position);
|
||||
long userID = user.userID;
|
||||
String username = user.screenname;
|
||||
|
||||
Intent intent = new Intent(this, UserProfile.class);
|
||||
intent.putExtra("userID", userID);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
Intent intent = new Intent(this, UserProfile.class);
|
||||
intent.putExtra("userID", userID);
|
||||
intent.putExtra("username", username);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void getUsers() {
|
||||
|
@ -106,7 +106,6 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if(tabIndex == 0) {
|
||||
@ -116,7 +115,6 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu m) {
|
||||
getMenuInflater().inflate(R.menu.profile, m);
|
||||
@ -129,11 +127,10 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
Intent intent;
|
||||
mProfile = new ProfileLoader(this);
|
||||
switch(item.getItemId()) {
|
||||
case R.id.profile_tweet:
|
||||
intent = new Intent(this, TweetPopup.class);
|
||||
Intent intent = new Intent(this, TweetPopup.class);
|
||||
if(!home)
|
||||
intent.putExtra("Addition", username);
|
||||
startActivity(intent);
|
||||
@ -163,7 +160,6 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
switch(tabIndex) {
|
||||
@ -186,26 +182,25 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
|
||||
@Override
|
||||
public void onItemClick(View v, ViewGroup parent, int position){
|
||||
TimelineRecycler tlAdp;
|
||||
TimelineRecycler tweetAdapter;
|
||||
if(parent.getId() == R.id.ht_list) {
|
||||
tlAdp = (TimelineRecycler) homeList.getAdapter();
|
||||
tweetAdapter = (TimelineRecycler) homeList.getAdapter();
|
||||
} else {
|
||||
tlAdp = (TimelineRecycler) favoriteList.getAdapter();
|
||||
tweetAdapter = (TimelineRecycler) favoriteList.getAdapter();
|
||||
}
|
||||
|
||||
Tweet tweet = tlAdp.getData().get(position);
|
||||
if(tweet.embedded != null) {
|
||||
tweet = tweet.embedded;
|
||||
if (tweetAdapter != null) {
|
||||
Tweet tweet = tweetAdapter.getData().get(position);
|
||||
if (tweet.embedded != null) {
|
||||
tweet = tweet.embedded;
|
||||
}
|
||||
Intent intent = new Intent(this, TweetDetail.class);
|
||||
intent.putExtra("tweetID", tweet.tweetID);
|
||||
intent.putExtra("userID", tweet.user.userID);
|
||||
intent.putExtra("username", tweet.user.screenname);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
Intent intent = new Intent(this, TweetDetail.class);
|
||||
intent.putExtra("tweetID", tweet.tweetID);
|
||||
intent.putExtra("userID", tweet.user.userID);
|
||||
intent.putExtra("username", tweet.user.screenname);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
private void setTabs() {
|
||||
mTab.setup();
|
||||
TabHost.TabSpec tab1 = mTab.newTabSpec("tweets");
|
||||
@ -244,18 +239,16 @@ public class UserProfile extends AppCompatActivity implements OnClickListener,
|
||||
lastView = mTab.getCurrentView();
|
||||
}
|
||||
|
||||
|
||||
private void getProfileTweets() {
|
||||
new ProfileLoader(this).execute(userId, ProfileLoader.LOAD_DB, 1L);
|
||||
mProfile = new ProfileLoader(this);
|
||||
mTweets = new ProfileLoader(this);
|
||||
mFavorites = new ProfileLoader(this);
|
||||
mProfile = new ProfileLoader(this);
|
||||
mProfile.execute(userId, ProfileLoader.GET_INFORMATION,1L);
|
||||
mTweets.execute(userId, ProfileLoader.GET_TWEETS,1L);
|
||||
mFavorites.execute(userId, ProfileLoader.GET_FAVS,1L);
|
||||
}
|
||||
|
||||
|
||||
private void getConnection(int mode) {
|
||||
Intent intent = new Intent(this, UserDetail.class);
|
||||
intent.putExtra("userID", userId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user