1
0

Add account picker for timetable widget (#314)

Close #281
This commit is contained in:
Rafał Borcz
2019-04-08 00:18:45 +02:00
committed by Mikołaj Pich
parent aa6dcaff94
commit c18877466f
26 changed files with 437 additions and 102 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 922 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="280dp"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/timetableWidgetConfigureTitle"
android:layout_width="match_parent"
android:layout_height="64dp"
android:paddingStart="24dp"
android:paddingLeft="24dp"
android:paddingEnd="24dp"
android:paddingRight="24dp"
android:text="@string/account_title"
android:textColor="?android:textColorPrimary"
android:textSize="20sp"
android:textStyle="bold"
app:firstBaselineToTopHeight="40dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/timetableWidgetConfigureRecycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/timetableWidgetConfigureTitle"
android:layout_marginBottom="16dp"
android:overScrollMode="never"
tools:itemCount="3"
tools:listitem="@layout/item_account" />
</RelativeLayout>

View File

@ -33,7 +33,8 @@
android:ellipsize="end"
android:maxLines="1"
android:textSize="16sp"
tools:text="@tools:sample/lorem/random" />
tools:text="@tools:sample/lorem/random"
android:textColor="?android:textColorSecondary"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/accountItemSchool"
@ -47,6 +48,7 @@
android:layout_toRightOf="@id/accountItemImage"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"
android:textSize="12sp"
tools:text="@tools:sample/lorem/random" />
</RelativeLayout>

View File

@ -7,7 +7,7 @@
android:background="@drawable/ic_all_divider"
android:minHeight="45dp"
android:orientation="horizontal"
tools:context=".ui.widgets.timetable.TimetableWidgetFactory">
tools:context=".ui.modules.timetablewidget.TimetableWidgetFactory">
<TextView
android:id="@+id/timetableWidgetItemNumber"

View File

@ -4,80 +4,87 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
tools:context=".ui.widgets.timetable.TimetableWidgetProvider">
tools:context=".ui.modules.timetablewidget.TimetableWidgetProvider">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="@dimen/timetable_widget_bar_height"
android:layout_height="56dp"
android:background="@color/colorPrimary">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/timetableWidgetAccount"
android:layout_toLeftOf="@id/timetableWidgetAccount"
android:layout_toEndOf="@id/timetableWidgetNext"
android:layout_toRightOf="@id/timetableWidgetNext"
android:orientation="vertical">
<TextView
android:id="@+id/timetableWidgetDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="15sp"
tools:text="Pon. 30.03.2019" />
<TextView
android:id="@+id/timetableWidgetName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="13sp"
tools:text="Jan Kowalski" />
</LinearLayout>
<ImageButton
android:id="@+id/timetableWidgetAccount"
android:layout_width="50dp"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:background="?android:selectableItemBackground"
android:contentDescription="@string/account_title"
android:src="@drawable/ic_widget_account" />
<ImageButton
android:id="@+id/timetableWidgetPrev"
android:layout_width="70dp"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:backgroundTint="@color/colorPrimaryDark"
android:contentDescription="@string/all_prev"
android:src="@drawable/ic_widget_chevron_24dp"
tools:targetApi="lollipop" />
<TextView
android:id="@+id/timetableWidgetDay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/timetableWidgetPrev"
android:layout_centerHorizontal="true"
android:layout_toStartOf="@id/timetableWidgetNext"
android:layout_toLeftOf="@id/timetableWidgetNext"
android:layout_toEndOf="@id/timetableWidgetPrev"
android:layout_toRightOf="@id/timetableWidgetPrev"
android:gravity="center_horizontal"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="15sp"
tools:text="Poniedziałek" />
<TextView
android:id="@+id/timetableWidgetDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/timetableWidgetDay"
android:layout_centerInParent="true"
android:layout_marginTop="3dp"
android:layout_toStartOf="@id/timetableWidgetNext"
android:layout_toLeftOf="@id/timetableWidgetNext"
android:layout_toEndOf="@id/timetableWidgetPrev"
android:layout_toRightOf="@id/timetableWidgetPrev"
android:gravity="center_horizontal"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="14sp"
tools:text="12.03.2019" />
<ImageButton
android:id="@+id/timetableWidgetNext"
android:layout_width="70dp"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:layout_toEndOf="@id/timetableWidgetPrev"
android:layout_toRightOf="@id/timetableWidgetPrev"
android:backgroundTint="@color/colorPrimaryDark"
android:contentDescription="@string/all_next"
android:rotation="180"
android:src="@drawable/ic_widget_chevron_24dp"
tools:targetApi="lollipop" />
</RelativeLayout>
<ListView
android:id="@+id/timetableWidgetList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/timetable_widget_bar_height"
android:layout_marginTop="56dp"
tools:listitem="@layout/item_widget_timetable" />
<TextView

View File

@ -24,9 +24,4 @@
<item name="about_libraries_dividerDark_openSource">@color/about_libraries_dividerDark_openSource_dark</item>
<item name="about_libraries_dividerLight_openSource">@color/about_libraries_dividerLight_openSource_dark</item>
</style>
<style name="WulkanowyTheme.NoActionBar" parent="WulkanowyTheme">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>

View File

@ -233,8 +233,6 @@
<!--Timetable Widget-->
<string name="widget_timetable_no_items">Brak lekcji</string>
<string name="widget_timetable_today">Dziś</string>
<string name="widget_timetable_tomorrow">Jutro</string>
<!--Preferences-->

View File

@ -2,7 +2,4 @@
<!--BottomNav-->
<dimen name="bottom_navigation_margin_top_active" tools:override="true">8dp</dimen>
<dimen name="bottom_navigation_margin_top_inactive" tools:override="true">8dp</dimen>
<!--Timetable Widget-->
<dimen name="timetable_widget_bar_height">60dp</dimen>
</resources>

View File

@ -218,8 +218,6 @@
<!--Timetable Widget-->
<string name="widget_timetable_no_items">No lessons</string>
<string name="widget_timetable_today">Today</string>
<string name="widget_timetable_tomorrow">Tomorrow</string>
<!--Preferences-->

View File

@ -40,4 +40,12 @@
<style name="WulkanowyTheme.ActionBar" parent="WulkanowyTheme">
<item name="colorControlNormal">@android:color/white</item>
</style>
<style name="WulkanowyTheme.TimetableWidgetAccount" parent="Theme.AppCompat.Light.Dialog">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:textColorPrimary">@android:color/primary_text_light</item>
<item name="android:textColorSecondary">@android:color/secondary_text_light</item>
<item name="android:textColorSecondaryInverse">@android:color/primary_text_dark</item>
</style>
</resources>

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:configure="io.github.wulkanowy.ui.modules.timetablewidget.TimetableWidgetConfigureActivity"
android:initialLayout="@layout/widget_timetable"
android:minWidth="150dp"
android:minHeight="100dp"
android:minWidth="250dp"
android:minHeight="110dp"
android:minResizeWidth="250dp"
android:minResizeHeight="110dp"
android:previewImage="@drawable/img_timetable_widget_preview"
android:resizeMode="horizontal|vertical"
android:updatePeriodMillis="3600000"