Move the token update to the adapter
This commit is contained in:
parent
dd97ac87f0
commit
f41eb620aa
2 changed files with 13 additions and 16 deletions
|
@ -253,14 +253,7 @@ public class MainActivity extends BaseActivity
|
|||
animation.setInterpolator(new LinearInterpolator());
|
||||
animation.start();
|
||||
|
||||
boolean change = false;
|
||||
for(int i =0;i < adapter.getFullItemCount(); i++){
|
||||
boolean item_changed = adapter.getItem(i).updateOTP();
|
||||
change = change || item_changed;
|
||||
}
|
||||
|
||||
if (change)
|
||||
adapter.notifyDataSetChanged();
|
||||
adapter.updateTokens();
|
||||
|
||||
handler.postDelayed(this, 1000);
|
||||
}
|
||||
|
|
|
@ -76,14 +76,6 @@ public class EntriesCardAdapter extends RecyclerView.Adapter<EntryViewHolder>
|
|||
return displayedEntries.size();
|
||||
}
|
||||
|
||||
public int getFullItemCount() {
|
||||
return entries.size();
|
||||
}
|
||||
|
||||
public Entry getItem(int i) {
|
||||
return entries.get(i);
|
||||
}
|
||||
|
||||
public void addEntry(Entry e) {
|
||||
entries.add(e);
|
||||
entriesChanged();
|
||||
|
@ -107,6 +99,18 @@ public class EntriesCardAdapter extends RecyclerView.Adapter<EntryViewHolder>
|
|||
entriesChanged();
|
||||
}
|
||||
|
||||
public void updateTokens() {
|
||||
boolean change = false;
|
||||
|
||||
for(int i =0;i < entries.size(); i++){
|
||||
boolean item_changed = entries.get(i).updateOTP();
|
||||
change = change || item_changed;
|
||||
}
|
||||
|
||||
if (change)
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(EntryViewHolder entryViewHolder, int i) {
|
||||
Entry entry = displayedEntries.get(i);
|
||||
|
|
Loading…
Reference in a new issue