Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
qihuan92 committed Mar 4, 2022
2 parents ca4667f + cd31d44 commit 76a243c
Show file tree
Hide file tree
Showing 83 changed files with 1,918 additions and 2,598 deletions.
19 changes: 11 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ android {
applicationId "com.qihuan.photowidget"
minSdkVersion 24
targetSdkVersion 31
versionCode 34
versionName "1.33"
versionCode 35
versionName "1.34"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -82,7 +82,6 @@ kapt {

dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.palette:palette-ktx:1.0.0"
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'androidx.recyclerview:recyclerview:1.2.1'
Expand All @@ -93,7 +92,7 @@ dependencies {

implementation 'com.google.android.material:material:1.6.0-alpha02'
implementation 'androidx.activity:activity-ktx:1.3.0'
implementation 'androidx.fragment:fragment-ktx:1.4.0'
implementation 'androidx.fragment:fragment-ktx:1.4.1'

def paging_version = "3.1.0"
implementation "androidx.paging:paging-runtime-ktx:$paging_version"
Expand All @@ -106,15 +105,19 @@ dependencies {
implementation "androidx.room:room-paging:$room_version"
testImplementation "androidx.room:room-testing:$room_version"

def work_version = "2.7.1"
implementation("androidx.work:work-runtime-ktx:$work_version")
// WorkManager 执行时会触发 AppWidgetProvider.onUpdate() 回调,导致不可控的行为。
// 在 AppWidgetProvider.onUpdate() 通过 WorkManager 执行刷新微件,会导致无限循环,所以暂时改用 JobScheduler 代替。
// 具体可见:https://medium.com/intive-developers/toss-a-coin-to-your-widget-or-dont-part-1-of-3-188c39d50b66
// def work_version = "2.7.1"
// implementation("androidx.work:work-runtime-ktx:$work_version")

implementation 'com.github.yalantis:ucrop:2.2.7'
implementation 'id.zelory:compressor:3.0.1'
implementation "com.github.skydoves:colorpickerview:2.2.4"

implementation 'com.github.bumptech.glide:glide:4.12.0'
kapt 'com.github.bumptech.glide:compiler:4.12.0'
def glide_version = "4.13.1"
implementation "com.github.bumptech.glide:glide:${glide_version}"
kapt "com.github.bumptech.glide:compiler:${glide_version}"

def appCenterSdkVersion = '4.3.1'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
Expand Down
295 changes: 295 additions & 0 deletions app/schemas/com.qihuan.photowidget.db.AppDatabase/15.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,295 @@
{
"formatVersion": 1,
"database": {
"version": 15,
"identityHash": "be6d61c0b9a4513dd85bb9d1e1da6347",
"entities": [
{
"tableName": "widget_info",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`widgetId` INTEGER NOT NULL, `topPadding` REAL NOT NULL, `bottomPadding` REAL NOT NULL, `leftPadding` REAL NOT NULL, `rightPadding` REAL NOT NULL, `widgetRadius` REAL NOT NULL, `widgetRadiusUnit` TEXT NOT NULL DEFAULT 'length', `widgetTransparency` REAL NOT NULL, `autoPlayInterval` INTEGER NOT NULL, `widgetType` TEXT NOT NULL, `linkInfo` TEXT, `photoScaleType` TEXT NOT NULL, `createTime` INTEGER, PRIMARY KEY(`widgetId`))",
"fields": [
{
"fieldPath": "widgetId",
"columnName": "widgetId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "topPadding",
"columnName": "topPadding",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "bottomPadding",
"columnName": "bottomPadding",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "leftPadding",
"columnName": "leftPadding",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "rightPadding",
"columnName": "rightPadding",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "widgetRadius",
"columnName": "widgetRadius",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "widgetRadiusUnit",
"columnName": "widgetRadiusUnit",
"affinity": "TEXT",
"notNull": true,
"defaultValue": "'length'"
},
{
"fieldPath": "widgetTransparency",
"columnName": "widgetTransparency",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "autoPlayInterval",
"columnName": "autoPlayInterval",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "widgetType",
"columnName": "widgetType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "linkInfo",
"columnName": "linkInfo",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "photoScaleType",
"columnName": "photoScaleType",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "createTime",
"columnName": "createTime",
"affinity": "INTEGER",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"widgetId"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "widget_image",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`imageId` INTEGER PRIMARY KEY AUTOINCREMENT, `widgetId` INTEGER NOT NULL, `imageUri` TEXT NOT NULL, `createTime` INTEGER NOT NULL, `sort` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "imageId",
"columnName": "imageId",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "widgetId",
"columnName": "widgetId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "imageUri",
"columnName": "imageUri",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "createTime",
"columnName": "createTime",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sort",
"columnName": "sort",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"imageId"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "link_info",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`widgetId` INTEGER NOT NULL, `type` TEXT NOT NULL, `title` TEXT NOT NULL, `description` TEXT NOT NULL, `link` TEXT NOT NULL, PRIMARY KEY(`widgetId`))",
"fields": [
{
"fieldPath": "widgetId",
"columnName": "widgetId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "title",
"columnName": "title",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "link",
"columnName": "link",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"widgetId"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "widget_frame",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`widgetId` INTEGER NOT NULL, `frameUri` TEXT, `frameColor` TEXT, `width` REAL NOT NULL, `type` TEXT NOT NULL, PRIMARY KEY(`widgetId`))",
"fields": [
{
"fieldPath": "widgetId",
"columnName": "widgetId",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "frameUri",
"columnName": "frameUri",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "frameColor",
"columnName": "frameColor",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "width",
"columnName": "width",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"widgetId"
],
"autoGenerate": false
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "widget_frame_resource",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL, `description` TEXT, `type` TEXT NOT NULL, `frameUri` TEXT, `frameColor` TEXT, `createTime` INTEGER NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "description",
"columnName": "description",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "frameUri",
"columnName": "frameUri",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "frameColor",
"columnName": "frameColor",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "createTime",
"columnName": "createTime",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
}
],
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'be6d61c0b9a4513dd85bb9d1e1da6347')"
]
}
}
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

<queries>
<intent>
Expand Down Expand Up @@ -238,6 +239,14 @@
android:exported="true"
android:permission="android.permission.BIND_REMOTEVIEWS" />

<service
android:name=".worker.UpdateWidgetService"
android:permission="android.permission.BIND_JOB_SERVICE" />

<service
android:name=".worker.DeleteWidgetService"
android:permission="android.permission.BIND_JOB_SERVICE" />

<activity
android:name=".main.MainActivity"
android:exported="true">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class GifWidgetPhotoViewFactory(
.diskCacheStrategy(DiskCacheStrategy.NONE)
.submit()
.get()
val remoteViews = RemoteViews(context.packageName, R.layout.widget_photo_single)
val remoteViews = RemoteViews(context.packageName, R.layout.layout_widget_image)
remoteViews.setImageViewBitmap(R.id.iv_picture, bitmap)
return remoteViews
}
Expand Down
Loading

0 comments on commit 76a243c

Please sign in to comment.