disable import key while import is running
This commit is contained in:
@@ -192,6 +192,7 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
|||||||
b.extraContainer.setVisibility(keyState.mShowed ? View.VISIBLE : View.GONE);
|
b.extraContainer.setVisibility(keyState.mShowed ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
b.progress.setVisibility(keyState.mProgress ? View.VISIBLE : View.GONE);
|
b.progress.setVisibility(keyState.mProgress ? View.VISIBLE : View.GONE);
|
||||||
|
b.extra.importKey.setEnabled(!keyState.mProgress);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -200,6 +201,10 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void getKeyWithProgress(int position, ImportKeysListEntry entry, boolean skipSave) {
|
private void getKeyWithProgress(int position, ImportKeysListEntry entry, boolean skipSave) {
|
||||||
|
if (isLoading(position)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
changeProgress(position, true);
|
changeProgress(position, true);
|
||||||
getKey(position, entry, skipSave);
|
getKey(position, entry, skipSave);
|
||||||
}
|
}
|
||||||
@@ -312,6 +317,11 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
|||||||
notifyItemChanged(position);
|
notifyItemChanged(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isLoading(int position) {
|
||||||
|
KeyState keyState = mKeyStates[position];
|
||||||
|
return keyState.mProgress;
|
||||||
|
}
|
||||||
|
|
||||||
private void changeProgress(int position, boolean progress) {
|
private void changeProgress(int position, boolean progress) {
|
||||||
KeyState keyState = mKeyStates[position];
|
KeyState keyState = mKeyStates[position];
|
||||||
keyState.mProgress = progress;
|
keyState.mProgress = progress;
|
||||||
|
|||||||
Reference in New Issue
Block a user