Add edit button for download label

This commit is contained in:
FooIbar authored and tarsin committed 2022-12-28 22:20:53 +08:00
1 parent d357e83d06
commit a85387c7c8
2 files changed
+17 -5

No files matched your search

@@ -875,11 +875,13 @@ public class DownloadsScene extends ToolbarScene
private static class DownloadLabelHolder extends RecyclerView.ViewHolder {
private final TextView label;
private final ImageView edit;
private final ImageView option;
private DownloadLabelHolder(View itemView) {
super(itemView);
label = (TextView) ViewUtils.$$(itemView, R.id.tv_key);
edit = (ImageView) ViewUtils.$$(itemView, R.id.iv_edit);
option = (ImageView) ViewUtils.$$(itemView, R.id.iv_option);
}
}
@@ -937,8 +939,8 @@ public class DownloadsScene extends ToolbarScene
}
});
if (position > 0) {
holder.option.setVisibility(View.VISIBLE);
holder.option.setOnClickListener(v -> {
holder.edit.setVisibility(View.VISIBLE);
holder.edit.setOnClickListener(v -> {
if (context != null) {
EditTextDialogBuilder builder = new EditTextDialogBuilder(
context, label, getString(R.string.download_labels));
+13 -3
View File
@@ -29,10 +29,20 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:textAppearance="?attr/textAppearanceListItemSmall"
android:textColor="?android:attr/textColorPrimary" />
<ImageView
android:id="@+id/iv_edit"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
android:visibility="gone"
app:srcCompat="@drawable/v_pencil_dark_x24" />
<ImageView
android:id="@+id/iv_option"
android:layout_width="wrap_content"
@@ -40,8 +50,8 @@
android:layout_gravity="center_vertical"
android:clickable="true"
android:focusable="true"
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
android:paddingRight="?attr/listPreferredItemPaddingRight"
android:paddingStart="?attr/listPreferredItemPaddingLeft"
android:paddingEnd="?attr/listPreferredItemPaddingRight"
app:srcCompat="@drawable/ic_baseline_reorder_24" />
</LinearLayout>