2 * Copyright © 2021 Damyan Ivanov.
3 * This file is part of MoLe.
4 * MoLe is free software: you can distribute it and/or modify it
5 * under the term of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your opinion), any later version.
9 * MoLe is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License terms for details.
14 * You should have received a copy of the GNU General Public License
15 * along with MoLe. If not, see <https://www.gnu.org/licenses/>.
18 package net.ktnx.mobileledger.model;
20 import android.content.res.Resources;
21 import android.util.SparseArray;
23 import net.ktnx.mobileledger.R;
25 public enum FutureDates {
26 None(0), OneWeek(7), TwoWeeks(14), OneMonth(30), TwoMonths(60), ThreeMonths(90),
27 SixMonths(180), OneYear(365), All(-1);
28 private static final SparseArray<FutureDates> map = new SparseArray<>();
31 for (FutureDates item : FutureDates.values()) {
32 map.put(item.value, item);
36 private final int value;
37 FutureDates(int value) {
40 public static FutureDates valueOf(int i) {
41 return map.get(i, None);
46 public String getText(Resources resources) {
49 return resources.getString(R.string.future_dates_7);
51 return resources.getString(R.string.future_dates_14);
53 return resources.getString(R.string.future_dates_30);
55 return resources.getString(R.string.future_dates_60);
57 return resources.getString(R.string.future_dates_90);
59 return resources.getString(R.string.future_dates_180);
61 return resources.getString(R.string.future_dates_365);
63 return resources.getString(R.string.future_dates_all);
65 return resources.getString(R.string.future_dates_none);