parent
31328698cd
commit
4bb0b2f63d
|
@ -145,6 +145,7 @@ public class MessageAdapter extends RecyclerView.Adapter<MessageAdapter.MessageH
|
|||
|
||||
|
||||
public interface OnItemSelected extends OnTagClickListener {
|
||||
|
||||
void onAnswer(int pos);
|
||||
|
||||
void onDelete(int pos);
|
||||
|
|
|
@ -83,10 +83,12 @@ public class MessageLoader extends AsyncTask<Long, Void, Long> {
|
|||
protected void onPostExecute(Long mode) {
|
||||
if (ui.get() == null) return;
|
||||
|
||||
if (mode == LOAD || mode == DELETE) {
|
||||
mAdapter.setData(message);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
} else if (mode == FAIL) {
|
||||
mAdapter.setData(message);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
SwipeRefreshLayout mRefresh = ui.get().findViewById(R.id.dm_reload);
|
||||
mRefresh.setRefreshing(false);
|
||||
|
||||
if (mode == FAIL) {
|
||||
switch (returnCode) {
|
||||
case 420:
|
||||
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show();
|
||||
|
@ -101,7 +103,5 @@ public class MessageLoader extends AsyncTask<Long, Void, Long> {
|
|||
Toast.makeText(ui.get(), errorMsg, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
SwipeRefreshLayout mRefresh = ui.get().findViewById(R.id.dm_reload);
|
||||
mRefresh.setRefreshing(false);
|
||||
}
|
||||
}
|
|
@ -270,11 +270,6 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
|||
protected void onPostExecute(final Long MODE) {
|
||||
if (ui.get() == null) return;
|
||||
|
||||
SwipeRefreshLayout homeReload = ui.get().findViewById(R.id.hometweets);
|
||||
SwipeRefreshLayout favReload = ui.get().findViewById(R.id.homefavorits);
|
||||
homeReload.setRefreshing(false);
|
||||
favReload.setRefreshing(false);
|
||||
|
||||
if (MODE == ACTION_FOLLOW) {
|
||||
if (isFollowing)
|
||||
Toast.makeText(ui.get(), R.string.followed, Toast.LENGTH_SHORT).show();
|
||||
|
@ -294,6 +289,11 @@ public class ProfileLoader extends AsyncTask<Long, Long, Long> {
|
|||
Toast.makeText(ui.get(), R.string.unmuted, Toast.LENGTH_SHORT).show();
|
||||
|
||||
} else if (MODE == FAILURE) {
|
||||
SwipeRefreshLayout homeReload = ui.get().findViewById(R.id.hometweets);
|
||||
SwipeRefreshLayout favReload = ui.get().findViewById(R.id.homefavorits);
|
||||
homeReload.setRefreshing(false);
|
||||
favReload.setRefreshing(false);
|
||||
|
||||
switch (returnCode) {
|
||||
case 420:
|
||||
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_LONG).show();
|
||||
|
|
|
@ -77,6 +77,9 @@ public class UserLists extends AsyncTask<Long, Void, Boolean> {
|
|||
usrAdp.setData(user);
|
||||
usrAdp.notifyDataSetChanged();
|
||||
} else {
|
||||
SwipeRefreshLayout refresh = ui.get().findViewById(R.id.user_refresh);
|
||||
refresh.setRefreshing(false);
|
||||
|
||||
switch (returnCode) {
|
||||
case 420:
|
||||
Toast.makeText(ui.get(), R.string.rate_limit_exceeded, Toast.LENGTH_SHORT).show();
|
||||
|
@ -85,7 +88,5 @@ public class UserLists extends AsyncTask<Long, Void, Boolean> {
|
|||
Toast.makeText(ui.get(), errorMessage, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
SwipeRefreshLayout refresh = ui.get().findViewById(R.id.user_refresh);
|
||||
refresh.setRefreshing(false);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package org.nuclearfog.twidda.backend.clickable;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.Spanned;
|
||||
|
@ -17,7 +18,7 @@ public abstract class Tagger {
|
|||
private static final int MODE = Spanned.SPAN_EXCLUSIVE_EXCLUSIVE;
|
||||
|
||||
|
||||
public static Spannable makeText(final String text, final int color, final OnTagClickListener l) {
|
||||
public static Spannable makeText(final String text, final int color, @NonNull final OnTagClickListener l) {
|
||||
SpannableStringBuilder sText = new SpannableStringBuilder(text);
|
||||
Pattern p = Pattern.compile(PATTERN);
|
||||
Matcher m = p.matcher(text);
|
||||
|
|
|
@ -76,9 +76,10 @@ public class DirectMessage extends AppCompatActivity implements OnRefreshListene
|
|||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
if (mLoader != null && mLoader.getStatus() == RUNNING)
|
||||
if (mLoader != null && mLoader.getStatus() == RUNNING) {
|
||||
mLoader.cancel(true);
|
||||
refresh.setRefreshing(false);
|
||||
refresh.setRefreshing(false);
|
||||
}
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ public class SearchPage extends AppCompatActivity implements UserAdapter.OnItemC
|
|||
|
||||
private RecyclerView tweetSearch, userSearch;
|
||||
private SwipeRefreshLayout tweetReload;
|
||||
private GlobalSettings settings;
|
||||
private TwitterSearch mSearch;
|
||||
private TabHost tabhost;
|
||||
private View lastView;
|
||||
|
@ -62,7 +63,7 @@ public class SearchPage extends AppCompatActivity implements UserAdapter.OnItemC
|
|||
tabhost = findViewById(R.id.search_tab);
|
||||
Toolbar tool = findViewById(R.id.search_toolbar);
|
||||
|
||||
GlobalSettings settings = GlobalSettings.getInstance(this);
|
||||
settings = GlobalSettings.getInstance(this);
|
||||
root.setBackgroundColor(settings.getBackgroundColor());
|
||||
|
||||
setSupportActionBar(tool);
|
||||
|
@ -84,16 +85,6 @@ public class SearchPage extends AppCompatActivity implements UserAdapter.OnItemC
|
|||
tweetSearch.setLayoutManager(new LinearLayoutManager(this));
|
||||
userSearch.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
TimelineAdapter searchAdapter = new TimelineAdapter(this);
|
||||
searchAdapter.setColor(settings.getHighlightColor(), settings.getFontColor());
|
||||
searchAdapter.toggleImage(settings.loadImages());
|
||||
tweetSearch.setAdapter(searchAdapter);
|
||||
|
||||
UserAdapter userAdapter = new UserAdapter(this);
|
||||
userAdapter.toggleImage(settings.loadImages());
|
||||
userAdapter.setColor(settings.getFontColor());
|
||||
userSearch.setAdapter(userAdapter);
|
||||
|
||||
tabhost.setOnTabChangedListener(this);
|
||||
tweetReload.setOnRefreshListener(this);
|
||||
}
|
||||
|
@ -103,6 +94,16 @@ public class SearchPage extends AppCompatActivity implements UserAdapter.OnItemC
|
|||
protected void onStart() {
|
||||
super.onStart();
|
||||
if (mSearch == null) {
|
||||
TimelineAdapter searchAdapter = new TimelineAdapter(this);
|
||||
searchAdapter.setColor(settings.getHighlightColor(), settings.getFontColor());
|
||||
searchAdapter.toggleImage(settings.loadImages());
|
||||
tweetSearch.setAdapter(searchAdapter);
|
||||
|
||||
UserAdapter userAdapter = new UserAdapter(this);
|
||||
userAdapter.toggleImage(settings.loadImages());
|
||||
userAdapter.setColor(settings.getFontColor());
|
||||
userSearch.setAdapter(userAdapter);
|
||||
|
||||
mSearch = new TwitterSearch(this);
|
||||
tweetReload.setRefreshing(true);
|
||||
mSearch.execute(search);
|
||||
|
|
|
@ -76,7 +76,6 @@ public class TweetDetail extends AppCompatActivity implements OnClickListener,
|
|||
mConnect = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
||||
View root = findViewById(R.id.tweet_layout);
|
||||
|
||||
View retweet = findViewById(R.id.rt_button_detail);
|
||||
View favorite = findViewById(R.id.fav_button_detail);
|
||||
View txtRt = findViewById(R.id.no_rt_detail);
|
||||
|
|
|
@ -29,6 +29,7 @@ public class UserDetail extends AppCompatActivity implements OnItemClicked, OnRe
|
|||
|
||||
private RecyclerView userList;
|
||||
private SwipeRefreshLayout refresh;
|
||||
private GlobalSettings settings;
|
||||
private UserLists uList;
|
||||
private int mode = -1;
|
||||
private long id = 0;
|
||||
|
@ -55,14 +56,9 @@ public class UserDetail extends AppCompatActivity implements OnItemClicked, OnRe
|
|||
Toolbar toolbar = findViewById(R.id.user_toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
GlobalSettings settings = GlobalSettings.getInstance(this);
|
||||
settings = GlobalSettings.getInstance(this);
|
||||
root.setBackgroundColor(settings.getBackgroundColor());
|
||||
|
||||
UserAdapter usrAdp = new UserAdapter(this);
|
||||
usrAdp.toggleImage(settings.loadImages());
|
||||
usrAdp.setColor(settings.getFontColor());
|
||||
userList.setAdapter(usrAdp);
|
||||
|
||||
refresh.setRefreshing(true);
|
||||
refresh.setOnRefreshListener(this);
|
||||
}
|
||||
|
@ -72,8 +68,14 @@ public class UserDetail extends AppCompatActivity implements OnItemClicked, OnRe
|
|||
protected void onStart() {
|
||||
super.onStart();
|
||||
if (uList == null) {
|
||||
uList = new UserLists(UserDetail.this);
|
||||
UserAdapter usrAdp = new UserAdapter(this);
|
||||
usrAdp.toggleImage(settings.loadImages());
|
||||
usrAdp.setColor(settings.getFontColor());
|
||||
userList.setAdapter(usrAdp);
|
||||
|
||||
int titleId;
|
||||
uList = new UserLists(UserDetail.this);
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
titleId = R.string.following;
|
||||
|
|
Loading…
Reference in New Issue