Skip to content

Commit

Permalink
增加解密说明
Browse files Browse the repository at this point in the history
  • Loading branch information
weihuagu committed Mar 28, 2019
1 parent eaf626a commit fa0ee85
Show file tree
Hide file tree
Showing 13 changed files with 429 additions and 62 deletions.
5 changes: 3 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ android {
applicationId "com.weihuagu.receiptnotice"
minSdkVersion 19
targetSdkVersion 25
versionCode 3
versionName "0.3"
versionCode 4
versionName "0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -35,6 +35,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.github.wangjintao:TLog:v1.0.1'
Expand Down
47 changes: 47 additions & 0 deletions app/build.gradle~
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.weihuagu.receiptnotice"
minSdkVersion 19
targetSdkVersion 25
versionCode 4
versionName "0.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}


signingConfigs{
debug {

}
release {
}
}

buildTypes {
debug {

}
release {
}
}
lintOptions {
abortOnError false
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.github.wangjintao:TLog:v1.0.1'
implementation 'com.github.pedrovgs:lynx:1.1.0'
implementation 'com.gcssloop.util:encrypt:1.0.2'
testImplementation 'junit:junit:4.12'
testImplementation "org.mockito:mockito-core:1.10.19"
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
7 changes: 6 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LogActivity">
<activity android:name=".LogActivity"/>
<activity android:name=".IllustrateDecryptActivity">
<intent-filter>
<action android:name="com.weihuagu.receiptnotice.illustratedecryptmethod"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<activity android:name="com.github.pedrovgs.lynx.LynxActivity"/>
<activity android:name=".PreferenceActivity"/>
Expand Down
34 changes: 34 additions & 0 deletions app/src/main/AndroidManifest.xml~
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.weihuagu.receiptnotice">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name=".MainApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LogActivity">
</activity>
<activity android:name="com.github.pedrovgs.lynx.LynxActivity"/>
<activity android:name=".PreferenceActivity"/>

<service android:name=".NLService"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<service android:name=".NotificationCollectorMonitorService"/>
</application>
</manifest>
58 changes: 0 additions & 58 deletions app/src/main/java/com/weihuagu/receiptnotice/DESUtilWithIV.java~

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package com.weihuagu.receiptnotice;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

public class IllustrateDecryptActivity extends AppCompatActivity {
private TextView text_method;
private TextView text_passwd;
private TextView text_iv;
private PreferenceUtil preference;
private void initView() {
text_method = (TextView) findViewById(R.id.info_text_method);
text_passwd = (TextView) findViewById(R.id.info_text_passwd);
text_iv = (TextView) findViewById(R.id.info_text_iv);
preference=new PreferenceUtil(getBaseContext());

}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_illustratedecrypt);
initView();
setText();
}

private void setText(){
String encrypt_type=preference.getEncryptMethod();
if(encrypt_type==null)
text_method.setText("您没有设置加密方法");
if(encrypt_type.equals("des")){

String method="DES/CBC/PKCS5Padding";
text_method.setText("解密的方法为:"+method);
String key=preference.getPasswd();
if(key!=null){
text_passwd.setText("解密秘钥为:"+key+"(des秘钥必须为8位,如果你设置的不是8位,请修改)");
text_iv.setText("解密的初始化向量为:"+key);

}
}







}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.weihuagu.receiptnotice;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

public class IllustrateDecryptActivity extends AppCompatActivity {
private TextView text_method;
private TextView text_passwd;
private TextView text_iv;
private PreferenceUtil preference;
private void initView() {
text_method = (TextView) findViewById(R.id.info_text_method);
text_passwd = (TextView) findViewById(R.id.info_text_passwd);
text_iv = (TextView) findViewById(R.id.info_text_iv);
preference=new PreferenceUtil(getBaseContext());

}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_illustratedecrypt.xml);
initView();
setText();
}

private void setText(){
if(preference.getEncryptMethod().equals("des")){

String method="DES/CBC/PKCS5Padding";
text_method.setText("解密的方法为:"+method);
String key=preference.getPasswd();
if(key!=null){
text_passwd.setText("解密秘钥为:"+key);
text_iv.setText("解密的初始化向量为:"+key);

}
}







}
}
68 changes: 68 additions & 0 deletions app/src/main/res/layout/activity_illustratedecrypt.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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="com.weihuagu.receiptnotice.MainActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/my_toolbar"
android:orientation="vertical">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="4dp">

<TextView
android:id="@+id/info_text_method"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="4dp">

<TextView
android:id="@+id/info_text_passwd"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.v7.widget.CardView>

<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
card_view:cardCornerRadius="4dp">

<TextView
android:id="@+id/info_text_iv"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.v7.widget.CardView>

</LinearLayout>



</android.support.constraint.ConstraintLayout>
Loading

0 comments on commit fa0ee85

Please sign in to comment.