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

Crash fix #97

Open
wants to merge 5 commits into
base: develop
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/.idea/kotlinc.xml
/.idea/deploymentTargetDropDown.xml
/.idea/assetWizardSettings.xml
.idea/
.DS_Store
/build
/captures
Expand Down
2 changes: 1 addition & 1 deletion .idea/compiler.xml

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

3 changes: 1 addition & 2 deletions .idea/gradle.xml

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

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
ext.firebaseUIVersion = "6.3.0"
ext.lifecycleVersion = "2.4.1"

def buildNumber = 449 //(System.getenv("TRAVIS_BUILD_NUMBER") ?: "1") as Integer
def buildNumber = 451 //(System.getenv("TRAVIS_BUILD_NUMBER") ?: "1") as Integer
def playTrack = System.getenv('PLAY_TRACK') ?: 'alpha'

def localProperties = new Properties()
Expand All @@ -20,7 +20,7 @@ android {
minSdkVersion 21
targetSdkVersion 34
versionCode buildNumber
versionName "2024.1"
versionName "2024.2"
resConfigs 'nl'
}

Expand Down
4 changes: 2 additions & 2 deletions app/lichtstad/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 449,
"versionName": "2024.1",
"versionCode": 450,
"versionName": "2024.2",
"outputFile": "app-lichtstad-release.apk"
}
],
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.WAKE_LOCK" />

<application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.program, menu);
updateFavoriteIcon(menu.findItem(R.id.show_favorites));
// Favorites are no longer supported due to permission conflict
// inflater.inflate(R.menu.program, menu);
// updateFavoriteIcon(menu.findItem(R.id.show_favorites));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,20 @@ public class ProgramFavoriteNotificationManager implements SharedPreferences.OnS
}

private void removeScheduledNotification(String dateAndKey) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(getNotificationPendingIntent(dateAndKey));
// AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
// alarmManager.cancel(getNotificationPendingIntent(dateAndKey));
}

private void addScheduledNotification(String dateAndKey, boolean reschedule) {
getProgram(context, dateAndKey, program -> {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
if (alarmManager == null || !shouldSchedule(program, reschedule) || !FavoriteManager.isFavorite(context, dateAndKey)) return;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, getAlarmTriggerMillis(program), getNotificationPendingIntent(dateAndKey));
} else {
alarmManager.setExact(AlarmManager.RTC_WAKEUP, getAlarmTriggerMillis(program), getNotificationPendingIntent(dateAndKey));
}
});
// getProgram(context, dateAndKey, program -> {
// AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
// if (alarmManager == null || !shouldSchedule(program, reschedule) || !FavoriteManager.isFavorite(context, dateAndKey)) return;
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, getAlarmTriggerMillis(program), getNotificationPendingIntent(dateAndKey));
// } else {
// alarmManager.setExact(AlarmManager.RTC_WAKEUP, getAlarmTriggerMillis(program), getNotificationPendingIntent(dateAndKey));
// }
// });
}

private long getAlarmTriggerMillis(Program program) {
Expand Down Expand Up @@ -112,8 +112,8 @@ public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
return;
}

Program program = new KeyedSnapshotParser<>(Program.class).parseSnapshot(dataSnapshot);
programUser.use(program);
// Program program = new KeyedSnapshotParser<>(Program.class).parseSnapshot(dataSnapshot);
// programUser.use(program);
}

@Override
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/res/layout/list_item_program.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,14 @@
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:button="@drawable/ic_favorite"
android:buttonTint="@color/toggle_favorite"
android:checked="@{safeUnbox(presenter.favoriteMap[program.key])}"
android:clickable="true"
android:contentDescription="@string/favorite_description"
android:focusable="true"
android:onClick="@{() -> presenter.onFavoriteClick(program)}"
android:button="@drawable/ic_favorite"
android:buttonTint="@color/toggle_favorite"
android:visibility="gone"
app:layout_minimumClickSize="@{@dimen/minimum_click_size}" />

<ImageView
Expand Down Expand Up @@ -144,4 +145,4 @@

</androidx.cardview.widget.CardView>
</FrameLayout>
</layout>
</layout>