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 lateinit var recyclerView: RecyclerView
|
||||||
private val mAdapter = FoodAdapter(foodArrayList)
|
private val mAdapter = FoodAdapter(foodArrayList)
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
// override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
return inflater.inflate(R.layout.food_layout, null)
|
// return inflater.inflate(R.layout.food_layout, null)
|
||||||
}
|
// } // TODO do I need this?
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.denizd.substitutionplan;
|
package com.denizd.substitutionplan;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -522,109 +523,121 @@ public class FragmentSettings extends Fragment {
|
|||||||
dialogButton.setOnClickListener(new View.OnClickListener() {
|
dialogButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (dialogEditText.getText().toString().equals("@DEV_DIAGNOSTICS")) {
|
switch (dialogEditText.getText().toString()) {
|
||||||
AlertDialog.Builder alertDialogDev;
|
case "@DIAGNOSTICS": {
|
||||||
if (prefs.getInt("themeInt", 0) == 1) {
|
AlertDialog.Builder alertDialogDev;
|
||||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomDark);
|
if (prefs.getInt("themeInt", 0) == 1) {
|
||||||
} else {
|
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomDark);
|
||||||
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomLight);
|
} 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);
|
|
||||||
}
|
}
|
||||||
});
|
alertDialogDev.setTitle(getString(R.string.diagnosticsmenu));
|
||||||
notif.setOnClickListener(new View.OnClickListener() {
|
View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.diagnostics_dialog, null);
|
||||||
@Override
|
final TextView dialogText = dialogView.findViewById(R.id.dialogtext);
|
||||||
public void onClick(View v) {
|
setDiagnosticsText(dialogText, prefs);
|
||||||
edit.putInt("notificationTestNumberDev", 0);
|
Button launch = dialogView.findViewById(R.id.btnResetLaunch);
|
||||||
edit.apply();
|
Button notif = dialogView.findViewById(R.id.btnResetNotif);
|
||||||
setDiagnosticsText(dialogText, prefs);
|
launch.setOnClickListener(new View.OnClickListener() {
|
||||||
}
|
@Override
|
||||||
});
|
public void onClick(View v) {
|
||||||
|
edit.putInt("launchDev", 0);
|
||||||
|
edit.apply();
|
||||||
alertDialogDev.setView(dialogView);
|
setDiagnosticsText(dialogText, prefs);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
notif.setOnClickListener(new View.OnClickListener() {
|
||||||
alertDialogDev.setView(dialogView);
|
@Override
|
||||||
alertDialogDev.show();
|
public void onClick(View v) {
|
||||||
|
edit.putInt("notificationTestNumberDev", 0);
|
||||||
|
edit.apply();
|
||||||
|
setDiagnosticsText(dialogText, prefs);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
} else {
|
|
||||||
Toast.makeText(getActivity(), getString(R.string.nothinghappened),
|
alertDialogDev.setView(dialogView);
|
||||||
Toast.LENGTH_LONG).show();
|
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) {
|
private void setDiagnosticsText(TextView dialogText, SharedPreferences prefs) {
|
||||||
dialogText.setText("First Launch: " + prefs.getString("firstTimeDev", "") +
|
dialogText.setText("First Launch: " + prefs.getString("firstTimeDev", "") +
|
||||||
"\n\nApp launched: " + prefs.getInt("launchDev", 0) +
|
"\n\nApp launched: " + prefs.getInt("launchDev", 0) +
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
Window window = this.getWindow();
|
Window window = this.getWindow();
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
||||||
|
// window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
// window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
// window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
|
||||||
// window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, 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
|
@Override
|
||||||
public void onSlide(@NonNull View bottomSheet, float slideOffset) {
|
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);
|
TextView dialogText = dialogView.findViewById(R.id.dialogtext);
|
||||||
dialogText.setText(R.string.chinaDialog);
|
dialogText.setText(R.string.chinaDialog);
|
||||||
secretText.setText(R.string.orbuy);
|
secretText.setText(R.string.orbuy);
|
||||||
Button searchbtn = dialogView.findViewById(R.id.searchbtn);
|
// Button searchbtn = dialogView.findViewById(R.id.searchbtn);
|
||||||
searchbtn.setOnClickListener(new View.OnClickListener() {
|
// searchbtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
// @Override
|
||||||
public void onClick(View v) {
|
// public void onClick(View v) {
|
||||||
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
|
// Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
|
||||||
intent.putExtra(SearchManager.QUERY, marketName + " disable power optimisation");
|
// intent.putExtra(SearchManager.QUERY, marketName + " disable power optimisation");
|
||||||
startActivity(intent);
|
// startActivity(intent);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
alertDialog.setView(dialogView);
|
alertDialog.setView(dialogView);
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
|
|
||||||
|
|||||||
@@ -30,15 +30,7 @@
|
|||||||
android:textColor="?attr/colorText"
|
android:textColor="?attr/colorText"
|
||||||
android:paddingStart="24dp"
|
android:paddingStart="24dp"
|
||||||
android:paddingEnd="24dp"
|
android:paddingEnd="24dp"
|
||||||
android:textSize="3dp"/>
|
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:layout_marginBottom="24dp"/>
|
android:layout_marginBottom="24dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|||||||
@@ -88,7 +88,7 @@
|
|||||||
<string name="nosubst">Kein Entfall für dich</string>
|
<string name="nosubst">Kein Entfall für dich</string>
|
||||||
<string name="chinaNotif">Auf diesem Gerät nicht unterstützt</string>
|
<string name="chinaNotif">Auf diesem Gerät nicht unterstützt</string>
|
||||||
<string name="chinaAuto">Auf diesem Gerät automatisch aktiviert</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="orbuy">Oder kauf dir ein gutes Smartphone</string>
|
||||||
<string name="chinaTitle">Informationen bezüglich deines Gerätes</string>
|
<string name="chinaTitle">Informationen bezüglich deines Gerätes</string>
|
||||||
<string name="searchonline">Suche online</string>
|
<string name="searchonline">Suche online</string>
|
||||||
|
|||||||
@@ -17,4 +17,6 @@
|
|||||||
<color name="hint">#9e9e9e</color>
|
<color name="hint">#9e9e9e</color>
|
||||||
<color name="hintdark">#757575</color>
|
<color name="hintdark">#757575</color>
|
||||||
|
|
||||||
|
<color name="slighttransparency">#42000000</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -100,7 +100,7 @@
|
|||||||
<string name="chinaAuto">Automatically enabled on your device</string>
|
<string name="chinaAuto">Automatically enabled on your device</string>
|
||||||
|
|
||||||
<string name="chinaTitle">Information regarding 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="orbuy">Or, you know, buy a good device</string>
|
||||||
|
|
||||||
<string name="searchonline">Search online</string>
|
<string name="searchonline">Search online</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user