集成aTrust SDK
parent
e72a10ed74
commit
90f5155d42
Binary file not shown.
@ -0,0 +1,67 @@
|
||||
package com.rehome.zhdcoa.vpn;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* 获取app信息的公共类
|
||||
*/
|
||||
public class AppInfoUtils {
|
||||
|
||||
private static String TAG = "AppInfoUtils";
|
||||
|
||||
/**
|
||||
* 获取当前应用名称
|
||||
*
|
||||
* @param activity
|
||||
* @return
|
||||
*/
|
||||
public static String getApplicationName(Activity activity) {
|
||||
PackageManager packageManager;
|
||||
ApplicationInfo applicationInfo;
|
||||
try {
|
||||
packageManager = activity.getApplicationContext().getPackageManager();
|
||||
applicationInfo = packageManager.getApplicationInfo(activity.getPackageName(), 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.i(TAG,"PackageManager.NameNotFoundException");
|
||||
return "";
|
||||
}
|
||||
String applicationName = (String) packageManager.getApplicationLabel(applicationInfo);
|
||||
if (TextUtils.isEmpty(applicationName)) {
|
||||
Log.i(TAG,"applicationName is Empty");
|
||||
return "";
|
||||
} else {
|
||||
return applicationName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前应用名称
|
||||
*
|
||||
* @param activity
|
||||
* @return
|
||||
*/
|
||||
public static String getApplicationName(Activity activity, String packAgeName) {
|
||||
PackageManager packageManager;
|
||||
ApplicationInfo applicationInfo;
|
||||
try {
|
||||
packageManager = activity.getApplicationContext().getPackageManager();
|
||||
applicationInfo = packageManager.getApplicationInfo(packAgeName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
Log.i(TAG,"PackageManager.NameNotFoundException");
|
||||
return "";
|
||||
}
|
||||
|
||||
String applicationName = (String) packageManager.getApplicationLabel(applicationInfo);
|
||||
if (TextUtils.isEmpty(applicationName)) {
|
||||
Log.i(TAG,"applicationName is Empty");
|
||||
return "";
|
||||
} else {
|
||||
return applicationName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.rehome.zhdcoa.vpn;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class AssetFileUtil {
|
||||
|
||||
/**
|
||||
* 获取assert 目录下某个文件内容
|
||||
* @param context
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public static String getAssertFileContent(Context context, String fileName){
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = context.getAssets().open(fileName);
|
||||
InputStreamReader inputreader = new InputStreamReader(inputStream);
|
||||
BufferedReader buffreader = new BufferedReader(inputreader);
|
||||
String line;
|
||||
// 分行读取
|
||||
while ((line = buffreader.readLine()) != null) {
|
||||
stringBuffer.append(line);
|
||||
}
|
||||
buffreader.close();
|
||||
inputreader.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(inputStream != null){
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,89 @@
|
||||
package com.rehome.zhdcoa.vpn;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import com.rehome.zhdcoa.R;
|
||||
import com.sangfor.sdk.entry.SFLaunchInfo;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 是否给子应用授权弹窗
|
||||
*/
|
||||
public class AuthSessionDialog {
|
||||
|
||||
private Activity mActivity;
|
||||
|
||||
private DialogClickListener mClickListener;
|
||||
|
||||
private AlertDialog mDialog;
|
||||
private SFLaunchInfo mSFLaunchInfo;
|
||||
|
||||
public void setClickListener(DialogClickListener clickListener) {
|
||||
mClickListener = clickListener;
|
||||
}
|
||||
|
||||
public AuthSessionDialog(Activity activity, SFLaunchInfo launchInfo) {
|
||||
mActivity = activity;
|
||||
mSFLaunchInfo = launchInfo;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
if (mDialog == null) {
|
||||
String hostAppName = AppInfoUtils.getApplicationName(mActivity);
|
||||
String subAppName = AppInfoUtils.getApplicationName(mActivity, mSFLaunchInfo.getPackageName());
|
||||
String dialogMessage = String.format(mActivity.getString(R.string.request_session_can_you_agree), subAppName, hostAppName);
|
||||
|
||||
mDialog = new AlertDialog.Builder(mActivity)
|
||||
.setMessage(dialogMessage)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(mActivity.getString(R.string.agree), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dismiss();
|
||||
|
||||
if (mClickListener != null) {
|
||||
mClickListener.onPositiveClick(mSFLaunchInfo);
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton(mActivity.getString(R.string.disagree), new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dismiss();
|
||||
|
||||
if (mClickListener != null) {
|
||||
mClickListener.onNegativeClick(mSFLaunchInfo);
|
||||
}
|
||||
}
|
||||
})
|
||||
.create();
|
||||
}
|
||||
|
||||
mDialog.show();
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
if (mDialog != null && mDialog.isShowing()) {
|
||||
mDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
if (mDialog != null) {
|
||||
return mDialog.isShowing();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public SFLaunchInfo getSFLaunchInfo() {
|
||||
return mSFLaunchInfo;
|
||||
}
|
||||
|
||||
public interface DialogClickListener {
|
||||
void onPositiveClick(SFLaunchInfo launchInfo);
|
||||
void onNegativeClick(SFLaunchInfo launchInfo);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,212 @@
|
||||
package com.rehome.zhdcoa.vpn;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.FileUtils;
|
||||
import android.provider.DocumentsContract;
|
||||
import android.provider.MediaStore;
|
||||
import android.provider.OpenableColumns;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.sangfor.sdk.utils.SFLogN;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Created by sangfor on 17-9-28.
|
||||
*/
|
||||
public class CertUtils {
|
||||
private static final String TAG = "CertUtils";
|
||||
|
||||
/**
|
||||
* 根据Uri的不同Scheme解析出在本机的路径
|
||||
* @param context
|
||||
* @param uri
|
||||
* @return Uri的真实路径
|
||||
*/
|
||||
@TargetApi(19)
|
||||
public static String fromUriGetRealPath(Context context, Uri uri) {
|
||||
if (uri == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
|
||||
// DocumentProvider
|
||||
if (isKitKat && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q && DocumentsContract.isDocumentUri(context, uri) ) {
|
||||
// ExternalStorageProvider
|
||||
if (isExternalStorageDocument(uri)) {
|
||||
final String docId = DocumentsContract.getDocumentId(uri);
|
||||
final String[] split = docId.split(":");
|
||||
final String type = split[0];
|
||||
|
||||
if ("primary".equalsIgnoreCase(type)) {
|
||||
return Environment.getExternalStorageDirectory() + "/" + split[1];
|
||||
}
|
||||
|
||||
// TODO handle non-primary volumes
|
||||
}
|
||||
// DownloadsProvider
|
||||
else if (isDownloadsDocument(uri)) {
|
||||
final String id = DocumentsContract.getDocumentId(uri);
|
||||
final Uri contentUri = ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
|
||||
|
||||
return getDataColumn(context, contentUri, null, null);
|
||||
}
|
||||
// MediaProvider
|
||||
else if (isMediaDocument(uri)) {
|
||||
final String docId = DocumentsContract.getDocumentId(uri);
|
||||
final String[] split = docId.split(":");
|
||||
final String type = split[0];
|
||||
|
||||
Uri contentUri = null;
|
||||
if ("image".equals(type)) {
|
||||
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
|
||||
} else if ("video".equals(type)) {
|
||||
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
|
||||
} else if ("audio".equals(type)) {
|
||||
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
|
||||
}
|
||||
|
||||
final String selection = "_id=?";
|
||||
final String[] selectionArgs = new String[]{split[1]};
|
||||
|
||||
return getDataColumn(context, contentUri, selection, selectionArgs);
|
||||
}
|
||||
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
return uriToFileApiQ(context, uri);
|
||||
}
|
||||
// MediaStore (and general)
|
||||
else if ("content".equalsIgnoreCase(uri.getScheme())) {
|
||||
|
||||
// Return the remote address
|
||||
if (isGooglePhotosUri(uri))
|
||||
return uri.getLastPathSegment();
|
||||
SFLogN.info(TAG, "uri authority is "+uri.getAuthority());
|
||||
if (isHuaWeiUri(uri)) {
|
||||
String uriPath = uri.getPath();
|
||||
// content://com.huawei.filemanager.share.fileprovider/root/storage/emulated/0/hbz1.p12
|
||||
if (uriPath != null && uriPath.startsWith("/root")) {
|
||||
return uriPath.replaceAll("/root", "");
|
||||
}
|
||||
}
|
||||
|
||||
return getDataColumn(context, uri, null, null);
|
||||
}
|
||||
// File
|
||||
else if ("file".equalsIgnoreCase(uri.getScheme())) {
|
||||
return uri.getPath();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
/**
|
||||
* Android 10 以上适配
|
||||
* @param context
|
||||
* @param uri
|
||||
* @return
|
||||
*/
|
||||
@RequiresApi(api = Build.VERSION_CODES.Q)
|
||||
private static String uriToFileApiQ(Context context, Uri uri) {
|
||||
File file = null;
|
||||
//android10以上转换
|
||||
if (uri.getScheme().equals(ContentResolver.SCHEME_FILE)) {
|
||||
file = new File(uri.getPath());
|
||||
} else if (uri.getScheme().equals(ContentResolver.SCHEME_CONTENT)) {
|
||||
//把文件复制到沙盒目录
|
||||
ContentResolver contentResolver = context.getContentResolver();
|
||||
Cursor cursor = contentResolver.query(uri, null, null, null, null);
|
||||
if (cursor.moveToFirst()) {
|
||||
@SuppressLint("Range")
|
||||
String displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
|
||||
try {
|
||||
InputStream is = contentResolver.openInputStream(uri);
|
||||
File file1 = new File(context.getExternalCacheDir().getAbsolutePath()+"/"+System.currentTimeMillis());
|
||||
if (!file1.exists())
|
||||
{
|
||||
file1.mkdir();
|
||||
}
|
||||
File cache = new File(file1.getPath(), displayName);
|
||||
FileOutputStream fos = new FileOutputStream(cache);
|
||||
FileUtils.copy(is, fos);
|
||||
file = cache;
|
||||
fos.close();
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
|
||||
public static String getDataColumn(Context context, Uri uri, String selection, String[] selectionArgs) {
|
||||
|
||||
Cursor cursor = null;
|
||||
final String column = "_data";
|
||||
final String[] projection = {column};
|
||||
|
||||
try {
|
||||
cursor = context.getContentResolver().query(uri, null, selection, selectionArgs, null);
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
final int index = cursor.getColumnIndexOrThrow(column);
|
||||
return cursor.getString(index);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is ExternalStorageProvider.
|
||||
*/
|
||||
public static boolean isExternalStorageDocument(Uri uri) {
|
||||
return "com.android.externalstorage.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is DownloadsProvider.
|
||||
*/
|
||||
public static boolean isDownloadsDocument(Uri uri) {
|
||||
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is MediaProvider.
|
||||
*/
|
||||
public static boolean isMediaDocument(Uri uri) {
|
||||
return "com.android.providers.media.documents".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param uri The Uri to check.
|
||||
* @return Whether the Uri authority is Google Photos.
|
||||
*/
|
||||
public static boolean isGooglePhotosUri(Uri uri) {
|
||||
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
/**
|
||||
* 适配 华为手机
|
||||
* @param uri
|
||||
* @return
|
||||
*/
|
||||
public static boolean isHuaWeiUri(Uri uri) {
|
||||
return "com.huawei.filemanager.share.fileprovider".equals(uri.getAuthority());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.rehome.zhdcoa.vpn;
|
||||
|
||||
public class Constants {
|
||||
public final static String PREF_FILE_NAME = "loginConfig";
|
||||
public final static String KEY_VPN_ADDRESS = "vpnAddress";
|
||||
public final static String KEY_USER_NAME = "userName";
|
||||
public final static String KEY_USER_PASSWORD = "userPassword";
|
||||
public final static String KEY_CERT_PATH = "certPath";
|
||||
public final static String KEY_CERT_PASSWORD = "certPassword";
|
||||
public final static String KEY_PHONE_NUMBER = "phoneNumber";
|
||||
public final static String KEY_SUB_APP_PKG_NAME = "subAppPkgName";
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
package com.rehome.zhdcoa.vpn;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.sangfor.sdk.utils.SFLogN;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PermissionUtil {
|
||||
private static final String TAG = "PermissionUtil";
|
||||
|
||||
public static boolean isNeedRequestSDCardPermission(Context context) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
return false;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
// 先判断有没有权限
|
||||
//context.checkSelfPermission(Manifest.permission.MANAGE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED
|
||||
if (!Environment.isExternalStorageManager()) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (context.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
return true;
|
||||
}
|
||||
if (context.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static void requestSDCardPermissions(Activity activity, int requestCode) {
|
||||
if (activity == null) {
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
//android 11
|
||||
Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
|
||||
intent.setData(Uri.parse("package:" + activity.getPackageName()));
|
||||
activity.startActivityForResult(intent, requestCode);
|
||||
Toast.makeText(activity, "请授予所有文件管理权限~", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
List<String> permissionsList = new ArrayList<String>();
|
||||
if (ContextCompat.checkSelfPermission(activity.getBaseContext(), Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
SFLogN.info(TAG,"No WRITE_EXTERNAL_STORAGE permission");
|
||||
permissionsList.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
|
||||
}
|
||||
if (ContextCompat.checkSelfPermission(activity.getBaseContext(), Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
SFLogN.info(TAG,"No READ_EXTERNAL_STORAGE permission");
|
||||
permissionsList.add(Manifest.permission.READ_EXTERNAL_STORAGE);
|
||||
}
|
||||
if (permissionsList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String[] permissions = permissionsList.toArray(new String[permissionsList.size()]);
|
||||
ActivityCompat.requestPermissions(activity, permissions, requestCode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转至系统设置内的应用详情页面
|
||||
* @param context
|
||||
*/
|
||||
public static void gotoAppPermissionManageActivity(Context context) {
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.setData(Uri.parse("package:" + context.getPackageName()));
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package com.rehome.zhdcoa.vpn;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.sangfor.sdk.utils.SFLogN;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class SignatureUtils {
|
||||
private static final String TAG = "SignatureUtils";
|
||||
|
||||
/**
|
||||
* 获取应用中的公钥信息
|
||||
* @param appInfo
|
||||
* @return 应用中公钥的字符串形式
|
||||
*/
|
||||
public static String getPubKeyInfo(ApplicationInfo appInfo, Context context) {
|
||||
PackageManager mPackageManager = context.getPackageManager();
|
||||
if (mPackageManager != null){
|
||||
try {
|
||||
PackageInfo packageInfo = mPackageManager.getPackageInfo(appInfo.packageName, mPackageManager.GET_SIGNATURES);
|
||||
Signature[] signatures = packageInfo.signatures;
|
||||
Signature signature = signatures[0];
|
||||
byte[] signatureBytes = signature.toByteArray();
|
||||
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
|
||||
X509Certificate cert = (X509Certificate) certFactory.generateCertificate(new ByteArrayInputStream(signatureBytes));
|
||||
String pubKeyStr = cert.getPublicKey().toString();
|
||||
return parsePubKey(pubKeyStr);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
SFLogN.error(TAG, "failed to get packageInfo ", e);
|
||||
} catch (CertificateException e) {
|
||||
SFLogN.error(TAG, "failed to get cert", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据解析安装apk的信息得到公钥信息
|
||||
* OpenSSLRSAPublicKey{modulus=98cfceafd123bc2d480af0bf31d41ca542736f8353031b01efad25dcef2dd566491635f23c0fbc950c93624dff4436c0910b0cdfe85bf6a86bcd7e42d790110ef4eec3eb8d3fb279734e71c6afd715f33712207101fa40ed0d196ad7c499bbc55d096de61f94117efaea996eed3a3a7c5bb875164bcb890439f6ccd2c0b2acb5,publicExponent=10001}";
|
||||
* @param info
|
||||
* @return
|
||||
*/
|
||||
private static String parsePubKey(String info) {
|
||||
if (TextUtils.isEmpty(info)) {
|
||||
return null;
|
||||
}
|
||||
String indexStr = "modulus=";
|
||||
int index = info.indexOf(indexStr);
|
||||
if (index != -1) {
|
||||
int startIndex = index + indexStr.length();
|
||||
indexStr = info.substring(startIndex);
|
||||
String pubkey = indexStr.split(",")[0];
|
||||
//因为解析出来的公钥信息中可能含有空格,换行等干扰信息,因此需要对其进行去杂处理,方便后续的字符串比较
|
||||
if (pubkey != null) {
|
||||
Pattern pattern = Pattern.compile("\\s*|\t|\r|\n");
|
||||
Matcher matcher = pattern.matcher(pubkey);
|
||||
pubkey = matcher.replaceAll("");
|
||||
}
|
||||
return pubkey;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.rehome.zhdcoa.weiget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.rehome.zhdcoa.R;
|
||||
|
||||
/**
|
||||
* SDP图形验证码点击圆圈自定义view
|
||||
* author yanghua
|
||||
* date 20220915
|
||||
*/
|
||||
public class RandCodeCircleView extends RelativeLayout {
|
||||
|
||||
private Context context;
|
||||
private View view;
|
||||
private SangforTextView tvNum;
|
||||
private RandCodeLayout.ClickPoint mPoint;
|
||||
|
||||
public RandCodeCircleView(Context context) {
|
||||
super(context);
|
||||
|
||||
}
|
||||
|
||||
public RandCodeCircleView(Context context, RandCodeLayout.ClickPoint point) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
this.mPoint = point;
|
||||
initViews();
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化视图
|
||||
**/
|
||||
protected void initViews() {
|
||||
view = LayoutInflater.from(context).inflate(R.layout.randcode_cricle_view, this, true);
|
||||
tvNum = view.findViewById(R.id.tvNum);
|
||||
tvNum.setText(mPoint.getNum() + "");
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return mPoint.getNum();
|
||||
}
|
||||
|
||||
public void setPoint(RandCodeLayout.ClickPoint point) {
|
||||
this.mPoint = point;
|
||||
tvNum.setText(mPoint.getNum() + "");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,93 @@
|
||||
package com.rehome.zhdcoa.weiget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
import com.rehome.zhdcoa.R;
|
||||
import com.rehome.zhdcoa.utils.DpPxSpTransformUtil;
|
||||
|
||||
/**
|
||||
* @ProjectName: SDKDemo
|
||||
* @Package: com.sangfor.sdkdemo.utils
|
||||
* @ClassName: SangforTextView
|
||||
* @Description: java类作用描述
|
||||
* @Author: yanghua
|
||||
* @CreateDate: 2022/9/21 下午5:40
|
||||
*/
|
||||
public class SangforTextView extends View {
|
||||
|
||||
String mText;
|
||||
|
||||
public void setText(String text) {
|
||||
mText = text;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
//构造方法
|
||||
public SangforTextView(@NonNull Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public SangforTextView(@NonNull Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public SangforTextView(@NonNull Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
//super.onDraw(canvas);
|
||||
//画水平中心线和垂直中心线
|
||||
//drawCenterLineX(canvas);
|
||||
//drawCenterLineY(canvas);
|
||||
|
||||
//画底层黑色
|
||||
drawTextCenter(canvas);
|
||||
|
||||
}
|
||||
|
||||
//将文字写到中央
|
||||
private void drawTextCenter(Canvas canvas){
|
||||
//创建画笔
|
||||
Paint paint = new Paint();
|
||||
paint.setTextSize(DpPxSpTransformUtil.sp2px(12));
|
||||
paint.setColor(getResources().getColor(R.color.white));
|
||||
//让他垂直居中
|
||||
Paint.FontMetrics fontMetrics = paint.getFontMetrics();
|
||||
float baseLine = getHeight()/2 -(fontMetrics.descent + fontMetrics.ascent)/2;
|
||||
//让他水平居中
|
||||
float x = getWidth()/2 - paint.measureText(mText)/2;
|
||||
|
||||
canvas.drawText(mText,x,baseLine,paint);
|
||||
}
|
||||
|
||||
//画x轴的中心线
|
||||
private void drawCenterLineX(final Canvas canvas){
|
||||
Paint paint = new Paint();
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(Color.RED);
|
||||
paint.setStrokeWidth(3);
|
||||
|
||||
canvas.drawLine(getWidth()/2,0,getWidth()/2,getHeight(),paint);
|
||||
}
|
||||
|
||||
//画y轴的中心线
|
||||
private void drawCenterLineY(final Canvas canvas){
|
||||
Paint paint = new Paint();
|
||||
paint.setStyle(Paint.Style.FILL);
|
||||
paint.setColor(Color.RED);
|
||||
paint.setStrokeWidth(3);
|
||||
|
||||
canvas.drawLine(0,getHeight()/2,getWidth(),getHeight()/2,paint);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<solid android:color="#029AFF"/>
|
||||
<corners android:radius="5dp"/>
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="true" android:color="@android:color/holo_blue_dark" />
|
||||
<item android:color="#808080"/>
|
||||
</selector>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 614 B |
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
android:shape="rectangle">
|
||||
<padding
|
||||
android:left="10dp"
|
||||
android:top="10dp"
|
||||
android:right="10dp"
|
||||
android:bottom="10dp"
|
||||
/>
|
||||
<stroke
|
||||
android:width="1px"
|
||||
android:color="#969696"/>
|
||||
|
||||
<!--背景色-->
|
||||
<solid android:color="#FFF"></solid>
|
||||
|
||||
</shape>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 794 B |
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#FFFFE9E9"/>
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/red" />
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="10dp"
|
||||
android:bottomRightRadius="10dp"/>
|
||||
</shape>
|
||||
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<solid android:color="#D0CDCD"/>
|
||||
|
||||
<corners
|
||||
android:bottomLeftRadius="10dp"
|
||||
android:bottomRightRadius="10dp"/>
|
||||
|
||||
</shape>
|
||||
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval"
|
||||
android:useLevel="false">
|
||||
<solid android:color="@color/blue"/>
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/white" />
|
||||
</shape>
|
||||
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<stroke
|
||||
android:width="0.5dp"
|
||||
android:color="#aaaaaa"/>
|
||||
|
||||
<corners android:radius="4dp" />
|
||||
|
||||
<solid android:color="@color/white"/>
|
||||
</shape>
|
||||
@ -0,0 +1,193 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="vertical"
|
||||
tools:context=".ui.activity.AuthSuccessActivity">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_file"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/file_test" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_udp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/udp_test" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_log"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/log_test" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_modify_psw"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="@string/modify_psw" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:gravity="right"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_start_tunnel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/start_tunnel" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_stop_tunnel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/stop_tunnel" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_master_slave"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/master_slave" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_atrust_auth"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="42dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:text="@string/atrust_auth" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_logout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:onClick="onClick"
|
||||
android:text="注销VPN"
|
||||
android:textColor="@android:color/holo_blue_dark"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp"
|
||||
tools:layout_editor_absoluteX="8dp"
|
||||
tools:layout_editor_absoluteY="0dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_url"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.7"
|
||||
android:hint="内网资源地址"
|
||||
android:inputType="textUri" />
|
||||
|
||||
<AutoCompleteTextView
|
||||
android:id="@+id/autoComTextView_url"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="0.7"
|
||||
android:hint="外网资源地址"
|
||||
android:inputType="textUri"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_test_res"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClick"
|
||||
android:text="测试"
|
||||
android:textSize="18sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/web_view_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/svpn_resource_tabheader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingTop="0dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingBottom="0dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/svpn_intraResource_tabheader"
|
||||
style="@style/VPNSourceButtonIndicator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:checked="true"
|
||||
android:text="@string/str_intranet_resource" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/svpn_extraResource_tabheader"
|
||||
style="@style/VPNSourceButtonIndicator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/str_extranet_resource" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/svpn_proxyDomain_tabheader"
|
||||
style="@style/VPNSourceButtonIndicator"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/str_proxy_domain" />
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/svpn_auth_tabheader"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="0dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingTop="0dp">
|
||||
|
||||
<RadioButton
|
||||
style="@style/AuthTabHeaderIndicator"
|
||||
android:id="@+id/svpn_userAuth_tabheader"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:text="@string/str_tab_password"
|
||||
android:checked="true"/>
|
||||
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<LinearLayout
|
||||
android:background="@drawable/shape_corner"
|
||||
android:id="@+id/svpn_userAuth_layout"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.rehome.zhdcoa.weiget.SFEditText
|
||||
android:id="@+id/svpn_username_editView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:drawableLeft="@mipmap/icon_user"
|
||||
android:drawablePadding="15dp"
|
||||
android:hint="用户名"
|
||||
android:textSize="16dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:paddingTop="10dp"
|
||||
android:singleLine="true"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="#999999"/>
|
||||
|
||||
<com.rehome.zhdcoa.weiget.SFEditText
|
||||
android:id="@+id/svpn_userPassword_editView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:drawableLeft="@mipmap/icon_psw"
|
||||
android:drawablePadding="15dp"
|
||||
android:hint="密码"
|
||||
android:textSize="16dp"
|
||||
android:inputType="textPassword"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:paddingTop="10dp"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:background="@drawable/shape_corner"
|
||||
android:id="@+id/svpn_certAuth_layout"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.rehome.zhdcoa.weiget.SFEditText
|
||||
android:id="@+id/svpn_certPath_editView"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:drawableLeft="@mipmap/icon_user"
|
||||
android:drawablePadding="15dp"
|
||||
android:hint="证书路径"
|
||||
android:textSize="16dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:paddingTop="10dp"
|
||||
android:singleLine="true" />
|
||||
|
||||
<ImageView
|
||||
android:background="@mipmap/icon_folder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="#999999"/>
|
||||
|
||||
<com.rehome.zhdcoa.weiget.SFEditText
|
||||
android:id="@+id/svpn_certPassword_editView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:drawableLeft="@mipmap/icon_psw"
|
||||
android:drawablePadding="15dp"
|
||||
android:hint="证书密码"
|
||||
android:textSize="16dp"
|
||||
android:inputType="textPassword"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:paddingTop="10dp"
|
||||
android:singleLine="true" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="5dp"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_certPath"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:drawablePadding="15dp"
|
||||
android:hint="证书路径"
|
||||
android:singleLine="true" />
|
||||
<TextView
|
||||
android:id="@+id/tv_certPath"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="选择"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@android:color/holo_blue_light"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_certPwd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:drawablePadding="15dp"
|
||||
android:hint="证书密码"
|
||||
android:inputType="textPassword"
|
||||
android:singleLine="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
>
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="10dp">
|
||||
<TextView
|
||||
android:id="@+id/tv_policy"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="密码策略">
|
||||
</TextView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="5dp"
|
||||
android:padding="5dp">
|
||||
<EditText
|
||||
android:id="@+id/et_oldpwd"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:hint="旧密码"
|
||||
android:singleLine="true" />
|
||||
<EditText
|
||||
android:id="@+id/et_newpwd"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:hint="新密码"
|
||||
android:singleLine="true" />
|
||||
<EditText
|
||||
android:id="@+id/et_renewpwd"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:hint="确认密码"
|
||||
android:singleLine="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:padding="5dp"
|
||||
android:text="请输入图形校验码(点击图片刷新):"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_graphCode"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:hint="验证码"
|
||||
android:singleLine="true" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/randcode_imgError"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:layout_height="40dp"
|
||||
android:src="@android:drawable/ic_delete"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_graphCode"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:layout_height="40dp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:layout_marginLeft="20dp"
|
||||
android:id="@+id/back"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/randcode_back"
|
||||
android:layout_width="25dp"
|
||||
android:layout_height="25dp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:textColor="@color/bg_font_normal"
|
||||
android:layout_marginTop="20dp"
|
||||
android:textSize="25sp"
|
||||
android:text="图形验证码(非SDK)"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:text="选择图片中的文字,来进行安全校验"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/rand_flayout"
|
||||
android:layout_width="326dp"
|
||||
android:layout_height="230dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/randcode_imgError"
|
||||
android:layout_width="1dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:layout_height="40dp"
|
||||
android:src="@android:drawable/ic_delete"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<com.rehome.zhdcoa.weiget.RandCodeLayout
|
||||
android:id="@+id/iv_graphCode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</com.rehome.zhdcoa.weiget.RandCodeLayout>
|
||||
|
||||
|
||||
<ImageView
|
||||
android:layout_margin="3dp"
|
||||
android:id="@+id/fresh_randcode"
|
||||
android:background="@drawable/fresh_button"
|
||||
android:layout_gravity="right"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"/>
|
||||
|
||||
<FrameLayout
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/shape_check_fl"
|
||||
android:id="@+id/check_code_fl"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="45dp">
|
||||
<ProgressBar
|
||||
android:visibility="gone"
|
||||
android:id="@+id/check_code_progress"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/shape_check_fail"
|
||||
android:id="@+id/check_code_fail"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/check_fail"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"/>
|
||||
<TextView
|
||||
android:textSize="18sp"
|
||||
android:textColor="@color/red"
|
||||
android:layout_gravity="center"
|
||||
android:text="验证失败,请重试"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_username"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:hint="用户名"
|
||||
android:drawablePadding="15dp"
|
||||
android:singleLine="true" />
|
||||
<EditText
|
||||
android:id="@+id/et_password"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:drawablePadding="15dp"
|
||||
android:hint="密码"
|
||||
android:singleLine="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
>
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:padding="5dp"
|
||||
android:id="@+id/tv_tel"
|
||||
android:text="手机号:"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:padding="5dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_verficationCode"
|
||||
android:layout_weight="0.55"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:hint="验证码"
|
||||
android:maxLength="6"
|
||||
android:singleLine="true" />
|
||||
<Button
|
||||
android:layout_marginLeft="10dp"
|
||||
android:id="@+id/bt_getVerficationCode"
|
||||
android:text="30s后重新发送"
|
||||
android:layout_weight="0.45"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center"
|
||||
android:padding="10dp"
|
||||
>
|
||||
<TextView
|
||||
android:layout_marginLeft="5dp"
|
||||
android:padding="5dp"
|
||||
android:text="请输入动态口令:"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<LinearLayout
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:padding="5dp">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_dynamicToken"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/edit_bg"
|
||||
android:hint="动态口令"
|
||||
android:singleLine="true" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="21dp"
|
||||
android:layout_height="21dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/shape_circle_select"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.rehome.zhdcoa.weiget.SangforTextView
|
||||
android:id="@+id/tvNum"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
/* //device/apps/common/assets/res/any/layout/simple_spinner_item.xml
|
||||
**
|
||||
** Copyright 2006, The Android Open Source Project
|
||||
**
|
||||
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||
** you may not use this file except in compliance with the License.
|
||||
** You may obtain a copy of the License at
|
||||
**
|
||||
** http://www.apache.org/licenses/LICENSE-2.0
|
||||
**
|
||||
** Unless required by applicable law or agreed to in writing, software
|
||||
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
** See the License for the specific language governing permissions and
|
||||
** limitations under the License.
|
||||
*/
|
||||
-->
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@android:id/text1"
|
||||
style="?android:attr/spinnerItemStyle"
|
||||
android:singleLine="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:textAlignment="inherit"/>
|
||||
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/svpn_auth_tabheader"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="0dp"
|
||||
android:paddingLeft="20dp"
|
||||
android:paddingRight="20dp"
|
||||
android:paddingTop="0dp">
|
||||
|
||||
<RadioButton
|
||||
style="@style/AuthTabHeaderIndicator"
|
||||
android:id="@+id/svpn_userAuth_tabheader"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:text="@string/str_tab_sms"
|
||||
android:checked="true"/>
|
||||
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
<LinearLayout
|
||||
android:background="@drawable/shape_corner"
|
||||
android:id="@+id/svpn_userAuth_layout"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.rehome.zhdcoa.weiget.SFEditText
|
||||
android:id="@+id/svpn_username_editView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:drawableLeft="@mipmap/icon_user"
|
||||
android:drawablePadding="15dp"
|
||||
android:hint="手机号"
|
||||
android:textSize="16dp"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:paddingTop="10dp"
|
||||
android:singleLine="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in New Issue