Skip to content

Commit bde8b6d

Browse files
author
litongjava
committed
init commit
0 parents  commit bde8b6d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1688
-0
lines changed

.gitignore

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
### Eclipse template
2+
*.pydevproject
3+
.metadata
4+
.gradle*
5+
classes/
6+
bin/
7+
tmp/
8+
*.tmp
9+
*.bak
10+
*.swp
11+
*~.nib
12+
local.properties
13+
.settings/
14+
.loadpath
15+
rebel.xml
16+
17+
# Eclipse Core
18+
.project
19+
20+
generatedsources
21+
22+
# External tool builders
23+
.externalToolBuilders/
24+
25+
# Locally stored "Eclipse launch configurations"
26+
*.launch
27+
28+
# CDT-specific
29+
.cproject
30+
31+
# JDT-specific (Eclipse Java Development Tools)
32+
.classpath
33+
34+
# PDT-specific
35+
.buildpath
36+
37+
# sbteclipse plugin
38+
.target
39+
40+
# TeXlipse plugin
41+
.texlipse
42+
43+
44+
45+
### JetBrains template
46+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
47+
48+
*.iml
49+
.flattened-pom.xml
50+
## Directory-based project format:
51+
.idea/
52+
# if you remove the above rule, at least ignore the following:
53+
54+
# User-specific stuff:
55+
# .idea/workspace.xml
56+
# .idea/tasks.xml
57+
# .idea/dictionaries
58+
59+
# Sensitive or high-churn files:
60+
# .idea/dataSources.ids
61+
# .idea/dataSources.xml
62+
# .idea/sqlDataSources.xml
63+
# .idea/dynamic.xml
64+
# .idea/uiDesigner.xml
65+
66+
# Gradle:
67+
# .idea/gradle.xml
68+
# .idea/libraries
69+
70+
# Mongo Explorer plugin:
71+
# .idea/mongoSettings.xml
72+
73+
## File-based project format:
74+
*.ipr
75+
*.iws
76+
77+
## Plugin-specific files:
78+
79+
# IntelliJ
80+
/out/
81+
82+
# mpeltonen/sbt-idea plugin
83+
.idea_modules/
84+
85+
# JIRA plugin
86+
atlassian-ide-plugin.xml
87+
88+
# Crashlytics plugin (for Android Studio and IntelliJ)
89+
com_crashlytics_export_strings.xml
90+
crashlytics.properties
91+
crashlytics-build.properties
92+
93+
build/
94+
95+
# Ignore Gradle GUI config
96+
gradle-app.setting
97+
98+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
99+
!gradle-wrapper.jar
100+
101+
db
102+
103+
### Java template
104+
*.class
105+
106+
# Mobile Tools for Java (J2ME)
107+
.mtj.tmp/
108+
109+
# Package Files #
110+
#*.jar
111+
112+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
113+
hs_err_pid*
114+
115+
116+
### Leiningen template
117+
classes/
118+
target/
119+
logs/
120+
checkouts/
121+
.lein-deps-sum
122+
.lein-repl-history
123+
.lein-plugins/
124+
.lein-failures
125+
.nrepl-port
126+
127+
querydsl/
128+
129+
.DS_Store
130+
131+
*.exe
132+
*.out
133+
134+
*.log
135+
node_modules/
136+
dist/
137+
dist.zip
138+
package-lock.json
139+
*.lock
140+
local.properties
141+
.cxx
142+
.externalNativeBuild
143+
/captures
144+
/build
145+
__pycache__/
146+
*.pyc
147+
148+
149+
cmake-build-debug/
150+
cmake-build-debug-mingw/
151+
venv/
152+
.vs/
153+
Debug/
154+
*.zip
155+
*.bin

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
plugins {
2+
id 'com.android.application'
3+
}
4+
5+
android {
6+
compileSdkVersion 30
7+
buildToolsVersion '30.0.3'
8+
9+
defaultConfig {
10+
applicationId "com.litongjava.whisper.cpp.android.java.demo"
11+
minSdkVersion 21
12+
targetSdkVersion 30
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
19+
buildTypes {
20+
release {
21+
minifyEnabled false
22+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23+
}
24+
}
25+
compileOptions {
26+
sourceCompatibility JavaVersion.VERSION_1_8
27+
targetCompatibility JavaVersion.VERSION_1_8
28+
}
29+
}
30+
31+
dependencies {
32+
33+
implementation 'com.google.android.material:material:1.1.0'
34+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
35+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
36+
implementation 'androidx.appcompat:appcompat:1.1.0'
37+
38+
testImplementation 'junit:junit:4.+'
39+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
40+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
41+
42+
//litongjava
43+
implementation 'com.litongjava:android-view-inject:1.0'
44+
implementation 'com.litongjava:litongjava-android-utils:1.0.0'
45+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.litongjava.whispercppandroidjavademo;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.platform.app.InstrumentationRegistry;
6+
import androidx.test.ext.junit.runners.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24+
assertEquals("com.litongjava.whispercppandroidjavademo", appContext.getPackageName());
25+
}
26+
}

app/src/main/AndroidManifest.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.litongjava.whisper.cpp.android.java.demo">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.Whispercppandroidjavademo">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>

app/src/main/assets/logback.xml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<configuration debug="false" xmlns="http://ch.qos.logback/xml/ns/logback"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://ch.qos.logback/xml/ns/logback https://raw.githubusercontent.com/enricopulatzo/logback-XSD/master/src/main/xsd/logback.xsd
5+
http://ch.qos.logback/xml/ns/logback ">
6+
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
7+
<property name="LOG_HOME" value="logs" />
8+
<!--格式化输出:%d表示日期,%-6level:日志级别从左显示6个字符宽度,%m:日志消息,%n是换行符 -->
9+
<property name="CONSOLE_LOG_PATTERN"
10+
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-6level%logger{0}.%M:%L - %m%n" />
11+
12+
<!-- 控制台输出 -->
13+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
14+
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
15+
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
16+
</encoder>
17+
</appender>
18+
19+
<!-- 按照每天生成日志文件 -->
20+
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
21+
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
22+
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
23+
</encoder>
24+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
25+
<!--日志文件输出的文件名 -->
26+
<fileNamePattern>${LOG_HOME}/project-name-%d{yyyy-MM-dd}.log</fileNamePattern>
27+
<!--日志文件保留天数 -->
28+
<maxHistory>180</maxHistory>
29+
</rollingPolicy>
30+
<!--日志文件最大的大小 -->
31+
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
32+
<maxFileSize>10MB</maxFileSize>
33+
</triggeringPolicy>
34+
</appender>
35+
<!-- 日志输出级别 和输出源 -->
36+
<root level="info">
37+
<appender-ref ref="STDOUT" />
38+
<appender-ref ref="FILE" />
39+
</root>
40+
</configuration>

0 commit comments

Comments
 (0)