diff --git a/app/src/main/java/rocks/tbog/tblauncher/entry/EntryItem.java b/app/src/main/java/rocks/tbog/tblauncher/entry/EntryItem.java
index 9b461153e..189df04b8 100644
--- a/app/src/main/java/rocks/tbog/tblauncher/entry/EntryItem.java
+++ b/app/src/main/java/rocks/tbog/tblauncher/entry/EntryItem.java
@@ -2,6 +2,7 @@
import android.content.Context;
import android.view.View;
+import android.widget.Toast;
import androidx.annotation.CallSuper;
import androidx.annotation.LayoutRes;
@@ -20,6 +21,7 @@
import rocks.tbog.tblauncher.result.ResultHelper;
import rocks.tbog.tblauncher.ui.LinearAdapter;
import rocks.tbog.tblauncher.ui.ListPopup;
+import rocks.tbog.tblauncher.utils.ClipboardUtils;
import rocks.tbog.tblauncher.utils.DebugInfo;
import rocks.tbog.tblauncher.utils.FuzzyScore;
import rocks.tbog.tblauncher.utils.Utilities;
@@ -273,27 +275,31 @@ ListPopup inflatePopupMenu(@NonNull Context context, @NonNull LinearAdapter adap
}
if (DebugInfo.itemRelevance(context)) {
- String debugTitle = context.getString(R.string.popup_title_debug);
- int pos = -1;
- // find title
- for (int i = 0; i < adapter.getCount(); i += 1) {
- if (debugTitle.equals(adapter.getItem(i).toString())) {
- pos = i + 1;
- break;
- }
- }
- // if title not found, add title
- if (pos == -1) {
- adapter.add(new LinearAdapter.ItemTitle(debugTitle));
- pos = adapter.getCount();
- }
- // add debug data after title
+ int pos = addDebugTitleOnce(context, adapter);
adapter.add(pos, new LinearAdapter.ItemString("Relevance: " + getRelevance()));
}
+ if (DebugInfo.itemShowId(context)) {
+ int pos = addDebugTitleOnce(context, adapter);
+ adapter.add(pos, new LinearAdapter.ItemString(id));
+ }
+
return menu;
}
+ int addDebugTitleOnce(@NonNull Context context, @NonNull LinearAdapter adapter) {
+ String debugTitle = context.getString(R.string.popup_title_debug);
+ // find title
+ for (int i = 0; i < adapter.getCount(); i += 1) {
+ if (debugTitle.equals(adapter.getItem(i).toString())) {
+ return i + 1;
+ }
+ }
+ // if title not found, add title
+ adapter.add(new LinearAdapter.ItemTitle(debugTitle));
+ return adapter.getCount();
+ }
+
/**
* How to display the popup menu
*
@@ -343,6 +349,10 @@ boolean popupMenuClickHandler(@NonNull View view, @NonNull LinearAdapter.MenuIte
} else if (R.string.menu_popup_quick_list_customize == stringId) {
TBApplication.behaviour(context).launchEditQuickListDialog(context);
return true;
+ } else if (id.equals(item.toString())) {
+ ClipboardUtils.setClipboard(context, id);
+ Toast.makeText(context, context.getString(R.string.copy_confirmation, id), Toast.LENGTH_SHORT).show();
+ return true;
}
// FullscreenActivity mainActivity = (FullscreenActivity) context;
diff --git a/app/src/main/java/rocks/tbog/tblauncher/utils/DebugInfo.java b/app/src/main/java/rocks/tbog/tblauncher/utils/DebugInfo.java
index 751894982..824940098 100644
--- a/app/src/main/java/rocks/tbog/tblauncher/utils/DebugInfo.java
+++ b/app/src/main/java/rocks/tbog/tblauncher/utils/DebugInfo.java
@@ -41,4 +41,9 @@ public static boolean itemIconInfo(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
return prefs.getBoolean("debug-item-icon-info", false);
}
+
+ public static boolean itemShowId(Context context) {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
+ return prefs.getBoolean("debug-item-id", false);
+ }
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index f9f7dd94a..f6f7aa0c7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -216,6 +216,7 @@
Long press for extra widget info
Search relevance
Icon info
+ Show item id
Shortcut
Auto-confirm shortcut
Show app badge
diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml
index 3994f7338..0ad9c253a 100644
--- a/app/src/main/res/xml/preferences.xml
+++ b/app/src/main/res/xml/preferences.xml
@@ -1159,6 +1159,11 @@
android:key="debug-item-icon-info"
android:title="@string/debug_item_icon_info" />
+
+