Add new dark icons
This commit is contained in:
@ -137,7 +137,7 @@ class GlanceSettingsDialog(val context: Activity, val provider: Constants.Glance
|
||||
}
|
||||
|
||||
/* TOGGLE */
|
||||
view.provider_switch.isChecked = when (provider) {
|
||||
view.provider_switch.setCheckedImmediatelyNoEvent(when (provider) {
|
||||
Constants.GlanceProviderId.PLAYING_SONG -> Preferences.showMusic
|
||||
Constants.GlanceProviderId.NEXT_CLOCK_ALARM -> Preferences.showNextAlarm
|
||||
Constants.GlanceProviderId.BATTERY_LEVEL_LOW -> Preferences.showBatteryCharging
|
||||
@ -146,7 +146,7 @@ class GlanceSettingsDialog(val context: Activity, val provider: Constants.Glance
|
||||
Constants.GlanceProviderId.NOTIFICATIONS -> Preferences.showNotifications
|
||||
Constants.GlanceProviderId.GREETINGS -> Preferences.showGreetings
|
||||
Constants.GlanceProviderId.EVENTS -> Preferences.showEventsAsGlanceProvider
|
||||
}
|
||||
})
|
||||
|
||||
var job: Job? = null
|
||||
|
||||
|
@ -68,12 +68,8 @@ class CustomLocationActivity : AppCompatActivity() {
|
||||
.register<String>(R.layout.custom_location_item) { _, injector ->
|
||||
injector
|
||||
.text(R.id.text, getString(R.string.custom_location_gps))
|
||||
.clicked(R.id.item) {
|
||||
MaterialBottomSheetDialog(this, message = getString(R.string.background_location_warning))
|
||||
.setPositiveButton(getString(android.R.string.ok)) {
|
||||
requirePermission()
|
||||
}
|
||||
.show()
|
||||
.clicked(R.id.text) {
|
||||
requirePermission()
|
||||
}
|
||||
}
|
||||
.register<Address>(R.layout.custom_location_item) { item, injector ->
|
||||
|
@ -51,6 +51,7 @@ import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
|
||||
import com.tommasoberlose.anotherwidget.utils.getCurrentWallpaper
|
||||
import com.tommasoberlose.anotherwidget.utils.toPixel
|
||||
import kotlinx.android.synthetic.main.activity_main.*
|
||||
import kotlinx.android.synthetic.main.fragment_tab_selector.*
|
||||
import kotlinx.android.synthetic.main.the_widget_sans.*
|
||||
import kotlinx.coroutines.*
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@ -96,6 +97,8 @@ class MainActivity : AppCompatActivity() {
|
||||
setResult(Activity.RESULT_OK)
|
||||
finish()
|
||||
}
|
||||
} else {
|
||||
viewModel.fragmentScrollY.value = 0
|
||||
}
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
|
@ -320,7 +320,7 @@ class GlanceTabFragment : Fragment() {
|
||||
) {
|
||||
val view = viewHolder.itemView as MaterialCardView
|
||||
if (isCurrentlyActive) {
|
||||
ViewCompat.setElevation(view, 2f.convertDpToPixel(requireContext()))
|
||||
ViewCompat.setElevation(view, 8f.convertDpToPixel(requireContext()))
|
||||
view.setCardBackgroundColor(ContextCompat.getColor(requireContext(),
|
||||
R.color.colorPrimary))
|
||||
view.strokeWidth = 0
|
||||
|
@ -111,10 +111,6 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
|
||||
// action_back?.isVisible = destination.id != R.id.tabSelectorFragment
|
||||
// Log.d("ciao", "${controller.currentDestination?.displayName} ${destination.id} - ${R.id.tabSelectorFragment}")
|
||||
// }
|
||||
|
||||
viewModel.fragmentScrollY.observe(viewLifecycleOwner) {
|
||||
toolbar?.cardElevation = if (it > 0) 24f else 0f
|
||||
}
|
||||
}
|
||||
|
||||
private var uiJob: Job? = null
|
||||
@ -325,7 +321,7 @@ class MainFragment : Fragment(), SharedPreferences.OnSharedPreferenceChangeList
|
||||
})
|
||||
|
||||
action_settings.setOnClickListener {
|
||||
Navigation.findNavController(it).navigate(R.id.action_appMainFragment_to_appSettingsFragment, null, null, FragmentNavigatorExtras(fragment_title to "settings_title"))
|
||||
Navigation.findNavController(it).navigate(R.id.action_appMainFragment_to_appSettingsFragment)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@ import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -37,6 +38,7 @@ import com.tommasoberlose.anotherwidget.ui.viewmodels.MainViewModel
|
||||
import com.tommasoberlose.anotherwidget.utils.checkGrantedPermission
|
||||
import com.tommasoberlose.anotherwidget.utils.openURI
|
||||
import kotlinx.android.synthetic.main.fragment_settings.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@ -82,16 +84,12 @@ class SettingsFragment : Fragment() {
|
||||
Navigation.findNavController(it).popBackStack()
|
||||
}
|
||||
|
||||
show_widget_preview_toggle.isChecked = Preferences.showPreview
|
||||
show_wallpaper_toggle.isChecked = Preferences.showWallpaper
|
||||
show_widget_preview_toggle.setCheckedImmediatelyNoEvent(Preferences.showPreview)
|
||||
show_wallpaper_toggle.setCheckedImmediatelyNoEvent(Preferences.showWallpaper)
|
||||
|
||||
setupListener()
|
||||
|
||||
app_version.text = "v%s (%s)".format(BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE)
|
||||
|
||||
scrollView.viewTreeObserver.addOnScrollChangedListener {
|
||||
toolbar?.cardElevation = if (scrollView.scrollY > 0) 24f else 0f
|
||||
}
|
||||
}
|
||||
|
||||
private fun subscribeUi(
|
||||
@ -202,12 +200,18 @@ class SettingsFragment : Fragment() {
|
||||
}
|
||||
|
||||
action_refresh_widget.setOnClickListener {
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
WeatherHelper.updateWeather(requireContext())
|
||||
}
|
||||
CalendarHelper.updateEventList(requireContext())
|
||||
MediaPlayerHelper.updatePlayingMediaInfo(requireContext())
|
||||
ActiveNotificationsHelper.clearLastNotification(requireContext())
|
||||
action_refresh_icon
|
||||
.animate()
|
||||
.rotation((action_refresh_icon.rotation - action_refresh_icon.rotation % 360f) + 360f)
|
||||
.withEndAction {
|
||||
viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) {
|
||||
WeatherHelper.updateWeather(requireContext())
|
||||
CalendarHelper.updateEventList(requireContext())
|
||||
MediaPlayerHelper.updatePlayingMediaInfo(requireContext())
|
||||
ActiveNotificationsHelper.clearLastNotification(requireContext())
|
||||
}
|
||||
}
|
||||
.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,6 @@ class TabSelectorFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
checkReadEventsPermission()
|
||||
updateCalendar()
|
||||
})
|
||||
|
||||
viewModel.showWeather.observe(viewLifecycleOwner, Observer {
|
||||
@ -225,28 +224,6 @@ class TabSelectorFragment : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
when (requestCode) {
|
||||
RequestCode.CALENDAR_APP_REQUEST_CODE.code -> {
|
||||
Preferences.bulk {
|
||||
calendarAppName = data?.getStringExtra(Constants.RESULT_APP_NAME) ?: getString(
|
||||
R.string.default_calendar_app)
|
||||
calendarAppPackage = data?.getStringExtra(Constants.RESULT_APP_PACKAGE) ?: ""
|
||||
}
|
||||
}
|
||||
RequestCode.EVENT_APP_REQUEST_CODE.code -> {
|
||||
Preferences.bulk {
|
||||
eventAppName = data?.getStringExtra(Constants.RESULT_APP_NAME) ?: getString(
|
||||
R.string.default_event_app)
|
||||
eventAppPackage = data?.getStringExtra(Constants.RESULT_APP_PACKAGE) ?: ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
|
||||
private fun maintainScrollPosition(callback: () -> Unit) {
|
||||
scrollView.isScrollable = false
|
||||
callback.invoke()
|
||||
|
@ -114,7 +114,6 @@ class WeatherTabFragment : Fragment() {
|
||||
|
||||
viewModel.customLocationAdd.observe(viewLifecycleOwner, Observer {
|
||||
maintainScrollPosition {
|
||||
background_location_warning.isVisible = it == ""
|
||||
label_custom_location?.text =
|
||||
if (it == "") getString(R.string.custom_location_gps) else it
|
||||
}
|
||||
@ -160,11 +159,9 @@ class WeatherTabFragment : Fragment() {
|
||||
private fun checkLocationPermission() {
|
||||
if (requireActivity().checkGrantedPermission(Manifest.permission.ACCESS_FINE_LOCATION)) {
|
||||
location_permission_alert?.isVisible = false
|
||||
background_location_warning.isVisible = Preferences.customLocationAdd == ""
|
||||
WeatherReceiver.setUpdates(requireContext())
|
||||
} else if (Preferences.showWeather && Preferences.customLocationAdd == "") {
|
||||
location_permission_alert?.isVisible = true
|
||||
background_location_warning.isVisible = true
|
||||
location_permission_alert?.setOnClickListener {
|
||||
MaterialBottomSheetDialog(requireContext(), message = getString(R.string.background_location_warning))
|
||||
.setPositiveButton(getString(android.R.string.ok)) {
|
||||
|
Reference in New Issue
Block a user