android: Format code
Finally makes us have consistent code format in the codebase.
This commit is contained in:
parent
85069301e5
commit
461cfd9e1d
@ -49,8 +49,7 @@ public class CitraApplication extends Application {
|
||||
databaseHelper = new GameDatabase(this);
|
||||
}
|
||||
|
||||
public static Context getAppContext()
|
||||
{
|
||||
public static Context getAppContext() {
|
||||
return application.getApplicationContext();
|
||||
}
|
||||
}
|
||||
|
@ -428,7 +428,8 @@ public final class NativeLibrary {
|
||||
synchronized (cameraPermissionLock) {
|
||||
try {
|
||||
cameraPermissionLock.wait();
|
||||
} catch (InterruptedException ignored) {}
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
return cameraPermissionGranted;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ public final class MiiSelector {
|
||||
final Activity emulationActivity = Objects.requireNonNull(getActivity());
|
||||
|
||||
MiiSelectorConfig config =
|
||||
Objects.requireNonNull((MiiSelectorConfig)Objects.requireNonNull(getArguments())
|
||||
Objects.requireNonNull((MiiSelectorConfig) Objects.requireNonNull(getArguments())
|
||||
.getSerializable("config"));
|
||||
|
||||
// Note: we intentionally leave out the Standard Mii in the native code so that
|
||||
@ -66,7 +66,7 @@ public final class MiiSelector {
|
||||
list.addAll(Arrays.asList(config.mii_names));
|
||||
|
||||
final int initialIndex = config.initially_selected_mii_index < list.size()
|
||||
? (int)config.initially_selected_mii_index
|
||||
? (int) config.initially_selected_mii_index
|
||||
: 0;
|
||||
data.index = initialIndex;
|
||||
AlertDialog.Builder builder =
|
||||
@ -74,8 +74,10 @@ public final class MiiSelector {
|
||||
.setTitle(config.title.isEmpty()
|
||||
? emulationActivity.getString(R.string.mii_selector)
|
||||
: config.title)
|
||||
.setSingleChoiceItems(list.toArray(new String[] {}), initialIndex,
|
||||
(dialog, which) -> { data.index = which; })
|
||||
.setSingleChoiceItems(list.toArray(new String[]{}), initialIndex,
|
||||
(dialog, which) -> {
|
||||
data.index = which;
|
||||
})
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
data.return_code = 0;
|
||||
synchronized (finishLock) {
|
||||
|
@ -60,7 +60,8 @@ public final class SoftwareKeyboard {
|
||||
public int max_text_length;
|
||||
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
|
||||
@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
|
||||
@ -110,14 +111,14 @@ public final class SoftwareKeyboard {
|
||||
R.dimen.dialog_margin);
|
||||
|
||||
KeyboardConfig config = Objects.requireNonNull(
|
||||
(KeyboardConfig)Objects.requireNonNull(getArguments()).getSerializable("config"));
|
||||
(KeyboardConfig) Objects.requireNonNull(getArguments()).getSerializable("config"));
|
||||
|
||||
// Set up the input
|
||||
EditText editText = new EditText(CitraApplication.getAppContext());
|
||||
editText.setHint(config.hint_text);
|
||||
editText.setSingleLine(!config.multiline_mode);
|
||||
editText.setLayoutParams(params);
|
||||
editText.setFilters(new InputFilter[] {
|
||||
editText.setFilters(new InputFilter[]{
|
||||
new Filter(), new InputFilter.LengthFilter(config.max_text_length)});
|
||||
|
||||
FrameLayout container = new FrameLayout(emulationActivity);
|
||||
@ -258,5 +259,6 @@ public final class SoftwareKeyboard {
|
||||
}
|
||||
|
||||
private static native ValidationError ValidateFilters(String text);
|
||||
|
||||
private static native ValidationError ValidateInput(String text);
|
||||
}
|
||||
|
@ -19,10 +19,12 @@ import androidx.annotation.Nullable;
|
||||
public final class StillImageCameraHelper {
|
||||
public static final int REQUEST_CAMERA_FILE_PICKER = 1;
|
||||
private static final Object filePickerLock = new Object();
|
||||
private static @Nullable String filePickerPath;
|
||||
private static @Nullable
|
||||
String filePickerPath;
|
||||
|
||||
// Opens file picker for camera.
|
||||
public static @Nullable String OpenFilePicker() {
|
||||
public static @Nullable
|
||||
String OpenFilePicker() {
|
||||
final EmulationActivity emulationActivity = NativeLibrary.sEmulationActivity.get();
|
||||
|
||||
// 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.StringSetting;
|
||||
|
||||
public class StringSingleChoiceSetting extends SettingsItem
|
||||
{
|
||||
public class StringSingleChoiceSetting extends SettingsItem {
|
||||
private String mDefaultValue;
|
||||
|
||||
private String[] mChoicesId;
|
||||
private String[] mValuesId;
|
||||
|
||||
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);
|
||||
mValuesId = valuesId;
|
||||
mChoicesId = choicesId;
|
||||
mDefaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String[] getChoicesId()
|
||||
{
|
||||
public String[] getChoicesId() {
|
||||
return mChoicesId;
|
||||
}
|
||||
|
||||
public String[] getValuesId()
|
||||
{
|
||||
public String[] getValuesId() {
|
||||
return mValuesId;
|
||||
}
|
||||
|
||||
public String getValueAt(int index)
|
||||
{
|
||||
public String getValueAt(int index) {
|
||||
if (mValuesId == null)
|
||||
return null;
|
||||
|
||||
if (index >= 0 && index < mValuesId.length)
|
||||
{
|
||||
if (index >= 0 && index < mValuesId.length) {
|
||||
return mValuesId[index];
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getSelectedValue()
|
||||
{
|
||||
if (getSetting() != null)
|
||||
{
|
||||
public String getSelectedValue() {
|
||||
if (getSetting() != null) {
|
||||
StringSetting setting = (StringSetting) getSetting();
|
||||
return setting.getValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return mDefaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
public int getSelectValueIndex()
|
||||
{
|
||||
public int getSelectValueIndex() {
|
||||
String selectedValue = getSelectedValue();
|
||||
for (int i = 0; i < mValuesId.length; i++)
|
||||
{
|
||||
if (mValuesId[i].equals(selectedValue))
|
||||
{
|
||||
for (int i = 0; i < mValuesId.length; i++) {
|
||||
if (mValuesId[i].equals(selectedValue)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -76,16 +63,12 @@ public class StringSingleChoiceSetting extends SettingsItem
|
||||
* @param selection New value of the int.
|
||||
* @return null if overwritten successfully otherwise; a newly created IntSetting.
|
||||
*/
|
||||
public StringSetting setSelectedValue(String selection)
|
||||
{
|
||||
if (getSetting() == null)
|
||||
{
|
||||
public StringSetting setSelectedValue(String selection) {
|
||||
if (getSetting() == null) {
|
||||
StringSetting setting = new StringSetting(getKey(), getSection(), selection);
|
||||
setSetting(setting);
|
||||
return setting;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
StringSetting setting = (StringSetting) getSetting();
|
||||
setting.setValue(selection);
|
||||
return null;
|
||||
@ -93,8 +76,7 @@ public class StringSingleChoiceSetting extends SettingsItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType()
|
||||
{
|
||||
public int getType() {
|
||||
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.utils.DirectoryStateReceiver;
|
||||
|
||||
/**
|
||||
* Abstraction for the Activity that manages SettingsFragments.
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ public class PicassoRoundedCornersTransformation implements Transformation {
|
||||
paint.setAntiAlias(true);
|
||||
paint.setShader(shader);
|
||||
|
||||
canvas.drawRoundRect(new RectF(rect), 10,10, paint);
|
||||
canvas.drawRoundRect(new RectF(rect), 10, 10, paint);
|
||||
|
||||
squaredBitmap.recycle();
|
||||
|
||||
|
@ -15,6 +15,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
public class PicassoUtils {
|
||||
private static boolean mPicassoInitialized = false;
|
||||
|
||||
public static void init() {
|
||||
if (mPicassoInitialized) {
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user