Skip to content

Commit

Permalink
Update to 3.0.0!!!
Browse files Browse the repository at this point in the history
Add sentence app widget
NCP app widget can select area
Add login
Fix bugs
Complete i18n
Refactory old codes
Support up to Android 12
  • Loading branch information
DawningW committed Aug 8, 2021
1 parent 3cd61a9 commit 258d3e3
Show file tree
Hide file tree
Showing 82 changed files with 4,140 additions and 1,247 deletions.
37 changes: 18 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
### Dawn-Desktop-Addons
### 曙光桌面小部件
An Android app provides a live wallpaper and some app widgets. Maintained by Dawncraft Studio.

An Android app provides a live wallpaper and some app widgets.

一个提供了一个可加载模型的动态桌面壁纸和一些桌面小部件的安卓应用程序。

Maintained by Dawncraft Studio.

由曙光工艺工作室维护
一个提供了一个可加载模型的动态桌面壁纸和一些桌面小部件的安卓应用程序,由曙光工艺工作室维护。

## Features
## 特性

1. A live wallpaper that can render some custom models.(WIP)
一个可加载自定义模型的动态壁纸(未完成)
2. An app widget that can monitor Novel coronavirus pneumonia's statistics.The API comes from Tencent News.
2. An app widget that can show a sentence every day. 一个展示一言的桌面小部件, API可选择一言([Hitokoto](https://hitokoto.cn/))或曙光工艺服务器.
![Screenshot3](./screenshot-3.png)
3. An app widget that can monitor Novel coronavirus pneumonia's statistics.The API comes from Tencent News.
一个用于监测新型冠状病毒肺炎的桌面小工具,API来自于腾讯新闻
![Screenshot1](/screenshot-1.png)
3. An app widget that can open/close zen mode.
![Screenshot1](./screenshot-1.png)
4. An app widget that can open/close zen mode.
一个用于开启或关闭勿扰模式的锁屏通知
![Screenshot2](/screenshot-2.png)
![Screenshot2](./screenshot-2.png)
5. A quick setting that can show layout borders.(WIP)
一个用于开启或关闭开发者选项中显示布局边界选项的快捷开关(开发中,目前版本需要root)

## Bugs
1. 各种bug

## TODO
1. ~~加入缓存~~
2. 将获取新冠肺炎数据放在Service中(可能不会加入)
3. 新冠肺炎小部件可选择地区
4. 新冠肺炎小部件打开自定义界面, 而非网页
2. ~~将获取新冠肺炎数据放在Service中~~(放弃)
3. ~~新冠肺炎小部件可选择地区~~
4. ~~新冠肺炎小部件打开自定义界面, 而非网页~~
5. ~~支持其他数据源~~(放弃支持)
6. 桌面小部件适配各种屏幕尺寸
6. 修改或删除句子

## 测试机型
- HM Note 1S(Android4.4.4/MIUI9.2稳定版) 新冠肺炎小部件可用(由old-android分支维护)
Expand All @@ -39,16 +37,17 @@ Maintained by Dawncraft Studio.
- HUAWEI 畅享7 Plus(Android7.0/EMUI5.1.3) 完全可用
- OPPO A7(Android8.1.0/ColorOSV5.2) 完全可用
- Honor 30(Android10/MagicUI4.0.0) 完全可用
- Honor 30(HarmonyOS 2.0.0) 完全可用

另外附上打开设置界面的方法
另外如果隐藏了桌面图标,可以通过以下命令打开设置界面:
```bash
adb shell
am start -n io.github.dawncraft.desktopaddons/io.github.dawncraft.desktopaddons.SettingsActivity
am start -n io.github.dawncraft.desktopaddons/io.github.dawncraft.desktopaddons.ui.MainActivity
```

## 特别致谢
1. 所有在疫情中奉献自己的医护人员
2. 腾讯新闻API

## 更新日志
懒得写
懒得写了...
26 changes: 22 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ android {
versionCode 13
versionName '3.0.0'
vectorDrawables.useSupportLibrary true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments += ["room.schemaLocation": "$projectDir/schemas".toString()]
}
}
lintOptions {
// 这个Android Studio告诉我Google Play需要目标平台26或以上, 而且还不让我编译
// WTF???我又不用谷歌...
// 虽然已经适配最新版本了, 但是我懒得去掉这个选项, 就留着吧
checkReleaseBuilds true
}
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -31,13 +36,26 @@ android {
}

dependencies {
def work_version = "2.5.0"
def room_version = "2.3.0"
def nav_version = "2.3.5"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.preference:preference:1.1.1'
implementation "androidx.work:work-runtime:$work_version"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.github.alidili:RecyclerViewHelper:1.1.5'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
implementation 'org.conscrypt:conscrypt-android:2.5.1'
implementation 'site.hanschen:glwallpaperservice:0.1.0'
testImplementation 'junit:junit:4.13.1'
implementation 'org.conscrypt:conscrypt-android:2.5.2'
implementation 'site.hanschen:glwallpaperservice:0.1.1'
testImplementation 'junit:junit:4.13.2'
testImplementation "androidx.room:room-testing:$room_version"
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation "androidx.work:work-testing:$work_version"
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
}
40 changes: 40 additions & 0 deletions app/schemas/io.github.dawncraft.desktopaddons.DADatabase/1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "3c1c152b82adcd571b4950120349fab4",
"entities": [
{
"tableName": "ncp_app_widget_id",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER NOT NULL, `region` TEXT, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "region",
"columnName": "region",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": false
},
"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, '3c1c152b82adcd571b4950120349fab4')"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
public class ExampleInstrumentedTest
{
@Test
public void useAppContext() {
public void useAppContext()
{
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

Expand Down
85 changes: 65 additions & 20 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.github.dawncraft.desktopaddons">

<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
Expand All @@ -13,42 +14,60 @@
<uses-feature android:name="android.software.live_wallpaper" />

<application
android:allowBackup="false"
android:name=".DAApplication"
android:label="@string/app_name"
android:icon="@drawable/app_icon"
android:roundIcon="@drawable/app_icon_round"
android:theme="@style/AppTheme"
android:name=".DAApplication"
android:supportsRtl="true"
android:allowBackup="false"
android:launchMode="singleInstance"
android:excludeFromRecents="true">

<activity
android:name=".SettingsActivity"
android:label="@string/settings"
android:launchMode="singleTask">
android:name=".ui.MainActivity"
android:label="@string/activity_settings"
android:launchMode="singleTask"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
</intent-filter>
</activity>

<activity-alias
android:name=".ui.MainActivityAlias"
android:label="@string/app_name"
android:targetActivity=".ui.MainActivity"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<activity
android:name=".WidgetConfigActivity"
android:label="@string/ncp_app_widget_config">
android:name=".ui.NCPAppWidgetConfigActivity"
android:label="@string/ncp_app_widget_config"
android:exported="true">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE"/>
</intent-filter>
</activity>

<activity
android:name=".NCPDetailActivity">
android:name=".ui.WebViewActivity"
android:taskAffinity="io.github.dawncraft.desktopaddons.WebViewActivity">
</activity>
<!-- 对于Activity的启动模式可以看看这个视频: https://www.bilibili.com/video/BV1CA41177Se -->

<service
android:name=".DawnLiveWallpaper"
android:enabled="true"
android:name=".wallpaper.DawnLiveWallpaper"
android:label="@string/wallpaper_name"
android:permission="android.permission.BIND_WALLPAPER">
android:permission="android.permission.BIND_WALLPAPER"
android:exported="true">

<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
Expand All @@ -59,36 +78,62 @@
android:resource="@xml/livewallpaper" />
</service>

<service
android:name=".quicksetting.ShowLayoutTile"
android:label="@string/show_layout_border"
android:icon="@drawable/ic_border_all"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">

<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>

<receiver
android:name=".NCPAppWidget">
android:name=".appwidget.SentenceAppWidget"
android:label="@string/sentence_app_widget_name"
android:exported="false">

<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="desktopaddons.intent.action.DETAILS" />
<action android:name="desktopaddons.intent.action.REFRESH" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/ncp_app_widget_info" />
android:resource="@xml/app_widget_sentence" />
</receiver>

<receiver
android:name=".ScreenBroadcastReceiver"
android:name=".appwidget.NCPAppWidget"
android:label="@string/ncp_app_widget_name"
android:exported="false">

<intent-filter>
<action android:name="desktopaddons.intent.action.SWITCH_ZEN_MODE" />
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
<action android:name="desktopaddons.intent.action.DETAILS" />
<action android:name="desktopaddons.intent.action.REFRESH" />
</intent-filter>

<meta-data
android:name="android.appwidget.provider"
android:resource="@xml/app_widget_ncp_info" />
</receiver>

<provider
android:name=".WidgetIDProvider"
android:authorities="io.github.dawncraft.desktopaddons.WidgetIDProvider"
<receiver
android:name=".broadcast.ZenModeBroadcastReceiver"
android:exported="false">

</provider>
<intent-filter>
<action android:name="desktopaddons.intent.action.SWITCH_ZEN_MODE" />
</intent-filter>
</receiver>

</application>

<queries>
<package android:name="com.tencent.mobileqq" />
</queries>

</manifest>
Loading

0 comments on commit 258d3e3

Please sign in to comment.