Archived
Changed small things in Settings Fragment, release number: 1.2.4
This commit is contained in:
@@ -18,9 +18,9 @@ class FoodFragment : Fragment(R.layout.food_layout) {
|
||||
private lateinit var recyclerView: RecyclerView
|
||||
private val mAdapter = FoodAdapter(foodArrayList)
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.food_layout, null)
|
||||
}
|
||||
// override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
// return inflater.inflate(R.layout.food_layout, null)
|
||||
// } // TODO do I need this?
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.denizd.substitutionplan;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
@@ -522,109 +523,121 @@ public class FragmentSettings extends Fragment {
|
||||
dialogButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (dialogEditText.getText().toString().equals("@DEV_DIAGNOSTICS")) {
|
||||
AlertDialog.Builder alertDialogDev;
|
||||
if (prefs.getInt("themeInt", 0) == 1) {
|
||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomDark);
|
||||
} else {
|
||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomLight);
|
||||
}
|
||||
alertDialogDev.setTitle(getString(R.string.diagnosticsmenu));
|
||||
View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.diagnostics_dialog, null);
|
||||
final TextView dialogText = dialogView.findViewById(R.id.dialogtext);
|
||||
setDiagnosticsText(dialogText, prefs);
|
||||
Button launch = dialogView.findViewById(R.id.btnResetLaunch);
|
||||
Button notif = dialogView.findViewById(R.id.btnResetNotif);
|
||||
launch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
edit.putInt("launchDev", 0);
|
||||
edit.apply();
|
||||
setDiagnosticsText(dialogText, prefs);
|
||||
switch (dialogEditText.getText().toString()) {
|
||||
case "@DIAGNOSTICS": {
|
||||
AlertDialog.Builder alertDialogDev;
|
||||
if (prefs.getInt("themeInt", 0) == 1) {
|
||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomDark);
|
||||
} else {
|
||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomLight);
|
||||
}
|
||||
});
|
||||
notif.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
edit.putInt("notificationTestNumberDev", 0);
|
||||
edit.apply();
|
||||
setDiagnosticsText(dialogText, prefs);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
alertDialogDev.setView(dialogView);
|
||||
alertDialogDev.show();
|
||||
|
||||
} else if (dialogEditText.getText().toString().equals("2018-04-20")) {
|
||||
Toast.makeText(getActivity(), "◢ ◤",
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
||||
} else if (dialogEditText.getText().toString().equals("Q1 Matchmaker")) {
|
||||
final Random gen = new Random();
|
||||
AlertDialog.Builder alertDialogDev;
|
||||
if (prefs.getInt("themeInt", 0) == 1) {
|
||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomDark);
|
||||
} else {
|
||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomLight);
|
||||
}
|
||||
alertDialogDev.setTitle(getString(R.string.dating));
|
||||
View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.dating_dialog, null);
|
||||
|
||||
Button datingBtn = dialogView.findViewById(R.id.dating_btn);
|
||||
final EditText boyT = dialogView.findViewById(R.id.dating_txt1);
|
||||
final EditText girlT = dialogView.findViewById(R.id.dating_txt2);
|
||||
final CheckBox boy = dialogView.findViewById(R.id.cb1);
|
||||
final CheckBox girl = dialogView.findViewById(R.id.cb2);
|
||||
final TextView percentage = dialogView.findViewById(R.id.dating_txtp);
|
||||
datingBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
double boyP = 0, girlP = 0, perc = 0;
|
||||
if (boyT.getText().toString().isEmpty() || boy.isChecked()) {
|
||||
boyT.setText(names.boy[gen.nextInt(names.boy.length)]);
|
||||
}
|
||||
if (girlT.getText().toString().isEmpty() || girl.isChecked()) {
|
||||
girlT.setText(names.girl[gen.nextInt(names.girl.length)]);
|
||||
}
|
||||
for (int i = 0; i < boyT.getText().length(); i++) {
|
||||
boyP++;
|
||||
}
|
||||
for (int i = 0; i < girlT.getText().length(); i++) {
|
||||
girlP++;
|
||||
}
|
||||
if (girlP < boyP) {
|
||||
perc = (girlP / boyP) * 100;
|
||||
}
|
||||
if (girlP > boyP) {
|
||||
perc = (boyP / girlP) * 100;
|
||||
}
|
||||
char multiplyTempBoy = boyT.getText().charAt(boyT.getText().length() - 1);
|
||||
char multiplyTempGirl = girlT.getText().charAt(girlT.getText().length() - 1);
|
||||
double multiply = Character.getNumericValue(multiplyTempBoy) + Character.getNumericValue(multiplyTempGirl);
|
||||
multiply = multiply / 1.2;
|
||||
if (perc == 0) {
|
||||
perc += 30;
|
||||
}
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
if (perc * (multiply / 40) > 100) {
|
||||
percentage.setText("100.00%");
|
||||
} else {
|
||||
percentage.setText(df.format(perc * (multiply / 40)) + "%");
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
Toast.makeText(getActivity(), getString(R.string.error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
alertDialogDev.setTitle(getString(R.string.diagnosticsmenu));
|
||||
View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.diagnostics_dialog, null);
|
||||
final TextView dialogText = dialogView.findViewById(R.id.dialogtext);
|
||||
setDiagnosticsText(dialogText, prefs);
|
||||
Button launch = dialogView.findViewById(R.id.btnResetLaunch);
|
||||
Button notif = dialogView.findViewById(R.id.btnResetNotif);
|
||||
launch.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
edit.putInt("launchDev", 0);
|
||||
edit.apply();
|
||||
setDiagnosticsText(dialogText, prefs);
|
||||
}
|
||||
}
|
||||
});
|
||||
alertDialogDev.setView(dialogView);
|
||||
alertDialogDev.show();
|
||||
});
|
||||
notif.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
edit.putInt("notificationTestNumberDev", 0);
|
||||
edit.apply();
|
||||
setDiagnosticsText(dialogText, prefs);
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
Toast.makeText(getActivity(), getString(R.string.nothinghappened),
|
||||
Toast.LENGTH_LONG).show();
|
||||
|
||||
alertDialogDev.setView(dialogView);
|
||||
alertDialogDev.show();
|
||||
|
||||
break;
|
||||
}
|
||||
case "2018-04-20":
|
||||
Toast.makeText(getActivity(), getEmojiByUnicode(0x1F494),
|
||||
Toast.LENGTH_LONG).show();
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=ynHYW1iTcq0")); // FTL
|
||||
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
intent.setPackage("com.google.android.youtube");
|
||||
startActivity(intent);
|
||||
|
||||
break;
|
||||
case "Q1 Matchmaker": {
|
||||
final Random gen = new Random();
|
||||
AlertDialog.Builder alertDialogDev;
|
||||
if (prefs.getInt("themeInt", 0) == 1) {
|
||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomDark);
|
||||
} else {
|
||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomLight);
|
||||
}
|
||||
alertDialogDev.setTitle(getString(R.string.dating));
|
||||
View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.dating_dialog, null);
|
||||
|
||||
Button datingBtn = dialogView.findViewById(R.id.dating_btn);
|
||||
final EditText boyT = dialogView.findViewById(R.id.dating_txt1);
|
||||
final EditText girlT = dialogView.findViewById(R.id.dating_txt2);
|
||||
final CheckBox boy = dialogView.findViewById(R.id.cb1);
|
||||
final CheckBox girl = dialogView.findViewById(R.id.cb2);
|
||||
final TextView percentage = dialogView.findViewById(R.id.dating_txtp);
|
||||
datingBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
double boyP = 0, girlP = 0, perc = 0;
|
||||
if (boyT.getText().toString().isEmpty() || boy.isChecked()) {
|
||||
boyT.setText(names.boy[gen.nextInt(names.boy.length)]);
|
||||
}
|
||||
if (girlT.getText().toString().isEmpty() || girl.isChecked()) {
|
||||
girlT.setText(names.girl[gen.nextInt(names.girl.length)]);
|
||||
}
|
||||
for (int i = 0; i < boyT.getText().length(); i++) {
|
||||
boyP++;
|
||||
}
|
||||
for (int i = 0; i < girlT.getText().length(); i++) {
|
||||
girlP++;
|
||||
}
|
||||
if (girlP < boyP) {
|
||||
perc = (girlP / boyP) * 100;
|
||||
}
|
||||
if (girlP > boyP) {
|
||||
perc = (boyP / girlP) * 100;
|
||||
}
|
||||
char multiplyTempBoy = boyT.getText().charAt(boyT.getText().length() - 1);
|
||||
char multiplyTempGirl = girlT.getText().charAt(girlT.getText().length() - 1);
|
||||
double multiply = Character.getNumericValue(multiplyTempBoy) + Character.getNumericValue(multiplyTempGirl);
|
||||
multiply = multiply / 1.2;
|
||||
if (perc == 0) {
|
||||
perc += 30;
|
||||
}
|
||||
DecimalFormat df = new DecimalFormat("#.##");
|
||||
if (perc * (multiply / 40) > 100) {
|
||||
percentage.setText("100.00%");
|
||||
} else {
|
||||
percentage.setText(df.format(perc * (multiply / 40)) + "%");
|
||||
}
|
||||
} catch (NullPointerException e) {
|
||||
Toast.makeText(getActivity(), getString(R.string.error),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
alertDialogDev.setView(dialogView);
|
||||
alertDialogDev.show();
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Toast.makeText(getActivity(), getString(R.string.nothinghappened),
|
||||
Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -635,6 +648,10 @@ public class FragmentSettings extends Fragment {
|
||||
});
|
||||
}
|
||||
|
||||
private String getEmojiByUnicode(int unicode){
|
||||
return new String(Character.toChars(unicode));
|
||||
}
|
||||
|
||||
private void setDiagnosticsText(TextView dialogText, SharedPreferences prefs) {
|
||||
dialogText.setText("First Launch: " + prefs.getString("firstTimeDev", "") +
|
||||
"\n\nApp launched: " + prefs.getInt("launchDev", 0) +
|
||||
|
||||
@@ -102,6 +102,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
Window window = this.getWindow();
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||
// window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
// window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||
|
||||
@@ -130,7 +131,8 @@ public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
|
||||
|
||||
// bottomSheetCloser.setVisibility(View.VISIBLE);
|
||||
// bottomSheetCloser.setAlpha(slideOffset);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -181,15 +183,15 @@ public class MainActivity extends AppCompatActivity {
|
||||
TextView dialogText = dialogView.findViewById(R.id.dialogtext);
|
||||
dialogText.setText(R.string.chinaDialog);
|
||||
secretText.setText(R.string.orbuy);
|
||||
Button searchbtn = dialogView.findViewById(R.id.searchbtn);
|
||||
searchbtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
|
||||
intent.putExtra(SearchManager.QUERY, marketName + " disable power optimisation");
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
// Button searchbtn = dialogView.findViewById(R.id.searchbtn);
|
||||
// searchbtn.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
|
||||
// intent.putExtra(SearchManager.QUERY, marketName + " disable power optimisation");
|
||||
// startActivity(intent);
|
||||
// }
|
||||
// });
|
||||
alertDialog.setView(dialogView);
|
||||
alertDialog.show();
|
||||
|
||||
|
||||
@@ -30,15 +30,7 @@
|
||||
android:textColor="?attr/colorText"
|
||||
android:paddingStart="24dp"
|
||||
android:paddingEnd="24dp"
|
||||
android:textSize="3dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/searchbtn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/searchonline"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:textSize="3dp"
|
||||
android:layout_marginBottom="24dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
<string name="nosubst">Kein Entfall für dich</string>
|
||||
<string name="chinaNotif">Auf diesem Gerät nicht unterstützt</string>
|
||||
<string name="chinaAuto">Auf diesem Gerät automatisch aktiviert</string>
|
||||
<string name="chinaDialog">Einige chinesische Hersteller, wie Huawei/Honor und Xiaomi, unterdrücken Hintergrund-Services, weshalb Benachrichtungen und Hintergrund-Synchronisation nicht funktionieren.\n\nIch habe feststellen müssen, dass es keine einfache Lösung dafür gibt, die ich einbauen könnte.\n\nStattdessen kannst du jedoch versuchen, App-Optimierungen für diese App zu deaktivieren. Der Knopf bringt eine Google-Suche für das Problem auf, folge bitte einem der Links.</string>
|
||||
<string name="chinaDialog">Einige chinesische Hersteller, wie Huawei/Honor und Xiaomi, unterdrücken Hintergrund-Services, weshalb Benachrichtungen und Hintergrund-Synchronisation nicht funktionieren.\n\nIch habe feststellen müssen, dass es keine einfache Lösung dafür gibt, die ich einbauen könnte.\n\nStattdessen kannst du jedoch versuchen, App-Optimierungen für diese App zu deaktivieren:\n\nSchließe die App und öffne \"Einstellungen\" -> \"Apps\" -> \"AvH-Plan\" -> \"Akku\" -> \"App-Start\" -> \"Automatisch verwalten\" deaktivieren, \"Im Hintergrund ausführen\" aktivieren.\n\nDies kann unter Umständen keinen Einfluss haben.</string>
|
||||
<string name="orbuy">Oder kauf dir ein gutes Smartphone</string>
|
||||
<string name="chinaTitle">Informationen bezüglich deines Gerätes</string>
|
||||
<string name="searchonline">Suche online</string>
|
||||
|
||||
@@ -17,4 +17,6 @@
|
||||
<color name="hint">#9e9e9e</color>
|
||||
<color name="hintdark">#757575</color>
|
||||
|
||||
<color name="slighttransparency">#42000000</color>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<string name="chinaAuto">Automatically enabled on your device</string>
|
||||
|
||||
<string name="chinaTitle">Information regarding your device</string>
|
||||
<string name="chinaDialog">Some Chinese manufacturers, such as Huawei/Honor and Xiaomi, heavily suppress background services, which results in notifications and background synchronisation not working.\n\nFrom my current research, I have determined that there\'s no easy workaround I can implement.\n\nYou can, however, try to disable power optimisation for this app in the settings. Click the button to be directed to a search and follow the instructions provided by one of the results.</string>
|
||||
<string name="chinaDialog">Some Chinese manufacturers, such as Huawei/Honor and Xiaomi, heavily suppress background services, which results in notifications and background synchronisation not working.\n\nFrom my current research, I have determined that there\'s no easy workaround I can implement.\n\nYou can, however, try to disable power optimisation for this app in the settings:\n\nClose the app and open \"Settings\" -> \"Apps\" -> \"AvH Plan\" -> \"Battery\" -> \"Launch\" -> disable \"Manage automatically\", enable \"Run in background\"\n\nThis is not guaranteed to work.</string>
|
||||
<string name="orbuy">Or, you know, buy a good device</string>
|
||||
|
||||
<string name="searchonline">Search online</string>
|
||||
|
||||
Reference in New Issue
Block a user