rename some widget related files
This commit is contained in:
parent
072a976584
commit
a5a30582b9
|
@ -22,7 +22,7 @@
|
|||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activities.WidgetConfigureActivity"
|
||||
android:name=".activities.WidgetMonthlyConfigureActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/MyWidgetConfigTheme">
|
||||
<intent-filter>
|
||||
|
@ -56,7 +56,7 @@
|
|||
android:parentActivityName=".activities.MainActivity"/>
|
||||
|
||||
<receiver
|
||||
android:name=".helpers.MyWidgetProvider"
|
||||
android:name=".helpers.MyWidgetMonthlyProvider"
|
||||
android:icon="@mipmap/widget_preview">
|
||||
<intent-filter>
|
||||
<action android:name="android.appwidget.action.APPWIDGET_UPDATE"/>
|
||||
|
@ -64,7 +64,7 @@
|
|||
|
||||
<meta-data
|
||||
android:name="android.appwidget.provider"
|
||||
android:resource="@xml/widget_info"/>
|
||||
android:resource="@xml/widget_monthly_info"/>
|
||||
</receiver>
|
||||
|
||||
<receiver android:name=".receivers.NotificationReceiver"/>
|
||||
|
|
|
@ -24,7 +24,7 @@ import kotlinx.android.synthetic.main.widget_config.*
|
|||
import org.joda.time.DateTime
|
||||
import yuku.ambilwarna.AmbilWarnaDialog
|
||||
|
||||
class WidgetConfigureActivity : AppCompatActivity(), MonthlyCalendar {
|
||||
class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
|
||||
lateinit var mRes: Resources
|
||||
private var mDays: List<Day>? = null
|
||||
private var mPackageName = ""
|
||||
|
@ -135,7 +135,7 @@ class WidgetConfigureActivity : AppCompatActivity(), MonthlyCalendar {
|
|||
}
|
||||
|
||||
private fun requestWidgetUpdate() {
|
||||
Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetProvider::class.java).apply {
|
||||
Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE, null, this, MyWidgetMonthlyProvider::class.java).apply {
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, intArrayOf(mWidgetId))
|
||||
sendBroadcast(this)
|
||||
}
|
|
@ -13,12 +13,12 @@ import com.simplemobiletools.calendar.models.Event
|
|||
import com.simplemobiletools.calendar.receivers.NotificationReceiver
|
||||
|
||||
fun Context.updateWidget() {
|
||||
val widgetsCnt = AppWidgetManager.getInstance(this).getAppWidgetIds(ComponentName(this, MyWidgetProvider::class.java))
|
||||
val widgetsCnt = AppWidgetManager.getInstance(this).getAppWidgetIds(ComponentName(this, MyWidgetMonthlyProvider::class.java))
|
||||
if (widgetsCnt.isEmpty())
|
||||
return
|
||||
|
||||
val ids = intArrayOf(R.xml.widget_info)
|
||||
Intent(this, MyWidgetProvider::class.java).apply {
|
||||
val ids = intArrayOf(R.xml.widget_monthly_info)
|
||||
Intent(this, MyWidgetMonthlyProvider::class.java).apply {
|
||||
action = AppWidgetManager.ACTION_APPWIDGET_UPDATE
|
||||
putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, ids)
|
||||
sendBroadcast(this)
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.simplemobiletools.calendar.interfaces.MonthlyCalendar
|
|||
import com.simplemobiletools.calendar.models.Day
|
||||
import org.joda.time.DateTime
|
||||
|
||||
class MyWidgetProvider : AppWidgetProvider(), MonthlyCalendar {
|
||||
class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
|
||||
companion object {
|
||||
private val PREV = "prev"
|
||||
private val NEXT = "next"
|
||||
|
@ -60,7 +60,7 @@ class MyWidgetProvider : AppWidgetProvider(), MonthlyCalendar {
|
|||
mWidgetManager = AppWidgetManager.getInstance(mContext)
|
||||
|
||||
mRemoteViews = RemoteViews(mContext.packageName, R.layout.fragment_month)
|
||||
mIntent = Intent(mContext, MyWidgetProvider::class.java)
|
||||
mIntent = Intent(mContext, MyWidgetMonthlyProvider::class.java)
|
||||
setupButtons()
|
||||
updateLabelColor()
|
||||
updateTopViews()
|
||||
|
@ -72,7 +72,7 @@ class MyWidgetProvider : AppWidgetProvider(), MonthlyCalendar {
|
|||
}
|
||||
|
||||
private fun updateWidget() {
|
||||
val thisWidget = ComponentName(mContext, MyWidgetProvider::class.java)
|
||||
val thisWidget = ComponentName(mContext, MyWidgetMonthlyProvider::class.java)
|
||||
AppWidgetManager.getInstance(mContext).updateAppWidget(thisWidget, mRemoteViews)
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/calendar_events_list_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/calendar_events_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipToPadding="false"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/medium_padding"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:configure="com.simplemobiletools.calendar.activities.WidgetConfigureActivity"
|
||||
android:configure="com.simplemobiletools.calendar.activities.WidgetMonthlyConfigureActivity"
|
||||
android:initialLayout="@layout/fragment_month"
|
||||
android:minHeight="@dimen/min_widget_height"
|
||||
android:minWidth="@dimen/min_widget_width"
|
Loading…
Reference in New Issue