hide "Update All" button once clicked to prevent repeated clicks
fdroid/fdroidclient#1357
This commit is contained in:
parent
e49d8c92df
commit
a2361df854
@ -64,7 +64,7 @@ public class UpdateableAppsHeader extends AppUpdateData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
private UpdateableAppsHeader header;
|
private UpdateableAppsHeader header;
|
||||||
|
|
||||||
@ -81,8 +81,22 @@ public class UpdateableAppsHeader extends AppUpdateData {
|
|||||||
appsToUpdate = (TextView) itemView.findViewById(R.id.text_apps_to_update);
|
appsToUpdate = (TextView) itemView.findViewById(R.id.text_apps_to_update);
|
||||||
toggleAppsToUpdate = (Button) itemView.findViewById(R.id.button_toggle_apps_to_update);
|
toggleAppsToUpdate = (Button) itemView.findViewById(R.id.button_toggle_apps_to_update);
|
||||||
|
|
||||||
toggleAppsToUpdate.setOnClickListener(this);
|
toggleAppsToUpdate.setOnClickListener(new View.OnClickListener() {
|
||||||
downloadAll.setOnClickListener(this);
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
header.adapter.toggleAllUpdateableApps();
|
||||||
|
updateToggleButtonText();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
downloadAll.setVisibility(View.VISIBLE);
|
||||||
|
downloadAll.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
downloadAll.setVisibility(View.GONE);
|
||||||
|
UpdateService.autoDownloadUpdates(header.activity);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void bindHeader(UpdateableAppsHeader header) {
|
public void bindHeader(UpdateableAppsHeader header) {
|
||||||
@ -101,16 +115,6 @@ public class UpdateableAppsHeader extends AppUpdateData {
|
|||||||
updateToggleButtonText();
|
updateToggleButtonText();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (v == toggleAppsToUpdate) {
|
|
||||||
header.adapter.toggleAllUpdateableApps();
|
|
||||||
updateToggleButtonText();
|
|
||||||
} else if (v == downloadAll) {
|
|
||||||
UpdateService.autoDownloadUpdates(header.activity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateToggleButtonText() {
|
private void updateToggleButtonText() {
|
||||||
if (header.adapter.canViewAllUpdateableApps()) {
|
if (header.adapter.canViewAllUpdateableApps()) {
|
||||||
toggleAppsToUpdate.setText(R.string.updates__hide_updateable_apps);
|
toggleAppsToUpdate.setText(R.string.updates__hide_updateable_apps);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user