Android: Reformat Java sources

This commit is contained in:
Connor McLaughlin 2021-01-03 18:28:12 +10:00
parent 600e8d5dd0
commit fc3780815d
15 changed files with 105 additions and 91 deletions

View File

@ -72,13 +72,17 @@ public class AndroidHostInterface {
public static native int getControllerAxisCode(String controllerType, String axisName); public static native int getControllerAxisCode(String controllerType, String axisName);
public static native String[] getControllerButtonNames(String controllerType); public static native String[] getControllerButtonNames(String controllerType);
public static native String[] getControllerAxisNames(String controllerType); public static native String[] getControllerAxisNames(String controllerType);
public native void handleControllerButtonEvent(int controllerIndex, int buttonIndex, boolean pressed); public native void handleControllerButtonEvent(int controllerIndex, int buttonIndex, boolean pressed);
public native void handleControllerAxisEvent(int controllerIndex, int axisIndex, float value); public native void handleControllerAxisEvent(int controllerIndex, int axisIndex, float value);
public native String[] getInputProfileNames(); public native String[] getInputProfileNames();
public native boolean loadInputProfile(String name); public native boolean loadInputProfile(String name);
public native boolean saveInputProfile(String name); public native boolean saveInputProfile(String name);
public native HotkeyInfo[] getHotkeyInfoList(); public native HotkeyInfo[] getHotkeyInfoList();
@ -90,6 +94,7 @@ public class AndroidHostInterface {
public native GameListEntry getGameListEntry(String path); public native GameListEntry getGameListEntry(String path);
public native String getGameSettingValue(String path, String key); public native String getGameSettingValue(String path, String key);
public native void setGameSettingValue(String path, String key, String value); public native void setGameSettingValue(String path, String key, String value);
public native void resetSystem(); public native void resetSystem();

View File

@ -94,11 +94,16 @@ public class ControllerBindingPreference extends Preference {
mValueView = ((TextView) holder.findViewById(R.id.controller_binding_value)); mValueView = ((TextView) holder.findViewById(R.id.controller_binding_value));
int drawableId = R.drawable.ic_baseline_radio_button_checked_24; int drawableId = R.drawable.ic_baseline_radio_button_checked_24;
switch (mType) switch (mType) {
{ case BUTTON:
case BUTTON: drawableId = getIconForButton(mBindingName); break; drawableId = getIconForButton(mBindingName);
case AXIS: drawableId = getIconForAxis(mBindingName); break; break;
case HOTKEY: drawableId = getIconForHotkey(mBindingName); break; case AXIS:
drawableId = getIconForAxis(mBindingName);
break;
case HOTKEY:
drawableId = getIconForHotkey(mBindingName);
break;
} }
iconView.setImageDrawable(ContextCompat.getDrawable(getContext(), drawableId)); iconView.setImageDrawable(ContextCompat.getDrawable(getContext(), drawableId));

View File

@ -193,11 +193,16 @@ public class GamePropertiesActivity extends AppCompatActivity {
TabLayout tabLayout = view.findViewById(R.id.tab_layout); TabLayout tabLayout = view.findViewById(R.id.tab_layout);
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> { new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> {
switch (position) switch (position) {
{ case 0:
case 0: tab.setText("Summary"); break; tab.setText("Summary");
case 1: tab.setText("Game Settings"); break; break;
case 2: tab.setText("Controller Settings"); break; case 1:
tab.setText("Game Settings");
break;
case 2:
tab.setText("Controller Settings");
break;
} }
}).attach(); }).attach();
} }
@ -214,8 +219,7 @@ public class GamePropertiesActivity extends AppCompatActivity {
@NonNull @NonNull
@Override @Override
public Fragment createFragment(int position) { public Fragment createFragment(int position) {
switch (position) switch (position) {
{
case 0: { // Summary case 0: { // Summary
ListFragment lf = new ListFragment(); ListFragment lf = new ListFragment();
lf.setListAdapter(activity.getPropertyListAdapter()); lf.setListAdapter(activity.getPropertyListAdapter());

View File

@ -9,6 +9,7 @@ public class PreferenceHelpers {
/** /**
* Clears all preferences in the specified section (starting with sectionName/). * Clears all preferences in the specified section (starting with sectionName/).
* We really don't want to have to do this with JNI... * We really don't want to have to do this with JNI...
*
* @param prefs Preferences object. * @param prefs Preferences object.
* @param sectionName Section to clear keys for. * @param sectionName Section to clear keys for.
*/ */
@ -43,8 +44,7 @@ public class PreferenceHelpers {
return values; return values;
} }
public static boolean addToStringList(SharedPreferences prefs, String keyName, String valueToAdd) public static boolean addToStringList(SharedPreferences prefs, String keyName, String valueToAdd) {
{
Set<String> values = getStringSet(prefs, keyName); Set<String> values = getStringSet(prefs, keyName);
if (values == null) if (values == null)
values = new ArraySet<>(); values = new ArraySet<>();
@ -54,8 +54,7 @@ public class PreferenceHelpers {
return result; return result;
} }
public static boolean removeFromStringList(SharedPreferences prefs, String keyName, String valueToRemove) public static boolean removeFromStringList(SharedPreferences prefs, String keyName, String valueToRemove) {
{
Set<String> values = getStringSet(prefs, keyName); Set<String> values = getStringSet(prefs, keyName);
if (values == null) if (values == null)
return false; return false;

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <TextView

View File

@ -29,7 +29,8 @@
app:title="@string/settings_controller_mapping" app:title="@string/settings_controller_mapping"
app:summary="@string/settings_controller_mapping_summary" app:summary="@string/settings_controller_mapping_summary"
app:iconSpaceReserved="false"> app:iconSpaceReserved="false">
<intent android:action="android.intent.action.VIEW" <intent
android:action="android.intent.action.VIEW"
android:targetClass="com.github.stenzek.duckstation.ControllerMappingActivity" android:targetClass="com.github.stenzek.duckstation.ControllerMappingActivity"
android:targetPackage="com.github.stenzek.duckstation" /> android:targetPackage="com.github.stenzek.duckstation" />
</Preference> </Preference>