fix clicking on widget days
This commit is contained in:
parent
6597e1c51a
commit
c2d19cf58a
3 changed files with 6 additions and 11 deletions
|
@ -46,7 +46,7 @@ ext {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:4.0.3'
|
||||
implementation 'com.simplemobiletools:commons:4.0.13'
|
||||
implementation 'joda-time:joda-time:2.9.9'
|
||||
implementation 'com.facebook.stetho:stetho:1.5.0'
|
||||
implementation 'com.android.support:multidex:1.0.3'
|
||||
|
|
|
@ -9,14 +9,10 @@ import android.content.Intent
|
|||
import android.net.Uri
|
||||
import android.widget.RemoteViews
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.activities.SplashActivity
|
||||
import com.simplemobiletools.calendar.extensions.config
|
||||
import com.simplemobiletools.calendar.extensions.launchNewEventIntent
|
||||
import com.simplemobiletools.calendar.services.WidgetService
|
||||
import com.simplemobiletools.commons.extensions.getColoredBitmap
|
||||
import com.simplemobiletools.commons.extensions.setBackgroundColor
|
||||
import com.simplemobiletools.commons.extensions.setText
|
||||
import com.simplemobiletools.commons.extensions.setTextSize
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import org.joda.time.DateTime
|
||||
|
||||
class MyWidgetListProvider : AppWidgetProvider() {
|
||||
|
@ -54,7 +50,7 @@ class MyWidgetListProvider : AppWidgetProvider() {
|
|||
views.setRemoteAdapter(R.id.widget_event_list, this)
|
||||
}
|
||||
|
||||
val startActivityIntent = Intent(context, SplashActivity::class.java)
|
||||
val startActivityIntent = context.getLaunchIntent()
|
||||
val startActivityPendingIntent = PendingIntent.getActivity(context, 0, startActivityIntent, PendingIntent.FLAG_UPDATE_CURRENT)
|
||||
views.setPendingIntentTemplate(R.id.widget_event_list, startActivityPendingIntent)
|
||||
views.setEmptyView(R.id.widget_event_list, R.id.widget_event_list_empty)
|
||||
|
@ -83,7 +79,7 @@ class MyWidgetListProvider : AppWidgetProvider() {
|
|||
}
|
||||
|
||||
private fun launchDayActivity(context: Context) {
|
||||
Intent(context, SplashActivity::class.java).apply {
|
||||
context.getLaunchIntent().apply {
|
||||
putExtra(DAY_CODE, Formatter.getDayCodeFromDateTime(DateTime()))
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(this)
|
||||
|
|
|
@ -10,7 +10,6 @@ import android.content.res.Resources
|
|||
import android.view.View
|
||||
import android.widget.RemoteViews
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.activities.SplashActivity
|
||||
import com.simplemobiletools.calendar.extensions.config
|
||||
import com.simplemobiletools.calendar.extensions.launchNewEventIntent
|
||||
import com.simplemobiletools.calendar.interfaces.MonthlyCalendar
|
||||
|
@ -46,7 +45,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
|||
}
|
||||
|
||||
private fun setupAppOpenIntent(context: Context, views: RemoteViews, id: Int, dayCode: String) {
|
||||
Intent(context, SplashActivity::class.java).apply {
|
||||
context.getLaunchIntent().apply {
|
||||
putExtra(DAY_CODE, dayCode)
|
||||
putExtra(OPEN_MONTH, true)
|
||||
val pendingIntent = PendingIntent.getActivity(context, Integer.parseInt(dayCode.substring(0, 6)), this, 0)
|
||||
|
@ -55,7 +54,7 @@ class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
|||
}
|
||||
|
||||
private fun setupDayOpenIntent(context: Context, views: RemoteViews, id: Int, dayCode: String) {
|
||||
Intent(context, SplashActivity::class.java).apply {
|
||||
context.getLaunchIntent().apply {
|
||||
putExtra(DAY_CODE, dayCode)
|
||||
val pendingIntent = PendingIntent.getActivity(context, Integer.parseInt(dayCode), this, 0)
|
||||
views.setOnClickPendingIntent(id, pendingIntent)
|
||||
|
|
Loading…
Reference in a new issue