Skip to content

Commit

Permalink
show path
Browse files Browse the repository at this point in the history
  • Loading branch information
SlaVcE14 committed Nov 4, 2023
1 parent 8829c04 commit 0599bc2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/com/sjapps/adapters/ListAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/com/sjapps/jsonlist/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 0599bc2

Please sign in to comment.