android: Format code
Finally makes us have consistent code format in the codebase.
This commit is contained in:
parent
d5f8f75bf3
commit
bc044da12e
@ -49,8 +49,7 @@ public class CitraApplication extends Application {
|
|||||||
databaseHelper = new GameDatabase(this);
|
databaseHelper = new GameDatabase(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Context getAppContext()
|
public static Context getAppContext() {
|
||||||
{
|
|
||||||
return application.getApplicationContext();
|
return application.getApplicationContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,8 @@ public final class NativeLibrary {
|
|||||||
synchronized (cameraPermissionLock) {
|
synchronized (cameraPermissionLock) {
|
||||||
try {
|
try {
|
||||||
cameraPermissionLock.wait();
|
cameraPermissionLock.wait();
|
||||||
} catch (InterruptedException ignored) {}
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return cameraPermissionGranted;
|
return cameraPermissionGranted;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,9 @@ public final class MiiSelector {
|
|||||||
? emulationActivity.getString(R.string.mii_selector)
|
? emulationActivity.getString(R.string.mii_selector)
|
||||||
: config.title)
|
: config.title)
|
||||||
.setSingleChoiceItems(list.toArray(new String[]{}), initialIndex,
|
.setSingleChoiceItems(list.toArray(new String[]{}), initialIndex,
|
||||||
(dialog, which) -> { data.index = which; })
|
(dialog, which) -> {
|
||||||
|
data.index = which;
|
||||||
|
})
|
||||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||||
data.return_code = 0;
|
data.return_code = 0;
|
||||||
synchronized (finishLock) {
|
synchronized (finishLock) {
|
||||||
|
@ -60,7 +60,8 @@ public final class SoftwareKeyboard {
|
|||||||
public int max_text_length;
|
public int max_text_length;
|
||||||
public boolean multiline_mode; /// True if the keyboard accepts multiple lines of input
|
public boolean multiline_mode; /// True if the keyboard accepts multiple lines of input
|
||||||
public String hint_text; /// Displayed in the field as a hint before
|
public String hint_text; /// Displayed in the field as a hint before
|
||||||
@Nullable public String[] button_text; /// Contains the button text that the caller provides
|
@Nullable
|
||||||
|
public String[] button_text; /// Contains the button text that the caller provides
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Corresponds to Frontend::KeyboardData
|
/// Corresponds to Frontend::KeyboardData
|
||||||
@ -258,5 +259,6 @@ public final class SoftwareKeyboard {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static native ValidationError ValidateFilters(String text);
|
private static native ValidationError ValidateFilters(String text);
|
||||||
|
|
||||||
private static native ValidationError ValidateInput(String text);
|
private static native ValidationError ValidateInput(String text);
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,12 @@ import androidx.annotation.Nullable;
|
|||||||
public final class StillImageCameraHelper {
|
public final class StillImageCameraHelper {
|
||||||
public static final int REQUEST_CAMERA_FILE_PICKER = 1;
|
public static final int REQUEST_CAMERA_FILE_PICKER = 1;
|
||||||
private static final Object filePickerLock = new Object();
|
private static final Object filePickerLock = new Object();
|
||||||
private static @Nullable String filePickerPath;
|
private static @Nullable
|
||||||
|
String filePickerPath;
|
||||||
|
|
||||||
// Opens file picker for camera.
|
// Opens file picker for camera.
|
||||||
public static @Nullable String OpenFilePicker() {
|
public static @Nullable
|
||||||
|
String OpenFilePicker() {
|
||||||
final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get();
|
final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get();
|
||||||
|
|
||||||
// At this point, we are assuming that we already have permissions as they are
|
// At this point, we are assuming that we already have permissions as they are
|
||||||
|
@ -3,65 +3,52 @@ package org.citra.citra_emu.features.settings.model.view;
|
|||||||
import org.citra.citra_emu.features.settings.model.Setting;
|
import org.citra.citra_emu.features.settings.model.Setting;
|
||||||
import org.citra.citra_emu.features.settings.model.StringSetting;
|
import org.citra.citra_emu.features.settings.model.StringSetting;
|
||||||
|
|
||||||
public class StringSingleChoiceSetting extends SettingsItem
|
public class StringSingleChoiceSetting extends SettingsItem {
|
||||||
{
|
|
||||||
private String mDefaultValue;
|
private String mDefaultValue;
|
||||||
|
|
||||||
private String[] mChoicesId;
|
private String[] mChoicesId;
|
||||||
private String[] mValuesId;
|
private String[] mValuesId;
|
||||||
|
|
||||||
public StringSingleChoiceSetting(String key, String section, int titleId, int descriptionId,
|
public StringSingleChoiceSetting(String key, String section, int titleId, int descriptionId,
|
||||||
String[] choicesId, String[] valuesId, String defaultValue, Setting setting)
|
String[] choicesId, String[] valuesId, String defaultValue, Setting setting) {
|
||||||
{
|
|
||||||
super(key, section, setting, titleId, descriptionId);
|
super(key, section, setting, titleId, descriptionId);
|
||||||
mValuesId = valuesId;
|
mValuesId = valuesId;
|
||||||
mChoicesId = choicesId;
|
mChoicesId = choicesId;
|
||||||
mDefaultValue = defaultValue;
|
mDefaultValue = defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getChoicesId()
|
public String[] getChoicesId() {
|
||||||
{
|
|
||||||
return mChoicesId;
|
return mChoicesId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getValuesId()
|
public String[] getValuesId() {
|
||||||
{
|
|
||||||
return mValuesId;
|
return mValuesId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValueAt(int index)
|
public String getValueAt(int index) {
|
||||||
{
|
|
||||||
if (mValuesId == null)
|
if (mValuesId == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (index >= 0 && index < mValuesId.length)
|
if (index >= 0 && index < mValuesId.length) {
|
||||||
{
|
|
||||||
return mValuesId[index];
|
return mValuesId[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSelectedValue()
|
public String getSelectedValue() {
|
||||||
{
|
if (getSetting() != null) {
|
||||||
if (getSetting() != null)
|
|
||||||
{
|
|
||||||
StringSetting setting = (StringSetting) getSetting();
|
StringSetting setting = (StringSetting) getSetting();
|
||||||
return setting.getValue();
|
return setting.getValue();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return mDefaultValue;
|
return mDefaultValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSelectValueIndex()
|
public int getSelectValueIndex() {
|
||||||
{
|
|
||||||
String selectedValue = getSelectedValue();
|
String selectedValue = getSelectedValue();
|
||||||
for (int i = 0; i < mValuesId.length; i++)
|
for (int i = 0; i < mValuesId.length; i++) {
|
||||||
{
|
if (mValuesId[i].equals(selectedValue)) {
|
||||||
if (mValuesId[i].equals(selectedValue))
|
|
||||||
{
|
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,16 +63,12 @@ public class StringSingleChoiceSetting extends SettingsItem
|
|||||||
* @param selection New value of the int.
|
* @param selection New value of the int.
|
||||||
* @return null if overwritten successfully otherwise; a newly created IntSetting.
|
* @return null if overwritten successfully otherwise; a newly created IntSetting.
|
||||||
*/
|
*/
|
||||||
public StringSetting setSelectedValue(String selection)
|
public StringSetting setSelectedValue(String selection) {
|
||||||
{
|
if (getSetting() == null) {
|
||||||
if (getSetting() == null)
|
|
||||||
{
|
|
||||||
StringSetting setting = new StringSetting(getKey(), getSection(), selection);
|
StringSetting setting = new StringSetting(getKey(), getSection(), selection);
|
||||||
setSetting(setting);
|
setSetting(setting);
|
||||||
return setting;
|
return setting;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
StringSetting setting = (StringSetting) getSetting();
|
StringSetting setting = (StringSetting) getSetting();
|
||||||
setting.setValue(selection);
|
setting.setValue(selection);
|
||||||
return null;
|
return null;
|
||||||
@ -93,8 +76,7 @@ public class StringSingleChoiceSetting extends SettingsItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getType()
|
public int getType() {
|
||||||
{
|
|
||||||
return TYPE_STRING_SINGLE_CHOICE;
|
return TYPE_STRING_SINGLE_CHOICE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import android.content.IntentFilter;
|
|||||||
|
|
||||||
import org.citra.citra_emu.features.settings.model.Settings;
|
import org.citra.citra_emu.features.settings.model.Settings;
|
||||||
import org.citra.citra_emu.utils.DirectoryStateReceiver;
|
import org.citra.citra_emu.utils.DirectoryStateReceiver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstraction for the Activity that manages SettingsFragments.
|
* Abstraction for the Activity that manages SettingsFragments.
|
||||||
*/
|
*/
|
||||||
|
@ -15,6 +15,7 @@ import androidx.annotation.Nullable;
|
|||||||
|
|
||||||
public class PicassoUtils {
|
public class PicassoUtils {
|
||||||
private static boolean mPicassoInitialized = false;
|
private static boolean mPicassoInitialized = false;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
if (mPicassoInitialized) {
|
if (mPicassoInitialized) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user