Changed small things in Settings Fragment, release number: 1.2.4

This commit is contained in:
Deniz Düzgören
2019-05-01 18:14:21 +02:00
parent d690a2604a
commit 00c893380e
7 changed files with 137 additions and 124 deletions
@@ -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,7 +523,8 @@ 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()) {
case "@DIAGNOSTICS": {
AlertDialog.Builder alertDialogDev; AlertDialog.Builder alertDialogDev;
if (prefs.getInt("themeInt", 0) == 1) { if (prefs.getInt("themeInt", 0) == 1) {
alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomDark); alertDialogDev = new AlertDialog.Builder(getContext(), R.style.AlertDialogCustomDark);
@@ -556,11 +558,19 @@ public class FragmentSettings extends Fragment {
alertDialogDev.setView(dialogView); alertDialogDev.setView(dialogView);
alertDialogDev.show(); alertDialogDev.show();
} else if (dialogEditText.getText().toString().equals("2018-04-20")) { break;
Toast.makeText(getActivity(), "◢ ◤", }
case "2018-04-20":
Toast.makeText(getActivity(), getEmojiByUnicode(0x1F494),
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.youtube.com/watch?v=ynHYW1iTcq0")); // FTL
} else if (dialogEditText.getText().toString().equals("Q1 Matchmaker")) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setPackage("com.google.android.youtube");
startActivity(intent);
break;
case "Q1 Matchmaker": {
final Random gen = new Random(); final Random gen = new Random();
AlertDialog.Builder alertDialogDev; AlertDialog.Builder alertDialogDev;
if (prefs.getInt("themeInt", 0) == 1) { if (prefs.getInt("themeInt", 0) == 1) {
@@ -622,9 +632,12 @@ public class FragmentSettings extends Fragment {
alertDialogDev.setView(dialogView); alertDialogDev.setView(dialogView);
alertDialogDev.show(); alertDialogDev.show();
} else { break;
}
default:
Toast.makeText(getActivity(), getString(R.string.nothinghappened), Toast.makeText(getActivity(), getString(R.string.nothinghappened),
Toast.LENGTH_LONG).show(); 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();
+1 -9
View File
@@ -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>
+1 -1
View File
@@ -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>
+2
View File
@@ -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>
+1 -1
View File
@@ -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>