Skip to content

Commit

Permalink
Add 5y range
Browse files Browse the repository at this point in the history
  • Loading branch information
premnirmal committed Jul 30, 2022
1 parent 921b8c4 commit 25ffa76
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ abstract class BaseGraphActivity<T : ViewBinding> : BaseActivity<T>() {
R.id.one_month -> range = Range.ONE_MONTH
R.id.three_month -> range = Range.THREE_MONTH
R.id.one_year -> range = Range.ONE_YEAR
R.id.five_years -> range = Range.FIVE_YEARS
R.id.max -> range = Range.MAX
}
fetchGraphData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.github.premnirmal.ticker.model

import com.github.premnirmal.ticker.components.Injector
import com.github.premnirmal.ticker.model.IHistoryProvider.Range
import com.github.premnirmal.ticker.model.IHistoryProvider.Range.Companion.FIVE_YEARS
import com.github.premnirmal.ticker.model.IHistoryProvider.Range.Companion.MAX
import com.github.premnirmal.ticker.model.IHistoryProvider.Range.Companion.ONE_DAY
import com.github.premnirmal.ticker.model.IHistoryProvider.Range.Companion.ONE_MONTH
Expand Down Expand Up @@ -103,6 +104,7 @@ class HistoryProvider : IHistoryProvider {
ONE_MONTH -> "1mo"
THREE_MONTH -> "3mo"
ONE_YEAR -> "1y"
FIVE_YEARS -> "5y"
MAX -> "max"
else -> "max"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ interface IHistoryProvider {
val ONE_MONTH = DateRange(Duration.ofDays(30))
val THREE_MONTH = DateRange(Duration.ofDays(90))
val ONE_YEAR = DateRange(Duration.ofDays(365))
val FIVE_YEARS = DateRange(Duration.ofDays(5 * 365))
val MAX = DateRange(Duration.ofDays(20 * 365))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class GraphActivity : BaseGraphActivity<ActivityGraphBinding>() {
Range.ONE_MONTH -> binding.oneMonth
Range.THREE_MONTH -> binding.threeMonth
Range.ONE_YEAR -> binding.oneYear
Range.FIVE_YEARS -> binding.fiveYears
Range.MAX -> binding.max
else -> throw UnsupportedOperationException("Range not supported")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class QuoteDetailActivity : BaseGraphActivity<ActivityQuoteDetailBinding>(), New
Range.ONE_MONTH -> binding.oneMonth
Range.THREE_MONTH -> binding.threeMonth
Range.ONE_YEAR -> binding.oneYear
Range.FIVE_YEARS -> binding.fiveYears
Range.MAX -> binding.max
else -> throw UnsupportedOperationException("Range not supported")
}
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout-land/activity_quote_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@
android:layout_height="wrap_content"
android:text="@string/one_year_short"/>

<com.google.android.material.chip.Chip
android:id="@+id/five_years"
style="@style/Widget.Chip.Chart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/five_years_short"/>

<com.google.android.material.chip.Chip
android:id="@+id/max"
style="@style/Widget.Chip.Chart"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@
android:layout_height="wrap_content"
android:text="@string/one_year_short"/>

<com.google.android.material.chip.Chip
android:id="@+id/five_years"
style="@style/Widget.Chip.Chart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/five_years_short"/>

<com.google.android.material.chip.Chip
android:id="@+id/max"
style="@style/Widget.Chip.Chart"
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/activity_graph.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@
android:layout_height="wrap_content"
android:text="@string/one_year_short"/>

<com.google.android.material.chip.Chip
android:id="@+id/five_years"
style="@style/Widget.Chip.Chart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/five_years_short"/>

<com.google.android.material.chip.Chip
android:id="@+id/max"
style="@style/Widget.Chip.Chart"
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/activity_quote_detail.xml
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@
android:layout_height="wrap_content"
android:text="@string/one_year_short"/>

<com.google.android.material.chip.Chip
android:id="@+id/five_years"
style="@style/Widget.Chip.Chart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/five_years_short"/>

<com.google.android.material.chip.Chip
android:id="@+id/max"
style="@style/Widget.Chip.Chart"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@
<string name="one_month">1 Monat</string>
<string name="three_month">3 Monate</string>
<string name="one_year">1 Jahr</string>
<string name="five_years">5 Jahre</string>
<string name="one_day_short">1D</string>
<string name="two_weeks_short">14D</string>
<string name="one_month_short">1M</string>
<string name="three_month_short">3M</string>
<string name="one_year_short">1Y</string>
<string name="five_years_short">5Y</string>
<string name="max">Max</string>
<string name="error_loading_graph">Fehler beim Laden des Diagramms</string>
<string name="widgets">Widgets</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,13 @@
<string name="one_month">1 mes</string>
<string name="three_month">3 meses</string>
<string name="one_year">1 año</string>
<string name="five_years">5 años</string>
<string name="one_day_short">1D</string>
<string name="two_weeks_short">2S</string>
<string name="one_month_short">1M</string>
<string name="three_month_short">3M</string>
<string name="one_year_short">1Y</string>
<string name="five_years_short">5Y</string>
<string name="max">Max</string>
<string name="error_loading_graph">Error al cargar los datos del gráfico</string>
<string name="widgets">Widgets</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,13 @@
<string name="one_month">1 mois</string>
<string name="three_month">3 mois</string>
<string name="one_year">1 an</string>
<string name="five_years">5 an</string>
<string name="one_day_short">1D</string>
<string name="two_weeks_short">14D</string>
<string name="one_month_short">1M</string>
<string name="three_month_short">3M</string>
<string name="one_year_short">1Y</string>
<string name="five_years_short">5Y</string>
<string name="max">Max</string>
<string name="error_loading_graph">Erreur de chargement du graphique</string>
<string name="widgets">Widgets</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,13 @@
<string name="one_month">1 Mese</string>
<string name="three_month">3 Mesi</string>
<string name="one_year">1 Anno</string>
<string name="five_years">5 Anno</string>
<string name="one_day_short">1G</string>
<string name="two_weeks_short">14D</string>
<string name="one_month_short">1M</string>
<string name="three_month_short">3M</string>
<string name="one_year_short">1A</string>
<string name="five_years_short">5A</string>
<string name="max">Massimo</string>
<string name="error_loading_graph">Errore caricamento grafico</string>
<string name="widgets">Widget</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@
<string name="one_month">1 Month</string>
<string name="three_month">3 Months</string>
<string name="one_year">1 Year</string>
<string name="five_years">5 Years</string>
<string name="one_day_short">1D</string>
<string name="two_weeks_short">2W</string>
<string name="one_month_short">1M</string>
<string name="three_month_short">3M</string>
<string name="one_year_short">1Y</string>
<string name="five_years_short">5Y</string>
<string name="max">Max</string>
<string name="error_loading_graph">Error loading graph</string>
<string name="widgets">Widgets</string>
Expand Down
4 changes: 2 additions & 2 deletions app/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# this file is purely for f-droid because it cannot infer the version name/code from the git tag
versionName=3.9.804
versionCode=300900004
versionName=3.9.805
versionCode=300900005

0 comments on commit 25ffa76

Please sign in to comment.