Implementing Pull to Refresh (#28)
* Add swipe refresh layout * Remove indicator and change border position * Add snackbar for new grades and rename classes of synchronization * Add info of the number of grades * Add grades average average * Add alert of new grades * Fix crash while refreshing * Add disappearing alerts * Optimize res and fix crash * Update API to version 27
This commit is contained in:

committed by
Mikołaj Pich

parent
fe54fa71f3
commit
f6e29490c3
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="35dp"
|
||||
android:height="35dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z" />
|
||||
<path android:pathData="M0-.75h24v24H0z" />
|
||||
</vector>
|
@ -4,5 +4,12 @@
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path android:fillColor="#ffffff" android:pathData="M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z" />
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M19.4,13c0-0.3,0.1-0.7,0.1-1s0-0.7-0.1-1l2.1-1.5c0.2-0.1,0.3-0.4,0.1-0.7l-2-3.5C19.5,5,19.2,4.9,19,5l-2.4,1.1
|
||||
c-0.5-0.4-1.2-0.8-1.8-1l-0.3-2.6C14.5,2.2,14.3,2,14,2H10C9.7,2,9.5,2.2,9.5,2.5L9.2,5c-0.7,0.3-1.3,0.6-1.8,1L5,5
|
||||
C4.8,4.9,4.5,5,4.4,5.2l-2,3.5C2.2,9,2.2,9.3,2.5,9.4L4.6,11c0,0.3-0.1,0.7-0.1,1s0,0.7,0.1,1l-2.1,1.5c-0.2,0.1-0.3,0.4-0.1,0.7
|
||||
l2,3.5C4.5,19,4.8,19.1,5,19l2.4-1.1c0.5,0.4,1.2,0.8,1.8,1l0.3,2.6c0,0.3,0.2,0.5,0.5,0.5H14c0.3,0,0.5-0.2,0.5-0.5l0.3-2.6
|
||||
c0.7-0.3,1.3-0.6,1.8-1L19,19c0.2,0.1,0.5,0,0.6-0.2l2-3.5c0.1-0.2,0.1-0.5-0.1-0.7L19.4,13z M12,16c-2.2,0-4-1.8-4-4
|
||||
c0-2.2,1.8-4,4-4s4,1.8,4,4C16,14.2,14.2,16,12,16z" />
|
||||
</vector>
|
9
app/src/main/res/drawable/subject_alert_circle.xml
Normal file
9
app/src/main/res/drawable/subject_alert_circle.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@color/colorPrimary"
|
||||
android:pathData="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" />
|
||||
</vector>
|
@ -2,7 +2,7 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:angle="270"
|
||||
android:centerColor="@android:color/transparent"
|
||||
android:centerX="0.01"
|
||||
android:startColor="#60606060" />
|
@ -9,12 +9,11 @@
|
||||
android:weightSum="1"
|
||||
tools:context="io.github.wulkanowy.activity.dashboard.DashboardActivity">
|
||||
|
||||
<FrameLayout
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fitsSystemWindows="true"
|
||||
app:layout_behavior="android.support.design.widget.AppBarLayout$ScrollingViewBehavior" />
|
||||
|
||||
|
||||
|
@ -1,24 +1,32 @@
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/coordinator_grade"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="io.github.wulkanowy.activity.dashboard.grades.GradesFragment">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
<android.support.v4.widget.SwipeRefreshLayout
|
||||
android:id="@+id/grade_swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/subject_grade_recycler" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/loadingPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/subject_grade_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true" />
|
||||
</RelativeLayout>
|
||||
<RelativeLayout
|
||||
android:id="@+id/loadingPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true" />
|
||||
</RelativeLayout>
|
||||
|
||||
</android.support.v4.widget.SwipeRefreshLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
@ -1,4 +1,5 @@
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/grade_cardview"
|
||||
android:layout_width="match_parent"
|
||||
@ -23,27 +24,28 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/grade_text"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_width="45dp"
|
||||
android:layout_height="45dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:gravity="center"
|
||||
android:textSize="19sp" />
|
||||
android:maxLength="5"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description_grade_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginRight="40dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_toEndOf="@+id/grade_text"
|
||||
android:layout_toRightOf="@+id/grade_text"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="19sp" />
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/grade_date_text"
|
||||
@ -53,7 +55,16 @@
|
||||
android:layout_alignLeft="@+id/description_grade_text"
|
||||
android:layout_alignStart="@+id/description_grade_text"
|
||||
android:text="@string/grades_text"
|
||||
android:textSize="13sp" />
|
||||
android:textSize="12sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/grade_new_grades_alert"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginTop="10dp"
|
||||
app:srcCompat="@drawable/subject_alert_circle" />
|
||||
|
||||
</RelativeLayout>
|
||||
</android.support.v7.widget.CardView>
|
@ -179,6 +179,7 @@
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/ok_text"
|
||||
android:textSize="16sp" />
|
||||
|
@ -2,36 +2,51 @@
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/border"
|
||||
android:foreground="?attr/selectableItemBackgroundBorderless">
|
||||
android:background="@drawable/subject_border_1px"
|
||||
android:foreground="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="15dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="15dp"
|
||||
android:layout_marginRight="50dp"
|
||||
android:layout_marginEnd="50dp"
|
||||
android:layout_marginEnd="35dp"
|
||||
android:layout_marginRight="35dp"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:text="@string/app_name"
|
||||
android:textSize="19sp" />
|
||||
android:textSize="17sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject_grades_average"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/subject_text"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="#4C4C4C"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject_number_of_grades"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/subject_text"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_toEndOf="@+id/subject_grades_average"
|
||||
android:layout_toRightOf="@+id/subject_grades_average"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="#4C4C4C"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/group_indicator_down"
|
||||
android:id="@+id/subject_new_grades_alert"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
app:srcCompat="@drawable/ic_arrow_down" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/group_indicator_up"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:rotation="180"
|
||||
app:srcCompat="@drawable/ic_arrow_down" />
|
||||
|
||||
android:layout_marginTop="10dp"
|
||||
app:srcCompat="@drawable/subject_alert_circle" />
|
||||
</RelativeLayout>
|
@ -20,11 +20,8 @@
|
||||
<string name="lessonplan_text">Plan lekcji</string>
|
||||
<string name="settings_text">Ustawienia</string>
|
||||
<string name="noInternet_text">Brak połączenia z internetem</string>
|
||||
<string name="login_cookies_save_failed_text">Nie udało się zapisać sesji</string>
|
||||
<string name="SQLite_ioError_text">W bazie danych wystąpił błąd. Zrestartuj aplikacje a także sprawdź iość wolnego miejsca w pamięci wewnętrznej</string>
|
||||
<string name="root_failed_text">To urządzenie posiada posiada podwyższone uprawnienia (root). Automatyczne logowanie zosatło wyłączone.</string>
|
||||
<string name="encrypt_failed_text">Szyfrowanie nie powiodło się. Automatyczne logowanie zostało wyłączone</string>
|
||||
<string name="decrypt_failed_text">Deszyfrowanie nie powiodło się. Automatyczne logowanie zostało wyłączone</string>
|
||||
<string name="version_text">Wersja\u0020</string>
|
||||
<string name="dialog_description_text">Opis</string>
|
||||
<string name="dialog_weight_text">Waga</string>
|
||||
@ -38,5 +35,16 @@
|
||||
<string name="color_green_text">Zielony</string>
|
||||
<string name="noColor_text">Brak koloru</string>
|
||||
<string name="ok_text">OK</string>
|
||||
<string name="dialog_subject_text">Przedmiot</string>
|
||||
<string name="refresh_error_text">"Podczas odświeżania zawartości wystąpił błąd. "</string>
|
||||
<string name="snackbar_no_grades">Brak nowych ocen</string>
|
||||
<string name="snackbar_new_grade">Ilość nowych ocen: %1$d</string>
|
||||
|
||||
<plurals name="numberOfGrades">
|
||||
<item quantity="one">%d ocena</item>
|
||||
<item quantity="few">%d oceny</item>
|
||||
<item quantity="many">%d ocen</item>
|
||||
<item quantity="other">%d ocen</item>
|
||||
</plurals>
|
||||
<string name="info_average_grades">Średnia: %1$.2f</string>
|
||||
<string name="info_no_average">Brak średniej</string>
|
||||
</resources>
|
||||
|
@ -20,11 +20,8 @@
|
||||
<string name="lessonplan_text">Lesson Plan</string>
|
||||
<string name="settings_text">Settings</string>
|
||||
<string name="noInternet_text">No internet connection</string>
|
||||
<string name="login_cookies_save_failed_text">Failed to save session</string>
|
||||
<string name="SQLite_ioError_text">An error occurred in the database. Restart the applications and check the free space in the internal memory</string>
|
||||
<string name="root_failed_text">This device is rooted. Automatic login has been disabled</string>
|
||||
<string name="encrypt_failed_text">Encryption failed. Automatic login has been disabled</string>
|
||||
<string name="decrypt_failed_text">Decrypt is failed. Automatic login has been disable</string>
|
||||
<string name="version_text">Version\u0020</string>
|
||||
<string name="dialog_description_text">Description</string>
|
||||
<string name="dialog_weight_text">Weight</string>
|
||||
@ -38,5 +35,14 @@
|
||||
<string name="color_green_text">Green</string>
|
||||
<string name="noColor_text">No color</string>
|
||||
<string name="ok_text">OK</string>
|
||||
<string name="dialog_subject_text">Subject</string>
|
||||
<string name="refresh_error_text">An error occurred while refreshing the content.</string>
|
||||
<string name="snackbar_no_grades">No new grades</string>
|
||||
<string name="snackbar_new_grade">Number of new grades: %1$d</string>
|
||||
|
||||
<plurals name="numberOfGrades">
|
||||
<item quantity="one">%d grade</item>
|
||||
<item quantity="other">%d grades</item>
|
||||
</plurals>
|
||||
<string name="info_average_grades">Average: %1$.2f</string>
|
||||
<string name="info_no_average">No average</string>
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user