Merge pull request #2564 from sigmabeta/android-refresh-library
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...
|
||||
|
BIN
Source/Android/app/src/main/res/drawable-hdpi/ic_refresh.png
Normal file
After Width: | Height: | Size: 531 B |
BIN
Source/Android/app/src/main/res/drawable-hdpi/ic_settings.png
Normal file
After Width: | Height: | Size: 561 B |
BIN
Source/Android/app/src/main/res/drawable-mdpi/ic_refresh.png
Normal file
After Width: | Height: | Size: 346 B |
BIN
Source/Android/app/src/main/res/drawable-mdpi/ic_settings.png
Normal file
After Width: | Height: | Size: 420 B |
BIN
Source/Android/app/src/main/res/drawable-xhdpi/ic_refresh.png
Normal file
After Width: | Height: | Size: 637 B |
BIN
Source/Android/app/src/main/res/drawable-xhdpi/ic_settings.png
Normal file
After Width: | Height: | Size: 737 B |
BIN
Source/Android/app/src/main/res/drawable-xxhdpi/ic_refresh.png
Normal file
After Width: | Height: | Size: 875 B |
BIN
Source/Android/app/src/main/res/drawable-xxhdpi/ic_settings.png
Normal file
After Width: | Height: | Size: 974 B |
BIN
Source/Android/app/src/main/res/drawable-xxxhdpi/ic_refresh.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
Source/Android/app/src/main/res/drawable-xxxhdpi/ic_settings.png
Normal file
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>
|
||||
|