diff --git a/app/src/main/java/com/denizd/substitutionplan/FoodFragment.kt b/app/src/main/java/com/denizd/substitutionplan/FoodFragment.kt
index 21af750..df3b641 100644
--- a/app/src/main/java/com/denizd/substitutionplan/FoodFragment.kt
+++ b/app/src/main/java/com/denizd/substitutionplan/FoodFragment.kt
@@ -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)
diff --git a/app/src/main/java/com/denizd/substitutionplan/FragmentSettings.java b/app/src/main/java/com/denizd/substitutionplan/FragmentSettings.java
index 500b937..4cfce9e 100644
--- a/app/src/main/java/com/denizd/substitutionplan/FragmentSettings.java
+++ b/app/src/main/java/com/denizd/substitutionplan/FragmentSettings.java
@@ -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) +
diff --git a/app/src/main/java/com/denizd/substitutionplan/MainActivity.java b/app/src/main/java/com/denizd/substitutionplan/MainActivity.java
index 4cf8e99..10e8f91 100644
--- a/app/src/main/java/com/denizd/substitutionplan/MainActivity.java
+++ b/app/src/main/java/com/denizd/substitutionplan/MainActivity.java
@@ -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();
diff --git a/app/src/main/res/layout/secret_dialog.xml b/app/src/main/res/layout/secret_dialog.xml
index 097aa58..d6ce8ca 100644
--- a/app/src/main/res/layout/secret_dialog.xml
+++ b/app/src/main/res/layout/secret_dialog.xml
@@ -30,15 +30,7 @@
android:textColor="?attr/colorText"
android:paddingStart="24dp"
android:paddingEnd="24dp"
- android:textSize="3dp"/>
-
-
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 41888ef..549ff21 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -88,7 +88,7 @@
Kein Entfall für dich
Auf diesem Gerät nicht unterstützt
Auf diesem Gerät automatisch aktiviert
- 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.
+ 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.
Oder kauf dir ein gutes Smartphone
Informationen bezüglich deines Gerätes
Suche online
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 1d712db..cef6d6a 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -17,4 +17,6 @@
#9e9e9e
#757575
+ #42000000
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 5685d29..562c7ed 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -100,7 +100,7 @@
Automatically enabled on your device
Information regarding your device
- 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.
+ 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.
Or, you know, buy a good device
Search online