mirror of
https://github.com/woheller69/solxpect.git
synced 2026-01-31 06:25:15 +01:00
update for V1.8
Bugfix Show date in course of day header
This commit is contained in:
parent
4752f96609
commit
23caf89c8e
6 changed files with 14 additions and 11 deletions
|
|
@ -2,14 +2,12 @@ package org.woheller69.weather.ui.Help;
|
|||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import org.woheller69.weather.R;
|
||||
import org.woheller69.weather.preferences.AppPreferencesManager;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
|
|
@ -60,6 +58,12 @@ public final class StringFormatUtils {
|
|||
return df.format(time);
|
||||
}
|
||||
|
||||
public static String formatDate(long time) {
|
||||
java.text.DateFormat df = java.text.DateFormat.getDateInstance(DateFormat.SHORT);
|
||||
df.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
return df.format(time);
|
||||
}
|
||||
|
||||
public static Integer getDayShort(int day){
|
||||
|
||||
switch(day) {
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public class CourseOfDayAdapter extends RecyclerView.Adapter<CourseOfDayAdapter.
|
|||
HeaderTime.setTimeInMillis(courseOfDayList.get(visiblePosition).getLocalForecastTime(context));
|
||||
int headerday = HeaderTime.get(Calendar.DAY_OF_WEEK);
|
||||
headerday = StringFormatUtils.getDayLong(headerday);
|
||||
recyclerViewHeader.setText(context.getResources().getString(headerday));
|
||||
recyclerViewHeader.setText(context.getResources().getString(headerday) + " (" + StringFormatUtils.formatDate(courseOfDayList.get(visiblePosition).getLocalForecastTime(context)) + ")");
|
||||
|
||||
courseOfDayHeaderDate=HeaderTime.getTime();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue