Skip to content

Commit

Permalink
登录拦截器优化、修复组件配置问题、加入语音识别功能组件
Browse files Browse the repository at this point in the history
wosojadfjgo committed Sep 4, 2019
1 parent 2908416 commit 534f946
Showing 130 changed files with 4,795 additions and 75 deletions.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# YouJu
[![](https://img.shields.io/badge/platform-android-brightgreen.svg)](https://developer.android.com/index.html) [![API](https://img.shields.io/badge/API-16%2B-blue.svg?style=flat)](https://android-arsenal.com/api?level=14) [![Twitter](https://img.shields.io/badge/Gradle-3.4.1-brightgreen.svg)](https://github.com/jiangzehui/polygonsview)


### 项目简介
“优聚”是一款集多个平台的资讯内容、复合型优秀资源和实用功能的APP,打破传统限制,融合多元,发现更多、更优秀、更有趣的东西。后续也会加入更多新的功能。也欢迎各位提出意见。
项目是一款组件化综合案例,包含新闻,MONO资讯,开眼视频,美女图片,垃圾分类,一言,古诗词,智能聊天机器人,语音识别功能,干货集中营,豆瓣电影等等模块。
项目利用业余时间开发,时间不固定,暂时只实现了这些功能。

### 主要模块
目前包含的主要模块有:base基础模块、network网络请求模块、语音识别模块、Gank模块、资讯模块。除base和network外,每个模块都可单独抽离为APP运行,不影响主工程,具体参照config.gradle配置文件。

### 架构模式
项目采用组件化Arouter+MVP+RxJava2+Retrofit2+AndroidX+Dagger2+Kotlin/Java混编模式

### \*\*
此项目属于业余时间练手的项目,接口数据来源均来自网络,如果存在侵权情况,请第一时间告知。本项目仅做学习交流使用,API数据内容所有权归原作公司所有,请勿用于其他用途!!

### Demo
[下载 Demo](https://github.com/HeYongRui/YouJu/tree/master/apk/app-debug.apk)体验

### 截图
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ android {
versionCode versions.publishVersionCode
versionName versions.publishVersion
multiDexEnabled true

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

kapt {
@@ -87,6 +88,9 @@ dependencies {
if (!rootProject.ext.isRunAloneModule2) {
implementation project(':module2')
}
if (!rootProject.ext.isRunAloneIflytek) {
implementation project(':iflytek')
}
//美团walle打包
implementation "com.meituan.android.walle:library:${versions.walle}"
//Arouter路由
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
android:name=".WelcomeActivity"
android:theme="@style/BaseAppTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
2 changes: 1 addition & 1 deletion base/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
android:value="portrait|landscape" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.heyongrui.base.fileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
19 changes: 19 additions & 0 deletions base/src/main/java/com/heyongrui/base/app/BaseApplication.java
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ public void onCreate() {
//注册网络状态监听器
NetStateChangeReceiver.registerReceiver(this);
registerActivityLife();
modulesApplicationInit();
}

private void initX5Webview() {
@@ -121,4 +122,22 @@ private void initializeInjector() {
.appModule(new AppModule(this))
.build();
}

private void modulesApplicationInit() {
for (String moduleImpl : ModuleConfig.MODULESLIST) {
try {
Class<?> clazz = Class.forName(moduleImpl);
Object obj = clazz.newInstance();
if (obj instanceof BaseApplicationImpl) {
((BaseApplicationImpl) obj).onCreate(this);
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InstantiationException e) {
e.printStackTrace();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.heyongrui.base.app;

public interface BaseApplicationImpl {
void onCreate(BaseApplication application);
}
7 changes: 7 additions & 0 deletions base/src/main/java/com/heyongrui/base/app/ModuleConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.heyongrui.base.app;

public class ModuleConfig {
public static final String[] MODULESLIST = {
"com.heyongrui.iflytek.mscv5plusdemo.IflytedApplicationImpl"
};
}
Original file line number Diff line number Diff line change
@@ -49,4 +49,6 @@ public class ConfigConstants {
public static final String PATH_WELFARE = "/module2/welfare";
public static final String PATH_ABOUT = "/module2/about";
public static final String PATH_ENCOURAGE = "/module2/encourage";
//科大讯飞Iflytek模块路径
public static final String PATH_VOICE_DICATION_PROVIDER = "/iflytek/service";
}
Original file line number Diff line number Diff line change
@@ -46,10 +46,8 @@ public void onSuccess(Postcard postcard) {
if (null != postcard) {
String targetPath = postcard.getPath();
bundle = postcard.getExtras();
if (!TextUtils.isEmpty(targetPath)) {
if (!TextUtils.equals(ConfigConstants.PATH_LOGIN, targetPath)) {
bundle.putString(ConfigConstants.PATH_TARGET, targetPath);
}
if (null != bundle && !TextUtils.isEmpty(targetPath) && !TextUtils.equals(ConfigConstants.PATH_LOGIN, targetPath)) {
bundle.putString(ConfigConstants.PATH_TARGET, targetPath);
}
}
ARouter.getInstance().build(ConfigConstants.PATH_LOGIN)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.heyongrui.base.provider;

import android.content.Context;

import com.alibaba.android.arouter.facade.template.IProvider;

public interface IIflytekProvider extends IProvider {

void initialize(Context context);

void startDictation(VoiceDictationListener voiceDictationListener);

void stopDictation();

void cancelDictation();

void uploadContact();

void uploadUserWords();

void release();

interface VoiceDictationListener {
void onResult(String result, boolean isSuccess);
}
}
3 changes: 2 additions & 1 deletion base/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>
<string name="app_name">base</string>
<string name="exit_tip">再按一次退出程序</string>
<string name="app_intro">“优聚”是一款集多种优秀资源和实用功能的APP,打破传统限制,融合多元,发现更多、更优秀、更有趣的东西。后续也会加入更多新的功能。也欢迎各位提出意见。</string>
<string name="app_intro">“优聚”是一款集多个平台的资讯内容、复合型优秀资源和实用功能的APP,打破传统限制,融合多元,发现更多、更优秀、更有趣的东西。后续也会加入更多新的功能。也欢迎各位提出意见。</string>
<string name="update_url">https://raw.githubusercontent.com/HeYongRui/YouJu/master/app/version_update.json</string>
<string name="update_title">更新提示</string>
<string name="update_error">更新失败</string>
@@ -15,6 +15,7 @@
<string name="cancel">取消</string>
<string name="permisson_title">权限提示</string>
<string name="read_write_permisson">此功能需要开启读写权限</string>
<string name="related_permisson">此功能需要开启相关权限</string>
<string name="install_permisson">请开启安装权限</string>
<string name="system_title">系统提示</string>
<string name="go_setting">设定</string>
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@ allprojects {
mavenCentral()
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
maven { url 'http://libmsc.xfyun.cn/repository/maven-releases/' }
}
}

1 change: 1 addition & 0 deletions config.gradle
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ ext {
isRunAloneUser = false;//user模块是否可以单独运行
isRunAloneModule = false;//module模块是否可以单独运行
isRunAloneModule2 = false;//module2模块是否可以单独运行
isRunAloneIflytek = false;//科大讯飞模块是否可以单独运行
//版本号控制
versions = [
//Project
65 changes: 65 additions & 0 deletions iflytek/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/caches

# Keystore files
# Uncomment the following line if you do not want to check your keystore files in.
#*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Google Services (e.g. APIs or Firebase)
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md
103 changes: 103 additions & 0 deletions iflytek/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
if (rootProject.ext.isRunAloneIflytek) {
apply plugin: 'com.android.application'
} else {
apply plugin: 'com.android.library'
}
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
compileSdkVersion versions.compileSdk

defaultConfig {
if (rootProject.ext.isRunAloneIflytek) {
applicationId "com.heyongrui.iflytek"
multiDexEnabled true
}
minSdkVersion versions.minSdk
targetSdkVersion versions.compileSdk
versionCode versions.publishVersionCode
versionName versions.publishVersion

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
kapt {
arguments {
arg("AROUTER_MODULE_NAME", project.getName())
}
}
// javaCompileOptions {
// annotationProcessorOptions {
// arguments = [AROUTER_MODULE_NAME: project.getName()]
// }
// }
}

signingConfigs {
release {
storeFile file("../keystore.jks")
storePassword "111111"
keyAlias "youju"
keyPassword "111111"
}

debug {
storeFile file("../keystore.jks")
storePassword "111111"
keyAlias "youju"
keyPassword "111111"
}
}

buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}

compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}

sourceSets {
main {
if (rootProject.ext.isRunAloneIflytek) {
manifest.srcFile 'src/main/debug/AndroidManifest.xml'
java.srcDirs = ['src/main/debug/java/', 'src/main/java/']
res.srcDirs = ['src/main/debug/res', 'src/main/res']
} else {
manifest.srcFile 'src/main/AndroidManifest.xml'
java.srcDirs = ['src/main/java/']
res.srcDirs = ['src/main/res']
java {
exclude 'src/main/debug/**'
}
}

}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':base')
implementation project(':network')
//Arouter路由
kapt "com.alibaba:arouter-compiler:${versions.arouterCompiler}"
//dagger
kapt "com.google.dagger:dagger-compiler:${versions.dagger}"

testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Binary file added iflytek/libs/Msc.jar
Binary file not shown.
21 changes: 21 additions & 0 deletions iflytek/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# 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 *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Loading

0 comments on commit 534f946

Please sign in to comment.