Ui update

This commit is contained in:
Tommaso Berlose 2020-10-13 11:32:10 +02:00
parent 2bb30aae69
commit 9ecb9b4819
44 changed files with 106 additions and 83 deletions

Binary file not shown.

1
.idea/gradle.xml generated
View File

@ -14,6 +14,7 @@
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
<option name="useQualifiedModuleNames" value="true" />
</GradleProjectSettings>
</option>
</component>

2
.idea/misc.xml generated
View File

@ -61,7 +61,7 @@
</profile-state>
</entry>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

4
.idea/modules.xml generated
View File

@ -2,8 +2,8 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Another_Widget.iml" filepath="$PROJECT_DIR$/.idea/modules/Another_Widget.iml" group="Another_Widget" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" group="Another Widget/app" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/Another_Widget.iml" filepath="$PROJECT_DIR$/.idea/modules/Another_Widget.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/app/Another_Widget.app.iml" filepath="$PROJECT_DIR$/.idea/modules/app/Another_Widget.app.iml" />
</modules>
</component>
</project>

View File

@ -5,6 +5,7 @@ object Actions {
const val ACTION_EXTRA_DISABLE_GPS_NOTIFICATION = "ACTION_EXTRA_DISABLE_GPS_NOTIFICATION"
const val ACTION_TIME_UPDATE = "com.tommasoberlose.anotherwidget.action.TIME_UPDATE"
const val ACTION_ALARM_UPDATE = "com.tommasoberlose.anotherwidget.action.ALARM_UPDATE"
const val ACTION_CALENDAR_UPDATE = "com.tommasoberlose.anotherwidget.action.CALENDAR_UPDATE"
const val ACTION_WEATHER_UPDATE = "com.tommasoberlose.anotherwidget.action.WEATHER_UPDATE"
const val ACTION_OPEN_WEATHER_INTENT = "com.tommasoberlose.anotherwidget.action.OPEN_WEATHER_INTENT"

View File

@ -1,9 +1,14 @@
package com.tommasoberlose.anotherwidget.helpers
import android.app.AlarmManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.text.format.DateFormat
import android.util.Log
import com.tommasoberlose.anotherwidget.global.Actions
import com.tommasoberlose.anotherwidget.receivers.ActivityDetectionReceiver
import com.tommasoberlose.anotherwidget.receivers.UpdatesReceiver
import java.text.SimpleDateFormat
import java.util.*
@ -14,6 +19,7 @@ object AlarmHelper {
alarm != null
&& alarm.triggerTime - Calendar.getInstance().timeInMillis > 5 * 60 * 1000
) {
setTimeout(context, alarm.triggerTime)
"%s %s".format(
SimpleDateFormat("EEE", Locale.getDefault()).format(alarm.triggerTime),
DateFormat.getTimeFormat(context).format(Date(alarm.triggerTime))
@ -32,4 +38,25 @@ object AlarmHelper {
)
}
}
private fun setTimeout(context: Context, trigger: Long) {
with(context.getSystemService(Context.ALARM_SERVICE) as AlarmManager) {
val intent = Intent(context, UpdatesReceiver::class.java).apply {
action = Actions.ACTION_ALARM_UPDATE
}
cancel(PendingIntent.getBroadcast(context, ALARM_UPDATE_ID, intent, 0))
setExact(
AlarmManager.RTC,
trigger,
PendingIntent.getBroadcast(
context,
ALARM_UPDATE_ID,
intent,
0
)
)
}
}
private const val ALARM_UPDATE_ID = 24953
}

View File

@ -4,6 +4,7 @@ import android.Manifest
import android.content.Context
import android.os.Build
import android.util.Log
import com.chibatching.kotpref.Kotpref
import com.google.android.gms.location.LocationServices
import com.tommasoberlose.anotherwidget.R
import com.tommasoberlose.anotherwidget.global.Constants
@ -26,6 +27,7 @@ import org.greenrobot.eventbus.EventBus
object WeatherHelper {
suspend fun updateWeather(context: Context) {
Kotpref.init(context)
val networkApi = WeatherNetworkApi(context)
if (Preferences.customLocationAdd != "") {
networkApi.updateWeather()

View File

@ -167,7 +167,7 @@ class ActivityDetectionReceiver : BroadcastReceiver() {
private fun setTimeout(context: Context) {
with(context.getSystemService(Context.ALARM_SERVICE) as AlarmManager) {
cancel(PendingIntent.getBroadcast(context, 5, Intent(context, ActivityDetectionReceiver::class.java), 0))
setExactAndAllowWhileIdle(
setExact(
AlarmManager.RTC,
Calendar.getInstance().timeInMillis + 5 * 60 * 1000,
PendingIntent.getBroadcast(

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M17.59,3.59c-0.38,-0.38 -0.89,-0.59 -1.42,-0.59L5,3c-1.11,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,7.83c0,-0.53 -0.21,-1.04 -0.59,-1.41l-2.82,-2.83zM12,19c-1.66,0 -3,-1.34 -3,-3s1.34,-3 3,-3 3,1.34 3,3 -1.34,3 -3,3zM13,9L7,9c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2h6c1.1,0 2,0.9 2,2s-0.9,2 -2,2z"/>
</vector>

View File

@ -30,11 +30,12 @@
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="12dp"
android:layout_marginTop="2dp"
android:layout_centerVertical="true"
android:id="@+id/action_back"
android:layout_alignParentLeft="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:id="@+id/action_back"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_arrow_back" />
<TextView

View File

@ -19,7 +19,7 @@
app:cardCornerRadius="0dp"
android:id="@+id/toolbar"
app:cardBackgroundColor="@color/colorPrimary">
<RelativeLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="56dp"
android:gravity="center_vertical"
@ -28,32 +28,21 @@
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:padding="12dp"
android:layout_marginTop="2dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:layout_centerVertical="true"
android:id="@+id/action_back"
android:layout_alignParentLeft="true"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_arrow_back" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="@string/custom_date_format"
android:layout_marginEnd="48dp"
android:gravity="center"
style="@style/AnotherWidget.Main.Title"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/action_save"
android:gravity="center"
android:layout_centerVertical="true"
android:padding="16dp"
android:layout_alignParentRight="true"
android:textColor="@color/colorAccent"
android:id="@+id/action_save"
android:textAppearance="@style/TextAppearance.MaterialComponents.Button"/>
</RelativeLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
@ -123,7 +112,7 @@
android:textAppearance="@style/AnotherWidget.Settings.Title"
android:letterSpacing="0"
android:textColor="@color/colorPrimaryText"
android:textSize="20sp"
android:textSize="18sp"
app:textAllCaps="false"
android:gravity="center_vertical|start"
android:paddingEnd="32dp"
@ -167,10 +156,23 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="16dp"
android:paddingBottom="64dp"
android:paddingTop="16dp"
android:clipToPadding="false"
android:id="@+id/list_view" />
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:layout_margin="16dp"
app:backgroundTint="@color/colorAccent"
android:layout_alignParentBottom="true"
android:id="@+id/action_save"
android:layout_alignParentRight="true"
android:text="@string/action_save" />
</RelativeLayout>
</LinearLayout>

View File

@ -30,11 +30,12 @@
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="12dp"
android:layout_marginTop="2dp"
android:layout_centerVertical="true"
android:id="@+id/action_back"
android:layout_alignParentLeft="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:id="@+id/action_back"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_arrow_back" />
<TextView
@ -44,17 +45,6 @@
android:text="@string/settings_custom_font_title"
android:gravity="center"
style="@style/AnotherWidget.Main.Title"/>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:layout_centerVertical="true"
android:id="@+id/action_filter"
android:layout_alignParentRight="true"
android:visibility="gone"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_filter_list" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView

View File

@ -30,10 +30,11 @@
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="12dp"
android:layout_marginTop="2dp"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:id="@+id/action_back"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_arrow_back" />

View File

@ -30,11 +30,12 @@
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="12dp"
android:layout_marginTop="2dp"
android:layout_centerVertical="true"
android:id="@+id/action_back"
android:layout_alignParentLeft="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:id="@+id/action_back"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_arrow_back" />
<TextView
@ -44,17 +45,6 @@
android:text="@string/settings_title_integrations"
android:gravity="center"
style="@style/AnotherWidget.Main.Title"/>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:layout_centerVertical="true"
android:id="@+id/action_filter"
android:layout_alignParentRight="true"
android:visibility="gone"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_filter_list" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<RelativeLayout

View File

@ -30,11 +30,12 @@
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="12dp"
android:layout_marginTop="2dp"
android:layout_centerVertical="true"
android:id="@+id/action_back"
android:layout_alignParentLeft="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:id="@+id/action_back"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_arrow_back" />
<TextView
@ -44,17 +45,6 @@
android:text="@string/settings_music_players_filter_title"
android:gravity="center"
style="@style/AnotherWidget.Main.Title"/>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:layout_centerVertical="true"
android:id="@+id/action_filter"
android:layout_alignParentRight="true"
android:visibility="gone"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_filter_list" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<com.google.android.material.card.MaterialCardView

View File

@ -35,10 +35,11 @@
<androidx.appcompat.widget.AppCompatImageView
android:layout_width="48dp"
android:layout_height="48dp"
android:padding="10dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="12dp"
android:layout_marginTop="2dp"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:background="?attr/selectableItemBackgroundBorderless"
android:id="@+id/action_back"
app:tint="@color/colorPrimaryText"
android:src="@drawable/round_arrow_back" />

View File

@ -58,7 +58,7 @@
app:rippleColor="@color/colorSecondaryText"
android:id="@+id/action_negative"
android:letterSpacing="0"
android:text="Dismiss"
android:text="@string/action_dismiss"
android:fontFamily="@font/google_sans"
android:textStyle="bold"
app:textAllCaps="false" />
@ -69,11 +69,12 @@
android:textColor="@color/colorAccent"
android:clickable="true"
android:focusable="true"
app:backgroundTint="@color/colorAccent_op10"
android:textSize="16sp"
app:rippleColor="@color/colorAccent_op30"
android:id="@+id/action_positive"
android:letterSpacing="0"
android:text="Accept"
android:text="@string/action_accept"
android:fontFamily="@font/google_sans"
android:textStyle="bold"
app:textAllCaps="false" />

View File

@ -62,6 +62,7 @@
android:clickable="true"
android:focusable="true"
android:textSize="16sp"
app:backgroundTint="@color/colorAccent_op10"
app:rippleColor="@color/colorAccent_op30"
android:id="@+id/action_positive"
android:letterSpacing="0"

View File

@ -111,12 +111,12 @@
android:layout_height="wrap_content"
android:layout_gravity="end"
android:textColor="@color/colorAccent"
android:letterSpacing="0"
android:clickable="true"
android:focusable="true"
app:elevation="0dp"
android:textSize="14sp"
app:strokeColor="@color/colorAccent"
android:textSize="16sp"
android:letterSpacing="0"
app:backgroundTint="@color/colorAccent_op10"
android:textAllCaps="false"
style="@style/Widget.MaterialComponents.Button.TextButton"
app:rippleColor="@color/colorAccent_op30"
android:layout_marginTop="8dp"

View File

@ -257,4 +257,6 @@
<string name="settings_title_integrations">Integrazioni</string>
<string name="label_count_installed_integrations">%d integrazioni installate</string>
<string name="nothing">Niente</string>
<string name="action_dismiss">Annulla</string>
<string name="action_accept">Ok</string>
</resources>

View File

@ -17,6 +17,7 @@
<color name="colorPrimary">#FFFFFF</color>
<color name="colorPrimaryDark">#F8F8F8</color>
<color name="colorAccent">#0092ca</color>
<color name="colorAccent_op10">#1A1089FF</color>
<color name="colorAccent_op30">#4D1089FF</color>
<color name="colorTitle">#1089FF</color>
<color name="black_op10">#1A000000</color>

View File

@ -271,4 +271,6 @@
<string name="settings_title_integrations">Integrations</string>
<string name="label_count_installed_integrations">%d installed integrations</string>
<string name="nothing">Nothing</string>
<string name="action_dismiss">Dismiss</string>
<string name="action_accept">Accept</string>
</resources>

View File

@ -10,7 +10,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.4'

View File

@ -1,6 +1,6 @@
#Mon Jun 15 17:31:53 CEST 2020
#Tue Oct 13 10:06:21 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip