Skip to content

Commit

Permalink
Merge pull request #2413 from sigmabeta/android-lollipop-settings
Browse files Browse the repository at this point in the history
Android: Implement Settings screen in new UI.
  • Loading branch information
lioncash committed May 20, 2015
2 parents 23f6e19 + ba591ea commit 23842cb
Show file tree
Hide file tree
Showing 22 changed files with 1,164 additions and 17 deletions.
30 changes: 30 additions & 0 deletions Source/Android/app/build.gradle
Expand Up @@ -29,6 +29,7 @@ android {
}
}

// Define build types, which are orthogonal to product flavors.
buildTypes {
// Signed by release key, allowing for upload to Play Store.
release {
Expand All @@ -43,6 +44,35 @@ android {
jniDebuggable true
}
}

// Define product flavors, which can be split into categories. Common examples
// of product flavors are paid vs. free, ARM vs. x86, etc.
productFlavors {
arm {
// This flavor is mutually exclusive against any flavor in the same dimension.
flavorDimension "abi"

// When building this flavor, only include native libs from the specified folder.
ndk {
abiFilter "armeabi-v7a"
}
}

arm_64 {
flavorDimension "abi"
ndk {
abiFilter "arm64-v8a"
}
}

// TODO Uncomment this when we successfully build for x86_64.
/*x86_64 {
flavorDimension "abi"
ndk {
abiFilter "x86_64"
}
}*/
}
}

dependencies {
Expand Down
16 changes: 16 additions & 0 deletions Source/Android/app/src/arm/res/values/arrays.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- All lists for ListPreference keys/values are placed here -->
<resources>

<!-- New UI CPU Core selection - ARM32 -->
<string-array name="string_emu_cores" translatable="false">
<item>@string/interpreter</item>
<item>@string/jit_arm_recompiler</item>
</string-array>
<string-array name="int_emu_cores" translatable="false">
<item>0</item>
<item>3</item>
</string-array>

</resources>
5 changes: 5 additions & 0 deletions Source/Android/app/src/arm/res/values/strings.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Title of the app -->
<string name="title_new_ui">Dolphin ARM32</string>
</resources>
16 changes: 16 additions & 0 deletions Source/Android/app/src/arm_64/res/values/arrays.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>

<!-- All lists for ListPreference keys/values are placed here -->
<resources>

<!-- New UI CPU Core selection - ARM64 -->
<string-array name="string_emu_cores" translatable="false">
<item>@string/interpreter</item>
<item>@string/jit_arm64_recompiler</item>
</string-array>
<string-array name="int_emu_cores" translatable="false">
<item>0</item>
<item>4</item>
</string-array>

</resources>
5 changes: 5 additions & 0 deletions Source/Android/app/src/arm_64/res/values/strings.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Title of the app -->
<string name="title_new_ui">Dolphin ARM64</string>
</resources>
13 changes: 10 additions & 3 deletions Source/Android/app/src/main/AndroidManifest.xml
Expand Up @@ -14,7 +14,7 @@

<activity
android:name=".activities.GameGridActivity"
android:label="Dolphin New UI"
android:label="@string/title_new_ui"
android:theme="@style/DolphinGamecube">

<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
Expand All @@ -27,9 +27,14 @@

<activity
android:name=".activities.AddDirectoryActivity"
android:theme="@style/DolphinWii"
android:theme="@style/DolphinGamecube"
android:label="@string/add_directory_title"/>

<activity
android:name=".activities.SettingsActivity"
android:theme="@style/DolphinSettingsGamecube"
android:label="@string/grid_menu_settings"/>

<activity
android:name="org.dolphinemu.dolphinemu.gamelist.GameListActivity"
android:label="@string/app_name"
Expand Down Expand Up @@ -60,7 +65,9 @@
android:label="@string/settings"
android:theme="@android:style/Theme.Holo.Light" />

<service android:name=".AssetCopyService"/>
<service android:name=".services.AssetCopyService"/>

<service android:name=".services.SettingsSaveService"/>

</application>

Expand Down
Expand Up @@ -10,16 +10,17 @@
import android.support.v7.widget.RecyclerView;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ImageButton;
import android.widget.Toolbar;

import org.dolphinemu.dolphinemu.AssetCopyService;
import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.adapters.GameAdapter;
import org.dolphinemu.dolphinemu.model.Game;
import org.dolphinemu.dolphinemu.model.GcGame;
import org.dolphinemu.dolphinemu.services.AssetCopyService;

import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -89,8 +90,8 @@ public void onClick(View view)
* Callback from AddDirectoryActivity. Applies any changes necessary to the GameGridActivity.
*
* @param requestCode An int describing whether the Activity that is returning did so successfully.
* @param resultCode An int describing what Activity is giving us this callback.
* @param result The information the returning Activity is providing us.
* @param resultCode An int describing what Activity is giving us this callback.
* @param result The information the returning Activity is providing us.
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent result)
Expand Down Expand Up @@ -126,7 +127,27 @@ public boolean onCreateOptionsMenu(Menu menu)
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_game_grid, menu);
return true;
}

/**
* Called by the framework whenever any actionbar/toolbar icon is clicked.
*
* @param item The icon that was clicked on.
* @return True if the event was handled, false to bubble it up to the OS.
*/
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.menu_settings:
// Launch the Settings Actvity.
Intent settings = new Intent(this, SettingsActivity.class);
startActivity(settings);
return true;
}

return false;
}

// TODO Replace all of this with a SQLite database
Expand Down Expand Up @@ -172,7 +193,8 @@ private ArrayList<Game> getGameList()
}

}
} catch (Exception ignored)
}
catch (Exception ignored)
{

}
Expand Down
@@ -0,0 +1,41 @@
package org.dolphinemu.dolphinemu.activities;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import org.dolphinemu.dolphinemu.fragments.SettingsFragment;
import org.dolphinemu.dolphinemu.services.SettingsSaveService;

public final class SettingsActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

// Display the fragment as the main content.
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new SettingsFragment(), "settings_fragment")
.commit();
}

/**
* If this is called, the user has left the settings screen (potentially through the
* home button) and will expect their changes to be persisted. So we kick off an
* IntentService which will do so on a background thread.
*/
@Override
protected void onStop()
{
super.onStop();

Log.d("DolphinEmulator", "Settings activity stopping. Saving settings to INI...");

// Copy assets into appropriate locations.
Intent settingsSaver = new Intent(this, SettingsSaveService.class);
startService(settingsSaver);
}
}

0 comments on commit 23842cb

Please sign in to comment.