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

View file

@ -94,11 +94,16 @@ public class ControllerBindingPreference extends Preference {
mValueView = ((TextView) holder.findViewById(R.id.controller_binding_value));
int drawableId = R.drawable.ic_baseline_radio_button_checked_24;
switch (mType)
{
case BUTTON: drawableId = getIconForButton(mBindingName); break;
case AXIS: drawableId = getIconForAxis(mBindingName); break;
case HOTKEY: drawableId = getIconForHotkey(mBindingName); break;
switch (mType) {
case BUTTON:
drawableId = getIconForButton(mBindingName);
break;
case AXIS:
drawableId = getIconForAxis(mBindingName);
break;
case HOTKEY:
drawableId = getIconForHotkey(mBindingName);
break;
}
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);
new TabLayoutMediator(tabLayout, viewPager, (tab, position) -> {
switch (position)
{
case 0: tab.setText("Summary"); break;
case 1: tab.setText("Game Settings"); break;
case 2: tab.setText("Controller Settings"); break;
switch (position) {
case 0:
tab.setText("Summary");
break;
case 1:
tab.setText("Game Settings");
break;
case 2:
tab.setText("Controller Settings");
break;
}
}).attach();
}
@ -214,8 +219,7 @@ public class GamePropertiesActivity extends AppCompatActivity {
@NonNull
@Override
public Fragment createFragment(int position) {
switch (position)
{
switch (position) {
case 0: { // Summary
ListFragment lf = new ListFragment();
lf.setListAdapter(activity.getPropertyListAdapter());

View file

@ -9,6 +9,7 @@ public class PreferenceHelpers {
/**
* Clears all preferences in the specified section (starting with sectionName/).
* We really don't want to have to do this with JNI...
*
* @param prefs Preferences object.
* @param sectionName Section to clear keys for.
*/
@ -43,8 +44,7 @@ public class PreferenceHelpers {
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);
if (values == null)
values = new ArraySet<>();
@ -54,8 +54,7 @@ public class PreferenceHelpers {
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);
if (values == null)
return false;

View file

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

View file

@ -29,7 +29,8 @@
app:title="@string/settings_controller_mapping"
app:summary="@string/settings_controller_mapping_summary"
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:targetPackage="com.github.stenzek.duckstation" />
</Preference>