Merge pull request #1252 from reicast/lk/android-studio
Android: Fix buttons being transparent
This commit is contained in:
commit
8d4f8597ef
|
@ -176,7 +176,7 @@ public class FileBrowser extends Fragment {
|
|||
if (!home.exists() || !home.isDirectory()) {
|
||||
showToastMessage(getActivity().getString(R.string.config_home), Snackbar.LENGTH_LONG);
|
||||
} else {
|
||||
(new installGraphics()).execute();
|
||||
installButtons();
|
||||
}
|
||||
|
||||
if (!ImgBrowse && !games) {
|
||||
|
@ -186,47 +186,37 @@ public class FileBrowser extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private class installGraphics extends AsyncTask<String, Integer, String> {
|
||||
@Override
|
||||
protected String doInBackground(String... params) {
|
||||
try {
|
||||
File buttons = null;
|
||||
String theme = mPrefs.getString(Config.pref_theme, null);
|
||||
if (theme != null) {
|
||||
buttons = new File(theme);
|
||||
}
|
||||
File file = new File(home_directory, "data/buttons.png");
|
||||
if (buttons != null && buttons.exists()) {
|
||||
InputStream in = new FileInputStream(buttons);
|
||||
OutputStream out = new FileOutputStream(file);
|
||||
|
||||
// Transfer bytes from in to out
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
} else if (!file.exists()) {
|
||||
org.apache.commons.io.FileUtils.touch(file);
|
||||
InputStream png = getActivity().getAssets().open("buttons.png");
|
||||
OutputStream fo = new FileOutputStream(file);
|
||||
byte[] buffer = new byte[4096];
|
||||
int read;
|
||||
while ((read = png.read(buffer)) != -1) {
|
||||
fo.write(buffer, 0, read);
|
||||
}
|
||||
png.close();
|
||||
fo.flush();
|
||||
fo.close();
|
||||
}
|
||||
} catch (FileNotFoundException fnf) {
|
||||
fnf.printStackTrace();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
private void installButtons() {
|
||||
try {
|
||||
File buttons = null;
|
||||
String theme = mPrefs.getString(Config.pref_theme, null);
|
||||
if (theme != null) {
|
||||
buttons = new File(theme);
|
||||
}
|
||||
return null;
|
||||
File file = new File(home_directory, "data/buttons.png");
|
||||
InputStream in = null;
|
||||
if (buttons != null && buttons.exists()) {
|
||||
in = new FileInputStream(buttons);
|
||||
} else if (!file.exists() || file.length() == 0) {
|
||||
in = getActivity().getAssets().open("buttons.png");
|
||||
}
|
||||
if (in != null) {
|
||||
OutputStream out = new FileOutputStream(file);
|
||||
|
||||
// Transfer bytes from in to out
|
||||
byte[] buf = new byte[4096];
|
||||
int len;
|
||||
while ((len = in.read(buf)) != -1) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
in.close();
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
} catch (FileNotFoundException fnf) {
|
||||
fnf.printStackTrace();
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ public final class JNIdc
|
|||
public static native void config(String dirName);
|
||||
public static native void init(String fileName);
|
||||
public static native void run(Object track);
|
||||
public static native void stop();
|
||||
public static native void terminate();
|
||||
|
||||
public static native int send(int cmd, int opt);
|
||||
|
|
|
@ -25,6 +25,7 @@ extern "C"
|
|||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_config(JNIEnv *env,jobject obj,jstring dirName) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_init(JNIEnv *env,jobject obj,jstring fileName) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_run(JNIEnv *env,jobject obj,jobject emu_thread) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_stop(JNIEnv *env,jobject obj) __attribute__((visibility("default")));
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_terminate(JNIEnv *env,jobject obj) __attribute__((visibility("default")));
|
||||
|
||||
JNIEXPORT jint JNICALL Java_com_reicast_emulator_emu_JNIdc_send(JNIEnv *env,jobject obj,jint id, jint v) __attribute__((visibility("default")));
|
||||
|
@ -158,6 +159,7 @@ void egl_stealcntx();
|
|||
void SetApplicationPath(wchar *path);
|
||||
int dc_init(int argc,wchar* argv[]);
|
||||
void dc_run();
|
||||
//void dc_stop();
|
||||
void dc_term();
|
||||
void mcfg_Create(MapleDeviceType type,u32 bus,u32 port);
|
||||
|
||||
|
@ -368,6 +370,11 @@ JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_setupVmu(JNIEnv *env,
|
|||
//jpix=env->NewByteArray(1536);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_stop(JNIEnv *env,jobject obj)
|
||||
{
|
||||
// dc_stop();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_terminate(JNIEnv *env,jobject obj)
|
||||
{
|
||||
dc_term();
|
||||
|
|
Loading…
Reference in New Issue