Skip to content

Commit

Permalink
更新demo
Browse files Browse the repository at this point in the history
  • Loading branch information
shenbengit committed Jul 21, 2021
1 parent 4a686b9 commit 8dc4f4a
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 14 deletions.
21 changes: 11 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ android {
versionName rootProject.ext.android.versionName

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

ndk {
// 设置支持的SO库架构,仅支持armeabi-v7a、arm64-v8a,若想减小APK体积,可只引用对应的SO库架构
abiFilters 'armeabi-v7a'//, 'arm64-v8a'
}
}

buildTypes {
Expand Down Expand Up @@ -47,17 +52,13 @@ android {

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation project(path: ':lib')
implementation project(path: ':lib-v7a')
implementation project(path: ':lib-v8a')
// implementation 'com.github.shenbengit.TTSTool:lib:1.0.1'
// implementation 'com.github.shenbengit.TTSTool:lib-v7a:1.0.1'
// implementation 'com.github.shenbengit.TTSTool:lib-v8a:1.0.1'
// implementation 'com.github.shenbengit.TTSTool:lib:1.0.3'
}
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.TTSTool">
<activity android:name=".JavaActivity" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
26 changes: 26 additions & 0 deletions app/src/main/java/com/shencoder/ttstooldemo/JavaActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.shencoder.ttstooldemo;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.iflytek.cloud.InitListener;
import com.shencoder.ttstool.TTSManager;
import com.shencoder.ttstool.TTSManagerExtKt;

public class JavaActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_java);
findViewById(R.id.btnTTS).setOnClickListener(v -> TTSManagerExtKt.startSpeaking("啦啦啦德玛西亚"));
}

@Override
protected void onDestroy() {
super.onDestroy();
}
}
6 changes: 3 additions & 3 deletions app/src/main/java/com/shencoder/ttstooldemo/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package com.shencoder.ttstooldemo

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import com.shencoder.ttstool.destroyTTS
import com.shencoder.ttstool.initTTS
import com.shencoder.ttstool.startSpeaking

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
initTTS(this, "appId", true)
initTTS(this, "97939e0c", true)
findViewById<Button>(R.id.btnTTS).setOnClickListener {
startSpeaking("播报测试")
startActivity(Intent(this,JavaActivity::class.java))
}
}

Expand Down
19 changes: 19 additions & 0 deletions app/src/main/res/layout/activity_java.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".JavaActivity">

<Button
android:id="@+id/btnTTS"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TTS"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
android:id="@+id/btnTTS"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TTS"
android:text="跳转到JavaActivity"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
Expand Down

0 comments on commit 8dc4f4a

Please sign in to comment.