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); }