update for V1.8

Bugfix
Show date in course of day header
This commit is contained in:
woheller69 2023-06-13 08:17:51 +02:00
parent 4752f96609
commit 23caf89c8e
6 changed files with 14 additions and 11 deletions

View file

@ -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) {

View file

@ -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();