Simon Hammer 3 жил өмнө
parent
commit
d1a8f5bc8d

+ 3 - 1
app/src/main/java/com/noahvogt/miniprojekt/ui/home/SettingsActivity.java

@@ -6,6 +6,8 @@ import androidx.appcompat.app.AppCompatActivity;
 
 import com.noahvogt.miniprojekt.R;
 
+import java.util.Objects;
+
 public class SettingsActivity extends AppCompatActivity {
 
     @Override
@@ -15,7 +17,7 @@ public class SettingsActivity extends AppCompatActivity {
 
         // below line is to change
         // the title of our action bar.
-        getSupportActionBar().setTitle("Settings");
+        Objects.requireNonNull(getSupportActionBar()).setTitle("Settings");
 
         // below line is used to check if
         // frame layout is empty or not.

+ 0 - 2
app/src/main/java/com/noahvogt/miniprojekt/ui/home/SettingsFragment.java

@@ -23,8 +23,6 @@ import androidx.appcompat.app.AlertDialog;
 import androidx.preference.Preference;
 import androidx.preference.PreferenceFragmentCompat;
 
-
-
 import com.noahvogt.miniprojekt.R;
 
 public class SettingsFragment extends PreferenceFragmentCompat {

+ 8 - 3
app/src/main/res/drawable/mail_write_icon.xml

@@ -1,4 +1,9 @@
-<vector android:height="468dp" android:viewportHeight="468.203"
-    android:viewportWidth="468.203" android:width="468dp" xmlns:android="http://schemas.android.com/apk/res/android">
-    <path android:fillColor="#FF000000" android:pathData="M439.618,175.913h-2.86l-46.092,-40.116l-25.694,25.691l33.289,28.957l-28.152,22.008l-136.007,99.741l-136.01,-99.747l-27.388,-20.575l32.799,-28.75v-48.941l-70.917,61.738h-4.001c-2.518,0 -4.563,2.045 -4.563,4.569v283.152c0,2.518 2.045,4.562 4.563,4.562h411.034c2.519,0 4.563,-2.045 4.563,-4.562V180.482C444.176,177.958 442.137,175.913 439.618,175.913zM407.642,431.663H60.556v-201.43l170.848,125.287c1.613,1.183 3.789,1.183 5.405,0l170.845,-125.287v201.43H407.642zM207.119,72.292h-55.502L234.663,0l83.052,72.297h-55.289l-27.763,-24.151L207.119,72.292zM130.71,218.639l-18.364,-15.356V81.589h229.521v5.87c-5.361,3.638 -11.39,8.292 -18.358,14.375v-1.882H130.71V218.639zM360.615,104.34l2.087,-2.093c4.078,-4.081 10.077,-5.042 15.09,-2.932l7.519,-7.521l11.36,11.36l-7.412,7.415c2.388,5.096 1.525,11.343 -2.695,15.555L274.59,238.104c-3.203,3.209 -7.601,4.45 -11.769,3.836c-13.045,9.174 -22.951,13.382 -26.137,10.189c-3.184,-3.18 1.022,-13.086 10.195,-26.131c-0.626,-4.164 0.627,-8.564 3.837,-11.766L350,114.938c-7.72,3.686 -22.308,13.837 -48.593,41.027c-1.714,1.631 -4.664,1.868 -6.49,0.106c-1.826,-1.761 -1.873,-4.666 -0.112,-6.487C338.415,104.496 353.333,101.884 360.615,104.34z"/>
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:height="468dp"
+    android:viewportHeight="468.203"
+    android:viewportWidth="468.203"
+    android:width="468dp">
+
+        <path android:fillColor="#FF000000"
+            android:pathData="M439.618,175.913h-2.86l-46.092,-40.116l-25.694,25.691l33.289,28.957l-28.152,22.008l-136.007,99.741l-136.01,-99.747l-27.388,-20.575l32.799,-28.75v-48.941l-70.917,61.738h-4.001c-2.518,0 -4.563,2.045 -4.563,4.569v283.152c0,2.518 2.045,4.562 4.563,4.562h411.034c2.519,0 4.563,-2.045 4.563,-4.562V180.482C444.176,177.958 442.137,175.913 439.618,175.913zM407.642,431.663H60.556v-201.43l170.848,125.287c1.613,1.183 3.789,1.183 5.405,0l170.845,-125.287v201.43H407.642zM207.119,72.292h-55.502L234.663,0l83.052,72.297h-55.289l-27.763,-24.151L207.119,72.292zM130.71,218.639l-18.364,-15.356V81.589h229.521v5.87c-5.361,3.638 -11.39,8.292 -18.358,14.375v-1.882H130.71V218.639zM360.615,104.34l2.087,-2.093c4.078,-4.081 10.077,-5.042 15.09,-2.932l7.519,-7.521l11.36,11.36l-7.412,7.415c2.388,5.096 1.525,11.343 -2.695,15.555L274.59,238.104c-3.203,3.209 -7.601,4.45 -11.769,3.836c-13.045,9.174 -22.951,13.382 -26.137,10.189c-3.184,-3.18 1.022,-13.086 10.195,-26.131c-0.626,-4.164 0.627,-8.564 3.837,-11.766L350,114.938c-7.72,3.686 -22.308,13.837 -48.593,41.027c-1.714,1.631 -4.664,1.868 -6.49,0.106c-1.826,-1.761 -1.873,-4.666 -0.112,-6.487C338.415,104.496 353.333,101.884 360.615,104.34z"/>
 </vector>

+ 7 - 5
app/src/main/res/layout/activity_main.xml

@@ -39,25 +39,27 @@
             android:id="@+id/addEmailButton"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="bottom|right"
-            android:layout_marginRight="20dp"
+            android:layout_gravity="bottom|end"
             android:layout_marginBottom="20dp"
+            android:layout_marginEnd="20dp"
+            android:layout_marginRight="20dp"
             android:onClick="onClick"
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
-            android:text="Add Email" />
+            android:text="@string/text_add_email" />
 
         <Button
             android:id="@+id/settingsButton"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_gravity="bottom|left"
+            android:layout_gravity="bottom|start"
             android:layout_marginLeft="20dp"
             android:layout_marginBottom="20dp"
             android:onClick="onClick"
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
-            android:text="Settings" />
+            android:text="@string/text_settings"
+            android:layout_marginStart="20dp" />
     </com.google.android.material.navigation.NavigationView>
 
 

+ 1 - 2
app/src/main/res/layout/fragment_home.xml

@@ -7,7 +7,6 @@
     android:paddingRight="16dp"
     android:layout_gravity="top">
 
-    <!-- Add in TextView to display flower name   -->
     <TextView
         android:id="@+id/textView"
         android:layout_column="0"
@@ -44,7 +43,7 @@
         android:layout_height="wrap_content"
         android:layout_row="0"
         android:layout_column="3"
-        android:gravity="left" />
+        android:gravity="start" />
 
 
 </GridLayout>

+ 6 - 6
app/src/main/res/layout/message_create_fragment.xml

@@ -37,8 +37,8 @@
             android:layout_marginStart="8dp"
             android:layout_marginLeft="8dp"
             android:layout_toEndOf="@+id/create_message_close_button"
-            android:layout_toRightOf="@id/create_message_close_button"
-            android:text="Create Message"
+            android:layout_toRightOf="@+id/create_message_close_button"
+            android:text="@string/text_create_message"
             android:textColor="@android:color/white"
             android:textSize="20sp" />
 
@@ -124,7 +124,7 @@
             android:inputType="textEmailAddress"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:hint="From (Email)" />
+            android:hint="@string/hint_email_from" />
     </com.google.android.material.textfield.TextInputLayout>
 
             <com.google.android.material.textfield.TextInputLayout
@@ -145,7 +145,7 @@
                     android:inputType="textEmailAddress"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:hint="To (Email)" />
+                    android:hint="@string/hint_email_to" />
             </com.google.android.material.textfield.TextInputLayout>
 
     <com.google.android.material.textfield.TextInputLayout
@@ -169,7 +169,7 @@
             android:inputType="textEmailSubject"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:hint="Subject" />
+            android:hint="@string/hint_subject" />
     </com.google.android.material.textfield.TextInputLayout>
 
     <com.google.android.material.textfield.TextInputLayout
@@ -194,7 +194,7 @@
             android:layout_height="wrap_content"
             android:minHeight="160dp"
             android:textAlignment="viewStart"
-            android:hint="Message ..."
+            android:hint="@string/hint_message"
             android:inputType="textMultiLine"
             android:gravity="start" />
     </com.google.android.material.textfield.TextInputLayout>

+ 6 - 6
app/src/main/res/layout/popup.xml

@@ -12,7 +12,7 @@
         android:layout_height="150dp"
         android:background="@drawable/ic_baseline_face_24"
 
-        android:contentDescription="face icon"
+        android:contentDescription="@string/face_icon"
 
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
@@ -32,7 +32,7 @@
 
         android:layout_marginTop="16dp"
         android:layout_marginBottom="16dp"
-        android:text="Save"
+        android:text="@string/text_save"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintHorizontal_bias="0.133"
@@ -51,7 +51,7 @@
 
         android:layout_marginRight="16dp"
         android:layout_marginBottom="16dp"
-        android:text="Cancel"
+        android:text="@string/text_cancel"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintHorizontal_bias="0.831"
@@ -72,7 +72,7 @@
         android:layout_marginRight="32dp"
         android:layout_marginBottom="3dp"
 
-        android:hint="Your Name"
+        android:hint="@string/hint_your_name"
         app:startIconDrawable="@drawable/ic_person"
         app:counterEnabled="true"
         app:counterMaxLength="50"
@@ -103,7 +103,7 @@
         android:layout_marginRight="32dp"
         android:layout_marginBottom="3dp"
 
-        android:hint="Your Email Address"
+        android:hint="@string/hint_your_email_address"
         app:startIconDrawable="@drawable/ic_mail_outline"
 
         app:layout_constraintEnd_toEndOf="parent"
@@ -131,7 +131,7 @@
         android:layout_marginRight="32dp"
         android:layout_marginBottom="3dp"
 
-        android:hint="Your Password"
+        android:hint="@string/hint_your_password"
         app:startIconDrawable="@drawable/ic_lock"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"

+ 4 - 4
app/src/main/res/menu/create_message_options_menu.xml

@@ -2,12 +2,12 @@
 <menu xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item android:id="@+id/create_message_item_1"
-        android:title="Item 1"/>
+        android:title="@string/title_item_1"/>
     <item android:id="@+id/create_message_item_2"
-        android:title="Item 2"/>
+        android:title="@string/title_item_2"/>
     <item android:id="@+id/create_message_item_3"
-        android:title="Item 3"/>
+        android:title="@string/title_item_3"/>
     <item android:id="@+id/create_message_item_4"
-        android:title="Item 4"/>
+        android:title="@string/title_item_4"/>
 
 </menu>

+ 23 - 59
app/src/main/res/values/strings.xml

@@ -20,65 +20,29 @@
     <string name="Beginn">E-mail Beginn</string>
     <string name="date">22. Apr.</string>
 
-
-    <string name="remind_to_take_a_break">Remind me to take a break</string>
-    <string name="key_upload_quality">key_upload_quality</string>
-    <string name="remind_me">Remind me to take a break</string>
-    <string name="remind_me_for_bed_time">remind_me_for_bed_time</string>
-    <string name="remind_for_bed_time">Remind me for bed time</string>
-    <string name="limit_data_usage">prefs_limit_data_usage</string>
-    <string name="stream_video">Only stream HD video on Wi-Fi</string>
-    <string name="limit_mobile_usage">Limit mobile data usage</string>
-    <string name="double_tap_to_seek">Double-tap to seek</string>
-    <string name="pref_seek_val">pref_seek_val</string>
-    <string name="seconds">seconds</string>
-    <string name="uploads">Uploads</string>
-    <string name="pref_uploads">pref_uploads</string>
-    <string name="specify_network_prefs">Specify network preferences for uploads</string>
-    <string name="prefs_restricted_mode">prefs_restricted_mode</string>
-    <string name="restricated_mode">Restricted Mode can help to hide videos with potentially mature content.No filter is 100% accurate, but it should help you to avoid most of this type of content.</string>
-    <string name="restricated_mode_description">Restricted Mode</string>
-    <string name="prefs_enable_stats">prefs_enable_stats</string>
-    <string name="enable_stats">Enable stats for nerds</string>
-
-    <string-array name="pref_upload_quality_entries">
-        <item>360p</item>
-        <item>480p</item>
-        <item>720p</item>
-        <item>1080p</item>
-        <item>Original</item>
-    </string-array>
-
-    <string-array name="pref_remind_me_to_take_a_break">
-        <item>1 hours</item>
-        <item>2 hours</item>
-        <item>3 hours</item>
-        <item>5 hours</item>
-        <item>10 hours</item>
-    </string-array>
-
-    <string-array name="pref_seek_values">
-        <item>5</item>
-        <item>10</item>
-        <item>15</item>
-        <item>20</item>
-        <item>30</item>
-    </string-array>
-
-    <string-array name="pref_duration">
-        <item>0</item>
-        <item>1</item>
-        <item>2</item>
-        <item>3</item>
-        <item>4</item>
-    </string-array>
-
-    <string-array name="pref_uploads">
-        <item>Only when on Wi-Fi</item>
-        <item>On any network</item>
-    </string-array>
-
-
+    <!--  Text  -->
+    <string name="text_add_email">Add Email</string>
+    <string name="text_settings">Settings</string>
+    <string name="text_save">Save</string>
+    <string name="text_cancel">Cancel</string>
+    <string name="text_create_message">Create Message</string>
+
+    <!--  hint -->
+    <string name="hint_email_from">From (Email)</string>
+    <string name="hint_email_to">To (Email)</string>
+    <string name="hint_subject">Subject</string>
+    <string name="hint_message">Message …</string>
+    <string name="hint_your_name">Your Name</string>
+    <string name="hint_your_email_address">Your Email Address</string>
+    <string name="hint_your_password">Your Password</string>
+
+    <string name="face_icon">face icon</string>
+
+    <!-- Titles -->
+    <string name="title_item_1">Item 1</string>
+    <string name="title_item_2">Item 2</string>
+    <string name="title_item_3">Item 3</string>
+    <string name="title_item_4">Item 4</string>
 
 </resources>
 

+ 64 - 0
app/src/main/res/values/stringsSettings.xml

@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <string name="remind_to_take_a_break">Remind me to take a break</string>
+    <string name="key_notification">notification</string>
+    <string name="key_upload_quality">key_upload_quality</string>
+    <string name="remind_me">Remind me to take a break</string>
+    <string name="remind_me_for_bed_time">remind_me_for_bed_time</string>
+    <string name="remind_for_bed_time">Remind me for bed time</string>
+    <string name="limit_data_usage">prefs_limit_data_usage</string>
+    <string name="stream_video">Only stream HD video on Wi-Fi</string>
+    <string name="limit_mobile_usage">Limit mobile data usage</string>
+    <string name="double_tap_to_seek">Double-tap to seek</string>
+    <string name="pref_seek_val">pref_seek_val</string>
+    <string name="seconds">seconds</string>
+    <string name="uploads">Uploads</string>
+    <string name="pref_uploads">pref_uploads</string>
+    <string name="specify_network_prefs">Specify network preferences for uploads</string>
+    <string name="prefs_restricted_mode">prefs_restricted_mode</string>
+    <string name="restricated_mode">Restricted Mode can help to hide videos with potentially mature content.No filter is 100% accurate, but it should help you to avoid most of this type of content.</string>
+    <string name="restricated_mode_description">Restricted Mode</string>
+    <string name="prefs_enable_stats">prefs_enable_stats</string>
+    <string name="enable_stats">Enable stats for nerds</string>
+    <string name="enable_message_notification">Enable Message notifications</string>
+
+    <string-array name="pref_upload_quality_entries">
+        <item>360p</item>
+        <item>480p</item>
+        <item>720p</item>
+        <item>1080p</item>
+        <item>Original</item>
+    </string-array>
+
+    <string-array name="pref_remind_me_to_take_a_break">
+        <item>1 hours</item>
+        <item>2 hours</item>
+        <item>3 hours</item>
+        <item>5 hours</item>
+        <item>10 hours</item>
+    </string-array>
+
+    <string-array name="pref_seek_values">
+        <item>5</item>
+        <item>10</item>
+        <item>15</item>
+        <item>20</item>
+        <item>30</item>
+    </string-array>
+
+    <string-array name="pref_duration">
+        <item>0</item>
+        <item>1</item>
+        <item>2</item>
+        <item>3</item>
+        <item>4</item>
+    </string-array>
+
+    <string-array name="pref_uploads">
+        <item>Only when on Wi-Fi</item>
+        <item>On any network</item>
+    </string-array>
+
+
+</resources>

+ 5 - 1
app/src/main/res/xml/settings.xml

@@ -2,6 +2,10 @@
 <PreferenceScreen
     xmlns:android="http://schemas.android.com/apk/res/android">
 
+    <SwitchPreferenceCompat
+        android:key="@string/key_notification"
+        android:title="@string/enable_message_notification"/>
+
 
     <PreferenceCategory android:title="General">
 
@@ -14,7 +18,7 @@
         android:summary="@string/remind_me"
         android:title="@string/remind_me" />
 
-    <SwitchPreference
+    <SwitchPreferenceCompat
         android:defaultValue="false"
         android:key="@string/remind_me_for_bed_time"
         android:title="@string/remind_for_bed_time" />