mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-05-15 22:42:51 +00:00
Fix #295
This commit is contained in:
parent
7f1ce1e645
commit
bbea6c2ae4
3 changed files with 15 additions and 7 deletions
|
@ -38,6 +38,7 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
|
||||||
private ViewMode _viewMode;
|
private ViewMode _viewMode;
|
||||||
private String _searchFilter;
|
private String _searchFilter;
|
||||||
private boolean _isPeriodUniform = true;
|
private boolean _isPeriodUniform = true;
|
||||||
|
private int _uniformPeriod = -1;
|
||||||
private Handler _dimHandler;
|
private Handler _dimHandler;
|
||||||
|
|
||||||
// keeps track of the viewholders that are currently bound
|
// keeps track of the viewholders that are currently bound
|
||||||
|
@ -380,17 +381,19 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkPeriodUniformity(boolean force) {
|
private void checkPeriodUniformity(boolean force) {
|
||||||
|
int uniformPeriod = getUniformPeriod();
|
||||||
boolean uniform = isPeriodUniform();
|
boolean uniform = isPeriodUniform();
|
||||||
if (!force && uniform == _isPeriodUniform) {
|
if (!force && uniform == _isPeriodUniform && uniformPeriod == _uniformPeriod) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_isPeriodUniform = uniform;
|
_isPeriodUniform = uniform;
|
||||||
|
_uniformPeriod = uniformPeriod;
|
||||||
|
|
||||||
for (EntryHolder holder : _holders) {
|
for (EntryHolder holder : _holders) {
|
||||||
holder.setShowProgress(!_isPeriodUniform);
|
holder.setShowProgress(!_isPeriodUniform);
|
||||||
}
|
}
|
||||||
|
|
||||||
_view.onPeriodUniformityChanged(_isPeriodUniform);
|
_view.onPeriodUniformityChanged(_isPeriodUniform, _uniformPeriod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUniformPeriod() {
|
public int getUniformPeriod() {
|
||||||
|
@ -478,7 +481,11 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPeriodUniform() {
|
public boolean isPeriodUniform() {
|
||||||
return getUniformPeriod() != -1;
|
return isPeriodUniform(getUniformPeriod());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isPeriodUniform(int period) {
|
||||||
|
return period != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -492,7 +499,7 @@ public class EntryAdapter extends RecyclerView.Adapter<EntryHolder> implements I
|
||||||
void onEntryMove(VaultEntry entry1, VaultEntry entry2);
|
void onEntryMove(VaultEntry entry1, VaultEntry entry2);
|
||||||
void onEntryDrop(VaultEntry entry);
|
void onEntryDrop(VaultEntry entry);
|
||||||
void onEntryChange(VaultEntry entry);
|
void onEntryChange(VaultEntry entry);
|
||||||
void onPeriodUniformityChanged(boolean uniform);
|
void onPeriodUniformityChanged(boolean uniform, int period);
|
||||||
void onSelect(VaultEntry entry);
|
void onSelect(VaultEntry entry);
|
||||||
void onDeselect(VaultEntry entry);
|
void onDeselect(VaultEntry entry);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class EntryHolder extends RecyclerView.ViewHolder {
|
||||||
_refresher = new UiRefresher(new UiRefresher.Listener() {
|
_refresher = new UiRefresher(new UiRefresher.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
if (_hidden) {
|
if (!_hidden) {
|
||||||
refreshCode();
|
refreshCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -205,11 +205,12 @@ public class EntryListView extends Fragment implements EntryAdapter.Listener {
|
||||||
public void onDeselect(VaultEntry entry) { _listener.onDeselect(entry); }
|
public void onDeselect(VaultEntry entry) { _listener.onDeselect(entry); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPeriodUniformityChanged(boolean isUniform) {
|
public void onPeriodUniformityChanged(boolean isUniform, int period) {
|
||||||
setShowProgress(isUniform);
|
setShowProgress(isUniform);
|
||||||
if (_showProgress) {
|
if (_showProgress) {
|
||||||
|
_refresher.stop();
|
||||||
_progressBar.setVisibility(View.VISIBLE);
|
_progressBar.setVisibility(View.VISIBLE);
|
||||||
_progressBar.setPeriod(_adapter.getUniformPeriod());
|
_progressBar.setPeriod(period);
|
||||||
_refresher.start();
|
_refresher.start();
|
||||||
} else {
|
} else {
|
||||||
_progressBar.setVisibility(View.GONE);
|
_progressBar.setVisibility(View.GONE);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue