Change timer task
This commit is contained in:
parent
f6e508517f
commit
d0cb35e01e
|
@ -109,7 +109,6 @@ import app.fedilab.android.interfaces.OnRetrieveEmojiInterface;
|
||||||
|
|
||||||
import static android.content.Context.MODE_PRIVATE;
|
import static android.content.Context.MODE_PRIVATE;
|
||||||
import static app.fedilab.android.activities.BaseMainActivity.social;
|
import static app.fedilab.android.activities.BaseMainActivity.social;
|
||||||
import static app.fedilab.android.drawers.StatusListAdapter.tmr;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -155,22 +154,6 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
};
|
};
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
|
|
||||||
private void startUpdateTimer() {
|
|
||||||
|
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
|
||||||
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
|
|
||||||
if( !disableAnimatedEmoji ){
|
|
||||||
if( tmr == null){
|
|
||||||
tmr = new Timer();
|
|
||||||
}
|
|
||||||
tmr.schedule(new TimerTask() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mHandler.post(updateAnimatedEmoji);
|
|
||||||
}
|
|
||||||
}, 0, 130);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public NotificationsListAdapter(boolean isOnWifi, int behaviorWithAttachments, List<Notification> notifications){
|
public NotificationsListAdapter(boolean isOnWifi, int behaviorWithAttachments, List<Notification> notifications){
|
||||||
this.notifications = notifications;
|
this.notifications = notifications;
|
||||||
|
@ -208,11 +191,11 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
holder = (NotificationsListAdapter.ViewHolder) viewHolder;
|
holder = (NotificationsListAdapter.ViewHolder) viewHolder;
|
||||||
context = holder.status_document_container.getContext();
|
context = holder.status_document_container.getContext();
|
||||||
|
|
||||||
startUpdateTimer();
|
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
lstHolders.add(holder);
|
lstHolders.add(holder);
|
||||||
}
|
}
|
||||||
|
holder.startUpdateTimer();
|
||||||
final Notification notification = notifications.get(position);
|
final Notification notification = notifications.get(position);
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
|
|
||||||
|
@ -1495,6 +1478,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
TextView number_votes, remaining_time;
|
TextView number_votes, remaining_time;
|
||||||
Button submit_vote, refresh_poll;
|
Button submit_vote, refresh_poll;
|
||||||
|
|
||||||
|
Timer tmr;
|
||||||
public View getView(){
|
public View getView(){
|
||||||
return itemView;
|
return itemView;
|
||||||
}
|
}
|
||||||
|
@ -1555,6 +1539,23 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
|
||||||
notification_status_content.invalidate();
|
notification_status_content.invalidate();
|
||||||
notification_account_username.invalidate();
|
notification_account_username.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void startUpdateTimer() {
|
||||||
|
|
||||||
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
|
||||||
|
if( !disableAnimatedEmoji ){
|
||||||
|
if( tmr == null){
|
||||||
|
tmr = new Timer();
|
||||||
|
}
|
||||||
|
tmr.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mHandler.post(updateAnimatedEmoji);
|
||||||
|
}
|
||||||
|
}, 0, 130);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -219,7 +219,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
private Status tootReply;
|
private Status tootReply;
|
||||||
private long currentToId = -1;
|
private long currentToId = -1;
|
||||||
private RecyclerView mRecyclerView;
|
private RecyclerView mRecyclerView;
|
||||||
static Timer tmr;
|
|
||||||
private List<ViewHolder> lstHolders;
|
private List<ViewHolder> lstHolders;
|
||||||
private final Object lock = new Object();
|
private final Object lock = new Object();
|
||||||
|
|
||||||
|
@ -259,23 +259,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
mRecyclerView = null;
|
mRecyclerView = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startUpdateTimer() {
|
|
||||||
|
|
||||||
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
|
||||||
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
|
|
||||||
if( !disableAnimatedEmoji ){
|
|
||||||
if( tmr == null){
|
|
||||||
tmr = new Timer();
|
|
||||||
}
|
|
||||||
tmr.schedule(new TimerTask() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mHandler.post(updateAnimatedEmoji);
|
|
||||||
}
|
|
||||||
}, 0, 130);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public StatusListAdapter(RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, List<Status> statuses){
|
public StatusListAdapter(RetrieveFeedsAsyncTask.Type type, String targetedId, boolean isOnWifi, List<Status> statuses){
|
||||||
super();
|
super();
|
||||||
this.statuses = statuses;
|
this.statuses = statuses;
|
||||||
|
@ -710,6 +693,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
ImageView quick_reply_emoji;
|
ImageView quick_reply_emoji;
|
||||||
Button quick_reply_button;
|
Button quick_reply_button;
|
||||||
ImageView quick_reply_privacy;
|
ImageView quick_reply_privacy;
|
||||||
|
Timer tmr;
|
||||||
|
|
||||||
public View getView(){
|
public View getView(){
|
||||||
return itemView;
|
return itemView;
|
||||||
|
@ -837,6 +821,25 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
}
|
}
|
||||||
status_content.invalidate();
|
status_content.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void startUpdateTimer() {
|
||||||
|
|
||||||
|
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, MODE_PRIVATE);
|
||||||
|
boolean disableAnimatedEmoji = sharedpreferences.getBoolean(Helper.SET_DISABLE_ANIMATED_EMOJI, false);
|
||||||
|
if( !disableAnimatedEmoji ){
|
||||||
|
if( tmr == null){
|
||||||
|
tmr = new Timer();
|
||||||
|
}
|
||||||
|
tmr.schedule(new TimerTask() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mHandler.post(updateAnimatedEmoji);
|
||||||
|
}
|
||||||
|
}, 0, 130);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Status getItem(int position){
|
public Status getItem(int position){
|
||||||
|
@ -867,7 +870,6 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
|
|
||||||
context = parent.getContext();
|
context = parent.getContext();
|
||||||
layoutInflater = LayoutInflater.from(this.context);
|
layoutInflater = LayoutInflater.from(this.context);
|
||||||
startUpdateTimer();
|
|
||||||
if( viewType == DISPLAYED_STATUS)
|
if( viewType == DISPLAYED_STATUS)
|
||||||
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_status, parent, false));
|
return new ViewHolder(layoutInflater.inflate(R.layout.drawer_status, parent, false));
|
||||||
else if(viewType == COMPACT_STATUS)
|
else if(viewType == COMPACT_STATUS)
|
||||||
|
@ -893,6 +895,9 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
lstHolders.add(holder);
|
lstHolders.add(holder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
holder.startUpdateTimer();
|
||||||
final Status status = statuses.get(i);
|
final Status status = statuses.get(i);
|
||||||
if( status == null)
|
if( status == null)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -847,18 +847,12 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
*/
|
*/
|
||||||
public void refreshFilter(){
|
public void refreshFilter(){
|
||||||
|
|
||||||
switch (instanceType) {
|
if( statusListAdapter != null) {
|
||||||
case "MASTODON":
|
statusListAdapter.notifyDataSetChanged();
|
||||||
case "MISSKEY":
|
}else if( pixelfedListAdapter != null) {
|
||||||
case "GNU":
|
pixelfedListAdapter.notifyDataSetChanged();
|
||||||
statusListAdapter.notifyDataSetChanged();
|
}else if( artListAdapter != null){
|
||||||
break;
|
artListAdapter.notifyDataSetChanged();
|
||||||
case "PIXELFED":
|
|
||||||
pixelfedListAdapter.notifyDataSetChanged();
|
|
||||||
break;
|
|
||||||
case "ART":
|
|
||||||
artListAdapter.notifyDataSetChanged();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue