Skip to content

Commit

Permalink
Add Calendar Month widget
Browse files Browse the repository at this point in the history
Adds a widget that displays a whole month.
You can tap on a day to open the calendar on that day.

Closes Etar-Group#162
  • Loading branch information
Dragoncraft89 committed Jan 18, 2019
1 parent 2cfb9c5 commit 084821e
Show file tree
Hide file tree
Showing 9 changed files with 425 additions and 0 deletions.
8 changes: 8 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,14 @@
android:permission="android.permission.BIND_REMOTEVIEWS">
</service-->

<receiver android:name="com.android.calendar.widget.CalendarMonthAppWidget" android:label="@string/gadget_title">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="com.android.calendar.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider" android:resource="@xml/appwidget_month_info" />
</receiver>

<service android:name="com.android.calendar.AsyncQueryServiceHelper" />

</application>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions res/layout/appwidget_month.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:orientation="vertical"
android:padding="@dimen/widget_margin"
android:focusable="true">

<TextView
android:id="@+id/month_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/actionbar_cursor"
android:textAlignment="center"
android:textColor="@color/appwidget_title"
android:textSize="26sp" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@color/line_background"
android:orientation="vertical">

<include
android:id="@+id/day_names"
layout="@layout/mini_month_header"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<LinearLayout
android:id="@+id/weeks"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

</LinearLayout>


</LinearLayout>

</LinearLayout>
170 changes: 170 additions & 0 deletions res/layout/widget_week_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:baselineAligned="false"
android:orientation="horizontal">

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="0.5dp"
android:layout_weight="1"
android:background="@color/month_bgcolor">

<LinearLayout
android:id="@+id/day_0"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/date_day_0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:gravity="right"
android:textColor="@color/agenda_day_item_text_color" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="0.5dp"
android:layout_weight="1"
android:background="@color/month_bgcolor">

<LinearLayout
android:id="@+id/day_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/date_day_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:gravity="right"
android:textColor="@color/agenda_day_item_text_color" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="0.5dp"
android:layout_weight="1"
android:background="@color/month_bgcolor">

<LinearLayout
android:id="@+id/day_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/date_day_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:gravity="right"
android:textColor="@color/agenda_day_item_text_color" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="0.5dp"
android:layout_weight="1"
android:background="@color/month_bgcolor">

<LinearLayout
android:id="@+id/day_3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/date_day_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:gravity="right"
android:textColor="@color/agenda_day_item_text_color" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="0.5dp"
android:layout_weight="1"
android:background="@color/month_bgcolor">

<LinearLayout
android:id="@+id/day_4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/date_day_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:gravity="right"
android:textColor="@color/agenda_day_item_text_color" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="0.5dp"
android:layout_weight="1"
android:background="@color/month_bgcolor">

<LinearLayout
android:id="@+id/day_5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/date_day_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:gravity="right"
android:textColor="@color/agenda_day_item_text_color" />
</LinearLayout>
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="0.5dp"
android:layout_weight="1"
android:background="@color/month_bgcolor">

<LinearLayout
android:id="@+id/day_6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/date_day_6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:gravity="right"
android:textColor="@color/agenda_day_item_text_color" />
</LinearLayout>
</LinearLayout>

</LinearLayout>
1 change: 1 addition & 0 deletions res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@
<dimen name="recurrence_picker_width">300dp</dimen>

<dimen name="fab_margin">16dp</dimen>
<dimen name="widget_margin">5dp</dimen>
</resources>
28 changes: 28 additions & 0 deletions res/xml/appwidget_month_info.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="220dip"
android:minHeight="220dip"
android:minResizeWidth="220dip"
android:minResizeHeight="220dip"
android:updatePeriodMillis="360000"
android:previewImage="@drawable/calendar_widget_month_preview"
android:initialLayout="@layout/appwidget"
android:resizeMode="horizontal|vertical"
android:widgetCategory="keyguard|home_screen">
</appwidget-provider>

Loading

0 comments on commit 084821e

Please sign in to comment.