Single render scale factor seekbar

This commit is contained in:
Marcel Szewczyk 2019-01-13 18:15:26 +01:00
parent 82bbe690b1
commit a60286cc0f
3 changed files with 13 additions and 96 deletions

View File

@ -411,17 +411,17 @@ public class OptionsFragment extends Fragment {
});
int resolutionVertical = mPrefs.getInt(Emulator.pref_resolutionv, Emulator.resolutionv);
final String verticalText = getActivity().getString(R.string.resolution_vertical) + " ";
final String resolutionText = getActivity().getString(R.string.resolution) + ": ";
final TextView resolutionVerticalView = getView().findViewById(R.id.resolutionv);
resolutionVerticalView.setText((verticalText + "(" + String.valueOf(resolutionVertical) + "%)"));
final TextView resolutionTextView = getView().findViewById(R.id.resolution);
resolutionTextView.setText((resolutionText + String.valueOf(resolutionVertical) + "%"));
final SeekBar resolutionVerticalSeek = getView().findViewById(R.id.resolutionv_seekbar);
resolutionVerticalSeek.setProgress(resolutionVertical - 1);
resolutionVerticalSeek.setIndeterminate(false);
resolutionVerticalSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
final SeekBar resolutionVHSeek = getView().findViewById(R.id.resolutionvh_seekbar);
resolutionVHSeek.setProgress(resolutionVertical - 1); //can take vertical OR horizontal (the same values)
resolutionVHSeek.setIndeterminate(false);
resolutionVHSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
resolutionVerticalView.setText((verticalText + "(" + String.valueOf(progress + 1) + "%)"));
resolutionTextView.setText((resolutionText + String.valueOf(progress + 1) + "%"));
}
public void onStartTrackingTouch(SeekBar seekBar) {
@ -429,29 +429,8 @@ public class OptionsFragment extends Fragment {
public void onStopTrackingTouch(SeekBar seekBar) {
int progress = seekBar.getProgress();
//the same progress for both resolutions
mPrefs.edit().putInt(Emulator.pref_resolutionv, progress + 1).apply();
}
});
int resolutionHorizontal = mPrefs.getInt(Emulator.pref_resolutionh, Emulator.resolutionh);
final String horizontalText = getActivity().getString(R.string.resolution_horizontal) + " ";
final TextView resolutionHorizontalView = getView().findViewById(R.id.resolutionh);
resolutionHorizontalView.setText((horizontalText + "(" + String.valueOf(resolutionHorizontal) + "%)"));
final SeekBar resolutionHorizontalSeek = getView().findViewById(R.id.resolutionh_seekbar);
resolutionHorizontalSeek.setProgress(resolutionHorizontal - 1);
resolutionHorizontalSeek.setIndeterminate(false);
resolutionHorizontalSeek.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
resolutionHorizontalView.setText((horizontalText + "(" + String.valueOf(progress + 1) + "%)"));
}
public void onStartTrackingTouch(SeekBar seekBar) {
}
public void onStopTrackingTouch(SeekBar seekBar) {
int progress = seekBar.getProgress();
mPrefs.edit().putInt(Emulator.pref_resolutionh, progress + 1).apply();
}
});

View File

@ -738,39 +738,8 @@
android:layout_marginTop="5dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/resolutionh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:text="@string/resolution_horizontal" />
<SeekBar
android:id="@+id/resolutionh_seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:gravity="center_vertical|left"
android:max="99"
android:progress="99" />
</TableRow>
<TableRow
android:layout_marginTop="5dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/resolutionv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:text="@string/resolution_vertical" />
<SeekBar
android:id="@+id/resolutionv_seekbar"
android:id="@+id/resolutionvh_seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"

View File

@ -738,46 +738,15 @@
android:layout_marginTop="5dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/resolutionh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:text="@string/resolution_horizontal" />
<SeekBar
android:id="@+id/resolutionh_seekbar"
android:id="@+id/resolutionvh_seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:gravity="center_vertical|left"
android:max="100"
android:progress="100" />
</TableRow>
<TableRow
android:layout_marginTop="5dp"
android:gravity="center_vertical" >
<TextView
android:id="@+id/resolutionv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:text="@string/resolution_vertical" />
<SeekBar
android:id="@+id/resolutionv_seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:gravity="center_vertical|left"
android:max="100"
android:progress="100" />
android:max="99"
android:progress="99" />
</TableRow>
<LinearLayout