mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-12 14:16:58 -04:00
Remove duplicate settings Activity
This commit is contained in:
parent
80261db3ac
commit
ab662dbbce
@ -62,12 +62,6 @@
|
|||||||
android:screenOrientation="sensorLandscape"
|
android:screenOrientation="sensorLandscape"
|
||||||
android:name=".prefs.LauncherPreferenceActivity"
|
android:name=".prefs.LauncherPreferenceActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"/>
|
android:configChanges="keyboardHidden|orientation|screenSize"/>
|
||||||
|
|
||||||
<activity
|
|
||||||
android:screenOrientation="sensorLandscape"
|
|
||||||
android:name=".prefs.PojavPreferenceActivity"
|
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"/>
|
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
@ -672,7 +672,7 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
// mainIntent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
|
// mainIntent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
|
||||||
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
mainIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
mainIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
if (PojavPreferenceActivity.PREF_FREEFORM) {
|
if (LauncherPreferences.PREF_FREEFORM) {
|
||||||
DisplayMetrics dm = new DisplayMetrics();
|
DisplayMetrics dm = new DisplayMetrics();
|
||||||
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||||
|
|
||||||
|
@ -1023,8 +1023,8 @@ public class MainActivity extends AppCompatActivity implements OnTouchListener,
|
|||||||
|
|
||||||
private Button findButton(int id) {
|
private Button findButton(int id) {
|
||||||
Button button = (Button) findViewById(id);
|
Button button = (Button) findViewById(id);
|
||||||
button.setWidth((int) Tools.dpToPx(this, Tools.pxToDp(this, button.getWidth()) * PojavPreferenceActivity.PREF_BUTTONSIZE));
|
button.setWidth((int) Tools.dpToPx(this, Tools.pxToDp(this, button.getWidth()) * LauncherPreferences.PREF_BUTTONSIZE));
|
||||||
button.setHeight((int) Tools.dpToPx(this, Tools.pxToDp(this, button.getHeight()) * PojavPreferenceActivity.PREF_BUTTONSIZE));
|
button.setHeight((int) Tools.dpToPx(this, Tools.pxToDp(this, button.getHeight()) * LauncherPreferences.PREF_BUTTONSIZE));
|
||||||
button.setOnTouchListener(this);
|
button.setOnTouchListener(this);
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
@ -1,157 +0,0 @@
|
|||||||
package net.kdt.pojavlaunch.prefs;
|
|
||||||
|
|
||||||
import android.content.*;
|
|
||||||
import android.os.*;
|
|
||||||
import android.view.*;
|
|
||||||
import android.widget.*;
|
|
||||||
import android.widget.CompoundButton.*;
|
|
||||||
import android.widget.SeekBar.*;
|
|
||||||
import com.kdt.mcgui.app.*;
|
|
||||||
import java.lang.reflect.*;
|
|
||||||
import net.kdt.pojavlaunch.*;
|
|
||||||
|
|
||||||
public class PojavPreferenceActivity extends MineActivity implements OnCheckedChangeListener, OnSeekBarChangeListener
|
|
||||||
{
|
|
||||||
public static boolean PREF_FREEFORM = false;
|
|
||||||
public static boolean PREF_FORGETOF = false;
|
|
||||||
public static float PREF_BUTTONSIZE = 1.0f;
|
|
||||||
|
|
||||||
private SeekBar viewSeekControlSize;
|
|
||||||
private TextView viewSeekProgressControl;
|
|
||||||
private Switch viewSwitchFreeform, viewSwitchForgetOF;
|
|
||||||
private CheckBox viewCheckVTypeRelease, viewCheckVTypeSnapshot, viewCheckVTypeOldAlpha, viewCheckVTypeOldBeta;
|
|
||||||
|
|
||||||
private SharedPreferences mainPreference;
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.settings);
|
|
||||||
|
|
||||||
/* Unable to setting to PreferenceActivity:
|
|
||||||
*
|
|
||||||
* - Unable to set custom Views.
|
|
||||||
* - Having trouble setting.
|
|
||||||
*/
|
|
||||||
|
|
||||||
LauncherPreferences.loadPreferences();
|
|
||||||
|
|
||||||
mainPreference = getSharedPreferences("pojav_preferences", MODE_PRIVATE);
|
|
||||||
final SharedPreferences.Editor mainPrefEdit = mainPreference.edit();
|
|
||||||
|
|
||||||
// Control size
|
|
||||||
viewSeekControlSize = (SeekBar) findView(R.id.settings_seekbar_controlsize);
|
|
||||||
viewSeekProgressControl = (TextView) findView(R.id.setting_progressseek_control);
|
|
||||||
viewSeekControlSize.setMax(200);
|
|
||||||
viewSeekControlSize.setProgress((int) (PREF_BUTTONSIZE * 100));
|
|
||||||
viewSeekControlSize.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
|
|
||||||
private float currProgress = 1.0f;
|
|
||||||
@Override
|
|
||||||
public void onProgressChanged(SeekBar bar, int progress, boolean p3) {
|
|
||||||
currProgress = (float) progress / 100;
|
|
||||||
String progressStr = Float.toString(currProgress);
|
|
||||||
if (progressStr.length() == 3) progressStr = progressStr + "0";
|
|
||||||
viewSeekProgressControl.setText(currProgress + "/2.00");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStartTrackingTouch(SeekBar bar) {
|
|
||||||
// Unused
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStopTrackingTouch(SeekBar bar) {
|
|
||||||
mainPrefEdit.putFloat("controlSize", currProgress);
|
|
||||||
mainPrefEdit.commit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
viewSeekProgressControl.setText(((float) viewSeekControlSize.getProgress() / 100f) + "/2");
|
|
||||||
|
|
||||||
// Freeform mode
|
|
||||||
viewSwitchFreeform = (Switch) findView(R.id.settings_switch_enablefreeform);
|
|
||||||
viewSwitchFreeform.setChecked(PREF_FREEFORM);
|
|
||||||
viewSwitchFreeform.setEnabled(Build.VERSION.SDK_INT >= 24);
|
|
||||||
|
|
||||||
// Forget OptiFine path
|
|
||||||
viewSwitchForgetOF = (Switch) findView(R.id.settings_switch_forgetoptifpath);
|
|
||||||
viewSwitchForgetOF.setChecked(PREF_FORGETOF);
|
|
||||||
|
|
||||||
viewCheckVTypeRelease = (CheckBox) findView(R.id.settings_checkbox_vertype_release);
|
|
||||||
viewCheckVTypeSnapshot = (CheckBox) findView(R.id.settings_checkbox_vertype_snapshot);
|
|
||||||
viewCheckVTypeOldAlpha = (CheckBox) findView(R.id.settings_checkbox_vertype_oldalpha);
|
|
||||||
viewCheckVTypeOldBeta = (CheckBox) findView(R.id.settings_checkbox_vertype_oldbeta);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
super.onBackPressed();
|
|
||||||
LauncherPreferences.loadPreferences();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton btn, boolean isChecked) {
|
|
||||||
String prefName = null;
|
|
||||||
switch (btn.getId()) {
|
|
||||||
case R.id.settings_switch_enablefreeform:
|
|
||||||
|
|
||||||
prefName = "freeform";
|
|
||||||
break;
|
|
||||||
case R.id.settings_switch_forgetoptifpath:
|
|
||||||
prefName = "forgetOptifinePath";
|
|
||||||
break;
|
|
||||||
case R.id.settings_checkbox_vertype_release:
|
|
||||||
prefName = "vertype_release";
|
|
||||||
break;
|
|
||||||
case R.id.settings_checkbox_vertype_snapshot:
|
|
||||||
prefName = "vertype_snapshot";
|
|
||||||
break;
|
|
||||||
case R.id.settings_checkbox_vertype_oldalpha:
|
|
||||||
prefName = "vertype_oldalpha";
|
|
||||||
break;
|
|
||||||
case R.id.settings_checkbox_vertype_oldbeta:
|
|
||||||
prefName = "vertype_oldbeta";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
mainPreference.edit()
|
|
||||||
.putBoolean(prefName, isChecked)
|
|
||||||
.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onProgressChanged(SeekBar p1, int p2, boolean p3) {
|
|
||||||
// Unused
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStartTrackingTouch(SeekBar bar) {
|
|
||||||
// Unused
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStopTrackingTouch(SeekBar bar) {
|
|
||||||
float currProgress = (float) bar.getProgress() / 100;
|
|
||||||
String progressStr = Float.toString(currProgress);
|
|
||||||
if (progressStr.length() == 3) progressStr = progressStr + "0";
|
|
||||||
|
|
||||||
try {
|
|
||||||
Field field = R.id.class.getDeclaredField(getId(bar.getId()).replace("seekbar", "progressseek"));
|
|
||||||
((TextView) findViewById((Integer) field.get(null))).setText(currProgress + "/" + bar.getMax());
|
|
||||||
} catch (Throwable th) {
|
|
||||||
throw new RuntimeException(th);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public View findView(int id) {
|
|
||||||
View view = findView(id);
|
|
||||||
if (view instanceof CompoundButton) {
|
|
||||||
((CompoundButton) view).setOnCheckedChangeListener(this);
|
|
||||||
}
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getId(int id) {
|
|
||||||
if (id == View.NO_ID) return "unknown";
|
|
||||||
else return getResources().getResourceEntryName(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,193 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<ScrollView
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_width="match_parent">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_margin="10dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:text="@string/mcl_setting_title_setmaxdxref"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="@string/mcl_setting_subtitle_setmaxdxref"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<SeekBar
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:id="@+id/settings_seekbar_setmaxdxref"
|
|
||||||
android:layout_weight="1.0"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="4600/65535"
|
|
||||||
android:id="@+id/setting_progressseek_maxdxref"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:background="?android:attr/dividerVertical"
|
|
||||||
android:layout_height="2dp"
|
|
||||||
android:layout_width="match_parent"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_margin="10dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="@string/mcl_setting_title_controlsize"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical">
|
|
||||||
|
|
||||||
<SeekBar
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:id="@+id/settings_seekbar_controlsize"
|
|
||||||
android:layout_weight="1.0"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="1/2"
|
|
||||||
android:id="@+id/setting_progressseek_control"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:background="?android:attr/dividerVertical"
|
|
||||||
android:layout_height="2dp"
|
|
||||||
android:layout_width="match_parent"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_margin="10dp">
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:id="@+id/settings_switch_enablefreeform"
|
|
||||||
android:text="@string/mcl_setting_title_freeform"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:background="?android:attr/dividerVertical"
|
|
||||||
android:layout_height="2dp"
|
|
||||||
android:layout_width="match_parent"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_margin="10dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="@string/mcl_setting_title_forgetoptifpath"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:id="@+id/settings_switch_forgetoptifpath"
|
|
||||||
android:text="@string/mcl_setting_subtitle_forgetoptifpath"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:background="?android:attr/dividerVertical"
|
|
||||||
android:layout_height="2dp"
|
|
||||||
android:layout_width="match_parent"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_margin="10dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="@string/mcl_setting_category_veroption"
|
|
||||||
android:textStyle="bold"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="@string/mcl_setting_veroption_release"
|
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:id="@+id/settings_checkbox_vertype_release"/>
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="@string/mcl_setting_veroption_snapshot"
|
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:id="@+id/settings_checkbox_vertype_snapshot"/>
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="@string/mcl_setting_veroption_oldalpha"
|
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:id="@+id/settings_checkbox_vertype_oldalpha"/>
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:text="@string/mcl_setting_veroption_oldbeta"
|
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:id="@+id/settings_checkbox_vertype_oldbeta"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user