parent
c389d50b09
commit
1721dff3cf
@ -40,6 +40,7 @@ object IntentHelper {
|
|||||||
private fun getWidgetRefreshIntent(context: Context): Intent {
|
private fun getWidgetRefreshIntent(context: Context): Intent {
|
||||||
return Intent(context, UpdatesReceiver::class.java).apply {
|
return Intent(context, UpdatesReceiver::class.java).apply {
|
||||||
action = Actions.ACTION_REFRESH
|
action = Actions.ACTION_REFRESH
|
||||||
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,6 +66,7 @@ object IntentHelper {
|
|||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
data = Uri.parse("dynact://velour/weather/ProxyActivity")
|
data = Uri.parse("dynact://velour/weather/ProxyActivity")
|
||||||
component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline")
|
component = ComponentName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline")
|
||||||
|
setClassName("com.google.android.googlequicksearchbox", "com.google.android.apps.gsa.velour.DynamicActivityTrampoline")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DO_NOTHING_OPTION -> {
|
DO_NOTHING_OPTION -> {
|
||||||
|
@ -6,6 +6,7 @@ import android.content.Intent
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import com.tommasoberlose.anotherwidget.R
|
import com.tommasoberlose.anotherwidget.R
|
||||||
import com.tommasoberlose.anotherwidget.global.Actions
|
import com.tommasoberlose.anotherwidget.global.Actions
|
||||||
|
import com.tommasoberlose.anotherwidget.global.Preferences
|
||||||
import com.tommasoberlose.anotherwidget.helpers.IntentHelper
|
import com.tommasoberlose.anotherwidget.helpers.IntentHelper
|
||||||
import com.tommasoberlose.anotherwidget.utils.toast
|
import com.tommasoberlose.anotherwidget.utils.toast
|
||||||
|
|
||||||
@ -15,12 +16,14 @@ class WidgetClickListenerReceiver : BroadcastReceiver() {
|
|||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
if (intent.action == Actions.ACTION_OPEN_WEATHER_INTENT) {
|
if (intent.action == Actions.ACTION_OPEN_WEATHER_INTENT) {
|
||||||
try {
|
try {
|
||||||
|
if (Preferences.weatherAppPackage == IntentHelper.REFRESH_WIDGET_OPTION) {
|
||||||
|
context.sendBroadcast(IntentHelper.getWeatherIntent(context))
|
||||||
|
} else {
|
||||||
context.startActivity(IntentHelper.getWeatherIntent(context))
|
context.startActivity(IntentHelper.getWeatherIntent(context))
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
try {
|
e.printStackTrace()
|
||||||
context.applicationContext.startActivity(IntentHelper.getWeatherIntent(context.applicationContext))
|
val uri = Uri.parse("http://www.google.com/search?q=weather")
|
||||||
} catch (e: Exception) {
|
|
||||||
val uri = Uri.parse("http://www.google.com/#q=weather")
|
|
||||||
val i = Intent(Intent.ACTION_VIEW, uri)
|
val i = Intent(Intent.ACTION_VIEW, uri)
|
||||||
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
i.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
try {
|
try {
|
||||||
@ -32,4 +35,3 @@ class WidgetClickListenerReceiver : BroadcastReceiver() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -97,7 +97,11 @@ class MainFragment : Fragment() {
|
|||||||
binding.actionBack.setOnClickListener {
|
binding.actionBack.setOnClickListener {
|
||||||
controller.navigateUp()
|
controller.navigateUp()
|
||||||
}
|
}
|
||||||
|
binding.actionBack.isClickable = show
|
||||||
|
binding.actionBack.isFocusable = show
|
||||||
binding.actionSettings.animate().alpha(if (!show) 1f else 0f).setDuration(200).translationX((if (!show) 0f else -4f).convertDpToPixel(requireContext())).start()
|
binding.actionSettings.animate().alpha(if (!show) 1f else 0f).setDuration(200).translationX((if (!show) 0f else -4f).convertDpToPixel(requireContext())).start()
|
||||||
|
binding.actionSettings.isClickable = !show
|
||||||
|
binding.actionSettings.isFocusable = !show
|
||||||
binding.fragmentTitle.text = if (show) destination.label.toString() else getString(R.string.app_name)
|
binding.fragmentTitle.text = if (show) destination.label.toString() else getString(R.string.app_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user