mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 16:20:27 +00:00
(Android) Make common RetroActivityCommon that both RetroActivityFuture and
RetroActivityPast extend from
This commit is contained in:
parent
c8d6ce4587
commit
b86a2c92e6
@ -0,0 +1,77 @@
|
||||
package com.retroarch.browser;
|
||||
|
||||
import com.retroarch.browser.mainmenu.MainMenuActivity;
|
||||
import com.retroarch.browser.preferences.util.UserPreferences;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
public class RetroActivityCommon extends NativeActivity {
|
||||
private Intent pendingIntent = null;
|
||||
@Override
|
||||
public void onDestroy()
|
||||
{
|
||||
UserPreferences.readbackConfigFile(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent)
|
||||
{
|
||||
Log.i("RetroActivity", "onNewIntent invoked.");
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
pendingIntent = intent;
|
||||
}
|
||||
|
||||
public String getPendingIntentFullPath()
|
||||
{
|
||||
return pendingIntent.getStringExtra("ROM");
|
||||
}
|
||||
|
||||
public String getPendingIntentLibretroPath()
|
||||
{
|
||||
return pendingIntent.getStringExtra("LIBRETRO");
|
||||
}
|
||||
|
||||
public String getPendingIntentConfigPath()
|
||||
{
|
||||
return pendingIntent.getStringExtra("CONFIGFILE");
|
||||
}
|
||||
|
||||
public String getPendingIntentIME()
|
||||
{
|
||||
return pendingIntent.getStringExtra("IME");
|
||||
}
|
||||
|
||||
public boolean hasPendingIntent()
|
||||
{
|
||||
if (pendingIntent == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void clearPendingIntent()
|
||||
{
|
||||
pendingIntent = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
Log.i("RetroActivity", "onBackKeyPressed");
|
||||
Intent retro = new Intent(this, MainMenuActivity.class);
|
||||
retro.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
startActivity(retro);
|
||||
}
|
||||
}
|
@ -2,12 +2,7 @@ package com.retroarch.browser;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.retroarch.browser.mainmenu.MainMenuActivity;
|
||||
import com.retroarch.browser.preferences.util.UserPreferences;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.SurfaceTexture;
|
||||
import android.graphics.SurfaceTexture.OnFrameAvailableListener;
|
||||
import android.hardware.Camera;
|
||||
@ -17,13 +12,12 @@ import android.util.Log;
|
||||
//For Android 3.0 and up
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public final class RetroActivityFuture extends NativeActivity
|
||||
public final class RetroActivityFuture extends RetroActivityCommon
|
||||
{
|
||||
private Camera mCamera;
|
||||
private long lastTimestamp = 0;
|
||||
private SurfaceTexture texture;
|
||||
private boolean updateSurface = true;
|
||||
private Intent pendingIntent = null;
|
||||
|
||||
public void onCameraStart()
|
||||
{
|
||||
@ -96,69 +90,5 @@ public final class RetroActivityFuture extends NativeActivity
|
||||
mCamera.setPreviewTexture(texture);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy()
|
||||
{
|
||||
UserPreferences.readbackConfigFile(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent)
|
||||
{
|
||||
Log.i("RetroActivity", "onNewIntent invoked.");
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
pendingIntent = intent;
|
||||
}
|
||||
|
||||
public String getPendingIntentFullPath()
|
||||
{
|
||||
return pendingIntent.getStringExtra("ROM");
|
||||
}
|
||||
|
||||
public String getPendingIntentLibretroPath()
|
||||
{
|
||||
return pendingIntent.getStringExtra("LIBRETRO");
|
||||
}
|
||||
|
||||
public String getPendingIntentConfigPath()
|
||||
{
|
||||
return pendingIntent.getStringExtra("CONFIGFILE");
|
||||
}
|
||||
|
||||
public String getPendingIntentIME()
|
||||
{
|
||||
return pendingIntent.getStringExtra("IME");
|
||||
}
|
||||
|
||||
public boolean hasPendingIntent()
|
||||
{
|
||||
if (pendingIntent == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void clearPendingIntent()
|
||||
{
|
||||
pendingIntent = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
Log.i("RetroActivity", "onBackKeyPressed");
|
||||
Intent retro = new Intent(this, MainMenuActivity.class);
|
||||
retro.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
startActivity(retro);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,20 +2,10 @@ package com.retroarch.browser;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import com.retroarch.browser.mainmenu.MainMenuActivity;
|
||||
import com.retroarch.browser.preferences.util.UserPreferences;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.NativeActivity;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
// For Android 2.3.x
|
||||
|
||||
public final class RetroActivityPast extends NativeActivity
|
||||
public final class RetroActivityPast extends RetroActivityCommon
|
||||
{
|
||||
private Intent pendingIntent = null;
|
||||
|
||||
public void onCameraStart()
|
||||
{
|
||||
}
|
||||
@ -37,79 +27,11 @@ public final class RetroActivityPast extends NativeActivity
|
||||
{
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void onCameraTextureInit(int gl_texid)
|
||||
{
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void onCameraSetTexture(int gl_texid) throws IOException
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy()
|
||||
{
|
||||
UserPreferences.readbackConfigFile(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrimMemory(int level)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNewIntent(Intent intent)
|
||||
{
|
||||
Log.i("RetroActivity", "onNewIntent invoked.");
|
||||
super.onNewIntent(intent);
|
||||
setIntent(intent);
|
||||
pendingIntent = intent;
|
||||
}
|
||||
|
||||
public String getPendingIntentFullPath()
|
||||
{
|
||||
return pendingIntent.getStringExtra("ROM");
|
||||
}
|
||||
|
||||
public String getPendingIntentLibretroPath()
|
||||
{
|
||||
return pendingIntent.getStringExtra("LIBRETRO");
|
||||
}
|
||||
|
||||
public String getPendingIntentConfigPath()
|
||||
{
|
||||
return pendingIntent.getStringExtra("CONFIGFILE");
|
||||
}
|
||||
|
||||
public String getPendingIntentIME()
|
||||
{
|
||||
return pendingIntent.getStringExtra("IME");
|
||||
}
|
||||
|
||||
public boolean hasPendingIntent()
|
||||
{
|
||||
if (pendingIntent == null)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void clearPendingIntent()
|
||||
{
|
||||
pendingIntent = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
Log.i("RetroActivity", "onBackKeyPressed");
|
||||
Intent retro = new Intent(this, MainMenuActivity.class);
|
||||
retro.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
|
||||
startActivity(retro);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user