]> git.ktnx.net Git - mobile-ledger.git/commitdiff
add two more limit options for the future date entry limit - one and two weeks
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 20 Feb 2020 16:05:54 +0000 (18:05 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 20 Feb 2020 16:05:54 +0000 (18:05 +0200)
app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java
app/src/main/java/net/ktnx/mobileledger/ui/DatePickerFragment.java
app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java
app/src/main/res/menu/future_dates.xml
app/src/main/res/values-bg/strings.xml
app/src/main/res/values/strings.xml

index 5fbb5ba04c69061d7999fde0936a6215b61f4855..7dc4bbfcecc79fabf6e86a6883f9e1041993e442 100644 (file)
@@ -489,8 +489,8 @@ public final class MobileLedgerProfile {
         }
     }
     public enum FutureDates {
-        None(0), OneMonth(30), TwoMonths(60), ThreeMonths(90), SixMonths(180), OneYear(365),
-        All(-1);
+        None(0), OneWeek(7), TwoWeeks(14), OneMonth(30), TwoMonths(60), ThreeMonths(90),
+        SixMonths(180), OneYear(365), All(-1);
         private static SparseArray<FutureDates> map = new SparseArray<>();
 
         static {
@@ -511,6 +511,10 @@ public final class MobileLedgerProfile {
         }
         public String getText(Resources resources) {
             switch (value) {
+                case 7:
+                    return resources.getString(R.string.future_dates_7);
+                case 14:
+                    return resources.getString(R.string.future_dates_14);
                 case 30:
                     return resources.getString(R.string.future_dates_30);
                 case 60:
index cd69f7d83d7bfa2871965b95f5e7dc30202d7f3c..4c2721d46651119789a96686669d3d4d296d35d1 100644 (file)
@@ -97,6 +97,12 @@ public class DatePickerFragment extends AppCompatDialogFragment
                 case None:
                     // already there
                     break;
+                case OneWeek:
+                    dateLimit.add(Calendar.DAY_OF_MONTH, 7);
+                    break;
+                case TwoWeeks:
+                    dateLimit.add(Calendar.DAY_OF_MONTH, 14);
+                    break;
                 case OneMonth:
                     dateLimit.add(Calendar.MONTH, 1);
                     break;
index dc7fa9cd47f9a079b63c715f8373249c4e662454..1ca52ddd371c7a6e32ad05b664ed781e1afb47f4 100644 (file)
@@ -212,6 +212,12 @@ public class ProfileDetailFragment extends Fragment implements HueRingDialog.Hue
                    menu.inflate(R.menu.future_dates);
                    menu.setOnMenuItemClickListener(item -> {
                        switch (item.getItemId()) {
+                           case R.id.menu_future_dates_7:
+                               futureDates = MobileLedgerProfile.FutureDates.OneWeek;
+                               break;
+                           case R.id.menu_future_dates_14:
+                               futureDates = MobileLedgerProfile.FutureDates.TwoWeeks;
+                               break;
                            case R.id.menu_future_dates_30:
                                futureDates = MobileLedgerProfile.FutureDates.OneMonth;
                                break;
index b318395bd00bbe4b317f63ac7d29726e1d7cff2b..bf88dac1482220cd448a5d0fee50d04a1ff27558 100644 (file)
@@ -19,6 +19,8 @@
 <menu xmlns:android="http://schemas.android.com/apk/res/android">
 
     <item android:title="@string/future_dates_none" android:id="@+id/menu_future_dates_none"/>
+    <item android:title="@string/future_dates_7" android:id="@+id/menu_future_dates_7"/>
+    <item android:title="@string/future_dates_14" android:id="@+id/menu_future_dates_14"/>
     <item android:title="@string/future_dates_30" android:id="@+id/menu_future_dates_30"/>
     <item android:title="@string/future_dates_60" android:id="@+id/menu_future_dates_60"/>
     <item android:title="@string/future_dates_90" android:id="@+id/menu_future_dates_90"/>
index bf14594f55d56a590f16c9ec576d3873b1e07798..3f8c56cd7c2ac04431229925d16b8b2760236ad7 100644 (file)
     <string name="simulate_save_condensed_label">Симул. съхр.</string>
     <string name="simulation_label">СИМУЛАЦИЯ</string>
     <string name="future_dates_180">До шест месеца</string>
+    <string name="future_dates_7">До една седмица</string>
+    <string name="future_dates_14">До две седмици</string>
     <string name="future_dates_30">До един месец</string>
     <string name="future_dates_365">До една година</string>
     <string name="future_dates_60">До два месеца</string>
index cd216197974e226ecdf803b0cffa86a62c5f0113..97b40641ef0e7ab6feb9708965dc2df40d22246f 100644 (file)
     <string name="simulation_label">SIMULATION</string>
     <string name="profile_future_dates_label">Allow input of dates in the future</string>
     <string name="future_dates_none">No future dates are allowed</string>
+    <string name="future_dates_7">Up to a week</string>
+    <string name="future_dates_14">Up to two weeks</string>
     <string name="future_dates_30">Up to a month</string>
     <string name="future_dates_60">Up to two months</string>
     <string name="future_dates_90">Up to three months</string>