Merge pull request #2564 from sigmabeta/android-refresh-library

Android: Add refresh library function.
This commit is contained in:
Lioncash 2015-06-07 21:58:04 -04:00
commit 7b3932e5b5
14 changed files with 25 additions and 1 deletions

View File

@ -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;

View File

@ -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...

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 420 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 875 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -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>

View File

@ -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>