Skip to content

Commit

Permalink
首次提交
Browse files Browse the repository at this point in the history
首次提交
  • Loading branch information
su committed Apr 5, 2020
1 parent 70ef525 commit 052503e
Show file tree
Hide file tree
Showing 38 changed files with 1,820 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
# OperatorClient
# OperatorClient

营业厅客户端

我就想简单的查个流量而已,为啥要我装个百来M的客户端。暂时只支持联通手机号。

## 效果图

![00.png](https://raw.githubusercontent.com/wuxiaosu/OperatorClient/master/screenshots/00.jpg)

## 下载

- release from [github](https://github.com/wuxiaosu/OperatorClient/releases)
70 changes: 70 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.wuxiaosu.operatorclient"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

/* signingConfigs {
release {
storeFile file(STORE_FILE)
storePassword STORE_PASSWORD
keyAlias KEY_ALIAS
keyPassword KEY_PASSWORD
}
}*/

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

applicationVariants.all { variant ->
variant.outputs.all { output ->
def oldFile = output.outputFileName
def newName = oldFile
if (variant.buildType.name == 'release') {
newName = oldFile.replace(".", "_v" + variant.versionName + "_" + variant.versionCode + '.')
.replace("app-", "operatorclient").replace("release", "")
}
outputFileName = newName
}
}
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

implementation 'com.koushikdutta.ion:ion:3.0.8'
}
42 changes: 42 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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

-keep class com.wuxiaosu.operatorclient.bean.*{*;}
-keep class com.wuxiaosu.operatorclient.http.resp.*{*;}

-assumenosideeffects class android.util.Log {

public static *** d(...);

public static *** e(...);

public static *** i(...);

public static *** v(...);

public static *** println(...);

public static *** w(...);

public static *** wtf(...);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.su.unicomreq;

import android.content.Context;

import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();

assertEquals("com.su.unicomreq", appContext.getPackageName());
}
}
25 changes: 25 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wuxiaosu.operatorclient">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<application
android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".activity.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
100 changes: 100 additions & 0 deletions app/src/main/java/com/wuxiaosu/operatorclient/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
package com.wuxiaosu.operatorclient

import android.app.Application
import android.content.Context
import android.util.Base64
import com.google.gson.Gson
import com.wuxiaosu.operatorclient.bean.PhoneInfo
import com.wuxiaosu.operatorclient.util.SPUtils

/**
* Created by su on 2020/1/2.
*/
class App : Application() {

override fun onCreate() {
super.onCreate()
sContext = this
}

companion object {

var sContext: Context? = null

fun getContext(): Context {
return sContext!!
}
}

object Session {
private const val KEY_FIRST = "first"
private const val KEY_FIRST_COOKIE = "first_cookie"
private const val KEY_FIRST_PHONE_NUM = "first_phone_num"
private const val KEY_FIRST_SHOW_NUM = "first_show_num"
var firstPhone: PhoneInfo? = null
get() {
if (field == null) {
field = Gson().fromJson(String(Base64.decode(SPUtils.getInstance(BuildConfig.APPLICATION_ID)
.getString(KEY_FIRST), Base64.DEFAULT)), PhoneInfo::class.java)
}
return field
}
set(firstPhone) {
SPUtils.getInstance(BuildConfig.APPLICATION_ID)
.put(KEY_FIRST, Base64.encodeToString(Gson().toJson(firstPhone).toByteArray(), Base64.DEFAULT))
field = firstPhone
}
private var firstCookie: String? = null
private var firstPhoneNum: String? = null
private var firstShowNum: String? = null

fun getFirstCookie(): String? {
if (firstCookie == null) {
firstCookie = String(Base64.decode(SPUtils.getInstance(BuildConfig.APPLICATION_ID)
.getString(KEY_FIRST_COOKIE), Base64.DEFAULT))
}
return firstCookie
}

fun setFirstCookie(firstCookie: String?) {
val v = if (firstCookie.isNullOrEmpty()) "" else
Base64.encodeToString(firstCookie.toByteArray(), Base64.DEFAULT)
SPUtils.getInstance(BuildConfig.APPLICATION_ID)
.put(KEY_FIRST_COOKIE, v)
Session.firstCookie = firstCookie
}

fun getFirstPhoneNum(): String? {
if (firstPhoneNum == null) {
firstPhoneNum = String(Base64.decode(SPUtils.getInstance(BuildConfig.APPLICATION_ID)
.getString(KEY_FIRST_PHONE_NUM), Base64.DEFAULT))
}
return firstPhoneNum
}

fun setFirstPhoneNum(firstPhoneNum: String?) {
val v = if (firstPhoneNum.isNullOrEmpty()) "" else
Base64.encodeToString(firstPhoneNum.toByteArray(), Base64.DEFAULT)
SPUtils.getInstance(BuildConfig.APPLICATION_ID)
.put(KEY_FIRST_PHONE_NUM, v)
Session.firstPhoneNum = firstPhoneNum
}

fun getFirstShowNum(): String? {
if (firstShowNum == null) {
firstShowNum = String(Base64.decode(SPUtils.getInstance(BuildConfig.APPLICATION_ID)
.getString(KEY_FIRST_SHOW_NUM), Base64.DEFAULT))
}
return firstShowNum
}

fun setFirstShowNum(firstShowNum: String?) {
val v = if (firstShowNum.isNullOrEmpty()) "" else
Base64.encodeToString(firstShowNum.toByteArray(), Base64.DEFAULT)
SPUtils.getInstance(BuildConfig.APPLICATION_ID)
.put(KEY_FIRST_SHOW_NUM, v)
Session.firstShowNum = firstShowNum
}
}

}
Loading

0 comments on commit 052503e

Please sign in to comment.