File tree Expand file tree Collapse file tree 3 files changed +25
-6
lines changed
java/com/jumptuck/recipebrowser2/recipelist Expand file tree Collapse file tree 3 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ import com.jumptuck.recipebrowser2.settings.RecipeDeleteAllDialogBuilder
2020import kotlinx.android.synthetic.main.activity_main.*
2121import kotlinx.android.synthetic.main.custom_action_bar_layout.view.*
2222import timber.log.Timber
23+ import java.text.SimpleDateFormat
24+ import java.util.*
25+ import kotlin.collections.ArrayList
2326
2427class RecipeListFragment : Fragment () {
2528 lateinit var recipeListViewModel: RecipeListViewModel
@@ -122,9 +125,17 @@ class RecipeListFragment : Fragment() {
122125 /* * Set last_refresh date in nav drawer header **/
123126 RecipeRepository .lastRefresh.observe(viewLifecycleOwner, Observer {
124127 it?.let {
128+ val timestamp = RecipeRepository .lastRefresh.value
129+ val stringTime: String
130+ if (timestamp == 0L ) { stringTime = getString(R .string.last_refresh_never) }
131+ else {
132+ stringTime =
133+ SimpleDateFormat (" MM/dd/yy hh:mma" )
134+ .format(timestamp)
135+ }
125136 val navigationView = requireActivity().findViewById<NavigationView >(R .id.navView)
126137 navigationView
127- .findViewById<TextView >(R .id.last_refresh ).text = RecipeRepository .lastRefresh.value.toString()
138+ .findViewById<TextView >(R .id.last_refresh_value ).text = stringTime
128139 }
129140 })
130141
Original file line number Diff line number Diff line change 4545 android : layout_width =" match_parent"
4646 android : layout_height =" wrap_content"
4747 android : layout_gravity =" bottom"
48- android : clickable =" true"
48+ android : paddingStart =" 16dp"
49+ android : paddingBottom =" 16dp"
4950 android : orientation =" vertical" >
5051
5152 <TextView
52- android : id =" @+id/last_refresh "
53+ android : id =" @+id/last_refresh_title "
5354 android : layout_width =" match_parent"
54- android : layout_height =" 48dp"
55- android : gravity =" center"
56- android : text =" Last Refresh" />
55+ android : layout_height =" 22dp"
56+ android : gravity =" start"
57+ android : text =" @string/nav_drawer_footer_last_refresh" />
58+ <TextView
59+ android : id =" @+id/last_refresh_value"
60+ android : layout_width =" match_parent"
61+ android : layout_height =" 22dp"
62+ android : gravity =" start" />
5763 </LinearLayout >
5864 </com .google.android.material.navigation.NavigationView>
5965
Original file line number Diff line number Diff line change 5050 <string name =" nav_header_icon_description" >Pie slice icon</string >
5151 <string name =" nav_header_title" >Recipe\nBrowser</string >
5252 <string name =" refresh_action_force" >Force Refresh</string >
53+ <string name =" nav_drawer_footer_last_refresh" >Last Refresh:</string >
54+ <string name =" last_refresh_never" >Never</string >
5355
5456 <plurals name =" numberOfRecipes" >
5557 <item quantity =" one" >%d Recipe</item >
You can’t perform that action at this time.
0 commit comments