From 75b2245061ca0a1bb0000a0fa33d1a8039d3100b Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Wed, 12 Feb 2025 23:28:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=9D=E5=A7=8B=20Contacts?= =?UTF-8?q?=20=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- contacts/README.md | 38 ++++ contacts/app_update_description.txt | 1 + contacts/build.gradle | 70 ++++++ contacts/build.properties | 8 + contacts/proguard-rules.pro | 17 ++ contacts/src/beta/AndroidManifest.xml | 13 ++ contacts/src/beta/res/values/strings.xml | 6 + contacts/src/main/AndroidManifest.xml | 48 ++++ .../java/cc/winboll/studio/contacts/App.java | 28 +++ .../winboll/studio/contacts/MainActivity.java | 205 ++++++++++++++++++ .../src/main/res/drawable/ic_launcher.xml | 11 + .../res/drawable/ic_launcher_background.xml | 170 +++++++++++++++ .../res/drawable/ic_launcher_foreground.xml | 10 + .../src/main/res/drawable/shape_gradient.xml | 10 + .../src/main/res/layout/activity_main.xml | 30 +++ contacts/src/main/res/layout/view_toast.xml | 32 +++ contacts/src/main/res/menu/toolbar_main.xml | 5 + contacts/src/main/res/values/colors.xml | 7 + contacts/src/main/res/values/strings.xml | 6 + contacts/src/main/res/values/styles.xml | 12 + contacts/src/main/res/xml/studio_provider.xml | 25 +++ contacts/src/stage/AndroidManifest.xml | 12 + contacts/src/stage/res/values/strings.xml | 6 + settings.gradle-demo | 4 + winboll-shared/build.properties | 10 +- 25 files changed, 779 insertions(+), 5 deletions(-) create mode 100644 contacts/README.md create mode 100644 contacts/app_update_description.txt create mode 100644 contacts/build.gradle create mode 100644 contacts/build.properties create mode 100644 contacts/proguard-rules.pro create mode 100644 contacts/src/beta/AndroidManifest.xml create mode 100644 contacts/src/beta/res/values/strings.xml create mode 100644 contacts/src/main/AndroidManifest.xml create mode 100644 contacts/src/main/java/cc/winboll/studio/contacts/App.java create mode 100644 contacts/src/main/java/cc/winboll/studio/contacts/MainActivity.java create mode 100644 contacts/src/main/res/drawable/ic_launcher.xml create mode 100644 contacts/src/main/res/drawable/ic_launcher_background.xml create mode 100644 contacts/src/main/res/drawable/ic_launcher_foreground.xml create mode 100644 contacts/src/main/res/drawable/shape_gradient.xml create mode 100644 contacts/src/main/res/layout/activity_main.xml create mode 100644 contacts/src/main/res/layout/view_toast.xml create mode 100644 contacts/src/main/res/menu/toolbar_main.xml create mode 100644 contacts/src/main/res/values/colors.xml create mode 100644 contacts/src/main/res/values/strings.xml create mode 100644 contacts/src/main/res/values/styles.xml create mode 100644 contacts/src/main/res/xml/studio_provider.xml create mode 100644 contacts/src/stage/AndroidManifest.xml create mode 100644 contacts/src/stage/res/values/strings.xml diff --git a/contacts/README.md b/contacts/README.md new file mode 100644 index 0000000..a52f622 --- /dev/null +++ b/contacts/README.md @@ -0,0 +1,38 @@ +# Contacts + +#### 介绍 +通讯录与拨号 + +#### 软件架构 +适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。 +也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。 + + +#### Gradle 编译说明 +调试版编译命令 :gradle assembleBetaDebug +阶段版编译命令 :gradle assembleStageRelease + +#### 使用说明 + +在安卓系统中需要设置两个权限允许。 +1.自启动权限允许。 +2.省电策略-无限制权限允许。 + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 : ZhanGSKen(ZhanGSKen@AliYun.Com) +4. 新建 Pull Request + + +#### 特技 + +1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md +2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) +3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 +4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 +5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) +6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) + +#### 参考文档 \ No newline at end of file diff --git a/contacts/app_update_description.txt b/contacts/app_update_description.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/contacts/app_update_description.txt @@ -0,0 +1 @@ + diff --git a/contacts/build.gradle b/contacts/build.gradle new file mode 100644 index 0000000..c7a26c8 --- /dev/null +++ b/contacts/build.gradle @@ -0,0 +1,70 @@ +apply plugin: 'com.android.application' +apply from: '../.winboll/winboll_app_build.gradle' +apply from: '../.winboll/winboll_lint_build.gradle' + +def genVersionName(def versionName){ + // 检查编译标志位配置 + assert (winbollBuildProps['stageCount'] != null) + assert (winbollBuildProps['baseVersion'] != null) + // 保存基础版本号 + winbollBuildProps.setProperty("baseVersion", "${versionName}"); + //保存编译标志配置 + FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile) + winbollBuildProps.store(fos, "${winbollBuildPropsDesc}"); + fos.close(); + + // 返回编译版本号 + return "${versionName}." + winbollBuildProps['stageCount'] +} + +android { + compileSdkVersion 32 + buildToolsVersion "33.0.3" + + defaultConfig { + applicationId "cc.winboll.studio.contacts" + minSdkVersion 21 + targetSdkVersion 30 + versionCode 1 + // versionName 更新后需要手动设置 + // 项目模块目录的 build.gradle 文件的 stageCount=0 + // Gradle编译环境下合起来的 versionName 就是 "${versionName}.0" + versionName "1.0" + if(true) { + versionName = genVersionName("${versionName}") + } + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 + } +} + +dependencies { + // 二维码使用的类库 + api 'com.google.zxing:core:3.4.1' + api 'com.journeyapps:zxing-android-embedded:3.6.0' + + api 'io.github.medyo:android-about-page:2.0.0' + api 'com.github.getActivity:ToastUtils:10.5' + api 'com.jcraft:jsch:0.1.55' + api 'org.jsoup:jsoup:1.13.1' + api 'com.squareup.okhttp3:okhttp:4.4.1' + + api 'androidx.appcompat:appcompat:1.3.1' + api 'androidx.fragment:fragment:1.1.0' + api 'com.google.android.material:material:1.1.0' + + api 'cc.winboll.studio:libapputils:9.3.2' + api 'cc.winboll.studio:libappbase:1.4.1' + + api fileTree(dir: 'libs', include: ['*.jar']) +} diff --git a/contacts/build.properties b/contacts/build.properties new file mode 100644 index 0000000..fb546db --- /dev/null +++ b/contacts/build.properties @@ -0,0 +1,8 @@ +#Created by .winboll/winboll_app_build.gradle +#Wed Feb 12 15:27:12 GMT 2025 +stageCount=0 +libraryProject=winboll-shared +baseVersion=1.0 +publishVersion=1.0.0 +buildCount=2 +baseBetaVersion=1.0.1 diff --git a/contacts/proguard-rules.pro b/contacts/proguard-rules.pro new file mode 100644 index 0000000..233bad2 --- /dev/null +++ b/contacts/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in C:\tools\adt-bundle-windows-x86_64-20131030\sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/contacts/src/beta/AndroidManifest.xml b/contacts/src/beta/AndroidManifest.xml new file mode 100644 index 0000000..c598f4f --- /dev/null +++ b/contacts/src/beta/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + + + + + diff --git a/contacts/src/beta/res/values/strings.xml b/contacts/src/beta/res/values/strings.xml new file mode 100644 index 0000000..dc3720a --- /dev/null +++ b/contacts/src/beta/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + Contacts+ + + diff --git a/contacts/src/main/AndroidManifest.xml b/contacts/src/main/AndroidManifest.xml new file mode 100644 index 0000000..915c449 --- /dev/null +++ b/contacts/src/main/AndroidManifest.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contacts/src/main/java/cc/winboll/studio/contacts/App.java b/contacts/src/main/java/cc/winboll/studio/contacts/App.java new file mode 100644 index 0000000..6b00e0f --- /dev/null +++ b/contacts/src/main/java/cc/winboll/studio/contacts/App.java @@ -0,0 +1,28 @@ +package cc.winboll.studio.contacts; + +/** + * @Author ZhanGSKen@QQ.COM + * @Date 2024/12/08 15:10:51 + * @Describe 全局应用类 + */ +import cc.winboll.studio.libappbase.GlobalApplication; +import cc.winboll.studio.libappbase.LogUtils; +import cc.winboll.studio.libapputils.app.WinBollActivityManager; + +public class App extends GlobalApplication { + + public static final String TAG = "App"; + + @Override + public void onCreate() { + // 必须在调用基类前设置应用调试标志, + // 这样可以预先设置日志与数据的存储根目录。 + //setIsDebug(BuildConfig.DEBUG); + super.onCreate(); + // 设置 WinBoll 应用 UI 类型 + WinBollActivityManager.getInstance(this).setWinBollUI_TYPE(WinBollActivityManager.WinBollUI_TYPE.Aplication); + + LogUtils.d(TAG, "onCreate"); + } + +} diff --git a/contacts/src/main/java/cc/winboll/studio/contacts/MainActivity.java b/contacts/src/main/java/cc/winboll/studio/contacts/MainActivity.java new file mode 100644 index 0000000..60e9f78 --- /dev/null +++ b/contacts/src/main/java/cc/winboll/studio/contacts/MainActivity.java @@ -0,0 +1,205 @@ +package cc.winboll.studio.contacts; + +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.text.TextUtils; +import android.view.Menu; +import android.view.MenuItem; +import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; +import cc.winboll.studio.contacts.BuildConfig; +import cc.winboll.studio.contacts.R; +import cc.winboll.studio.libappbase.LogUtils; +import cc.winboll.studio.libapputils.app.IWinBollActivity; +import cc.winboll.studio.libapputils.app.WinBollActivityManager; +import cc.winboll.studio.libapputils.bean.APPInfo; +import cc.winboll.studio.libapputils.util.UriUtils; +import cc.winboll.studio.libapputils.view.StringToQrCodeView; +import cc.winboll.studio.libapputils.view.YesNoAlertDialog; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.UUID; +import cc.winboll.studio.libapputils.app.AboutActivityFactory; + +final public class MainActivity extends AppCompatActivity implements IWinBollActivity { + + public static final String TAG = "MainActivity"; + + public static final int REQUEST_HOME_ACTIVITY = 0; + public static final int REQUEST_ABOUT_ACTIVITY = 1; + + Toolbar mToolbar; + + @Override + public AppCompatActivity getActivity() { + return this; + } + + @Override + public APPInfo getAppInfo() { + String szBranchName = "contacts"; + + APPInfo appInfo = AboutActivityFactory.buildDefaultAPPInfo(); + appInfo.setAppName("Contacts"); + appInfo.setAppIcon(cc.winboll.studio.libapputils.R.drawable.ic_winboll); + appInfo.setAppDescription("Contacts Description"); + appInfo.setAppGitName("APP"); + appInfo.setAppGitOwner("Studio"); + appInfo.setAppGitAPPBranch(szBranchName); + appInfo.setAppGitAPPSubProjectFolder(szBranchName); + appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=Contacts"); + appInfo.setAppAPKName("Contacts"); + appInfo.setAppAPKFolderName("Contacts"); + return appInfo; + //return null; + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + // 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回 + //if (prosessIntents(getIntent())) return; + // 以下正常创建主窗口 + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + // 初始化工具栏 + mToolbar = findViewById(R.id.activitymainToolbar1); + setSupportActionBar(mToolbar); + if (isEnableDisplayHomeAsUp()) { + // 显示后退按钮 + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + } + getSupportActionBar().setSubtitle(getTag()); + + //ToastUtils.show("WinBollUI_TYPE " + WinBollApplication.getWinBollUI_TYPE()); + LogUtils.d(TAG, "BuildConfig.DEBUG : " + Boolean.toString(BuildConfig.DEBUG)); + } + + @Override + protected void onPostCreate(Bundle savedInstanceState) { + super.onPostCreate(savedInstanceState); + //setSubTitle(""); + } + + // + // 处理传入的 Intent 数据 + // +// boolean prosessIntents(Intent intent) { +// if (intent == null +// || intent.getAction() == null +// || intent.getAction().equals("")) +// return false; +// +// if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) { +// try { +// WinBollActivity clazzActivity = UnitTestActivity.class.newInstance(); +// String tag = clazzActivity.getTag(); +// LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag); +// Intent subIntent = new Intent(this, UnitTestActivity.class); +// subIntent.setAction(intent.getAction()); +// File file = new File(getCacheDir(), UUID.randomUUID().toString()); +// //取出文件uri +// Uri uri = intent.getData(); +// if (uri == null) { +// uri = intent.getParcelableExtra(Intent.EXTRA_STREAM); +// } +// //获取文件真实地址 +// String szSrcPath = UriUtils.getFileFromUri(getApplication(), uri); +// if (TextUtils.isEmpty(szSrcPath)) { +// return false; +// } +// +// Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath())); +// //startWinBollActivity(subIntent, tag); +// WinBollActivityManager.getInstance(this).startWinBollActivity(this, subIntent, UnitTestActivity.class); +// } catch (IllegalAccessException | InstantiationException | IOException e) { +// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); +// // 函数处理异常返回失败 +// return false; +// } +// } else { +// LogUtils.d(TAG, "prosessIntents|" + intent.getAction() + "|yet"); +// return false; +// } +// return true; +// } + + @Override + public String getTag() { + return TAG; + } + + @Override + public Toolbar initToolBar() { + return findViewById(R.id.activitymainToolbar1); + } + + @Override + public boolean isAddWinBollToolBar() { + return true; + } + + @Override + public boolean isEnableDisplayHomeAsUp() { + return false; + } + + @Override + public void onBackPressed() { + exit(); + } + + void exit() { + YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){ + + @Override + public void onYes() { + WinBollActivityManager.getInstance(getApplicationContext()).finishAll(); + } + + @Override + public void onNo() { + } + }; + YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.toolbar_main, menu); + return super.onCreateOptionsMenu(menu); + } + + + @Override + public boolean onOptionsItemSelected(MenuItem item) { +// if (item.getItemId() == R.id.item_unittest) { +// WinBollActivityManager.getInstance(this).startWinBollActivity(this, UnitTestActivity.class); +// } else +// if (item.getItemId() == R.id.item_exit) { +// exit(); +// return true; +// } + return super.onOptionsItemSelected(item); + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + switch (resultCode) { + case REQUEST_HOME_ACTIVITY : { + LogUtils.d(TAG, "REQUEST_HOME_ACTIVITY"); + break; + } + case REQUEST_ABOUT_ACTIVITY : { + LogUtils.d(TAG, "REQUEST_ABOUT_ACTIVITY"); + break; + } + default : { + super.onActivityResult(requestCode, resultCode, data); + } + } + } +} diff --git a/contacts/src/main/res/drawable/ic_launcher.xml b/contacts/src/main/res/drawable/ic_launcher.xml new file mode 100644 index 0000000..d4d1eaf --- /dev/null +++ b/contacts/src/main/res/drawable/ic_launcher.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/contacts/src/main/res/drawable/ic_launcher_background.xml b/contacts/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..9486190 --- /dev/null +++ b/contacts/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contacts/src/main/res/drawable/ic_launcher_foreground.xml b/contacts/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..872b04e --- /dev/null +++ b/contacts/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,10 @@ + + + + diff --git a/contacts/src/main/res/drawable/shape_gradient.xml b/contacts/src/main/res/drawable/shape_gradient.xml new file mode 100644 index 0000000..c164fe9 --- /dev/null +++ b/contacts/src/main/res/drawable/shape_gradient.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/contacts/src/main/res/layout/activity_main.xml b/contacts/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..ba8cd96 --- /dev/null +++ b/contacts/src/main/res/layout/activity_main.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + diff --git a/contacts/src/main/res/layout/view_toast.xml b/contacts/src/main/res/layout/view_toast.xml new file mode 100644 index 0000000..d6a9915 --- /dev/null +++ b/contacts/src/main/res/layout/view_toast.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + diff --git a/contacts/src/main/res/menu/toolbar_main.xml b/contacts/src/main/res/menu/toolbar_main.xml new file mode 100644 index 0000000..4a5cc30 --- /dev/null +++ b/contacts/src/main/res/menu/toolbar_main.xml @@ -0,0 +1,5 @@ + + + + diff --git a/contacts/src/main/res/values/colors.xml b/contacts/src/main/res/values/colors.xml new file mode 100644 index 0000000..bb20e29 --- /dev/null +++ b/contacts/src/main/res/values/colors.xml @@ -0,0 +1,7 @@ + + + + #FF196ABC + #FF002B57 + #FF80BFFF + diff --git a/contacts/src/main/res/values/strings.xml b/contacts/src/main/res/values/strings.xml new file mode 100644 index 0000000..cc96fb0 --- /dev/null +++ b/contacts/src/main/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + Contacts + + diff --git a/contacts/src/main/res/values/styles.xml b/contacts/src/main/res/values/styles.xml new file mode 100644 index 0000000..4b743f7 --- /dev/null +++ b/contacts/src/main/res/values/styles.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/contacts/src/main/res/xml/studio_provider.xml b/contacts/src/main/res/xml/studio_provider.xml new file mode 100644 index 0000000..f045677 --- /dev/null +++ b/contacts/src/main/res/xml/studio_provider.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/contacts/src/stage/AndroidManifest.xml b/contacts/src/stage/AndroidManifest.xml new file mode 100644 index 0000000..ee78d9f --- /dev/null +++ b/contacts/src/stage/AndroidManifest.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + diff --git a/contacts/src/stage/res/values/strings.xml b/contacts/src/stage/res/values/strings.xml new file mode 100644 index 0000000..ace0c41 --- /dev/null +++ b/contacts/src/stage/res/values/strings.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/settings.gradle-demo b/settings.gradle-demo index 860f719..e2ad341 100644 --- a/settings.gradle-demo +++ b/settings.gradle-demo @@ -37,3 +37,7 @@ //include ':aes' //include ':libaes' //rootProject.name = "aes" + +// Contacts 项目编译设置 +//include ':contacts' +//rootProject.name = "contacts" diff --git a/winboll-shared/build.properties b/winboll-shared/build.properties index d4e3b95..fb546db 100644 --- a/winboll-shared/build.properties +++ b/winboll-shared/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Fri Nov 29 11:55:20 GMT 2024 +#Wed Feb 12 15:27:12 GMT 2025 stageCount=0 libraryProject=winboll-shared -baseVersion=1.8 -publishVersion=1.8.16 -buildCount=0 -baseBetaVersion=1.8.17 +baseVersion=1.0 +publishVersion=1.0.0 +buildCount=2 +baseBetaVersion=1.0.1