Display detailed undo messages

This commit is contained in:
Kasun 2019-05-10 01:25:08 +05:30
parent aa7d4ab054
commit e55bf64bf0
3 changed files with 31 additions and 0 deletions

View File

@ -95,6 +95,7 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
public static boolean updated;
private ItemTouchHelper touchHelper;
private RelativeLayout undo_container;
private TextView undo_message;
private TextView undo_action;
private List<ManageTimelines> timelines;
private ReorderTabAdapter adapter;
@ -354,6 +355,7 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
new SimpleItemTouchHelperCallback(adapter);
touchHelper = new ItemTouchHelper(callback);
touchHelper.attachToRecyclerView(lv_reorder_tabs);
undo_message = findViewById(R.id.undo_message);
undo_action = findViewById(R.id.undo_action);
undo_container = findViewById(R.id.undo_container);
lv_reorder_tabs.setAdapter(adapter);
@ -370,6 +372,17 @@ public class ReorderTimelinesActivity extends BaseActivity implements OnStartDra
@Override
public void onUndo(ManageTimelines manageTimelines, int position) {
undo_container.setVisibility(View.VISIBLE);
switch (manageTimelines.getType()){
case TAG:
undo_message.setText(R.string.reorder_tag_removed);
break;
case INSTANCE:
undo_message.setText(R.string.reorder_instance_removed);
break;
case LIST:
undo_message.setText(R.string.reorder_list_deleted);
break;
}
undo_action.setPaintFlags(undo_action.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
actionCanBeApplied = true;
undo_action.setOnClickListener(new View.OnClickListener() {

View File

@ -36,6 +36,21 @@
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0dp">
<TextView
android:id="@+id/undo_message"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:textColor="@color/mastodonC4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_alignParentLeft="true" />
<TextView
android:id="@+id/undo_action"
android:paddingLeft="20dp"

View File

@ -933,6 +933,9 @@
<string name="move_timeline">Move timeline</string>
<string name="hide_timeline">Hide timeline</string>
<string name="reorder_timelines">Reorder 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>
<string name="undo">Undo</string>
<string name="visible_tabs_needed">You need to keep two visible tabs!</string>
<string name="action_reorder_timeline">Reorder timelines</string>