Android: Add refresh library function.
|
@ -140,6 +140,12 @@ public final class GameGridActivity extends Activity implements LoaderManager.Lo
|
|||
Intent settings = new Intent(this, SettingsActivity.class);
|
||||
startActivity(settings);
|
||||
return true;
|
||||
|
||||
case R.id.menu_refresh:
|
||||
getContentResolver().insert(GameProvider.URI_REFRESH, null);
|
||||
getLoaderManager().restartLoader(LOADER_ID_GAMES, null, this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -15,13 +15,17 @@ import org.dolphinemu.dolphinemu.BuildConfig;
|
|||
*/
|
||||
public final class GameProvider extends ContentProvider
|
||||
{
|
||||
public static final String REFRESH_LIBRARY = "refresh";
|
||||
|
||||
public static final String AUTHORITY = "content://" + BuildConfig.APPLICATION_ID + ".provider";
|
||||
public static final Uri URI_FOLDER = Uri.parse(AUTHORITY + "/" + GameDatabase.TABLE_NAME_FOLDERS + "/");
|
||||
public static final Uri URI_GAME = Uri.parse(AUTHORITY + "/" + GameDatabase.TABLE_NAME_GAMES + "/");
|
||||
public static final Uri URI_REFRESH = Uri.parse(AUTHORITY + "/" + REFRESH_LIBRARY + "/");
|
||||
|
||||
public static final String MIME_TYPE_FOLDER = "vnd.android.cursor.item/vnd.dolphin.folder";
|
||||
public static final String MIME_TYPE_GAME = "vnd.android.cursor.item/vnd.dolphin.game";
|
||||
|
||||
|
||||
private GameDatabase mDbHelper;
|
||||
|
||||
@Override
|
||||
|
@ -92,6 +96,12 @@ public final class GameProvider extends ContentProvider
|
|||
|
||||
if (table != null)
|
||||
{
|
||||
if (table.equals(REFRESH_LIBRARY))
|
||||
{
|
||||
mDbHelper.scanLibrary(database);
|
||||
return uri;
|
||||
}
|
||||
|
||||
id = database.insertWithOnConflict(table, null, values, SQLiteDatabase.CONFLICT_IGNORE);
|
||||
|
||||
// If insertion was successful...
|
||||
|
|
After Width: | Height: | Size: 531 B |
After Width: | Height: | Size: 561 B |
After Width: | Height: | Size: 346 B |
After Width: | Height: | Size: 420 B |
After Width: | Height: | Size: 637 B |
After Width: | Height: | Size: 737 B |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 974 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
|
@ -1,7 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/menu_refresh"
|
||||
android:title="@string/grid_menu_refresh"
|
||||
android:icon="@drawable/ic_refresh"
|
||||
android:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/menu_settings"
|
||||
android:title="@string/grid_menu_settings"
|
||||
android:showAsAction="never"/>
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:showAsAction="ifRoom"/>
|
||||
|
||||
</menu>
|
|
@ -226,6 +226,7 @@
|
|||
|
||||
<!-- Game Grid Screen-->
|
||||
<string name="grid_menu_settings">Settings</string>
|
||||
<string name="grid_menu_refresh">Refresh Library</string>
|
||||
|
||||
<!-- Add Directory Screen-->
|
||||
<string name="add_directory_title">Add Folder to Library</string>
|
||||
|
|