rewrite the monthly widget implementation
This commit is contained in:
parent
7a7b22b702
commit
615780f67f
11 changed files with 161 additions and 200 deletions
|
@ -2,6 +2,7 @@ package com.simplemobiletools.calendar.activities
|
|||
|
||||
import android.app.Activity
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.graphics.Color
|
||||
|
@ -187,7 +188,7 @@ class WidgetMonthlyConfigureActivity : AppCompatActivity(), MonthlyCalendar {
|
|||
}
|
||||
}
|
||||
|
||||
override fun updateMonthlyCalendar(month: String, days: List<DayMonthly>) {
|
||||
override fun updateMonthlyCalendar(context: Context, month: String, days: List<DayMonthly>) {
|
||||
runOnUiThread {
|
||||
mDays = days
|
||||
top_value.text = month
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.simplemobiletools.calendar.fragments
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.graphics.PorterDuff
|
||||
|
@ -61,9 +62,6 @@ class MonthFragment : Fragment(), MonthlyCalendar {
|
|||
setupLabels()
|
||||
mCalendar = MonthlyCalendarImpl(this, context)
|
||||
|
||||
val padding = mRes.getDimension(R.dimen.activity_margin).toInt()
|
||||
view.calendar_holder.setPadding(padding, padding, padding, padding)
|
||||
|
||||
return view
|
||||
}
|
||||
|
||||
|
@ -85,7 +83,7 @@ class MonthFragment : Fragment(), MonthlyCalendar {
|
|||
mCalendar.updateMonthlyCalendar(Formatter.getDateTimeFromCode(mDayCode))
|
||||
}
|
||||
|
||||
override fun updateMonthlyCalendar(month: String, days: List<DayMonthly>) {
|
||||
override fun updateMonthlyCalendar(context: Context, month: String, days: List<DayMonthly>) {
|
||||
activity?.runOnUiThread {
|
||||
mHolder.top_value.apply {
|
||||
text = month
|
||||
|
|
|
@ -79,7 +79,7 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
|
|||
if (markDaysWithEvents) {
|
||||
markDaysWithEvents(days)
|
||||
} else {
|
||||
mCallback.updateMonthlyCalendar(monthName, days)
|
||||
mCallback.updateMonthlyCalendar(mContext, monthName, days)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ class MonthlyCalendarImpl(val mCallback: MonthlyCalendar, val mContext: Context)
|
|||
days.filter { dayEvents.keys.contains(it.code) }.forEach {
|
||||
it.dayEvents = dayEvents[it.code]!!
|
||||
}
|
||||
mCallback.updateMonthlyCalendar(monthName, days)
|
||||
mCallback.updateMonthlyCalendar(mContext, monthName, days)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ import android.appwidget.AppWidgetProvider
|
|||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.Resources
|
||||
import android.graphics.*
|
||||
import android.view.View
|
||||
import android.widget.RemoteViews
|
||||
|
@ -22,151 +21,129 @@ import com.simplemobiletools.commons.extensions.setBackgroundColor
|
|||
import com.simplemobiletools.commons.extensions.setTextSize
|
||||
import org.joda.time.DateTime
|
||||
|
||||
class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
|
||||
class MyWidgetMonthlyProvider : AppWidgetProvider() {
|
||||
private val PREV = "prev"
|
||||
private val NEXT = "next"
|
||||
private val NEW_EVENT = "new_event"
|
||||
|
||||
private var mTextColor = 0
|
||||
private var mCalendar: MonthlyCalendarImpl? = null
|
||||
|
||||
private var mSmallerFontSize = 0f
|
||||
private var mMediumFontSize = 0f
|
||||
private var mLargerFontSize = 0f
|
||||
|
||||
lateinit var mRes: Resources
|
||||
lateinit var mContext: Context
|
||||
lateinit var mWidgetManager: AppWidgetManager
|
||||
lateinit var mIntent: Intent
|
||||
|
||||
companion object {
|
||||
private var mTargetDate = DateTime()
|
||||
private var mRemoteViews: RemoteViews? = null
|
||||
var targetDate = DateTime.now()
|
||||
}
|
||||
|
||||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
|
||||
initVariables(context)
|
||||
updateWidget()
|
||||
super.onUpdate(context, appWidgetManager, appWidgetIds)
|
||||
performUpdate(context)
|
||||
}
|
||||
|
||||
private fun initVariables(context: Context) {
|
||||
mContext = context
|
||||
mRes = mContext.resources
|
||||
mCalendar = MonthlyCalendarImpl(this, mContext)
|
||||
mWidgetManager = AppWidgetManager.getInstance(mContext)
|
||||
private fun performUpdate(context: Context) {
|
||||
val largerFontSize = context.config.getFontSize() + 3f
|
||||
val textColor = context.config.widgetTextColor
|
||||
|
||||
context.config.apply {
|
||||
mTextColor = widgetTextColor
|
||||
mMediumFontSize = getFontSize()
|
||||
mSmallerFontSize = getFontSize() - 3f
|
||||
mLargerFontSize = getFontSize() + 3f
|
||||
val appWidgetManager = AppWidgetManager.getInstance(context)
|
||||
appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach {
|
||||
val views = RemoteViews(context.packageName, R.layout.fragment_month_widget)
|
||||
views.setBackgroundColor(R.id.calendar_holder, context.config.widgetBgColor)
|
||||
|
||||
mRemoteViews = RemoteViews(mContext.packageName, R.layout.fragment_month_widget)
|
||||
mRemoteViews?.setBackgroundColor(R.id.calendar_holder, widgetBgColor)
|
||||
}
|
||||
views.setTextColor(R.id.top_value, textColor)
|
||||
views.setTextSize(R.id.top_value, largerFontSize)
|
||||
|
||||
mIntent = Intent(mContext, MyWidgetMonthlyProvider::class.java)
|
||||
setupButtons()
|
||||
updateLabelColor()
|
||||
updateTopViews()
|
||||
mCalendar?.updateMonthlyCalendar(mTargetDate, false)
|
||||
}
|
||||
var bmp = getColoredIcon(context, textColor, R.drawable.ic_pointer_left)
|
||||
views.setImageViewBitmap(R.id.top_left_arrow, bmp)
|
||||
|
||||
private fun updateWidget() {
|
||||
val thisWidget = ComponentName(mContext, MyWidgetMonthlyProvider::class.java)
|
||||
try {
|
||||
AppWidgetManager.getInstance(mContext).updateAppWidget(thisWidget, mRemoteViews)
|
||||
} catch (ignored: Exception) {
|
||||
bmp = getColoredIcon(context, textColor, R.drawable.ic_pointer_right)
|
||||
views.setImageViewBitmap(R.id.top_right_arrow, bmp)
|
||||
|
||||
bmp = getColoredIcon(context, textColor, R.drawable.ic_plus)
|
||||
views.setImageViewBitmap(R.id.top_new_event, bmp)
|
||||
|
||||
setupIntent(context, views, PREV, R.id.top_left_arrow)
|
||||
setupIntent(context, views, NEXT, R.id.top_right_arrow)
|
||||
setupIntent(context, views, NEW_EVENT, R.id.top_new_event)
|
||||
setupAppOpenIntent(context, views, R.id.top_value)
|
||||
updateDayLabels(context, views, textColor)
|
||||
|
||||
appWidgetManager.updateAppWidget(it, views)
|
||||
MonthlyCalendarImpl(monthlyCalendar, context).getMonth(targetDate)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupIntent(action: String, id: Int) {
|
||||
mIntent.action = action
|
||||
val pendingIntent = PendingIntent.getBroadcast(mContext, 0, mIntent, 0)
|
||||
mRemoteViews?.setOnClickPendingIntent(id, pendingIntent)
|
||||
}
|
||||
|
||||
private fun setupAppOpenIntent(id: Int) {
|
||||
Intent(mContext, SplashActivity::class.java).apply {
|
||||
val pendingIntent = PendingIntent.getActivity(mContext, 0, this, 0)
|
||||
mRemoteViews?.setOnClickPendingIntent(id, pendingIntent)
|
||||
private fun setupIntent(context: Context, views: RemoteViews, action: String, id: Int) {
|
||||
Intent(context, MyWidgetMonthlyProvider::class.java).apply {
|
||||
this.action = action
|
||||
val pendingIntent = PendingIntent.getBroadcast(context, 0, this, 0)
|
||||
views.setOnClickPendingIntent(id, pendingIntent)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupDayOpenIntent(id: Int, dayCode: String) {
|
||||
Intent(mContext, SplashActivity::class.java).apply {
|
||||
private fun setupAppOpenIntent(context: Context, views: RemoteViews, id: Int) {
|
||||
val intent = Intent(context, SplashActivity::class.java)
|
||||
val pendingIntent = PendingIntent.getActivity(context, 0, intent, 0)
|
||||
views.setOnClickPendingIntent(id, pendingIntent)
|
||||
}
|
||||
|
||||
private fun setupDayOpenIntent(context: Context, views: RemoteViews, id: Int, dayCode: String) {
|
||||
Intent(context, SplashActivity::class.java).apply {
|
||||
putExtra(DAY_CODE, dayCode)
|
||||
val pendingIntent = PendingIntent.getActivity(mContext, Integer.parseInt(dayCode), this, 0)
|
||||
mRemoteViews?.setOnClickPendingIntent(id, pendingIntent)
|
||||
val pendingIntent = PendingIntent.getActivity(context, Integer.parseInt(dayCode), this, 0)
|
||||
views.setOnClickPendingIntent(id, pendingIntent)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupButtons() {
|
||||
setupIntent(PREV, R.id.top_left_arrow)
|
||||
setupIntent(NEXT, R.id.top_right_arrow)
|
||||
setupIntent(NEW_EVENT, R.id.top_new_event)
|
||||
setupAppOpenIntent(R.id.top_value)
|
||||
}
|
||||
private fun getComponentName(context: Context) = ComponentName(context, MyWidgetMonthlyProvider::class.java)
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (mCalendar == null || mRemoteViews == null) {
|
||||
initVariables(context)
|
||||
}
|
||||
|
||||
val action = intent.action
|
||||
when (action) {
|
||||
PREV -> getPrevMonth()
|
||||
NEXT -> getNextMonth()
|
||||
NEW_EVENT -> mContext.launchNewEventIntent()
|
||||
when (intent.action) {
|
||||
PREV -> getPrevMonth(context)
|
||||
NEXT -> getNextMonth(context)
|
||||
NEW_EVENT -> context.launchNewEventIntent()
|
||||
else -> super.onReceive(context, intent)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getPrevMonth() {
|
||||
mTargetDate = mTargetDate.minusMonths(1)
|
||||
mCalendar?.getMonth(mTargetDate)
|
||||
private fun getPrevMonth(context: Context) {
|
||||
targetDate = targetDate!!.minusMonths(1)
|
||||
MonthlyCalendarImpl(monthlyCalendar, context).getMonth(targetDate!!)
|
||||
}
|
||||
|
||||
private fun getNextMonth() {
|
||||
mTargetDate = mTargetDate.plusMonths(1)
|
||||
mCalendar?.getMonth(mTargetDate)
|
||||
private fun getNextMonth(context: Context) {
|
||||
targetDate = targetDate!!.plusMonths(1)
|
||||
MonthlyCalendarImpl(monthlyCalendar, context).getMonth(targetDate!!)
|
||||
}
|
||||
|
||||
private fun updateDays(days: List<DayMonthly>) {
|
||||
if (mRemoteViews == null)
|
||||
return
|
||||
|
||||
val displayWeekNumbers = mContext.config.displayWeekNumbers
|
||||
private fun updateDays(context: Context, views: RemoteViews, days: List<DayMonthly>) {
|
||||
val displayWeekNumbers = context.config.displayWeekNumbers
|
||||
val textColor = context.config.widgetTextColor
|
||||
val smallerFontSize = context.config.getFontSize() - 3f
|
||||
val res = context.resources
|
||||
val len = days.size
|
||||
val packageName = mContext.packageName
|
||||
mRemoteViews!!.apply {
|
||||
setTextColor(R.id.week_num, mTextColor)
|
||||
setTextSize(R.id.week_num, mSmallerFontSize)
|
||||
val packageName = context.packageName
|
||||
views.apply {
|
||||
setTextColor(R.id.week_num, textColor)
|
||||
setTextSize(R.id.week_num, smallerFontSize)
|
||||
setViewVisibility(R.id.week_num, if (displayWeekNumbers) View.VISIBLE else View.GONE)
|
||||
}
|
||||
|
||||
for (i in 0..5) {
|
||||
val id = mRes.getIdentifier("week_num_$i", "id", packageName)
|
||||
mRemoteViews!!.apply {
|
||||
setTextViewText(id, "${days[i * 7 + 3].weekOfYear}:") // fourth day of the week matters
|
||||
setTextColor(id, mTextColor)
|
||||
setTextSize(id, mSmallerFontSize)
|
||||
val id = res.getIdentifier("week_num_$i", "id", packageName)
|
||||
views.apply {
|
||||
setTextViewText(id, "${days[i * 7 + 3].weekOfYear}:") // fourth day of the week matters at determining week of the year
|
||||
setTextColor(id, textColor)
|
||||
setTextSize(id, smallerFontSize)
|
||||
setViewVisibility(id, if (displayWeekNumbers) View.VISIBLE else View.GONE)
|
||||
}
|
||||
}
|
||||
|
||||
val weakTextColor = mTextColor.adjustAlpha(LOW_ALPHA)
|
||||
val weakTextColor = textColor.adjustAlpha(LOW_ALPHA)
|
||||
for (i in 0 until len) {
|
||||
val day = days[i]
|
||||
var textColor = if (day.isThisMonth) mTextColor else weakTextColor
|
||||
val primaryColor = mContext.config.primaryColor
|
||||
var currTextColor = if (day.isThisMonth) textColor else weakTextColor
|
||||
val primaryColor = context.config.primaryColor
|
||||
if (day.isToday)
|
||||
textColor = primaryColor.getContrastColor()
|
||||
currTextColor = primaryColor.getContrastColor()
|
||||
|
||||
val id = mRes.getIdentifier("day_$i", "id", packageName)
|
||||
mRemoteViews!!.removeAllViews(id)
|
||||
addDayNumber(day, packageName, textColor, id, primaryColor)
|
||||
val id = res.getIdentifier("day_$i", "id", packageName)
|
||||
views.removeAllViews(id)
|
||||
addDayNumber(context, views, day, currTextColor, id, primaryColor)
|
||||
setupDayOpenIntent(context, views, id, day.code)
|
||||
|
||||
day.dayEvents.forEach {
|
||||
var backgroundColor = it.color
|
||||
|
@ -180,68 +157,56 @@ class MyWidgetMonthlyProvider : AppWidgetProvider(), MonthlyCalendar {
|
|||
val newRemoteView = RemoteViews(packageName, R.layout.day_monthly_event_view).apply {
|
||||
setTextViewText(R.id.day_monthly_event_id, it.title.replace(" ", "\u00A0"))
|
||||
setTextColor(R.id.day_monthly_event_id, eventTextColor)
|
||||
setTextSize(R.id.day_monthly_event_id, smallerFontSize - 3f)
|
||||
setBackgroundColor(R.id.day_monthly_event_id, backgroundColor)
|
||||
}
|
||||
mRemoteViews!!.addView(id, newRemoteView)
|
||||
views.addView(id, newRemoteView)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun addDayNumber(day: DayMonthly, packageName: String, textColor: Int, id: Int, primaryColor: Int) {
|
||||
val newRemoteView = RemoteViews(packageName, R.layout.day_monthly_number_view).apply {
|
||||
private fun addDayNumber(context: Context, views: RemoteViews, day: DayMonthly, textColor: Int, id: Int, primaryColor: Int) {
|
||||
val newRemoteView = RemoteViews(context.packageName, R.layout.day_monthly_number_view).apply {
|
||||
setTextViewText(R.id.day_monthly_number_id, day.value.toString())
|
||||
setTextColor(R.id.day_monthly_number_id, textColor)
|
||||
setTextSize(R.id.day_monthly_number_id, context.config.getFontSize() - 3f)
|
||||
|
||||
if (day.isToday) {
|
||||
setViewPadding(R.id.day_monthly_number_id, 10, 0, 10, 0)
|
||||
setBackgroundColor(R.id.day_monthly_number_id, primaryColor)
|
||||
}
|
||||
}
|
||||
mRemoteViews!!.addView(id, newRemoteView)
|
||||
setupDayOpenIntent(id, day.code)
|
||||
views.addView(id, newRemoteView)
|
||||
}
|
||||
|
||||
private fun updateTopViews() {
|
||||
mRemoteViews?.setTextColor(R.id.top_value, mTextColor)
|
||||
mRemoteViews?.setTextSize(R.id.top_value, mLargerFontSize)
|
||||
|
||||
var bmp = getColoredIcon(mContext, mTextColor, R.drawable.ic_pointer_left)
|
||||
mRemoteViews?.setImageViewBitmap(R.id.top_left_arrow, bmp)
|
||||
|
||||
bmp = getColoredIcon(mContext, mTextColor, R.drawable.ic_pointer_right)
|
||||
mRemoteViews?.setImageViewBitmap(R.id.top_right_arrow, bmp)
|
||||
|
||||
bmp = getColoredIcon(mContext, mTextColor, R.drawable.ic_plus)
|
||||
mRemoteViews?.setImageViewBitmap(R.id.top_new_event, bmp)
|
||||
}
|
||||
|
||||
private fun updateMonth(month: String) {
|
||||
mRemoteViews?.setTextViewText(R.id.top_value, month)
|
||||
}
|
||||
|
||||
override fun updateMonthlyCalendar(month: String, days: List<DayMonthly>) {
|
||||
try {
|
||||
updateMonth(month)
|
||||
updateDays(days)
|
||||
updateWidget()
|
||||
} catch (ignored: ArrayIndexOutOfBoundsException) {
|
||||
private val monthlyCalendar = object : MonthlyCalendar {
|
||||
override fun updateMonthlyCalendar(context: Context, month: String, days: List<DayMonthly>) {
|
||||
val appWidgetManager = AppWidgetManager.getInstance(context)
|
||||
appWidgetManager.getAppWidgetIds(getComponentName(context)).forEach {
|
||||
val views = RemoteViews(context.packageName, R.layout.fragment_month_widget)
|
||||
views.setTextViewText(R.id.top_value, month)
|
||||
updateDays(context, views, days)
|
||||
appWidgetManager.updateAppWidget(it, views)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateLabelColor() {
|
||||
val mSundayFirst = mContext.config.isSundayFirst
|
||||
val packageName = mContext.packageName
|
||||
private fun updateDayLabels(context: Context, views: RemoteViews, textColor: Int) {
|
||||
val sundayFirst = context.config.isSundayFirst
|
||||
val smallerFontSize = context.config.getFontSize() - 3f
|
||||
val res = context.resources
|
||||
val packageName = context.packageName
|
||||
val letters = letterIDs
|
||||
for (i in 0..6) {
|
||||
val id = mRes.getIdentifier("label_$i", "id", packageName)
|
||||
mRemoteViews?.setTextColor(id, mTextColor)
|
||||
mRemoteViews?.setTextSize(id, mSmallerFontSize)
|
||||
val id = res.getIdentifier("label_$i", "id", packageName)
|
||||
views.setTextColor(id, textColor)
|
||||
views.setTextSize(id, smallerFontSize)
|
||||
|
||||
var index = i
|
||||
if (!mSundayFirst)
|
||||
if (!sundayFirst)
|
||||
index = (index + 1) % letters.size
|
||||
|
||||
mRemoteViews?.setTextViewText(id, mContext.resources.getString(letters[index]))
|
||||
views.setTextViewText(id, res.getString(letters[index]))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package com.simplemobiletools.calendar.interfaces
|
||||
|
||||
import android.content.Context
|
||||
import com.simplemobiletools.calendar.models.DayMonthly
|
||||
|
||||
interface MonthlyCalendar {
|
||||
fun updateMonthlyCalendar(month: String, days: List<DayMonthly>)
|
||||
fun updateMonthlyCalendar(context: Context, month: String, days: List<DayMonthly>)
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
android:id="@+id/day_monthly_event_id"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/tiny_margin"
|
||||
android:layout_marginRight="@dimen/tiny_margin"
|
||||
android:layout_margin="1dp"
|
||||
android:ellipsize="none"
|
||||
android:gravity="start"
|
||||
android:maxLines="1"
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
|
@ -14,9 +13,8 @@
|
|||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:visibility="gone"
|
||||
tools:text="#"
|
||||
tools:visibility="visible"/>
|
||||
android:text="#"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<com.simplemobiletools.commons.views.MyTextView
|
||||
android:id="@+id/label_0"
|
||||
|
|
|
@ -3,81 +3,72 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_weight="1"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/small_margin"
|
||||
android:paddingTop="@dimen/small_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/week_num"
|
||||
style="@style/DayView"
|
||||
style="@style/MetaView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
tools:text="#"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
android:text="#"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_0"
|
||||
style="@style/DayView"
|
||||
style="@style/MetaView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/monday_letter"
|
||||
android:textStyle="bold"/>
|
||||
android:text="@string/monday_letter"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_1"
|
||||
style="@style/DayView"
|
||||
style="@style/MetaView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/tuesday_letter"
|
||||
android:textStyle="bold"/>
|
||||
android:text="@string/tuesday_letter"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_2"
|
||||
style="@style/DayView"
|
||||
style="@style/MetaView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/wednesday_letter"
|
||||
android:textStyle="bold"/>
|
||||
android:text="@string/wednesday_letter"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_3"
|
||||
style="@style/DayView"
|
||||
style="@style/MetaView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/thursday_letter"
|
||||
android:textStyle="bold"/>
|
||||
android:text="@string/thursday_letter"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_4"
|
||||
style="@style/DayView"
|
||||
style="@style/MetaView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/friday_letter"
|
||||
android:textStyle="bold"/>
|
||||
android:text="@string/friday_letter"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_5"
|
||||
style="@style/DayView"
|
||||
style="@style/MetaView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/saturday_letter"
|
||||
android:textStyle="bold"/>
|
||||
android:text="@string/saturday_letter"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label_6"
|
||||
style="@style/DayView"
|
||||
style="@style/MetaView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/sunday_letter"
|
||||
android:textStyle="bold"/>
|
||||
android:text="@string/sunday_letter"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/calendar_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/medium_margin">
|
||||
|
||||
<include layout="@layout/top_navigation"/>
|
||||
|
||||
|
|
|
@ -1,26 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/calendar_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/medium_margin">
|
||||
|
||||
<include layout="@layout/top_navigation_widget"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/first_row_widget"
|
||||
layout="@layout/first_row_widget"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/top_value"
|
||||
tools:ignore="UnknownIdInLayout"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/table_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/top_value"
|
||||
android:layout_below="@+id/first_row_widget"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include
|
||||
layout="@layout/first_row_widget"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/month_line_holder_1"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -30,11 +34,11 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/week_num_0"
|
||||
style="@style/MetaView"
|
||||
style="@style/WeekNumberStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:visibility="visible"/>
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/day_0"
|
||||
|
@ -102,11 +106,11 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/week_num_1"
|
||||
style="@style/MetaView"
|
||||
style="@style/WeekNumberStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:visibility="visible"/>
|
||||
android:visibility="gone"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/day_7"
|
||||
|
@ -174,7 +178,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/week_num_2"
|
||||
style="@style/MetaView"
|
||||
style="@style/WeekNumberStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -246,7 +250,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/week_num_3"
|
||||
style="@style/MetaView"
|
||||
style="@style/WeekNumberStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -318,7 +322,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/week_num_4"
|
||||
style="@style/MetaView"
|
||||
style="@style/WeekNumberStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
@ -390,7 +394,7 @@
|
|||
|
||||
<TextView
|
||||
android:id="@+id/week_num_5"
|
||||
style="@style/MetaView"
|
||||
style="@style/WeekNumberStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_alignBottom="@+id/top_value"
|
||||
android:layout_alignTop="@+id/top_value"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_pointer_left"/>
|
||||
|
||||
<TextView
|
||||
|
@ -21,8 +22,8 @@
|
|||
android:layout_toLeftOf="@+id/top_right_arrow"
|
||||
android:layout_toRightOf="@+id/top_left_arrow"
|
||||
android:gravity="center"
|
||||
android:paddingBottom="@dimen/activity_margin"
|
||||
android:paddingTop="@dimen/activity_margin"
|
||||
android:paddingBottom="@dimen/medium_margin"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:textSize="@dimen/month_text_size"/>
|
||||
|
||||
<ImageView
|
||||
|
@ -33,7 +34,8 @@
|
|||
android:layout_alignBottom="@+id/top_value"
|
||||
android:layout_alignTop="@+id/top_value"
|
||||
android:layout_toLeftOf="@+id/top_new_event"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_pointer_right"/>
|
||||
|
||||
<ImageView
|
||||
|
@ -44,7 +46,8 @@
|
|||
android:layout_alignBottom="@+id/top_value"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignTop="@+id/top_value"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:paddingLeft="@dimen/activity_margin"
|
||||
android:paddingRight="@dimen/activity_margin"
|
||||
android:src="@drawable/ic_plus"/>
|
||||
|
||||
</merge>
|
||||
|
|
Loading…
Reference in a new issue