Fix issue #485 - Add a delete icon on items + rename menu item

maths
Thomas 2 years ago
parent 0e8354b0c1
commit d76fcd0f7a

@ -19,6 +19,7 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;
@ -160,7 +161,19 @@ public class ReorderTabAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
}
return false;
});
PinnedTimeline item = pinned.pinnedTimelines.get(position);
if (item.type == Timeline.TimeLineEnum.TAG || item.type == Timeline.TimeLineEnum.REMOTE || item.type == Timeline.TimeLineEnum.LIST) {
holder.binding.delete.setVisibility(View.VISIBLE);
} else {
holder.binding.delete.setVisibility(View.GONE);
}
holder.binding.delete.setOnClickListener(v -> {
if (item.type == Timeline.TimeLineEnum.TAG || item.type == Timeline.TimeLineEnum.REMOTE || item.type == Timeline.TimeLineEnum.LIST) {
mUndoListener.onUndo(item, position);
pinned.pinnedTimelines.remove(position);
notifyItemRemoved(position);
}
});
}
@Override

@ -29,6 +29,7 @@
android:layout_gravity="center_vertical"
android:layout_weight="1" />
<ImageView
android:id="@+id/hide"
android:layout_width="40dp"
@ -39,6 +40,17 @@
android:src="@drawable/ic_baseline_visibility_off_24"
tools:ignore="RtlHardcoded" />
<ImageView
android:id="@+id/delete"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:contentDescription="@string/delete_timeline"
android:scaleType="center"
android:src="@drawable/ic_baseline_delete_24"
android:visibility="gone"
tools:ignore="RtlHardcoded" />
<ImageView
android:id="@+id/handle"
android:layout_width="40dp"

@ -407,7 +407,7 @@
<string name="settings_category_notif_categories">Categories</string>
<string name="move_timeline">Move timeline</string>
<string name="hide_timeline">Hide timeline</string>
<string name="reorder_timelines">Reorder timelines</string>
<string name="reorder_timelines">Manage timelines</string>
<string name="reorder_list_deleted">List permanently deleted</string>
<string name="reorder_instance_removed">Followed instance removed</string>
<string name="reorder_tag_removed">Pinned tag removed</string>
@ -1901,4 +1901,5 @@
<string name="toast_error_add_to_list">The app failed to add the account into the list!</string>
<string name="display_remote_profile">Display remote profile</string>
<string name="toast_fetch_error">The app cannot find remote data!</string>
<string name="delete_timeline">Delete timeline</string>
</resources>
Loading…
Cancel
Save