Hoofdscherm opgeruimd: machtigingen-sectie verwijderd (systeem regelt dit), korte informatietekst

This commit is contained in:
eddy 2026-10-14 20:14:19 +02:00
commit 23eae6e428
2 changed files with 1 additions and 99 deletions

View file

@ -4,11 +4,8 @@ import android.Manifest
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.PowerManager
import android.provider.Settings
import android.widget.EditText import android.widget.EditText
import android.widget.TextView import android.widget.TextView
import android.widget.Toast import android.widget.Toast
@ -42,19 +39,6 @@ class MainActivity : AppCompatActivity() {
} }
findViewById<MaterialButton>(R.id.btn_save).setOnClickListener { saveSettings() } findViewById<MaterialButton>(R.id.btn_save).setOnClickListener { saveSettings() }
findViewById<MaterialButton>(R.id.btn_perm_notifications).setOnClickListener {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED
) {
requestPermissions(arrayOf(Manifest.permission.POST_NOTIFICATIONS), REQ_NOTIFICATIONS)
} else {
toast("Meldingen zijn al toegestaan")
}
}
findViewById<MaterialButton>(R.id.btn_perm_exact).setOnClickListener { openExactAlarmSettings() }
findViewById<MaterialButton>(R.id.btn_perm_battery).setOnClickListener { openBatterySettings() }
findViewById<MaterialButton>(R.id.btn_perm_fullscreen).setOnClickListener { openFullScreenSettings() }
// Staat altijd zichtbaar in de status-edit: pionnen van de volgende controle alvast zetten. // Staat altijd zichtbaar in de status-edit: pionnen van de volgende controle alvast zetten.
AlarmScheduler.scheduleNoonCheck(this) AlarmScheduler.scheduleNoonCheck(this)
@ -140,46 +124,6 @@ class MainActivity : AppCompatActivity() {
} }
} }
private fun openExactAlarmSettings() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
runCatching {
startActivity(
Intent(Settings.ACTION_REQUEST_SCHEDULE_EXACT_ALARM, Uri.parse("package:$packageName")),
)
}.onFailure { toast("Niet beschikbaar op dit toestel") }
} else {
toast("Niet nodig op dit toestel")
}
}
private fun openBatterySettings() {
val pm = getSystemService(Context.POWER_SERVICE) as PowerManager
if (pm.isIgnoringBatteryOptimizations(packageName)) {
toast("Deze app is al uitgezonderd van batterijoptimalisatie")
return
}
runCatching {
startActivity(
Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS, Uri.parse("package:$packageName")),
)
}.onFailure { toast("Niet beschikbaar op dit toestel") }
}
private fun openFullScreenSettings() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
runCatching {
startActivity(
Intent(
Settings.ACTION_MANAGE_APP_USE_FULL_SCREEN_INTENT,
Uri.parse("package:$packageName"),
),
)
}.onFailure { toast("Niet beschikbaar op dit toestel") }
} else {
toast("Op dit toestel (Android < 14) is volledig scherm standaard geregeld")
}
}
private fun requestNotificationPermission() { private fun requestNotificationPermission() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) != ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) !=

View file

@ -84,53 +84,11 @@
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:background="?android:attr/listDivider" /> android:background="?android:attr/listDivider" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Machtigingen"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_perm_notifications"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Meldingen toestaan (nodig voor afgaande wekker)" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_perm_exact"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Exacte alarmen toestaan (wekker op tijd)" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_perm_battery"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Batterijoptimalisatie uitzonderen (achtergrondtaken)" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_perm_fullscreen"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Volledig scherm inschakelen (wekker bovenop slotscherm)" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="24dp"
android:layout_marginBottom="8dp"
android:background="?android:attr/listDivider" />
<TextView <TextView
android:id="@+id/tv_info" android:id="@+id/tv_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="13sp" android:textSize="13sp"
android:text="Elke dag om 12:00 leest de app de volgende dag uit de CalDAV-agenda EBS-Diensten. De dienstbegintijd wordt naar beneden afgerond op een heel kwartier (05:00–05:14 → 05:00, 05:15–05:29 → 05:15, 05:30–05:44 → 05:30, 05:45–05:59 → 05:45). Daarna worden drie wekkers gezet:\nOpstaan 2 uur vóór aanvang, Wally 1,5 uur vóór aanvang, Vertrek 0,5 uur vóór aanvang. Staat er geen dienst in de agenda, dan worden geen wekkers gezet. De app gebruikt hiervoor wifi én mobiele data en voert ook op de achtergrond (vergrendeld scherm) zijn taken uit." /> android:text="Elke dag om 12:00 leest de app de agenda van morgen (EBS-Diensten via CalDAV). De dienstbegintijd wordt naar beneden afgerond op een heel kwartier (05:00–05:14 → 05:00, 05:15–05:29 → 05:15, 05:30–05:44 → 05:30, 05:45–05:59 → 05:45) en er worden drie wekkers gezet: Opstaan 2 uur, Wally 1,5 uur en Vertrek 0,5 uur vóór aanvang. Geen dienst → geen wekkers. Meldingen vraagt het systeem bij de eerste start." />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>