Skip to content

Commit

Permalink
I said nothing
Browse files Browse the repository at this point in the history
  • Loading branch information
8192Bit committed Feb 19, 2024
2 parents 7efc073 + 4572c1f commit f9233da
Show file tree
Hide file tree
Showing 83 changed files with 2,225 additions and 839 deletions.
10 changes: 10 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 12 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ java {
}

android {
compileSdk 33
compileSdk 34

sourceSets {
main {
jniLibs.srcDirs = ['src/main/cpp/fluidsynth/lib']
}
}


defaultConfig {
applicationId "com.x8192Bit.DIYEdit_Mobile"
minSdk 16
targetSdk 33
minSdk 14
targetSdk 34
versionCode 1
versionName '1.0.0'
multiDexEnabled true
vectorDrawables.useSupportLibrary = true

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
externalNativeBuild {
cmake {
cppFlags ''
Expand All @@ -48,6 +48,7 @@ android {
}
buildFeatures {
viewBinding true
buildConfig true
}
namespace 'x8192Bit.DIYEdit_Mobile'
lint {
Expand All @@ -70,19 +71,21 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.android.material:material:1.9.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.test.ext:junit:1.1.5'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation "androidx.multidex:multidex:2.0.1"
implementation 'com.github.mendhak:storage-chooser:1715784d34'
implementation 'net.danlew:android.joda:2.12.5'
implementation 'jp.kshoji:jfugue-android:4.0.3:@aar'
implementation files('libs/javax-sound-midi-0.0.4.aar')
implementation 'androidx.navigation:navigation-fragment:2.7.7'
implementation 'androidx.navigation:navigation-ui:2.7.7'
implementation 'androidx.navigation:navigation-runtime:2.7.7'

testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
Expand Down
16 changes: 12 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@

<dist:module dist:instant="true" />

<uses-permission
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<!-- support as more devices as possible -->
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" /> <!-- support as more devices as possible -->
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
tools:node="merge" />
Expand All @@ -27,6 +24,15 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.DIYEdit">
<activity
android:name="com.x8192Bit.DIYEdit_Mobile.FileChooseActivity"
android:exported="false"
android:label="@string/title_activity_file_choose">
<intent-filter>
<action android:name="com.x8192Bit.DIYEdit_Mobile.OPEN_FILECHOOSE_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.x8192Bit.DIYEdit_Mobile.AboutActivity"
android:exported="false" />
Expand All @@ -43,10 +49,12 @@
android:launchMode="singleTop">
<intent-filter>
<category android:name="android.intent.category.LAUNCHER" />

<action android:name="android.intent.action.MAIN" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />

<data android:scheme="content" />
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/cpp/midi-interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
extern "C" {

JNIEXPORT void JNICALL
Java_com_x8192Bit_DIYEdit_1Mobile_Fragments_PlayThread_PlayMIDIFile(JNIEnv *env, jobject,
Java_com_x8192Bit_DIYEdit_1Mobile_fragments_PlayThread_PlayMIDIFile(JNIEnv *env, jobject,
jstring MIDIFilePath,
jstring SoundFontFilePath) {
fluid_settings_t *settings;
Expand All @@ -32,6 +32,4 @@ Java_com_x8192Bit_DIYEdit_1Mobile_Fragments_PlayThread_PlayMIDIFile(JNIEnv *env,
delete_fluid_synth(synth);
delete_fluid_settings(settings);
}


}
Binary file modified app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ protected void onCreate(Bundle savedInstanceState) {
findViewById(R.id.AboutButton).setOnClickListener(this::OnAboutButtonClicked);
findViewById(R.id.LicenseButton).setOnClickListener(this::OnLicenseButtonClicked);
OnAboutButtonClicked(null);
TextView tv = findViewById(R.id.InformationTextView);
tv.setText(getString(R.string.aboutTextKey).replace("\\n", "\n"));
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
this.finish();
overridePendingTransition(0, 0);
return true;
}
return super.onOptionsItemSelected(item);
Expand Down
180 changes: 180 additions & 0 deletions app/src/main/java/com/x8192Bit/DIYEdit_Mobile/FileChooseActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
package com.x8192Bit.DIYEdit_Mobile;

import static com.x8192Bit.DIYEdit_Mobile.MainActivity.CHOOSE_RESULT;
import static com.x8192Bit.DIYEdit_Mobile.fragments.SaveEditFragment.IS_IMPORT_MIO;
import static com.x8192Bit.DIYEdit_Mobile.fragments.SaveEditFragment.IS_SAVE_EDIT;
import static com.x8192Bit.DIYEdit_Mobile.fragments.SaveEditFragment.SAVE_EDIT_COUNT;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Environment;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import x8192Bit.DIYEdit_Mobile.R;


public class FileChooseActivity extends AppCompatActivity {

public static final int CHOOSE_FILE = 0;
public static final int CHOOSE_DIRECTORY = 1;
File CurrentPath = null;
private int chooseType = CHOOSE_FILE;
private boolean isImportMIO;
private boolean isSaveEdit;
private int saveEditCount;
private boolean isTimeSorted;

//TODO UPDATE!!!!!!!!!!!!!!!!!!!!!!!!FUK LISTVIEW
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_file_choose);

Intent intent = getIntent();
chooseType = intent.getIntExtra(MainActivity.CHOOSE_TYPE, CHOOSE_FILE);

Button directoryButton = findViewById(R.id.fileChooseButton);

if (chooseType == CHOOSE_FILE) {
((LinearLayout) findViewById(R.id.fileChooseLayout)).removeView(directoryButton);
} else {
directoryButton.setOnClickListener(v -> {
try {
Intent intentResult = new Intent();
String path = CurrentPath.getAbsolutePath();
intentResult.putExtra(CHOOSE_RESULT, path);
intentResult.putExtra(IS_SAVE_EDIT, isSaveEdit);
if (isSaveEdit) {
intentResult.putExtra(IS_IMPORT_MIO, isImportMIO);
intentResult.putExtra(SAVE_EDIT_COUNT, saveEditCount);
}
setResult(1919810, intentResult);
finish();
} catch (Exception e) {
new AlertDialog.Builder(FileChooseActivity.this)
.setTitle("What the fuck????!!")
.setMessage("GO FUCK YOURSELF!!!!!!!!!!!!!!!!!11").show();
}
});
}
isSaveEdit = intent.getBooleanExtra(IS_SAVE_EDIT, false);
if (isSaveEdit) {
isImportMIO = intent.getBooleanExtra(IS_IMPORT_MIO, false);
saveEditCount = intent.getIntExtra(SAVE_EDIT_COUNT, 0);
}

ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
}

CurrentPath = Environment.getExternalStorageDirectory();

refreshList(getApplicationContext());

ListView fileChooser = findViewById(R.id.fileChooseView);
SharedPreferences sp = this.getSharedPreferences("com.x8192Bit.DIYEdit_Mobile_preferences", MODE_PRIVATE);

isTimeSorted = sp.getBoolean("isTimeOrdered", false);


fileChooser.setOnItemClickListener((adapterView, view, i, l) -> {
File originalPath = CurrentPath;
try {
String path = (String) (((TextView) ((LinearLayout) view).getChildAt(1))).getText();
if (path.equals("..")) {
CurrentPath = CurrentPath.getParentFile();
} else {
CurrentPath = new File(CurrentPath.getAbsolutePath() + '/' + path);
if (CurrentPath.isFile() && chooseType == CHOOSE_FILE) {
Intent intentResult = new Intent();
intentResult.putExtra(CHOOSE_RESULT, CurrentPath.getAbsolutePath());
intentResult.putExtra(IS_SAVE_EDIT, isSaveEdit);
if (isSaveEdit) {
intentResult.putExtra(IS_IMPORT_MIO, isImportMIO);
intentResult.putExtra(SAVE_EDIT_COUNT, saveEditCount);
}
setResult(1919810, intentResult);
finish();
}
}
refreshList(getApplicationContext());
} catch (NullPointerException e) {
CurrentPath = originalPath;
} catch (Exception e) {
new AlertDialog.Builder(FileChooseActivity.this)
.setTitle("What the fuck????!!")
.setMessage("GO FUCK YOURSELF!!!!!!!!!!!!!!!!!11").show();
CurrentPath = originalPath;
}
});
}

public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
this.finish();
return true;
}
return super.onOptionsItemSelected(item);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
int sortType = isTimeSorted ? R.string.timeSortededKey : R.string.nameSortededKey;
menu.add(0, 0, 0, sortType);
menu.add(0, 0, 0, R.string.reverseOrderKey);
return super.onCreateOptionsMenu(menu);
}

public void refreshList(Context c) {
ListView fileChooser = findViewById(R.id.fileChooseView);
TextView PathView = findViewById(R.id.fileChooseTextView);
String[] from = {"img", "text"};
int[] to = {R.id.FileChooseItemImageView, R.id.FileChooseItemTextView};
ArrayList<Map<String, Object>> files = new ArrayList<>();
HashMap<String, Object> parentFolder = new HashMap<>();
parentFolder.put("img", R.drawable.exit);
parentFolder.put("text", "..");
files.add(parentFolder);
for (File f : Objects.requireNonNull(CurrentPath.listFiles())) {
HashMap<String, Object> file = new HashMap<>();
if (f.isFile()) {
String splited[] = f.getName().split("\\.");
if (f.getName().equals("MDATA") || f.getName().equals("GDATA") || f.getName().equals("RDATA")) {
file.put("img", R.drawable.save_wii);
} else if (splited.length > 1 && (splited[splited.length - 1].equals("sav") || splited[splited.length - 1].equals("dsv"))) {
file.put("img", R.drawable.save_ds);
} else if (splited.length > 1 && splited[splited.length - 1].equals("mio")) {
file.put("img", R.mipmap.ic_launcher_foreground);
} else {
file.put("img", R.drawable.baseline_file_open_24);
}
} else if (f.isDirectory()) {
file.put("img", R.drawable.directory);
}
file.put("text", f.getName());
files.add(file);
}
fileChooser.setAdapter(new SimpleAdapter(c, files, R.layout.filechoose_item_layout, from, to));
PathView.setText(CurrentPath.getAbsolutePath());
}
}
Loading

0 comments on commit f9233da

Please sign in to comment.