From 0599bc27e581d289ac436640da7c6fd620b9ad34 Mon Sep 17 00:00:00 2001 From: SlaVcE <102253539+SlaVcE14@users.noreply.github.com> Date: Sat, 4 Nov 2023 23:02:52 +0100 Subject: [PATCH] show path --- app/src/main/java/com/sjapps/adapters/ListAdapter.java | 4 +++- app/src/main/java/com/sjapps/jsonlist/MainActivity.java | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/sjapps/adapters/ListAdapter.java b/app/src/main/java/com/sjapps/adapters/ListAdapter.java index e6e15e0..da9ea4b 100644 --- a/app/src/main/java/com/sjapps/adapters/ListAdapter.java +++ b/app/src/main/java/com/sjapps/adapters/ListAdapter.java @@ -10,6 +10,7 @@ import android.widget.TextView; import android.widget.Toast; +import com.sjapps.jsonlist.java.JsonData; import com.sjapps.jsonlist.java.ListItem; import com.sjapps.jsonlist.MainActivity; import com.sjapps.jsonlist.R; @@ -75,7 +76,8 @@ public View getView(int position, View convertView, ViewGroup parent) { if (selectedItem == position){ view.findViewById(R.id.copyBtn).setVisibility(View.VISIBLE); } - view.findViewById(R.id.btn).setOnClickListener(view1 -> activity.open(item.getName(),path + (path.equals("") ? "": "///" + (item.getId()!=-1?"{" + item.getId() + "}":"")) + item.getName())); + String newPath = path + (path.equals("") ? "": "///" + (item.getId()!=-1?"{" + item.getId() + "}":"")) + item.getName(); + view.findViewById(R.id.btn).setOnClickListener(view1 -> activity.open(JsonData.getPathFormat(newPath),newPath)); view.findViewById(R.id.copyBtn).setOnClickListener(v -> { ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); ClipData clipData = ClipData.newPlainText("Text",item.getName()); diff --git a/app/src/main/java/com/sjapps/jsonlist/MainActivity.java b/app/src/main/java/com/sjapps/jsonlist/MainActivity.java index 9002641..c00f397 100644 --- a/app/src/main/java/com/sjapps/jsonlist/MainActivity.java +++ b/app/src/main/java/com/sjapps/jsonlist/MainActivity.java @@ -141,8 +141,7 @@ public void handleOnBackPressed() { data.goBack(); - String[] pathString = data.splitPath(); - open(JsonData.getName(pathString[pathString.length-1]), data.getPath()); + open(JsonData.getPathFormat(data.getPath()), data.getPath()); if (data.isEmptyPath()) { backBtn.setVisibility(View.GONE); }