Skip to content

Commit

Permalink
add copy all file to ClipBoard to using texturs.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
appt2 committed May 18, 2024
1 parent 68e2852 commit cd584a6
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 33 deletions.
28 changes: 14 additions & 14 deletions .androidide/editor/openedFiles.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
{
"allFiles": [
{
"file": "/storage/emulated/0/AndroidIDEProjects/Psp tools/app/src/main/java/ir/ninjacoder/psptools/rewinter/adapters/FileListAdapter.java",
"file": "/storage/emulated/0/AndroidIDEProjects/Psp tools/app/src/main/java/ir/ninjacoder/psptools/rewinter/App.java",
"selection": {
"end": {
"column": 4,
"index": 3479,
"line": 106
"column": 34,
"index": 409,
"line": 12
},
"start": {
"column": 4,
"index": 3479,
"line": 106
"column": 34,
"index": 409,
"line": 12
}
}
},
{
"file": "/storage/emulated/0/AndroidIDEProjects/Psp tools/app/src/main/java/ir/ninjacoder/psptools/rewinter/MainActivity.java",
"file": "/storage/emulated/0/AndroidIDEProjects/Psp tools/app/src/main/java/ir/ninjacoder/psptools/rewinter/adapters/FileListAdapter.java",
"selection": {
"end": {
"column": 8,
"index": 10229,
"line": 281
"column": 38,
"index": 2621,
"line": 72
},
"start": {
"column": 8,
"index": 10229,
"line": 281
"column": 38,
"index": 2621,
"line": 72
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/ir/ninjacoder/psptools/rewinter/App.java
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
package ir.ninjacoder.psptools.rewinter;

import android.app.Application;
import android.content.Context;
import com.google.android.material.color.MaterialColorUtilitiesHelper;
import com.google.android.material.shape.CornerFamily;
import ir.ninjacoder.psptools.rewinter.utils.MatetialColorUtils;

public class App extends Application {

protected static Context ctx;

public static Context getContext(){
return ctx;
}

@Override
public void onCreate() {
super.onCreate();
// TODO: Implement this method
MatetialColorUtils.setMaterialColors(this);


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ protected void onCreate(Bundle savedInstanceState) {
onBack();
listCh();
tests();



binding.fb.setOnClickListener(
x -> {
ItemRuner runer = new ItemRuner(this);
Expand Down Expand Up @@ -155,10 +156,10 @@ void reloadFile(String path) {
manger = new GridLayoutManager(this, 2);
runOnUiThread(
() -> {
binding.rv.setAdapter(filelist);
binding.rv.setLayoutManager(manger);
var itemAnimator = new ZoomItemAnimator();
itemAnimator.setup(binding.rv);
binding.rv.setAdapter(filelist);
binding.rv.setLayoutManager(manger);
showPrograss(false);
});
})
Expand All @@ -172,12 +173,8 @@ void reloadFile(String path) {
new OnTreeViewClick() {

@Override
public void onTree(File file, int pos) {
if (file != null && !file.getAbsolutePath().equals(path)) {
reloadFile(file.getParent());
} else {
finishAffinity();
}
public void onTree(File files, int pos) {
onBack();
}
}));
binding.barLayout.smoothScrollToPosition(ma.size());
Expand Down Expand Up @@ -259,7 +256,7 @@ public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) {
int position = viewHolder.getAdapterPosition();
ViewPropertyAnimator animator = viewHolder.itemView.animate();
animator.translationYBy(1000).setDuration(1000).start();
filelist.removeItemWithAnimation(position,file);
filelist.removeItemWithAnimation(position, file);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
package ir.ninjacoder.psptools.rewinter.adapters;

import android.animation.ValueAnimator;
import android.graphics.Color;
import android.widget.Toast;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import android.view.LayoutInflater;
import android.view.View;
import com.blankj.utilcode.util.ClipboardUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.ThreadUtils;
import com.bluewhaleyt.materialfileicon.core.FileIconHelper;
import com.bumptech.glide.Glide;
import ir.ninjacoder.psptools.rewinter.App;
import ir.ninjacoder.psptools.rewinter.R;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import ir.ninjacoder.psptools.rewinter.databinding.FilelistBinding;
import ir.ninjacoder.psptools.rewinter.interfaces.OnItemClick;
import ir.ninjacoder.psptools.rewinter.utils.IsoFileFinder;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.stream.Collectors;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class FileListAdapter extends RecyclerView.Adapter<FileListAdapter.Holder> {
Expand Down Expand Up @@ -70,6 +69,10 @@ public void onBindViewHolder(Holder holder, int pos) {
.placeholder(R.drawable.ic_launcher_foreground)
.into(holder.icon);
}
holder.itemView.setOnLongClickListener(v ->{
copyFileNamesToClipboard(listFile);
return false;
});
holder.name.setText(files.getName());
if (!files.isDirectory()) {
setHolder(holder.sub, files);
Expand Down Expand Up @@ -104,7 +107,7 @@ public int getItemCount() {
}

public void removeItemWithAnimation(int pos, File file) {
notifyItemRemoved(pos);
notifyItemRemoved(pos);
}

class Holder extends RecyclerView.ViewHolder {
Expand Down Expand Up @@ -181,4 +184,17 @@ public void onFail(Throwable ss) {
}
});
}

private void copyFileNamesToClipboardFromPsp(List<File> listFile) {
StringBuilder fileNamesBuilder = new StringBuilder();
for (File file : listFile) {
if (file.isDirectory()) {
continue;
}
fileNamesBuilder.append(file.getName()).append("\n");
}
String fileNames = fileNamesBuilder.toString();
ClipboardUtils.copyText(fileNames + " = " + fileNames );
Toast.makeText(App.getContext(),"All File copyed using from Texturs.ini!",2).show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,21 @@ public void onBindViewHolder(Holder holder, int pos) {

holder.name.setText(files.getName());
holder.name.setAlpha(files.isHidden() ? 0.5f : 1f);

if (pos == 0) {
holder.icon.setVisibility(View.VISIBLE);
holder.name.setTextColor(Color.BLUE);
}

if (click instanceof OnTreeViewClick) {
holder.itemView.setOnClickListener(
new View.OnClickListener() {

@Override
public void onClick(View arg0) {
click.onTree(files,holder.getAdapterPosition());
}
});
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public static boolean searchForIsoFiles(File directory) {
}
} else {
if (file.getName().endsWith(".iso")) {
Log.d("JarFileFinder", "🎉 Found a .jar file: " + file.getAbsolutePath());
jarFileFound = true;
}
}
Expand Down

0 comments on commit cd584a6

Please sign in to comment.