Skip to content

Commit b301e60

Browse files
committed
update version code
1 parent cb2a3ae commit b301e60

File tree

15 files changed

+88
-92
lines changed

15 files changed

+88
-92
lines changed

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,33 @@ AndroidP7zip(P7Zip安卓)
33
An Android compress and extract library, P7Zip port for Android
44

55
### Details
6+
#### Get Started
67

7-
#### Begin To Use
8-
```gradle
8+
* Add gradle dependencie:
9+
``` gradle
910
dependencies {
10-
compile 'com.hzy:libp7zip:1.5.0'
11+
implementation 'com.hzy:libp7zip:1.6.0'
1112
}
1213
```
14+
* Or just download the aar [here](https://jcenter.bintray.com/com/hzy/libp7zip/)
15+
16+
* If you want to add some abi filters
17+
``` gradle
18+
android {
19+
...
20+
defaultConfig {
21+
...
22+
ndk {
23+
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
24+
}
25+
}
26+
}
27+
```
28+
29+
* Simple interface
30+
``` java
31+
P7ZipApi.executeCommand(String command);
32+
```
1333

1434
### Screenshot
1535
![image](https://raw.githubusercontent.com/hzy3774/AndroidP7zip/master/misc/screenshot.gif)

app/build.gradle

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ android {
1515
applicationId "com.hzy.p7zip.app"
1616
minSdkVersion 15
1717
targetSdkVersion 28
18-
versionCode 4
19-
versionName "1.5"
18+
versionCode 6
19+
versionName "1.6.0"
20+
ndk {
21+
abiFilters 'armeabi-v7a'
22+
}
2023
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
2124
}
2225
buildTypes {
@@ -30,6 +33,9 @@ android {
3033
signingConfig signingConfigs.demokey
3134
}
3235
}
36+
lintOptions {
37+
abortOnError false
38+
}
3339
}
3440

3541
dependencies {
@@ -39,7 +45,7 @@ dependencies {
3945
implementation 'com.android.support:design:28.0.0'
4046
implementation 'com.android.support:cardview-v7:28.0.0'
4147
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
42-
implementation 'com.blankj:utilcode:1.22.1'
48+
implementation 'com.blankj:utilcode:1.22.9'
4349
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'
4450
implementation 'com.jakewharton:butterknife:8.8.1'
4551
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

app/src/main/java/com/hzy/p7zip/app/fragment/AboutFragment.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public void onCreate(@Nullable Bundle savedInstanceState) {
3636

3737
@Nullable
3838
@Override
39-
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
39+
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
40+
@Nullable Bundle savedInstanceState) {
4041
View rootView = inflater.inflate(R.layout.fragment_about, null);
4142
ButterKnife.bind(this, rootView);
4243
mVersionInfo.setText(P7ZipApi.get7zVersionInfo());

app/src/main/java/com/hzy/p7zip/app/fragment/StorageFragment.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
import android.view.LayoutInflater;
1717
import android.view.View;
1818
import android.view.ViewGroup;
19-
import android.widget.Toast;
2019

2120
import com.afollestad.materialdialogs.MaterialDialog;
2221
import com.blankj.utilcode.util.SnackbarUtils;
22+
import com.hzy.libp7zip.ExitCode;
2323
import com.hzy.libp7zip.P7ZipApi;
2424
import com.hzy.p7zip.app.R;
2525
import com.hzy.p7zip.app.adapter.FileItemAdapter;
@@ -43,12 +43,6 @@
4343
import io.reactivex.schedulers.Schedulers;
4444

4545
import static android.support.v7.widget.LinearLayoutManager.HORIZONTAL;
46-
import static com.hzy.p7zip.app.command.ExitCode.EXIT_CMD_ERROR;
47-
import static com.hzy.p7zip.app.command.ExitCode.EXIT_FATAL;
48-
import static com.hzy.p7zip.app.command.ExitCode.EXIT_MEMORY_ERROR;
49-
import static com.hzy.p7zip.app.command.ExitCode.EXIT_NOT_SUPPORT;
50-
import static com.hzy.p7zip.app.command.ExitCode.EXIT_OK;
51-
import static com.hzy.p7zip.app.command.ExitCode.EXIT_WARNING;
5246

5347
/**
5448
* Created by huzongyao on 17-7-10.
@@ -273,22 +267,22 @@ private void dismissProgressDialog() {
273267
private void showResult(int result) {
274268
int retMsgId = R.string.msg_ret_success;
275269
switch (result) {
276-
case EXIT_OK:
270+
case ExitCode.EXIT_OK:
277271
retMsgId = R.string.msg_ret_success;
278272
break;
279-
case EXIT_WARNING:
273+
case ExitCode.EXIT_WARNING:
280274
retMsgId = R.string.msg_ret_warning;
281275
break;
282-
case EXIT_FATAL:
276+
case ExitCode.EXIT_FATAL:
283277
retMsgId = R.string.msg_ret_fault;
284278
break;
285-
case EXIT_CMD_ERROR:
279+
case ExitCode.EXIT_CMD_ERROR:
286280
retMsgId = R.string.msg_ret_command;
287281
break;
288-
case EXIT_MEMORY_ERROR:
282+
case ExitCode.EXIT_MEMORY_ERROR:
289283
retMsgId = R.string.msg_ret_memmory;
290284
break;
291-
case EXIT_NOT_SUPPORT:
285+
case ExitCode.EXIT_NOT_SUPPORT:
292286
retMsgId = R.string.msg_ret_user_stop;
293287
break;
294288
default:

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<string name="folder_cant_extract">Folder Can Not Be Extracted!</string>
2222

2323
<string name="progress_title">Message</string>
24-
<string name="progress_message">Please wait...</string>
24+
<string name="progress_message">Please wait</string>
2525
<string name="msg_ret_success">Success</string>
2626
<string name="msg_ret_warning">Warning (Non fatal error(s))</string>
2727
<string name="msg_ret_fault">Fatal error </string>

libp7zip/build.gradle

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ android {
66
defaultConfig {
77
minSdkVersion 15
88
targetSdkVersion 28
9-
versionCode 5
10-
versionName "1.5.0"
9+
versionCode 6
10+
versionName "1.6.0"
1111
ndk {
12-
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86'
12+
abiFilters 'armeabi-v7a'//, 'arm64-v8a', 'x86'
1313
}
1414
externalNativeBuild {
1515
cmake {
@@ -21,6 +21,7 @@ android {
2121
debug {
2222
externalNativeBuild {
2323
cmake {
24+
// log switch
2425
cppFlags.add('-DNATIVE_LOG')
2526
}
2627
}
@@ -31,6 +32,9 @@ android {
3132
path 'src/main/cpp/CMakeLists.txt'
3233
}
3334
}
35+
lintOptions {
36+
abortOnError false
37+
}
3438
}
3539

3640
dependencies {

libp7zip/src/androidTest/java/com/hzy/libp7zip/ExampleInstrumentedTest.java

Lines changed: 0 additions & 26 deletions
This file was deleted.

libp7zip/src/main/AndroidManifest.xml

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
3-
package="com.hzy.libp7zip">
4-
5-
<application
6-
android:allowBackup="true"
7-
android:label="@string/app_name"
8-
android:supportsRtl="true">
9-
10-
</application>
11-
12-
</manifest>
1+
<manifest package="com.hzy.libp7zip" />

libp7zip/src/main/cpp/ndkhelper.h

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ extern "C" {
66
#endif
77

88
#include <jni.h>
9+
#include <android/log.h>
10+
#include <7zip/MyVersion.h>
11+
12+
#define MY_P7ZIP_VERSION_INFO "P7Zip Version: "MY_VERSION"\n"MY_COPYRIGHT"\nDate: "MY_DATE
913

1014
#ifdef NATIVE_LOG
1115
#define LOG_TAG "NATIVE.LOG"
12-
#include <android/log.h>
13-
1416
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
1517
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
1618
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN,LOG_TAG,__VA_ARGS__)
@@ -24,11 +26,26 @@ extern "C" {
2426
#define LOGF(...) do{}while(0)
2527
#endif
2628

27-
JNIEXPORT jstring JNICALL
28-
Java_com_hzy_libp7zip_P7ZipApi_get7zVersionInfo(JNIEnv *env, jclass type);
29+
#define JNI_FUNC(X) Java_com_hzy_libp7zip_P7ZipApi_##X
2930

31+
/**
32+
* To Get lib p7zip version info
33+
* @param env
34+
* @param type
35+
* @return
36+
*/
37+
JNIEXPORT jstring JNICALL
38+
JNI_FUNC(get7zVersionInfo)(JNIEnv *env, jclass type);
39+
40+
/**
41+
* To execute some command with p7zip
42+
* @param env
43+
* @param type
44+
* @param command_
45+
* @return
46+
*/
3047
JNIEXPORT jint JNICALL
31-
Java_com_hzy_libp7zip_P7ZipApi_executeCommand(JNIEnv *env, jclass type, jstring command_);
48+
JNI_FUNC(executeCommand)(JNIEnv *env, jclass type, jstring command_);
3249

3350
#ifdef __cplusplus
3451
}

libp7zip/src/main/cpp/p7zip.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
#include <ndkhelper.h>
2-
#include <7zip/MyVersion.h>
32
#include <cmd/command.h>
43

5-
#define MY_P7ZIP_VERSION_INFO "7zVersion: "MY_VERSION"\n"MY_COPYRIGHT"\nDate: "MY_DATE
6-
74
JNIEXPORT jstring JNICALL
8-
Java_com_hzy_libp7zip_P7ZipApi_get7zVersionInfo(JNIEnv *env, jclass type) {
5+
JNI_FUNC(get7zVersionInfo)(JNIEnv *env, jclass type) {
96
return env->NewStringUTF(MY_P7ZIP_VERSION_INFO);
107
}
118

129
JNIEXPORT jint JNICALL
13-
Java_com_hzy_libp7zip_P7ZipApi_executeCommand(JNIEnv *env, jclass type, jstring command_) {
10+
JNI_FUNC(executeCommand)(JNIEnv *env, jclass type, jstring command_) {
1411
const char *command = env->GetStringUTFChars(command_, 0);
1512
LOGI("CMD:[%s]", command);
1613
int ret = executeCommand(command);

0 commit comments

Comments
 (0)