Support non-libnx NROs

This commit is contained in:
◱ PixelyIon 2019-07-04 02:18:43 +05:30
parent 2bf88e129d
commit 4da7a9cdbc
3 changed files with 12 additions and 5 deletions

View File

@ -25,10 +25,13 @@ class GameItem {
int index;
public GameItem(File file) {
public GameItem(File file, Context ctx) {
this.file = file;
index = file.getName().lastIndexOf(".");
meta = NroMeta.getTitleEntry(getPath());
if(meta==null) {
meta = new TitleEntry(file.getName(), ctx.getString(R.string.aset_missing), null);
}
}
public Bitmap getIcon() {
@ -39,7 +42,7 @@ class GameItem {
return meta.getName() + " (" + getType() + ")";
}
public String getAuthor() {
public String getSubTitle() {
return meta.getAuthor();
}
@ -93,8 +96,11 @@ public class FileAdapter extends ArrayAdapter<GameItem> implements View.OnClickL
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.txtTitle.setText(dataModel.getTitle());
viewHolder.txtSub.setText(dataModel.getAuthor());
viewHolder.icon.setImageBitmap(dataModel.getIcon());
viewHolder.txtSub.setText(dataModel.getSubTitle());
Bitmap icon = dataModel.getIcon();
if(icon!=null) {
viewHolder.icon.setImageBitmap(icon);
}
viewHolder.icon.setOnClickListener(this);
viewHolder.icon.setTag(position);
return convertView;

View File

@ -67,7 +67,7 @@ public class MainActivity extends AppCompatActivity {
adapter.clear();
List<File> files = findFile("nro", new File(sharedPreferences.getString("search_location", "")), null);
for (File file : files) {
adapter.add(new GameItem(file));
adapter.add(new GameItem(file, getApplicationContext()));
}
}

View File

@ -6,6 +6,7 @@
<!-- Main -->
<string name="refresh_string">The list of ROMs has been refreshed.</string>
<string name="launch_string">Launching</string>
<string name="aset_missing">ASET Header Missing</string>
<string name="icon">Icon</string>
<!-- Settings -->
<string name="search">Search</string>