add functions to look for certain extra folders that may be useful to set sane defaults
This commit is contained in:
parent
a07c8cd551
commit
3d348edcb3
|
@ -22,6 +22,7 @@ import android.preference.PreferenceManager;
|
|||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.retroarch.R;
|
||||
import com.retroarch.browser.NativeInterface;
|
||||
|
@ -250,5 +251,8 @@ public final class MainMenuFragment extends PreferenceListFragment implements On
|
|||
retro.putExtra("CONFIGFILE", configFilePath);
|
||||
retro.putExtra("IME", imePath);
|
||||
retro.putExtra("DATADIR", dataDirPath);
|
||||
retro.putExtra("SDCARD", Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
retro.putExtra("DOWNLOADS", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath());
|
||||
retro.putExtra("SCREENSHOTS", Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.retroarch.browser.preferences.util.UserPreferences;
|
|||
* Class which provides common methods for RetroActivity related classes.
|
||||
*/
|
||||
public class RetroActivityCommon extends RetroActivityLocation
|
||||
{
|
||||
{
|
||||
@Override
|
||||
public void onLowMemory()
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.util.Log;
|
|||
|
||||
public class RetroActivityIntent extends RetroActivityCommon {
|
||||
private Intent pendingIntent = null;
|
||||
private static final String TAG = "RetroArch";
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
|
@ -56,6 +57,21 @@ public class RetroActivityIntent extends RetroActivityCommon {
|
|||
return pendingIntent.getStringExtra("CONFIGFILE");
|
||||
}
|
||||
|
||||
public String getPendingIntentStorageLocation()
|
||||
{
|
||||
return pendingIntent.getStringExtra("SDCARD");
|
||||
}
|
||||
|
||||
public String getPendingIntentDownloadLocation()
|
||||
{
|
||||
return pendingIntent.getStringExtra("DOWNLOADS");
|
||||
}
|
||||
|
||||
public String getPendingIntentScreenshotsLocation()
|
||||
{
|
||||
return pendingIntent.getStringExtra("SCREENSHOTS");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the specified IME in the pending intent.
|
||||
*
|
||||
|
|
|
@ -568,6 +568,75 @@ static void frontend_android_get_environment_settings(int *argc,
|
|||
}
|
||||
}
|
||||
|
||||
/* External Storage */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
(*env)->NewStringUTF(env, "SDCARD"));
|
||||
|
||||
if (android_app->getStringExtra && jstr)
|
||||
{
|
||||
static char path[PATH_MAX_LENGTH];
|
||||
const char *argv = NULL;
|
||||
|
||||
*path = '\0';
|
||||
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
|
||||
if (argv && *argv)
|
||||
strlcpy(path, argv, sizeof(path));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
if (*path)
|
||||
{
|
||||
RARCH_LOG("External Storage Location %s.\n", path);
|
||||
//todo base dir handler
|
||||
}
|
||||
}
|
||||
|
||||
/* Screenshots */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
(*env)->NewStringUTF(env, "SCREENSHOTS"));
|
||||
|
||||
if (android_app->getStringExtra && jstr)
|
||||
{
|
||||
static char path[PATH_MAX_LENGTH];
|
||||
const char *argv = NULL;
|
||||
|
||||
*path = '\0';
|
||||
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
|
||||
if (argv && *argv)
|
||||
strlcpy(path, argv, sizeof(path));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
if (*path)
|
||||
{
|
||||
RARCH_LOG("Screenshot Location %s.\n", path);
|
||||
//todo screenshot handler
|
||||
}
|
||||
}
|
||||
|
||||
/* Downloads */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
(*env)->NewStringUTF(env, "DOWNLOADS"));
|
||||
|
||||
if (android_app->getStringExtra && jstr)
|
||||
{
|
||||
static char path[PATH_MAX_LENGTH];
|
||||
const char *argv = NULL;
|
||||
|
||||
*path = '\0';
|
||||
argv = (*env)->GetStringUTFChars(env, jstr, 0);
|
||||
|
||||
if (argv && *argv)
|
||||
strlcpy(path, argv, sizeof(path));
|
||||
(*env)->ReleaseStringUTFChars(env, jstr, argv);
|
||||
|
||||
if (*path)
|
||||
{
|
||||
RARCH_LOG("Downloads Location %s.\n", path);
|
||||
//todo downloads handler
|
||||
}
|
||||
}
|
||||
|
||||
/* Content. */
|
||||
CALL_OBJ_METHOD_PARAM(env, jstr, obj, android_app->getStringExtra,
|
||||
(*env)->NewStringUTF(env, "DATADIR"));
|
||||
|
|
|
@ -57,6 +57,9 @@ struct android_app
|
|||
jmethodID getPendingIntentLibretroPath;
|
||||
jmethodID getPendingIntentFullPath;
|
||||
jmethodID getPendingIntentIME;
|
||||
jmethodID getPendingIntentStorageLocation;
|
||||
jmethodID getPendingIntentDownloadsLocation;
|
||||
jmethodID getPendingIntentScreenshotsLocation;
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
Loading…
Reference in New Issue