Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repaired mess menu widget for homescreen.. now updating every 30 mins. #306

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

8 changes: 8 additions & 0 deletions app/src/main/java/app/insti/widget/MessMenuWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.widget.RemoteViews;

import androidx.annotation.RequiresApi;

import java.time.OffsetTime;
import java.util.Calendar;
import java.util.List;

Expand Down Expand Up @@ -70,6 +74,7 @@ private void displayMenu(String hostel) {
displayMessMenu(hostelMessMenu);
}

@RequiresApi(api = Build.VERSION_CODES.O)
private void displayMessMenu(HostelMessMenu hostelMessMenu) {
MessMenu todaysMenu = hostelMessMenu.getSortedMessMenus().get(0);

Expand All @@ -78,6 +83,9 @@ private void displayMessMenu(HostelMessMenu hostelMessMenu) {
Calendar calendar = Calendar.getInstance();
int hourOfDay = calendar.get(Calendar.HOUR_OF_DAY);
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
OffsetTime offset = OffsetTime.now();

hourOfDay = offset.getHour();

// TODO: Consider moving to a separate Meal class
String mealType;
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/mess_menu_widget_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
android:minHeight="110dp"
android:previewImage="@mipmap/ic_launcher_foreground"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="86400000"
android:updatePeriodMillis="1800000"
android:widgetCategory="home_screen|keyguard" />