Make necessary modifications to Java_GCAdapter for permissions request

This commit is contained in:
sigmabeta 2016-01-30 10:10:15 -05:00
parent 6115d39a7a
commit bc03bbccf1
3 changed files with 9 additions and 10 deletions

View File

@ -19,7 +19,7 @@ import org.dolphinemu.dolphinemu.utils.Log;
*/
public final class NativeLibrary
{
private static EmulationActivity mEmulationActivity;
public static EmulationActivity sEmulationActivity;
/**
* Button type for use in onTouchEvent
@ -403,12 +403,12 @@ public final class NativeLibrary
public static void displayAlertMsg(final String alert)
{
Log.error("[NativeLibrary] Alert: " + alert);
mEmulationActivity.runOnUiThread(new Runnable()
sEmulationActivity.runOnUiThread(new Runnable()
{
@Override
public void run()
{
Toast.makeText(mEmulationActivity, "Panic Alert: " + alert, Toast.LENGTH_LONG).show();
Toast.makeText(sEmulationActivity, "Panic Alert: " + alert, Toast.LENGTH_LONG).show();
}
});
}
@ -416,12 +416,12 @@ public final class NativeLibrary
public static void endEmulationActivity()
{
Log.verbose("[NativeLibrary]Ending EmulationActivity.");
mEmulationActivity.exitWithAnimation();
sEmulationActivity.exitWithAnimation();
}
public static void setEmulationActivity(EmulationActivity emulationActivity)
{
Log.verbose("[NativeLibrary]Registering EmulationActivity.");
mEmulationActivity = emulationActivity;
sEmulationActivity = emulationActivity;
}
}

View File

@ -118,7 +118,7 @@ public final class EmulationActivity extends AppCompatActivity
setTheme(themeId);
super.onCreate(savedInstanceState);
Java_GCAdapter.our_activity = this;
Java_GCAdapter.manager = (UsbManager) getSystemService(Context.USB_SERVICE);
// Picasso will take a while to load these big-ass screenshots. So don't run

View File

@ -1,8 +1,6 @@
package org.dolphinemu.dolphinemu.utils;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.hardware.usb.UsbConfiguration;
import android.hardware.usb.UsbConstants;
@ -12,6 +10,7 @@ import android.hardware.usb.UsbEndpoint;
import android.hardware.usb.UsbInterface;
import android.hardware.usb.UsbManager;
import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.services.USBPermService;
import java.util.HashMap;
@ -39,8 +38,8 @@ public class Java_GCAdapter {
{
Intent intent = new Intent();
PendingIntent pend_intent;
intent.setClass(our_activity, USBPermService.class);
pend_intent = PendingIntent.getService(our_activity, 0, intent, 0);
intent.setClass(NativeLibrary.sEmulationActivity, USBPermService.class);
pend_intent = PendingIntent.getService(NativeLibrary.sEmulationActivity, 0, intent, 0);
manager.requestPermission(dev, pend_intent);
}
}