@ -11,8 +11,8 @@ typealias DialogCallback = () -> Unit
|
||||
|
||||
class MaterialBottomSheetDialog(
|
||||
context: Context,
|
||||
private val title: String? = "",
|
||||
private val message: String? = ""
|
||||
private val title: String? = null,
|
||||
private val message: String? = null
|
||||
) : BottomSheetDialog(context, R.style.BottomSheetDialogTheme) {
|
||||
|
||||
private var positiveButtonLabel: String? = null
|
||||
@ -36,7 +36,7 @@ class MaterialBottomSheetDialog(
|
||||
val view = View.inflate(context, R.layout.bottom_sheet_dialog, null)
|
||||
|
||||
// Header
|
||||
view.message.isVisible = title != null
|
||||
view.title.isVisible = title != null
|
||||
view.title.text = title ?: ""
|
||||
|
||||
view.message.isVisible = message != null
|
||||
|
@ -12,8 +12,7 @@ object AlarmHelper {
|
||||
val alarm = nextAlarmClock
|
||||
return if (
|
||||
alarm != null
|
||||
&& alarm.triggerTime - Calendar.getInstance().timeInMillis > 10 * 60 * 1000
|
||||
&& alarm.triggerTime - Calendar.getInstance().timeInMillis < 12 * 60 * 60 * 1000
|
||||
&& alarm.triggerTime - Calendar.getInstance().timeInMillis > 5 * 60 * 1000
|
||||
) {
|
||||
"%s %s".format(
|
||||
SimpleDateFormat("EEE", Locale.getDefault()).format(alarm.triggerTime),
|
||||
|
@ -8,8 +8,10 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -34,6 +36,7 @@ import com.tommasoberlose.anotherwidget.R
|
||||
import com.tommasoberlose.anotherwidget.components.BottomSheetMenu
|
||||
import com.tommasoberlose.anotherwidget.components.CustomNotesDialog
|
||||
import com.tommasoberlose.anotherwidget.components.GlanceProviderSortMenu
|
||||
import com.tommasoberlose.anotherwidget.components.MaterialBottomSheetDialog
|
||||
import com.tommasoberlose.anotherwidget.databinding.FragmentGlanceSettingsBinding
|
||||
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||
import com.tommasoberlose.anotherwidget.helpers.AlarmHelper
|
||||
@ -188,7 +191,9 @@ class GlanceTabFragment : Fragment() {
|
||||
} catch (e: Exception) {
|
||||
alarm.showIntent?.creatorPackage ?: ""
|
||||
}
|
||||
activity?.toast(getString(R.string.next_alarm_warning).format(appNameOrPackage), long = true)
|
||||
MaterialBottomSheetDialog(requireContext(), message = getString(R.string.next_alarm_warning).format(appNameOrPackage))
|
||||
.setPositiveButton(getString(android.R.string.ok))
|
||||
.show()
|
||||
}
|
||||
}
|
||||
true
|
||||
@ -274,19 +279,23 @@ class GlanceTabFragment : Fragment() {
|
||||
}
|
||||
|
||||
private fun checkNotificationPermission() {
|
||||
if (NotificationManagerCompat.getEnabledListenerPackages(requireContext()).contains(requireContext().packageName)) {
|
||||
notification_permission_alert?.isVisible = false
|
||||
MediaPlayerHelper.updatePlayingMediaInfo(requireContext())
|
||||
show_music_label?.text = if (Preferences.showMusic) getString(R.string.settings_visible) else getString(R.string.settings_not_visible)
|
||||
} else if (Preferences.showMusic) {
|
||||
notification_permission_alert?.isVisible = true
|
||||
show_music_label?.text = getString(R.string.settings_request_notification_access)
|
||||
notification_permission_alert?.setOnClickListener {
|
||||
activity?.startActivity(Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"))
|
||||
when {
|
||||
NotificationManagerCompat.getEnabledListenerPackages(requireContext()).contains(requireContext().packageName) -> {
|
||||
notification_permission_alert?.isVisible = false
|
||||
MediaPlayerHelper.updatePlayingMediaInfo(requireContext())
|
||||
show_music_label?.text = if (Preferences.showMusic) getString(R.string.settings_visible) else getString(R.string.settings_not_visible)
|
||||
}
|
||||
Preferences.showMusic -> {
|
||||
notification_permission_alert?.isVisible = true
|
||||
show_music_label?.text = getString(R.string.settings_request_notification_access)
|
||||
notification_permission_alert?.setOnClickListener {
|
||||
activity?.startActivity(Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"))
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
show_music_label?.text = getString(R.string.settings_not_visible)
|
||||
notification_permission_alert?.isVisible = false
|
||||
}
|
||||
} else {
|
||||
show_music_label?.text = getString(R.string.settings_not_visible)
|
||||
notification_permission_alert?.isVisible = false
|
||||
}
|
||||
}
|
||||
|
||||
|
BIN
app/src/main/res/drawable-hdpi/round_style_black_18.png
Normal file
After Width: | Height: | Size: 364 B |
BIN
app/src/main/res/drawable-hdpi/round_style_black_24.png
Normal file
After Width: | Height: | Size: 432 B |
BIN
app/src/main/res/drawable-hdpi/round_style_black_36.png
Normal file
After Width: | Height: | Size: 601 B |
BIN
app/src/main/res/drawable-hdpi/round_style_black_48.png
Normal file
After Width: | Height: | Size: 808 B |
BIN
app/src/main/res/drawable-mdpi/round_style_black_18.png
Normal file
After Width: | Height: | Size: 259 B |
BIN
app/src/main/res/drawable-mdpi/round_style_black_24.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
app/src/main/res/drawable-mdpi/round_style_black_36.png
Normal file
After Width: | Height: | Size: 432 B |
BIN
app/src/main/res/drawable-mdpi/round_style_black_48.png
Normal file
After Width: | Height: | Size: 567 B |
BIN
app/src/main/res/drawable-xhdpi/round_style_black_18.png
Normal file
After Width: | Height: | Size: 432 B |
BIN
app/src/main/res/drawable-xhdpi/round_style_black_24.png
Normal file
After Width: | Height: | Size: 567 B |
BIN
app/src/main/res/drawable-xhdpi/round_style_black_36.png
Normal file
After Width: | Height: | Size: 808 B |
BIN
app/src/main/res/drawable-xhdpi/round_style_black_48.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-xxhdpi/round_style_black_18.png
Normal file
After Width: | Height: | Size: 601 B |
BIN
app/src/main/res/drawable-xxhdpi/round_style_black_24.png
Normal file
After Width: | Height: | Size: 808 B |
BIN
app/src/main/res/drawable-xxhdpi/round_style_black_36.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/drawable-xxhdpi/round_style_black_48.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/round_style_black_18.png
Normal file
After Width: | Height: | Size: 808 B |
BIN
app/src/main/res/drawable-xxxhdpi/round_style_black_24.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/round_style_black_36.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
app/src/main/res/drawable-xxxhdpi/round_style_black_48.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
10
app/src/main/res/drawable/round_style.xml
Normal file
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M2.53,19.65l1.34,0.56v-9.03l-2.43,5.86c-0.41,1.02 0.08,2.19 1.09,2.61zM22.03,15.95L17.07,3.98c-0.31,-0.75 -1.04,-1.21 -1.81,-1.23 -0.26,0 -0.53,0.04 -0.79,0.15L7.1,5.95c-0.75,0.31 -1.21,1.03 -1.23,1.8 -0.01,0.27 0.04,0.54 0.15,0.8l4.96,11.97c0.31,0.76 1.05,1.22 1.83,1.23 0.26,0 0.52,-0.05 0.77,-0.15l7.36,-3.05c1.02,-0.42 1.51,-1.59 1.09,-2.6zM7.88,8.75c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1 1,0.45 1,1 -0.45,1 -1,1zM5.88,19.75c0,1.1 0.9,2 2,2h1.45l-3.45,-8.34v6.34z"/>
|
||||
</vector>
|
@ -59,6 +59,8 @@
|
||||
android:id="@+id/action_negative"
|
||||
android:letterSpacing="0"
|
||||
android:text="Dismiss"
|
||||
android:fontFamily="@font/product_sans"
|
||||
android:textStyle="bold"
|
||||
app:textAllCaps="false" />
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:layout_width="wrap_content"
|
||||
@ -72,6 +74,8 @@
|
||||
android:id="@+id/action_positive"
|
||||
android:letterSpacing="0"
|
||||
android:text="Accept"
|
||||
android:fontFamily="@font/product_sans"
|
||||
android:textStyle="bold"
|
||||
app:textAllCaps="false" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
@ -224,6 +224,18 @@
|
||||
android:text="@string/action_grant_permission"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:text="@string/preferences_header"
|
||||
android:textAlignment="viewStart"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textAppearance="@style/AnotherWidget.Settings.Header"
|
||||
app:textAllCaps="false" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -298,18 +310,6 @@
|
||||
style="@style/AnotherWidget.Settings.Subtitle"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="16dp"
|
||||
android:text="@string/appearance_header"
|
||||
android:textAlignment="viewStart"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:textSize="16sp"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textAppearance="@style/AnotherWidget.Settings.Header"
|
||||
app:textAllCaps="false" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@ -327,7 +327,7 @@
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/round_cloud_circle"
|
||||
android:src="@drawable/round_style"
|
||||
android:tint="@color/colorPrimaryText"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -189,7 +189,7 @@
|
||||
<string name="settings_title">Settings</string>
|
||||
<string name="style_header">Style</string>
|
||||
<string name="actions_header">Actions</string>
|
||||
<string name="provider_header">Setup</string>
|
||||
<string name="provider_header">Provider</string>
|
||||
<string name="appearance_header">Appearance</string>
|
||||
<string name="preferences_header">Preferences</string>
|
||||
|
||||
|