Compare commits
35 Commits
webpagesou
...
mymessagem
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a40dbcfb61 | ||
|
|
4d344b299b | ||
|
|
37b0867d34 | ||
|
|
b505156211 | ||
|
|
91b30fb576 | ||
|
|
ab3ac72d54 | ||
|
|
870e9a94fb | ||
|
|
2421ecb943 | ||
|
|
687fff7216 | ||
|
|
3795cf8631 | ||
|
|
b374f3117a | ||
|
|
6d9adc124e | ||
|
|
52f738b45b | ||
|
|
9ece6778b7 | ||
|
|
e13c8e7af0 | ||
|
|
a4988b5b68 | ||
|
|
5507126f6b | ||
|
|
d381c29452 | ||
|
|
945eadb617 | ||
|
|
c5bffc5eef | ||
|
|
88597fe407 | ||
|
|
53f985533a | ||
|
|
a3950f13ad | ||
|
|
c878e9dc02 | ||
|
|
f2f7cab330 | ||
|
|
c4e88e9593 | ||
|
|
08d9d92ae4 | ||
|
|
74841c08dc | ||
|
|
945bacb825 | ||
|
|
0e464495fd | ||
|
|
e8682ce410 | ||
|
|
2e4003dae0 | ||
|
|
198b0975ce | ||
|
|
24a578a9d2 | ||
|
|
46de24447f |
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Mon Jun 09 01:44:28 HKT 2025
|
#Thu Jun 19 20:42:40 HKT 2025
|
||||||
stageCount=1
|
stageCount=2
|
||||||
libraryProject=libaes
|
libraryProject=libaes
|
||||||
baseVersion=15.9
|
baseVersion=15.9
|
||||||
publishVersion=15.9.0
|
publishVersion=15.9.1
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.9.1
|
baseBetaVersion=15.9.2
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sun Jun 01 08:03:56 GMT 2025
|
#Thu Jun 19 12:49:47 GMT 2025
|
||||||
stageCount=0
|
stageCount=0
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.0
|
baseVersion=15.0
|
||||||
publishVersion=15.0.0
|
publishVersion=15.0.0
|
||||||
buildCount=24
|
buildCount=26
|
||||||
baseBetaVersion=15.0.1
|
baseBetaVersion=15.0.1
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Sun May 04 05:32:00 GMT 2025
|
#Tue Jun 24 09:54:47 HKT 2025
|
||||||
stageCount=1
|
stageCount=3
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.2
|
baseVersion=15.2
|
||||||
publishVersion=15.2.0
|
publishVersion=15.2.2
|
||||||
buildCount=74
|
buildCount=0
|
||||||
baseBetaVersion=15.2.1
|
baseBetaVersion=15.2.3
|
||||||
|
|||||||
@@ -42,23 +42,24 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
/*compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_11
|
sourceCompatibility JavaVersion.VERSION_11
|
||||||
targetCompatibility JavaVersion.VERSION_11
|
targetCompatibility JavaVersion.VERSION_11
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
api project(':libjc')
|
||||||
|
api 'cc.winboll.studio:libaes:15.9.1'
|
||||||
|
api 'cc.winboll.studio:libapputils:15.8.4'
|
||||||
|
api 'cc.winboll.studio:libappbase:15.8.4'
|
||||||
|
|
||||||
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
|
// https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on
|
||||||
//implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
|
//implementation 'org.bouncycastle:bcprov-jdk15on:1.70'
|
||||||
implementation 'org.bouncycastle:bcprov-jdk15to18:1.69'
|
implementation 'org.bouncycastle:bcprov-jdk15to18:1.69'
|
||||||
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.69'
|
implementation 'org.bouncycastle:bcpkix-jdk15to18:1.69'
|
||||||
|
|
||||||
api project(':libjc')
|
|
||||||
api 'androidx.appcompat:appcompat:1.0.0'
|
api 'androidx.appcompat:appcompat:1.0.0'
|
||||||
api 'com.google.android.material:material:1.0.0'
|
api 'com.google.android.material:material:1.0.0'
|
||||||
|
|
||||||
api 'cc.winboll.studio:libapputils:9.1.0'
|
|
||||||
api 'cc.winboll.studio:libappbase:1.0.3'
|
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Fri Jan 10 22:03:57 GMT 2025
|
#Tue Jun 24 11:17:30 GMT 2025
|
||||||
stageCount=0
|
stageCount=0
|
||||||
libraryProject=libjc
|
libraryProject=libjc
|
||||||
baseVersion=1.0
|
baseVersion=1.0
|
||||||
publishVersion=1.0.0
|
publishVersion=1.0.0
|
||||||
buildCount=133
|
buildCount=135
|
||||||
baseBetaVersion=1.0.1
|
baseBetaVersion=1.0.1
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ import android.widget.LinearLayout;
|
|||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import cc.winboll.studio.jc.R;
|
import cc.winboll.studio.jc.R;
|
||||||
import cc.winboll.studio.libapputils.log.LogUtils;
|
|
||||||
import cc.winboll.studio.libjc.JAR_RUNNING_MODE;
|
|
||||||
import cc.winboll.studio.libjc.JCMainThread;
|
import cc.winboll.studio.libjc.JCMainThread;
|
||||||
import cc.winboll.studio.libjc.net.JCSocketClient;
|
import cc.winboll.studio.libjc.net.JCSocketClient;
|
||||||
|
import cc.winboll.studio.libjc.util.LogUtils;
|
||||||
|
import cc.winboll.studio.libjc.Main;
|
||||||
|
|
||||||
final public class MainActivity extends Activity implements JCMainThread.OnMessageListener {
|
final public class MainActivity extends Activity implements JCMainThread.OnMessageListener {
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ final public class MainActivity extends Activity implements JCMainThread.OnMessa
|
|||||||
// 启动主线程
|
// 启动主线程
|
||||||
_JCMainThread = JCMainThread.getInstance(getPackageName());
|
_JCMainThread = JCMainThread.getInstance(getPackageName());
|
||||||
_JCMainThread.setOnLogListener(this);
|
_JCMainThread.setOnLogListener(this);
|
||||||
_JCMainThread.setRunningMode(JAR_RUNNING_MODE.JC);
|
//_JCMainThread.setRunningMode(Main.JAR_RUNNING_MODE.JC);
|
||||||
_JCMainThread.start();
|
_JCMainThread.start();
|
||||||
|
|
||||||
// 设置 WinBoll 应用 UI 类型
|
// 设置 WinBoll 应用 UI 类型
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Mon Jun 09 01:44:28 HKT 2025
|
#Thu Jun 19 20:42:26 HKT 2025
|
||||||
stageCount=1
|
stageCount=2
|
||||||
libraryProject=libaes
|
libraryProject=libaes
|
||||||
baseVersion=15.9
|
baseVersion=15.9
|
||||||
publishVersion=15.9.0
|
publishVersion=15.9.1
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.9.1
|
baseBetaVersion=15.9.2
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Fri Jan 10 22:03:57 GMT 2025
|
#Tue Jun 24 11:17:30 GMT 2025
|
||||||
stageCount=0
|
stageCount=0
|
||||||
libraryProject=libjc
|
libraryProject=libjc
|
||||||
baseVersion=1.0
|
baseVersion=1.0
|
||||||
publishVersion=1.0.0
|
publishVersion=1.0.0
|
||||||
buildCount=133
|
buildCount=135
|
||||||
baseBetaVersion=1.0.1
|
baseBetaVersion=1.0.1
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class Main {
|
|||||||
public final static int JAR_RUNNING_MODE_JCNDK_DEBUG = 4;
|
public final static int JAR_RUNNING_MODE_JCNDK_DEBUG = 4;
|
||||||
public final static int JAR_RUNNING_MODE_JC = 5;
|
public final static int JAR_RUNNING_MODE_JC = 5;
|
||||||
public final static int JAR_RUNNING_MODE_JC_DEBUG = 6;
|
public final static int JAR_RUNNING_MODE_JC_DEBUG = 6;
|
||||||
public enum JAR_RUNNING_MODE {
|
public static enum JAR_RUNNING_MODE {
|
||||||
UNKNOWN(JAR_RUNNING_MODE_UNKNOWN),
|
UNKNOWN(JAR_RUNNING_MODE_UNKNOWN),
|
||||||
CONSOLE(JAR_RUNNING_MODE_CONSOLE),
|
CONSOLE(JAR_RUNNING_MODE_CONSOLE),
|
||||||
CONSOLE_DEBUG(JAR_RUNNING_MODE_CONSOLE_DEBUG),
|
CONSOLE_DEBUG(JAR_RUNNING_MODE_CONSOLE_DEBUG),
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ android {
|
|||||||
// versionName 更新后需要手动设置
|
// versionName 更新后需要手动设置
|
||||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
||||||
versionName "15.2"
|
versionName "15.3"
|
||||||
if(true) {
|
if(true) {
|
||||||
versionName = genVersionName("${versionName}")
|
versionName = genVersionName("${versionName}")
|
||||||
}
|
}
|
||||||
@@ -45,15 +45,17 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
api fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
api 'cc.winboll.studio:libaes:15.8.0'
|
api 'cc.winboll.studio:libaes:15.9.3'
|
||||||
api 'cc.winboll.studio:libapputils:15.8.1'
|
api 'cc.winboll.studio:libapputils:15.8.6'
|
||||||
api 'cc.winboll.studio:libappbase:15.8.1'
|
api 'cc.winboll.studio:libappbase:15.9.5'
|
||||||
|
|
||||||
api 'io.github.medyo:android-about-page:2.0.0'
|
api 'io.github.medyo:android-about-page:2.0.0'
|
||||||
api 'com.github.getActivity:ToastUtils:10.5'
|
api 'com.github.getActivity:ToastUtils:10.5'
|
||||||
api 'com.jcraft:jsch:0.1.55'
|
api 'com.jcraft:jsch:0.1.55'
|
||||||
api 'org.jsoup:jsoup:1.13.1'
|
api 'org.jsoup:jsoup:1.13.1'
|
||||||
api 'com.squareup.okhttp3:okhttp:4.4.1'
|
api 'com.squareup.okhttp3:okhttp:4.4.1'
|
||||||
|
|
||||||
|
api 'com.belerweb:pinyin4j:2.5.1'
|
||||||
|
|
||||||
// 权限请求框架:https://github.com/getActivity/XXPermissions
|
// 权限请求框架:https://github.com/getActivity/XXPermissions
|
||||||
api 'com.github.getActivity:XXPermissions:18.63'
|
api 'com.github.getActivity:XXPermissions:18.63'
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#Created by .winboll/winboll_app_build.gradle
|
||||||
#Tue May 20 20:39:06 HKT 2025
|
#Sat Sep 06 01:57:20 HKT 2025
|
||||||
stageCount=6
|
stageCount=9
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.2
|
baseVersion=15.3
|
||||||
publishVersion=15.2.5
|
publishVersion=15.3.8
|
||||||
buildCount=0
|
buildCount=0
|
||||||
baseBetaVersion=15.2.6
|
baseBetaVersion=15.3.9
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
|||||||
import cc.winboll.studio.mymessagemanager.App;
|
import cc.winboll.studio.mymessagemanager.App;
|
||||||
import cc.winboll.studio.mymessagemanager.R;
|
import cc.winboll.studio.mymessagemanager.R;
|
||||||
|
|
||||||
public class AboutActivity extends WinBollActivity implements IWinBoLLActivity {
|
public class AboutActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
||||||
|
|
||||||
public static final String TAG = "AboutActivity";
|
public static final String TAG = "AboutActivity";
|
||||||
|
|
||||||
@@ -79,11 +79,11 @@ public class AboutActivity extends WinBollActivity implements IWinBoLLActivity {
|
|||||||
appInfo.setAppName(getString(R.string.app_name));
|
appInfo.setAppName(getString(R.string.app_name));
|
||||||
appInfo.setAppIcon(cc.winboll.studio.libaes.R.drawable.ic_winboll);
|
appInfo.setAppIcon(cc.winboll.studio.libaes.R.drawable.ic_winboll);
|
||||||
appInfo.setAppDescription(getString(R.string.app_description));
|
appInfo.setAppDescription(getString(R.string.app_description));
|
||||||
appInfo.setAppGitName("APP");
|
appInfo.setAppGitName("APPBase");
|
||||||
appInfo.setAppGitOwner("Studio");
|
appInfo.setAppGitOwner("Studio");
|
||||||
appInfo.setAppGitAPPBranch(szBranchName);
|
appInfo.setAppGitAPPBranch(szBranchName);
|
||||||
appInfo.setAppGitAPPSubProjectFolder(szBranchName);
|
appInfo.setAppGitAPPSubProjectFolder(szBranchName);
|
||||||
appInfo.setAppHomePage("https://www.winboll.cc/studio/details.php?app=MyMessageManager");
|
appInfo.setAppHomePage("https://discuz.winboll.cc/forum.php?mod=viewthread&tid=5&extra=page%3D1");
|
||||||
appInfo.setAppAPKName("MyMessageManager");
|
appInfo.setAppAPKName("MyMessageManager");
|
||||||
appInfo.setAppAPKFolderName("MyMessageManager");
|
appInfo.setAppAPKFolderName("MyMessageManager");
|
||||||
return new AboutView(mContext, appInfo);
|
return new AboutView(mContext, appInfo);
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ abstract public class BaseActivity extends AppCompatActivity {
|
|||||||
} else if (R.id.item_defaulttheme == item.getItemId()) {
|
} else if (R.id.item_defaulttheme == item.getItemId()) {
|
||||||
AESThemeUtil.saveThemeStyleID(this, R.style.MyAppTheme);
|
AESThemeUtil.saveThemeStyleID(this, R.style.MyAppTheme);
|
||||||
recreate();
|
recreate();
|
||||||
|
} else if (R.id.item_defaulttheme == item.getItemId()) {
|
||||||
|
AESThemeUtil.saveThemeStyleID(this, R.style.MyAppTheme);
|
||||||
|
recreate();
|
||||||
}
|
}
|
||||||
//ToastUtils.show("nThemeStyleID " + Integer.toString(nThemeStyleID));
|
//ToastUtils.show("nThemeStyleID " + Integer.toString(nThemeStyleID));
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package cc.winboll.studio.mymessagemanager.activitys;
|
package cc.winboll.studio.mymessagemanager.activitys;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen&豆包大模型<zhangsken@188.com>
|
||||||
|
* @Date 2025/08/30 14:32
|
||||||
|
* @Describe 联系人查询与短信发送窗口
|
||||||
|
*/
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
@@ -11,13 +16,17 @@ import android.widget.RelativeLayout;
|
|||||||
import android.widget.SimpleAdapter;
|
import android.widget.SimpleAdapter;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toolbar;
|
import android.widget.Toolbar;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
|
import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
|
||||||
import cc.winboll.studio.mymessagemanager.R;
|
import cc.winboll.studio.mymessagemanager.R;
|
||||||
import cc.winboll.studio.mymessagemanager.activitys.ComposeSMSActivity;
|
|
||||||
import cc.winboll.studio.mymessagemanager.beans.PhoneBean;
|
import cc.winboll.studio.mymessagemanager.beans.PhoneBean;
|
||||||
import cc.winboll.studio.mymessagemanager.utils.PhoneUtil;
|
import cc.winboll.studio.mymessagemanager.utils.PhoneUtil;
|
||||||
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
|
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
|
||||||
import com.hjq.toast.ToastUtils;
|
import com.hjq.toast.ToastUtils;
|
||||||
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -26,166 +35,331 @@ import java.util.Map;
|
|||||||
public class ComposeSMSActivity extends BaseActivity {
|
public class ComposeSMSActivity extends BaseActivity {
|
||||||
|
|
||||||
public static String TAG = "ComposeSMSActivity";
|
public static String TAG = "ComposeSMSActivity";
|
||||||
|
|
||||||
public static String EXTRA_SMSBODY = "sms_body";
|
public static String EXTRA_SMSBODY = "sms_body";
|
||||||
|
private static final String MAP_NAME = "NAME";
|
||||||
|
private static final String MAP_PHONE = "PHONE";
|
||||||
|
|
||||||
static String MAP_NAME = "NAME";
|
private String mszSMSBody;
|
||||||
static String MAP_PHONE = "PHONE";
|
private String mszScheme;
|
||||||
|
private String mszPhoneTo;
|
||||||
String mszSMSBody;
|
private TextView mtvTOName;
|
||||||
String mszScheme;
|
private EditText metTONameSearch;
|
||||||
String mszPhoneTo;
|
private EditText metTO;
|
||||||
EditText metTO;
|
private EditText metSMSBody;
|
||||||
EditText metSMSBody;
|
private SimpleAdapter mSimpleAdapter;
|
||||||
SimpleAdapter mSimpleAdapter;
|
private List<Map<String, Object>> mAdapterData = new ArrayList<Map<String, Object>>();
|
||||||
List<Map<String,Object>> mAdapterData = new ArrayList<>();
|
private ListView mlvContracts;
|
||||||
ListView mlvContracts;
|
private List<PhoneBean> mListPhoneBeanContracts;
|
||||||
List<PhoneBean> mListPhoneBeanContracts;
|
private Toolbar mToolbar;
|
||||||
Toolbar mToolbar;
|
private AOHPCTCSeekBar mAOHPCTCSeekBar;
|
||||||
AOHPCTCSeekBar mAOHPCTCSeekBar;
|
private RelativeLayout mrlContracts;
|
||||||
RelativeLayout mrlContracts;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
LogUtils.d(TAG, "onCreate");
|
||||||
setContentView(R.layout.activity_composesms);
|
setContentView(R.layout.activity_composesms);
|
||||||
mszSMSBody = getIntent().getStringExtra(EXTRA_SMSBODY);
|
|
||||||
mszScheme = getIntent().getData().getScheme();
|
// 初始化Intent数据(增加空判断,避免NullPointerException)
|
||||||
mszPhoneTo = getIntent().getData().getSchemeSpecificPart();
|
Intent intent = getIntent();
|
||||||
if (!mszScheme.equals("smsto")) {
|
if (intent != null) {
|
||||||
// 其他方式未支持就退出
|
mszSMSBody = intent.getStringExtra(EXTRA_SMSBODY);
|
||||||
finish();
|
if (intent.getData() != null) {
|
||||||
|
mszScheme = intent.getData().getScheme();
|
||||||
|
mszPhoneTo = intent.getData().getSchemeSpecificPart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 初始化视图
|
|
||||||
|
// 校验启动方式,非smsto则退出
|
||||||
|
if (mszScheme == null || !"smsto".equals(mszScheme)) {
|
||||||
|
ToastUtils.show("不支持的启动方式");
|
||||||
|
finish();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
initView();
|
initView();
|
||||||
// 设置适配器
|
initAdapter(null); // 初始加载所有联系人
|
||||||
initAdapter();
|
setListViewPrePositionByPhone();
|
||||||
// 设置搜索到的匹配位置
|
|
||||||
setListViewPrePosition();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
private void initView() {
|
||||||
// 初始化视图
|
|
||||||
//
|
|
||||||
void initView() {
|
|
||||||
//Drawable drawableFrame = AppCompatResources.getDrawable(this, R.drawable.bg_frame);
|
|
||||||
|
|
||||||
// 初始化标题栏
|
// 初始化标题栏
|
||||||
mToolbar = findViewById(R.id.activitycomposesmsASupportToolbar1);
|
mToolbar = (Toolbar) findViewById(R.id.activitycomposesmsASupportToolbar1);
|
||||||
mToolbar.setSubtitle(getString(R.string.activity_name_composesms));
|
mToolbar.setSubtitle(getString(R.string.activity_name_composesms));
|
||||||
setActionBar(mToolbar);
|
setActionBar(mToolbar);
|
||||||
|
|
||||||
// 初始化联系人栏目框
|
// 初始化联系人姓名显示和搜索栏
|
||||||
mrlContracts = findViewById(R.id.activitycomposesmsRelativeLayout1);
|
mtvTOName = (TextView) findViewById(R.id.activitycomposesmsTextView2);
|
||||||
//mrlContracts.setBackground(drawableFrame);
|
mrlContracts = (RelativeLayout) findViewById(R.id.activitycomposesmsRelativeLayout1);
|
||||||
|
metTONameSearch = (EditText) findViewById(R.id.activitycomposesmsEditText2);
|
||||||
|
|
||||||
// 初始化联系人列表
|
// 姓名搜索框文本变化监听
|
||||||
mlvContracts = findViewById(R.id.activitycomposesmsListView1);
|
metTONameSearch.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
metTO.setText(""); // 清空号码输入框,避免冲突
|
||||||
|
String input = s == null ? "" : s.toString().trim();
|
||||||
|
if (input.isEmpty()) {
|
||||||
|
initAdapter(null); // 空搜索时显示所有联系人
|
||||||
|
} else {
|
||||||
|
setListViewPrePositionByName(); // 按姓名搜索
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化联系人输入框
|
@Override
|
||||||
metTO = findViewById(R.id.activitycomposesmsEditText1);
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
metTO.setText(mszPhoneTo);
|
// 无操作
|
||||||
metTO.addTextChangedListener(new TextWatcher() {
|
}
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
setListViewPrePosition();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
}
|
// 无操作
|
||||||
});
|
}
|
||||||
|
|
||||||
// 初始化发送拉动控件
|
|
||||||
mAOHPCTCSeekBar = findViewById(R.id.viewsmssendpart1AOHPCTCSeekBar1);
|
|
||||||
mAOHPCTCSeekBar.setThumb(getDrawable(R.drawable.ic_message));
|
|
||||||
mAOHPCTCSeekBar.setThumbOffset(20);
|
|
||||||
mAOHPCTCSeekBar.setOnOHPCListener(new AOHPCTCSeekBar.OnOHPCListener() {
|
|
||||||
@Override
|
|
||||||
public void onOHPCommit() {
|
|
||||||
// 空号码不发送
|
|
||||||
mszPhoneTo = metTO.getText().toString();
|
|
||||||
if (mszPhoneTo.trim().equals("")) {
|
|
||||||
ToastUtils.show("没有设置接收号码。");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 空消息不发送
|
|
||||||
mszSMSBody = metSMSBody.getText().toString();
|
|
||||||
if (mszSMSBody.equals("")) {
|
|
||||||
ToastUtils.show("没有消息内容可发送。");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 发送消息
|
|
||||||
if (SMSUtil.sendMessageByInterface2(ComposeSMSActivity.this, mszPhoneTo, mszSMSBody)) {
|
|
||||||
ComposeSMSActivity.this.finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 初始化提示框
|
// 初始化联系人列表(关键:设置单选模式,确保选中状态生效)
|
||||||
TextView tvAOHPCTCSeekBarMSG = findViewById(R.id.viewsmssendpart1TextView1);
|
mlvContracts = (ListView) findViewById(R.id.activitycomposesmsListView1);
|
||||||
|
mlvContracts.setChoiceMode(ListView.CHOICE_MODE_SINGLE); // 开启单选,与布局中一致
|
||||||
|
|
||||||
|
// 初始化号码输入框(核心:优化文本变化监听逻辑)
|
||||||
|
metTO = (EditText) findViewById(R.id.activitycomposesmsEditText1);
|
||||||
|
if (mszPhoneTo != null) {
|
||||||
|
metTO.setText(mszPhoneTo);
|
||||||
|
}
|
||||||
|
metTO.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
mtvTOName.setText(""); // 清空姓名显示
|
||||||
|
String inputPhone = s == null ? "" : s.toString().trim();
|
||||||
|
|
||||||
|
if (inputPhone.isEmpty()) {
|
||||||
|
// 输入为空时,显示所有联系人
|
||||||
|
initAdapter(null);
|
||||||
|
} else {
|
||||||
|
// 输入非空时,按号码搜索并更新列表(无结果则清空)
|
||||||
|
filterListByPhone(inputPhone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
// 无操作
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
// 无操作
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化发送控件
|
||||||
|
mAOHPCTCSeekBar = (AOHPCTCSeekBar) findViewById(R.id.viewsmssendpart1AOHPCTCSeekBar1);
|
||||||
|
Drawable thumbDrawable = getResources().getDrawable(R.drawable.ic_message); // Java 7兼容写法
|
||||||
|
mAOHPCTCSeekBar.setThumb(thumbDrawable);
|
||||||
|
mAOHPCTCSeekBar.setThumbOffset(20);
|
||||||
|
mAOHPCTCSeekBar.setOnOHPCListener(new AOHPCTCSeekBar.OnOHPCListener() {
|
||||||
|
@Override
|
||||||
|
public void onOHPCommit() {
|
||||||
|
sendSMS();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 初始化短信内容输入框
|
||||||
|
TextView tvAOHPCTCSeekBarMSG = (TextView) findViewById(R.id.viewsmssendpart1TextView1);
|
||||||
tvAOHPCTCSeekBarMSG.setText(R.string.msg_100sendmsg);
|
tvAOHPCTCSeekBarMSG.setText(R.string.msg_100sendmsg);
|
||||||
|
metSMSBody = (EditText) findViewById(R.id.viewsmssendpart1EditText1);
|
||||||
// 初始化发送消息框
|
if (mszSMSBody != null) {
|
||||||
metSMSBody = findViewById(R.id.viewsmssendpart1EditText1);
|
metSMSBody.setText(mszSMSBody);
|
||||||
//metSMSBody.setBackground(drawableFrame);
|
}
|
||||||
metSMSBody.setText(mszSMSBody);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// 核心优化:根据输入号码筛选列表(无结果则显示空列表,优化选中逻辑)
|
||||||
// 设置搜索到的匹配位置
|
private void filterListByPhone(String inputPhone) {
|
||||||
//
|
PhoneUtil phoneUtil = new PhoneUtil(this);
|
||||||
void setListViewPrePosition() {
|
List<PhoneBean> allContacts = phoneUtil.getPhoneList();
|
||||||
int nPrePosition = getContractsDataPrePosition(metTO.getText().toString());
|
List<PhoneBean> matchedContacts = new ArrayList<PhoneBean>();
|
||||||
mlvContracts.setSelected(false);
|
|
||||||
mlvContracts.setSelection(nPrePosition);
|
// 遍历所有联系人,匹配包含输入号码的联系人
|
||||||
|
for (PhoneBean contact : allContacts) {
|
||||||
|
if (contact.getTelPhone().contains(inputPhone)
|
||||||
|
|| phoneUtil.isTheSamePhoneNumber(contact.getTelPhone(), inputPhone)) {
|
||||||
|
matchedContacts.add(contact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LogUtils.d(TAG, "号码搜索:输入'" + inputPhone + "', 匹配" + matchedContacts.size() + "个结果");
|
||||||
|
|
||||||
|
// 用筛选结果更新列表(无结果则传入空列表)
|
||||||
|
initAdapter(matchedContacts.isEmpty() ? new ArrayList<PhoneBean>() : matchedContacts);
|
||||||
|
|
||||||
|
// 定位并选中匹配项(如果有)
|
||||||
|
if (!matchedContacts.isEmpty()) {
|
||||||
|
boolean isFound = false;
|
||||||
|
for (int i = 0; i < matchedContacts.size(); i++) {
|
||||||
|
PhoneBean item = matchedContacts.get(i);
|
||||||
|
// 精确匹配号码(兼容区域码格式)
|
||||||
|
if (phoneUtil.isTheSamePhoneNumber(item.getTelPhone(), inputPhone)) {
|
||||||
|
mtvTOName.setText(item.getName());
|
||||||
|
// 关键:先滚动到目标位置,再设置选中状态
|
||||||
|
mlvContracts.setSelection(i);
|
||||||
|
// 主动设置选中(确保样式生效,兼容部分系统)
|
||||||
|
mlvContracts.setItemChecked(i, true);
|
||||||
|
LogUtils.d(TAG, String.format("%s 匹配 %s,选中位置:%d", inputPhone, item.getTelPhone(), i));
|
||||||
|
isFound = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 若未精确匹配,选中第一个结果
|
||||||
|
/*if (!isFound) {
|
||||||
|
mlvContracts.setSelection(0);
|
||||||
|
mlvContracts.setItemChecked(0, true);
|
||||||
|
mtvTOName.setText(matchedContacts.get(0).getName());
|
||||||
|
}*/
|
||||||
|
} else {
|
||||||
|
mtvTOName.setText(""); // 无结果时清空姓名显示
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// 根据姓名搜索联系人
|
||||||
// 返回搜索到的匹配位置
|
private void setListViewPrePositionByName() {
|
||||||
//
|
String searchName = metTONameSearch.getText().toString().trim();
|
||||||
int getContractsDataPrePosition(String szPhone) {
|
PhoneUtil phoneUtil = new PhoneUtil(this);
|
||||||
|
List<PhoneBean> matchedContacts = phoneUtil.getPhonesByName(searchName);
|
||||||
|
initAdapter(matchedContacts);
|
||||||
|
if (!matchedContacts.isEmpty()) {
|
||||||
|
// 选中第一个结果并设置样式
|
||||||
|
mlvContracts.setSelection(0);
|
||||||
|
mlvContracts.setItemChecked(0, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始定位号码对应的联系人
|
||||||
|
private void setListViewPrePositionByPhone() {
|
||||||
|
String inputPhone = metTO.getText().toString().trim();
|
||||||
|
if (inputPhone.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
filterListByPhone(inputPhone); // 复用筛选逻辑
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取号码匹配的位置(兼容旧逻辑)
|
||||||
|
private int getContractsDataPrePositionByPhone(String szPhone) {
|
||||||
|
if (mListPhoneBeanContracts == null || mListPhoneBeanContracts.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
for (int i = 0; i < mListPhoneBeanContracts.size(); i++) {
|
for (int i = 0; i < mListPhoneBeanContracts.size(); i++) {
|
||||||
if (mListPhoneBeanContracts.get(i).getTelPhone().compareTo(szPhone) > -1) {
|
PhoneBean bean = mListPhoneBeanContracts.get(i);
|
||||||
|
if (bean.getTelPhone().compareTo(szPhone) >= 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// 获取姓名匹配的位置(兼容旧逻辑)
|
||||||
// 初始化适配器
|
private int getContractsDataPrePositionByName(String szName) {
|
||||||
//
|
if (mListPhoneBeanContracts == null || mListPhoneBeanContracts.isEmpty()) {
|
||||||
void initAdapter() {
|
return 0;
|
||||||
// 初始化联系人数据适配器
|
|
||||||
mAdapterData = new ArrayList<>();
|
|
||||||
// 读取联系人数据
|
|
||||||
PhoneUtil phoneUtils = new PhoneUtil(this);
|
|
||||||
mListPhoneBeanContracts = phoneUtils.getPhoneList();
|
|
||||||
// 映射联系人数据给适配器数据对象
|
|
||||||
for (int i = 0;i < mListPhoneBeanContracts.size();i++) {
|
|
||||||
Map<String,Object> map =new HashMap<>();
|
|
||||||
map.put(MAP_NAME, mListPhoneBeanContracts.get(i).getName());
|
|
||||||
map.put(MAP_PHONE, mListPhoneBeanContracts.get(i).getTelPhone());
|
|
||||||
mAdapterData.add(map);
|
|
||||||
}
|
}
|
||||||
// 绑定适配器与数据
|
for (int i = 0; i < mListPhoneBeanContracts.size(); i++) {
|
||||||
mSimpleAdapter = new SimpleAdapter(ComposeSMSActivity.this, mAdapterData, R.layout.listview_contracts
|
if (mListPhoneBeanContracts.get(i).getName().startsWith(szName)) {
|
||||||
, new String[]{MAP_NAME, MAP_PHONE}
|
return i;
|
||||||
, new int[]{R.id.listviewcontractsTextView1, R.id.listviewcontractsTextView2});
|
}
|
||||||
mSimpleAdapter.setDropDownViewResource(R.layout.listview_contracts);
|
}
|
||||||
mlvContracts.setAdapter(mSimpleAdapter);
|
return 0;
|
||||||
mlvContracts.setOnItemClickListener(new ListView.OnItemClickListener() {
|
}
|
||||||
|
|
||||||
@Override
|
// 初始化或更新列表适配器
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
private void initAdapter(List<PhoneBean> initData) {
|
||||||
metTO.setText(mAdapterData.get(position).get(MAP_PHONE).toString());
|
mAdapterData.clear(); // 清空旧数据
|
||||||
|
final PhoneUtil phoneUtil = new PhoneUtil(this);
|
||||||
|
|
||||||
}
|
// 确定数据源:传入的筛选数据或所有联系人
|
||||||
});
|
if (initData != null) {
|
||||||
|
mListPhoneBeanContracts = initData;
|
||||||
|
} else {
|
||||||
|
mListPhoneBeanContracts = phoneUtil.getPhoneList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换数据为SimpleAdapter所需格式
|
||||||
|
if (mListPhoneBeanContracts != null) {
|
||||||
|
for (PhoneBean bean : mListPhoneBeanContracts) {
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
map.put(MAP_NAME, bean.getName());
|
||||||
|
map.put(MAP_PHONE, bean.getTelPhone());
|
||||||
|
mAdapterData.add(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化或更新适配器
|
||||||
|
if (mSimpleAdapter == null) {
|
||||||
|
mSimpleAdapter = new SimpleAdapter(
|
||||||
|
ComposeSMSActivity.this,
|
||||||
|
mAdapterData,
|
||||||
|
R.layout.listview_contracts,
|
||||||
|
new String[]{MAP_NAME, MAP_PHONE},
|
||||||
|
new int[]{R.id.listviewcontractsTextView1, R.id.listviewcontractsTextView2}
|
||||||
|
);
|
||||||
|
mSimpleAdapter.setDropDownViewResource(R.layout.listview_contracts);
|
||||||
|
mlvContracts.setAdapter(mSimpleAdapter);
|
||||||
|
|
||||||
|
// 列表项点击事件:点击时主动设置选中状态,确保样式突显
|
||||||
|
mlvContracts.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
if (position < mAdapterData.size()) {
|
||||||
|
// 1. 主动设置当前项为选中状态
|
||||||
|
mlvContracts.setItemChecked(position, true);
|
||||||
|
// 2. 更新号码输入框和姓名显示
|
||||||
|
String phone = mAdapterData.get(position).get(MAP_PHONE).toString();
|
||||||
|
metTO.setText(phone);
|
||||||
|
mtvTOName.setText(phoneUtil.getNameByPhone(phone));
|
||||||
|
// 3. 滚动到点击位置(确保可见)
|
||||||
|
mlvContracts.setSelection(position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 列表项选中状态变化监听(可选,增强选中反馈)
|
||||||
|
mlvContracts.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
|
@Override
|
||||||
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
// 选中时可添加额外反馈(如改变文本颜色,可选)
|
||||||
|
if (view != null) {
|
||||||
|
TextView tvName = (TextView) view.findViewById(R.id.listviewcontractsTextView1);
|
||||||
|
TextView tvPhone = (TextView) view.findViewById(R.id.listviewcontractsTextView2);
|
||||||
|
if (tvName != null) tvName.setTextColor(getResources().getColor(R.color.white));
|
||||||
|
if (tvPhone != null) tvPhone.setTextColor(getResources().getColor(R.color.white));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNothingSelected(AdapterView<?> parent) {
|
||||||
|
// 未选中时无操作
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 数据更新时,先取消所有旧选中状态,再通知适配器刷新
|
||||||
|
mlvContracts.clearChoices();
|
||||||
|
mSimpleAdapter.notifyDataSetChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发送短信逻辑
|
||||||
|
private void sendSMS() {
|
||||||
|
String phoneTo = metTO.getText().toString().trim();
|
||||||
|
if (phoneTo.isEmpty()) {
|
||||||
|
ToastUtils.show("没有设置接收号码。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String smsBody = metSMSBody.getText().toString().trim();
|
||||||
|
if (smsBody.isEmpty()) {
|
||||||
|
ToastUtils.show("没有消息内容可发送。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (SMSUtil.sendMessageByInterface2(ComposeSMSActivity.this, phoneTo, smsBody)) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public class MainActivity extends BaseActivity {
|
|||||||
mToolbar = findViewById(R.id.activitymainASupportToolbar1);
|
mToolbar = findViewById(R.id.activitymainASupportToolbar1);
|
||||||
mToolbar.setSubtitle(getString(R.string.activity_name_main));
|
mToolbar.setSubtitle(getString(R.string.activity_name_main));
|
||||||
setSupportActionBar(mToolbar);
|
setSupportActionBar(mToolbar);
|
||||||
|
|
||||||
boolean isEnableService = mAppConfigUtil.mAppConfigBean.isEnableService();
|
boolean isEnableService = mAppConfigUtil.mAppConfigBean.isEnableService();
|
||||||
msvEnableService = findViewById(R.id.activitymainSwitchView1);
|
msvEnableService = findViewById(R.id.activitymainSwitchView1);
|
||||||
msvEnableService.setChecked(isEnableService);
|
msvEnableService.setChecked(isEnableService);
|
||||||
@@ -269,17 +269,9 @@ public class MainActivity extends BaseActivity {
|
|||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
//return super.onCreateOptionsMenu(menu);
|
//return super.onCreateOptionsMenu(menu);
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
||||||
|
super.onCreateOptionsMenu(menu);
|
||||||
/*ThemeUtil.BaseTheme baseTheme = ThemeUtil.getTheme(mAppConfigUtil.mAppConfigBean.getAppThemeID());
|
getMenuInflater().inflate(R.menu.toolbar_main2, menu);
|
||||||
if (baseTheme == ThemeUtil.BaseTheme.DEFAULT) {
|
return true;
|
||||||
menu.findItem(R.id.app_defaulttheme).setChecked(true);
|
|
||||||
} else if (baseTheme == ThemeUtil.BaseTheme.SKY) {
|
|
||||||
menu.findItem(R.id.app_skytheme).setChecked(true);
|
|
||||||
} else if (baseTheme == ThemeUtil.BaseTheme.GOLDEN) {
|
|
||||||
menu.findItem(R.id.app_goldentheme).setChecked(true);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reloadSMS() {
|
public static void reloadSMS() {
|
||||||
@@ -306,7 +298,7 @@ public class MainActivity extends BaseActivity {
|
|||||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
} else if (nItemId == R.id.app_log) {
|
} else if (nItemId == R.id.app_log) {
|
||||||
//App.getWinBoLLActivityManager().startLogActivity(this);
|
App.getWinBoLLActivityManager().startLogActivity(this);
|
||||||
} else if (nItemId == R.id.app_unittest) {
|
} else if (nItemId == R.id.app_unittest) {
|
||||||
Intent i = new Intent(MainActivity.this, UnitTestActivity.class);
|
Intent i = new Intent(MainActivity.this, UnitTestActivity.class);
|
||||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
@@ -324,7 +316,7 @@ public class MainActivity extends BaseActivity {
|
|||||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,16 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
|
import android.view.inputmethod.InputMethodManager;
|
||||||
import android.widget.AbsListView;
|
import android.widget.AbsListView;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -16,19 +21,17 @@ import android.widget.Toolbar;
|
|||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
|
import cc.winboll.studio.libaes.views.AOHPCTCSeekBar;
|
||||||
import cc.winboll.studio.mymessagemanager.R;
|
import cc.winboll.studio.mymessagemanager.R;
|
||||||
import cc.winboll.studio.mymessagemanager.activitys.SMSActivity;
|
|
||||||
import cc.winboll.studio.mymessagemanager.adapters.SMSArrayAdapter;
|
import cc.winboll.studio.mymessagemanager.adapters.SMSArrayAdapter;
|
||||||
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
|
import cc.winboll.studio.mymessagemanager.utils.AddressUtils;
|
||||||
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
|
import cc.winboll.studio.mymessagemanager.utils.SMSUtil;
|
||||||
import cc.winboll.studio.mymessagemanager.utils.ViewUtil;
|
import cc.winboll.studio.mymessagemanager.utils.ViewUtil;
|
||||||
|
import cc.winboll.studio.mymessagemanager.views.BottomPositionFixedScrollView;
|
||||||
import cc.winboll.studio.mymessagemanager.views.SMSListViewForScrollView;
|
import cc.winboll.studio.mymessagemanager.views.SMSListViewForScrollView;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
public class SMSActivity extends BaseActivity {
|
public class SMSActivity extends BaseActivity {
|
||||||
public static String TAG = "SMSActivity";
|
public static String TAG = "SMSActivity";
|
||||||
|
|
||||||
public static final String ACTION_NOTIFY_SMS_CHANGED = "cc.winboll.studio.mymessagemanager.activitys.SMSActivity.ACTION_NOTIFY_SMS_CHANGED";
|
public static final String ACTION_NOTIFY_SMS_CHANGED = "cc.winboll.studio.mymessagemanager.activitys.SMSActivity.ACTION_NOTIFY_SMS_CHANGED";
|
||||||
|
|
||||||
public static final String EXTRA_PHONE = "Phone";
|
public static final String EXTRA_PHONE = "Phone";
|
||||||
final static int MSG_SET_FOCUS = 0;
|
final static int MSG_SET_FOCUS = 0;
|
||||||
|
|
||||||
@@ -36,10 +39,11 @@ public class SMSActivity extends BaseActivity {
|
|||||||
Toolbar mToolbar;
|
Toolbar mToolbar;
|
||||||
String mszPhoneTo;
|
String mszPhoneTo;
|
||||||
SMSArrayAdapter mSMSArrayAdapter;
|
SMSArrayAdapter mSMSArrayAdapter;
|
||||||
ScrollView mScrollView;
|
BottomPositionFixedScrollView mScrollView1;
|
||||||
EditText metSMSBody;
|
EditText metSMSBody;
|
||||||
SMSActivityBroadcastReceiver mSMSActivityBroadcastReceiver;
|
SMSActivityBroadcastReceiver mSMSActivityBroadcastReceiver;
|
||||||
Handler mSetFocusHandler;
|
Handler mSetFocusHandler;
|
||||||
|
private boolean isImeVisible = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -47,45 +51,90 @@ public class SMSActivity extends BaseActivity {
|
|||||||
setContentView(R.layout.activity_sms);
|
setContentView(R.layout.activity_sms);
|
||||||
|
|
||||||
initView();
|
initView();
|
||||||
mSetFocusHandler = new MyHandler(SMSActivity.this);
|
|
||||||
scrollScrollView();
|
scrollScrollView();
|
||||||
|
setupImeStatusListener();
|
||||||
|
|
||||||
// 每隔一定时间设置输入框获得焦点
|
// 新增:监听窗口加载完成,触发mScrollView1滚动到底部
|
||||||
//
|
setupScrollToBottomAfterWindowLoaded();
|
||||||
new Thread() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
while (true) {
|
|
||||||
try {
|
|
||||||
Thread.sleep(1500);
|
|
||||||
} catch (InterruptedException e) {}
|
|
||||||
Message message = mSetFocusHandler.obtainMessage(MSG_SET_FOCUS);
|
|
||||||
mSetFocusHandler.sendMessage(message);
|
|
||||||
}
|
|
||||||
}}.start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// 新增:窗口加载完成后让mScrollView1滚动到底部
|
||||||
// 设置输入框获得焦点的类
|
private void setupScrollToBottomAfterWindowLoaded() {
|
||||||
//
|
final View rootView = findViewById(android.R.id.content);
|
||||||
static class MyHandler extends Handler {
|
// 监听根布局绘制完成(窗口加载完成的标志)
|
||||||
WeakReference<SMSActivity> mActivity;
|
rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
MyHandler(SMSActivity activity) {
|
@Override
|
||||||
mActivity = new WeakReference<SMSActivity>(activity);
|
public void onGlobalLayout() {
|
||||||
}
|
// 滚动到底部
|
||||||
public void handleMessage(Message msg) {
|
mScrollView1.post(new Runnable() {
|
||||||
SMSActivity theActivity = mActivity.get();
|
@Override
|
||||||
switch (msg.what) {
|
public void run() {
|
||||||
case MSG_SET_FOCUS:
|
mScrollView1.fullScroll(ScrollView.FOCUS_DOWN);
|
||||||
theActivity.metSMSBody.setFocusable(true);
|
}
|
||||||
theActivity.metSMSBody.requestFocus();
|
});
|
||||||
break;
|
|
||||||
default:
|
// 移除监听,避免重复触发
|
||||||
break;
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
}
|
rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
super.handleMessage(msg);
|
} else {
|
||||||
}
|
rootView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupImeStatusListener() {
|
||||||
|
final View rootView = findViewById(android.R.id.content);
|
||||||
|
rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
int rootViewHeight = rootView.getHeight();
|
||||||
|
int screenHeight = getResources().getDisplayMetrics().heightPixels;
|
||||||
|
int imeThreshold = dp2px(200);
|
||||||
|
|
||||||
|
boolean currentImeVisible = (screenHeight - rootViewHeight) > imeThreshold;
|
||||||
|
|
||||||
|
if (currentImeVisible != isImeVisible) {
|
||||||
|
isImeVisible = currentImeVisible;
|
||||||
|
setupScrollView1Height();
|
||||||
|
if (!isImeVisible) {
|
||||||
|
metSMSBody.clearFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
|
rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||||
|
} else {
|
||||||
|
rootView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
|
||||||
|
}
|
||||||
|
setupImeStatusListener();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private int dp2px(int dp) {
|
||||||
|
return (int) (dp * getResources().getDisplayMetrics().density + 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static class MyHandler extends Handler {
|
||||||
|
WeakReference<SMSActivity> mActivity;
|
||||||
|
MyHandler(SMSActivity activity) {
|
||||||
|
mActivity = new WeakReference<SMSActivity>(activity);
|
||||||
|
}
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
SMSActivity theActivity = mActivity.get();
|
||||||
|
switch (msg.what) {
|
||||||
|
case MSG_SET_FOCUS:
|
||||||
|
theActivity.metSMSBody.setFocusable(true);
|
||||||
|
theActivity.metSMSBody.requestFocus();
|
||||||
|
theActivity.setupScrollView1Height();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
super.handleMessage(msg);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
@@ -94,135 +143,130 @@ public class SMSActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initView() {
|
void initView() {
|
||||||
// 发送端空号码退出
|
|
||||||
mszPhoneTo = getIntent().getStringExtra(EXTRA_PHONE);
|
mszPhoneTo = getIntent().getStringExtra(EXTRA_PHONE);
|
||||||
if (mszPhoneTo == null || mszPhoneTo.trim().equals("")) {
|
if (mszPhoneTo == null || mszPhoneTo.trim().equals("")) {
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化标题栏
|
mToolbar = (Toolbar) findViewById(R.id.activitysmsASupportToolbar1);
|
||||||
mToolbar = findViewById(R.id.activitysmsASupportToolbar1);
|
|
||||||
mToolbar.setSubtitle(getString(R.string.activity_name_smsinphone) + " < Phone : " + AddressUtils.getFormattedAddress(mszPhoneTo) + " >");
|
mToolbar.setSubtitle(getString(R.string.activity_name_smsinphone) + " < Phone : " + AddressUtils.getFormattedAddress(mszPhoneTo) + " >");
|
||||||
setActionBar(mToolbar);
|
setActionBar(mToolbar);
|
||||||
|
|
||||||
// 初始化滚动窗口
|
mScrollView1 = (BottomPositionFixedScrollView) findViewById(R.id.activitysmsScrollView1);
|
||||||
mScrollView = findViewById(R.id.activitysmsinphoneScrollView1);
|
|
||||||
|
|
||||||
// 初始化发送消息框
|
metSMSBody = (EditText) findViewById(R.id.viewsmssendpart1EditText1);
|
||||||
//Drawable drawableFrame = AppCompatResources.getDrawable(this, R.drawable.bg_frame);
|
metSMSBody.setOnClickListener(new View.OnClickListener() {
|
||||||
metSMSBody = findViewById(R.id.viewsmssendpart1EditText1);
|
@Override
|
||||||
//metSMSBody.setBackground(drawableFrame);
|
public void onClick(View v) {
|
||||||
|
setupScrollView1Height();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
metSMSBody.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onFocusChange(View v, boolean hasFocus) {
|
||||||
|
setupScrollView1Height();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 初始化发送拉动控件
|
final AOHPCTCSeekBar aOHPCTCSeekBar = (AOHPCTCSeekBar) findViewById(R.id.viewsmssendpart1AOHPCTCSeekBar1);
|
||||||
final AOHPCTCSeekBar aOHPCTCSeekBar = findViewById(R.id.viewsmssendpart1AOHPCTCSeekBar1);
|
|
||||||
aOHPCTCSeekBar.setThumb(getDrawable(R.drawable.ic_message));
|
aOHPCTCSeekBar.setThumb(getDrawable(R.drawable.ic_message));
|
||||||
aOHPCTCSeekBar.setThumbOffset(20);
|
aOHPCTCSeekBar.setThumbOffset(20);
|
||||||
aOHPCTCSeekBar.setOnOHPCListener(
|
aOHPCTCSeekBar.setOnOHPCListener(new AOHPCTCSeekBar.OnOHPCListener() {
|
||||||
new AOHPCTCSeekBar.OnOHPCListener(){
|
@Override
|
||||||
@Override
|
public void onOHPCommit() {
|
||||||
public void onOHPCommit() {
|
sendSMS();
|
||||||
//Toast.makeText(getApplication(), "Send", Toast.LENGTH_SHORT).show();
|
}
|
||||||
sendSMS();
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// 初始化提示框
|
TextView tvAOHPCTCSeekBarMSG = (TextView) findViewById(R.id.viewsmssendpart1TextView1);
|
||||||
TextView tvAOHPCTCSeekBarMSG = findViewById(R.id.viewsmssendpart1TextView1);
|
|
||||||
tvAOHPCTCSeekBarMSG.setText(R.string.msg_100sendmsg);
|
tvAOHPCTCSeekBarMSG.setText(R.string.msg_100sendmsg);
|
||||||
|
|
||||||
mlvSMS = (SMSListViewForScrollView) findViewById(R.id.activitysmsinphoneListView1);
|
mlvSMS = (SMSListViewForScrollView) findViewById(R.id.activitysmsSMSListViewForScrollView1);
|
||||||
|
|
||||||
// 准备数据
|
|
||||||
mSMSArrayAdapter = new SMSArrayAdapter(SMSActivity.this, mszPhoneTo);
|
mSMSArrayAdapter = new SMSArrayAdapter(SMSActivity.this, mszPhoneTo);
|
||||||
mlvSMS.setAdapter(mSMSArrayAdapter);
|
mlvSMS.setAdapter(mSMSArrayAdapter);
|
||||||
|
|
||||||
// 设置短信列表滚动到底部就取消已发送的通知消息
|
|
||||||
//
|
|
||||||
mlvSMS.setOnScrollListener(new AbsListView.OnScrollListener() {
|
mlvSMS.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
public void onScrollStateChanged(AbsListView view, int scrollState) {}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||||
if (firstVisibleItem + visibleItemCount == totalItemCount && totalItemCount > 0) {
|
if (firstVisibleItem + visibleItemCount == totalItemCount && totalItemCount > 0) {
|
||||||
// 滑动到了底部
|
mSMSArrayAdapter.cancelMessageNotification();
|
||||||
mSMSArrayAdapter.cancelMessageNotification();
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
mSMSActivityBroadcastReceiver = new SMSActivityBroadcastReceiver();
|
mSMSActivityBroadcastReceiver = new SMSActivityBroadcastReceiver();
|
||||||
IntentFilter intentFilter = new IntentFilter();
|
IntentFilter intentFilter = new IntentFilter(ACTION_NOTIFY_SMS_CHANGED);
|
||||||
intentFilter.addAction(ACTION_NOTIFY_SMS_CHANGED);
|
|
||||||
LocalBroadcastManager.getInstance(this).registerReceiver(mSMSActivityBroadcastReceiver, intentFilter);
|
LocalBroadcastManager.getInstance(this).registerReceiver(mSMSActivityBroadcastReceiver, intentFilter);
|
||||||
|
|
||||||
/*SMSView mSMSView = findViewById(R.id.viewsmssendSMSView1);
|
|
||||||
mSMSView.setSMSType(SMSView.SMSType.SEND);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
private void setupScrollView1Height() {
|
||||||
// 更新信息列表
|
mScrollView1.postDelayed(new Runnable() {
|
||||||
//
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final ScrollView scrollView2 = (ScrollView) findViewById(R.id.activitysmsScrollView2);
|
||||||
|
final BottomPositionFixedScrollView scrollView1 = (BottomPositionFixedScrollView) findViewById(R.id.activitysmsScrollView1);
|
||||||
|
final View includeView = findViewById(R.id.activitysmsinclude1);
|
||||||
|
|
||||||
|
scrollView2.post(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
int scrollView2Height = scrollView2.getHeight();
|
||||||
|
int includeHeight = includeView.getHeight();
|
||||||
|
int targetHeight = Math.max(scrollView2Height - includeHeight, 0);
|
||||||
|
|
||||||
|
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) scrollView1.getLayoutParams();
|
||||||
|
params.height = targetHeight;
|
||||||
|
scrollView1.setLayoutParams(params);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateSMSView() {
|
public void updateSMSView() {
|
||||||
mSMSArrayAdapter.reLoadSMSList(SMSActivity.this, mszPhoneTo);
|
mSMSArrayAdapter.reLoadSMSList(SMSActivity.this, mszPhoneTo);
|
||||||
mSMSArrayAdapter.notifyDataSetChanged();
|
mSMSArrayAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// 滚动消息文本框
|
|
||||||
//
|
|
||||||
void scrollScrollView() {
|
void scrollScrollView() {
|
||||||
|
ViewUtil.scrollScrollView(mScrollView1);
|
||||||
ViewUtil.scrollScrollView(mScrollView);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// 发送短信
|
|
||||||
//
|
|
||||||
void sendSMS() {
|
void sendSMS() {
|
||||||
// 空消息不发送
|
|
||||||
String szSMSBody = metSMSBody.getText().toString();
|
String szSMSBody = metSMSBody.getText().toString();
|
||||||
if (szSMSBody.equals("")) {
|
if (szSMSBody.equals("")) {
|
||||||
Toast.makeText(getApplication(), "没有消息内容可发送。", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplication(), "没有消息内容可发送。", Toast.LENGTH_SHORT).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送短信
|
|
||||||
if (SMSUtil.sendMessageByInterface2(this, mszPhoneTo, szSMSBody)) {
|
if (SMSUtil.sendMessageByInterface2(this, mszPhoneTo, szSMSBody)) {
|
||||||
metSMSBody.setText("");
|
metSMSBody.setText("");
|
||||||
new Handler().postDelayed(new Runnable(){
|
metSMSBody.clearFocus();
|
||||||
@Override
|
new Handler().postDelayed(new Runnable() {
|
||||||
public void run() {
|
@Override
|
||||||
updateSMSView();
|
public void run() {
|
||||||
ViewUtil.scrollScrollView(mScrollView);
|
updateSMSView();
|
||||||
}
|
ViewUtil.scrollScrollView(mScrollView1);
|
||||||
}, 1000);
|
}
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SMSActivityBroadcastReceiver extends BroadcastReceiver {
|
class SMSActivityBroadcastReceiver extends BroadcastReceiver {
|
||||||
|
public SMSActivityBroadcastReceiver() {}
|
||||||
public SMSActivityBroadcastReceiver() {
|
|
||||||
//LogUtils.d(TAG, "SMSActivityBroadcastReceiver()");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
switch (intent.getAction()) {
|
if (ACTION_NOTIFY_SMS_CHANGED.equals(intent.getAction())) {
|
||||||
case ACTION_NOTIFY_SMS_CHANGED :
|
updateSMSView();
|
||||||
//Toast.makeText(context, "ACTION_NOTIFY_SMS_CHANGED", Toast.LENGTH_SHORT).show();
|
ViewUtil.scrollScrollView(mScrollView1);
|
||||||
updateSMSView();
|
} else {
|
||||||
ViewUtil.scrollScrollView(mScrollView);
|
throw new IllegalStateException("Unexpected value: " + intent.getAction());
|
||||||
//LogUtils.d(TAG, "ACTION_NOTIFY_SMS_CHANGED");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new IllegalStateException("Unexpected value: " + intent.getAction());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,9 @@ import cc.winboll.studio.libaes.beans.AESThemeBean;
|
|||||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
||||||
|
|
||||||
public class WinBollActivity extends AppCompatActivity implements IWinBoLLActivity {
|
public class WinBoLLActivity extends AppCompatActivity implements IWinBoLLActivity {
|
||||||
|
|
||||||
public static final String TAG = "WinBollActivity";
|
public static final String TAG = "WinBoLLActivity";
|
||||||
|
|
||||||
protected volatile AESThemeBean.ThemeType mThemeType;
|
protected volatile AESThemeBean.ThemeType mThemeType;
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package cc.winboll.studio.mymessagemanager.utils;
|
package cc.winboll.studio.mymessagemanager.utils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author ZhanGSKen<zhangsken@188.com>
|
* @Author ZhanGSKen&豆包大模型<zhangsken@188.com>
|
||||||
* @Date 2024/07/19 14:30:57
|
* @Date 2025/08/30 14:32
|
||||||
* @Describe 手机联系人工具类
|
* @Describe 手机联系人工具类
|
||||||
*/
|
*/
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
@@ -11,6 +11,7 @@ import android.database.Cursor;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libapputils.utils.RegexPPiUtils;
|
||||||
import cc.winboll.studio.mymessagemanager.beans.PhoneBean;
|
import cc.winboll.studio.mymessagemanager.beans.PhoneBean;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -18,6 +19,11 @@ import java.util.Comparator;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||||
|
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
|
||||||
|
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||||
|
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
||||||
|
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
|
||||||
|
|
||||||
public class PhoneUtil {
|
public class PhoneUtil {
|
||||||
|
|
||||||
@@ -38,28 +44,137 @@ public class PhoneUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 读取所有联系人
|
// 读取所有联系人
|
||||||
//
|
|
||||||
public List<PhoneBean> getPhoneList() {
|
public List<PhoneBean> getPhoneList() {
|
||||||
List<PhoneBean> listPhoneBean = new ArrayList<>();
|
List<PhoneBean> listPhoneBean = new ArrayList<>();
|
||||||
ContentResolver cr = mContext.getContentResolver();
|
ContentResolver cr = mContext.getContentResolver();
|
||||||
Cursor cursor = cr.query(mUriPhoneContent, new String[]{NUMBER, DISPLAY_NAME}, null, null, null);
|
Cursor cursor = cr.query(mUriPhoneContent, new String[]{NUMBER, DISPLAY_NAME}, null, null, null);
|
||||||
while (cursor.moveToNext()) {
|
if (cursor != null) {
|
||||||
PhoneBean phoneBean = new PhoneBean(cursor.getString(1), cursor.getString(0).replaceAll("\\s", ""));
|
while (cursor.moveToNext()) {
|
||||||
listPhoneBean.add(phoneBean);
|
// 去除号码中的空格
|
||||||
|
String phone = cursor.getString(0).replaceAll("\\s", "");
|
||||||
|
String name = cursor.getString(1);
|
||||||
|
PhoneBean phoneBean = new PhoneBean(name, phone);
|
||||||
|
listPhoneBean.add(phoneBean);
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
}
|
}
|
||||||
cursor.close();
|
|
||||||
|
|
||||||
|
// 按电话号码排序
|
||||||
Collections.sort(listPhoneBean, new Comparator<PhoneBean>() {
|
Collections.sort(listPhoneBean, new Comparator<PhoneBean>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(PhoneBean o1, PhoneBean o2) {
|
public int compare(PhoneBean o1, PhoneBean o2) {
|
||||||
return o1.getTelPhone().compareTo(o2.getTelPhone());
|
return o1.getTelPhone().compareTo(o2.getTelPhone());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return listPhoneBean;
|
return listPhoneBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据联系人名称查询号码(兼容拼音查询)
|
||||||
|
* @param keyword 搜索关键词(支持汉字、拼音、拼音首字母)
|
||||||
|
* @return 匹配的联系人列表(包含姓名和号码)
|
||||||
|
*/
|
||||||
|
public List<PhoneBean> getPhonesByName(String keyword) {
|
||||||
|
List<PhoneBean> result = new ArrayList<>();
|
||||||
|
if (keyword == null || keyword.trim().isEmpty()) {
|
||||||
|
return result; // 关键词为空,返回空列表
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取所有联系人
|
||||||
|
List<PhoneBean> allContacts = getPhoneList();
|
||||||
|
// 统一转为小写,忽略大小写
|
||||||
|
String keywordLower = keyword.trim().toLowerCase();
|
||||||
|
|
||||||
|
for (PhoneBean contact : allContacts) {
|
||||||
|
String name = contact.getName();
|
||||||
|
if (name == null || name.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 直接匹配姓名(包含关键词)
|
||||||
|
if (name.toLowerCase().contains(keywordLower)) {
|
||||||
|
result.add(contact);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 匹配姓名的全拼(包含关键词)
|
||||||
|
String namePinyin = getPinyin(name).toLowerCase();
|
||||||
|
if (namePinyin.contains(keywordLower)) {
|
||||||
|
result.add(contact);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 匹配姓名的拼音首字母(包含关键词)
|
||||||
|
String namePinyinFirstLetter = getPinyinFirstLetter(name).toLowerCase();
|
||||||
|
if (namePinyinFirstLetter.contains(keywordLower)) {
|
||||||
|
result.add(contact);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将汉字转为全拼(不带声调,小写)
|
||||||
|
* 例如:"张三" → "zhangsan"
|
||||||
|
*/
|
||||||
|
private String getPinyin(String chinese) {
|
||||||
|
StringBuilder pinyin = new StringBuilder();
|
||||||
|
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
|
||||||
|
format.setCaseType(HanyuPinyinCaseType.LOWERCASE); // 小写
|
||||||
|
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE); // 不带声调
|
||||||
|
|
||||||
|
char[] chars = chinese.toCharArray();
|
||||||
|
for (char c : chars) {
|
||||||
|
// 如果是汉字,转换为拼音;否则直接拼接(如字母、数字、符号)
|
||||||
|
if (Character.toString(c).matches("[\\u4e00-\\u9fa5]")) {
|
||||||
|
try {
|
||||||
|
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c, format);
|
||||||
|
if (pinyinArray != null && pinyinArray.length > 0) {
|
||||||
|
pinyin.append(pinyinArray[0]); // 取第一个拼音(多音字默认取第一个)
|
||||||
|
}
|
||||||
|
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||||
|
LogUtils.e(TAG, "拼音转换失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pinyin.append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pinyin.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将汉字转为拼音首字母(小写)
|
||||||
|
* 例如:"张三" → "zs"
|
||||||
|
*/
|
||||||
|
private String getPinyinFirstLetter(String chinese) {
|
||||||
|
StringBuilder firstLetters = new StringBuilder();
|
||||||
|
HanyuPinyinOutputFormat format = new HanyuPinyinOutputFormat();
|
||||||
|
format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||||
|
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||||
|
|
||||||
|
char[] chars = chinese.toCharArray();
|
||||||
|
for (char c : chars) {
|
||||||
|
if (Character.toString(c).matches("[\\u4e00-\\u9fa5]")) {
|
||||||
|
try {
|
||||||
|
String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(c, format);
|
||||||
|
if (pinyinArray != null && pinyinArray.length > 0) {
|
||||||
|
// 取拼音首字母(如"zhang" → "z")
|
||||||
|
firstLetters.append(pinyinArray[0].charAt(0));
|
||||||
|
}
|
||||||
|
} catch (BadHanyuPinyinOutputFormatCombination e) {
|
||||||
|
LogUtils.e(TAG, "拼音首字母转换失败:" + e.getMessage());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 非汉字直接拼接首字符(如"李3" → "l3")
|
||||||
|
firstLetters.append(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return firstLetters.toString();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isPhoneInContacts(String szPhone) {
|
public boolean isPhoneInContacts(String szPhone) {
|
||||||
List<PhoneBean> listPhoneDto = getPhoneList();
|
List<PhoneBean> listPhoneDto = getPhoneList();
|
||||||
LogUtils.d(TAG, String.format("isPhoneInContacts(...) listPhoneDto.size() %d", listPhoneDto.size()));
|
LogUtils.d(TAG, String.format("isPhoneInContacts(...) listPhoneDto.size() %d", listPhoneDto.size()));
|
||||||
@@ -70,49 +185,56 @@ public class PhoneUtil {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isTheSamePhoneNumber(String szNum1, String szNum2) {
|
public String getNameByPhone(String szPhone) {
|
||||||
//LogUtils.d(TAG, String.format("szNum1 %s\nszNum2 %s", szNum1, szNum2));
|
if (szPhone == null || szPhone.equals("")) {
|
||||||
if(szNum1.equals(szNum2)) {
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
List<PhoneBean> listPhoneDto = getPhoneList();
|
||||||
|
LogUtils.d(TAG, String.format("getNameByPhone(...) listPhoneDto.size() %d", listPhoneDto.size()));
|
||||||
|
for (int i = 0; i < listPhoneDto.size(); i++) {
|
||||||
|
if (isTheSamePhoneNumber(listPhoneDto.get(i).getTelPhone(), szPhone)) {
|
||||||
|
return listPhoneDto.get(i).getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTheSamePhoneNumber(String szNum1, String szNum2) {
|
||||||
|
if (szNum1.equals(szNum2)) {
|
||||||
LogUtils.d(TAG, "szNum1.equals(szNum2)");
|
LogUtils.d(TAG, "szNum1.equals(szNum2)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UnitAreaUtils.getInstance(mContext).isCurrentUnitAreaNumber(szNum1)) {
|
if (UnitAreaUtils.getInstance(mContext).isCurrentUnitAreaNumber(szNum1)) {
|
||||||
if(szNum1.equals(UnitAreaUtils.getInstance(mContext).genCurrentUnitAreaNumber(szNum2))) {
|
if (szNum1.equals(UnitAreaUtils.getInstance(mContext).genCurrentUnitAreaNumber(szNum2))) {
|
||||||
LogUtils.d(TAG, "szNum1.equals(UnitAreaUtils.genCurrentUnitAreaNumber(szNum2))");
|
LogUtils.d(TAG, "szNum1.equals(UnitAreaUtils.genCurrentUnitAreaNumber(szNum2))");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UnitAreaUtils.getInstance(mContext).isCurrentUnitAreaNumber(szNum2)) {
|
if (UnitAreaUtils.getInstance(mContext).isCurrentUnitAreaNumber(szNum2)) {
|
||||||
if(szNum2.equals(UnitAreaUtils.getInstance(mContext).genCurrentUnitAreaNumber(szNum1))) {
|
if (szNum2.equals(UnitAreaUtils.getInstance(mContext).genCurrentUnitAreaNumber(szNum1))) {
|
||||||
LogUtils.d(TAG, "szNum2.equals(UnitAreaUtils.genCurrentUnitAreaNumber(szNum1))");
|
LogUtils.d(TAG, "szNum2.equals(UnitAreaUtils.genCurrentUnitAreaNumber(szNum1))");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogUtils.d(TAG, "isTheSamePhoneNumber(...) return false;");
|
LogUtils.d(TAG, "isTheSamePhoneNumber(...) return false;");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// 检验电话号码是否是数字
|
// 检验电话号码是否是数字
|
||||||
//
|
|
||||||
public static boolean isPhoneByDigit(String szPhone) {
|
public static boolean isPhoneByDigit(String szPhone) {
|
||||||
if(!RegexPPiUtils.isPPiOK(szPhone)) {
|
if (!RegexPPiUtils.isPPiOK(szPhone)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//String text = "这里是一些任意的文本内容";
|
|
||||||
String regex = "[+]?\\d+";
|
String regex = "[+]?\\d+";
|
||||||
Pattern pattern = Pattern.compile(regex);
|
Pattern pattern = Pattern.compile(regex);
|
||||||
Matcher matcher = pattern.matcher(szPhone);
|
Matcher matcher = pattern.matcher(szPhone);
|
||||||
LogUtils.d(TAG, String.format("matcher.matches() : %s", matcher.matches()));
|
LogUtils.d(TAG, String.format("matcher.matches() : %s", matcher.matches()));
|
||||||
/*if (matcher.matches()) {
|
|
||||||
System.out.println("文本满足该正则表达式模式");
|
|
||||||
} else {
|
|
||||||
System.out.println("文本不满足该正则表达式模式");
|
|
||||||
}*/
|
|
||||||
return matcher.matches();
|
return matcher.matches();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
package cc.winboll.studio.mymessagemanager.utils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen<zhangsken@188.com>
|
|
||||||
* @Date 2024/12/09 19:00:21
|
|
||||||
* @Describe .* 前置预防针
|
|
||||||
regex pointer preventive injection
|
|
||||||
简称 RegexPPi
|
|
||||||
*/
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class RegexPPiUtils {
|
|
||||||
|
|
||||||
public static final String TAG = "RegexPPiUtils";
|
|
||||||
|
|
||||||
//
|
|
||||||
// 检验文本是否满足适合正则表达式模式计算
|
|
||||||
//
|
|
||||||
public static boolean isPPiOK(String text) {
|
|
||||||
//String text = "这里是一些任意的文本内容";
|
|
||||||
String regex = ".*";
|
|
||||||
Pattern pattern = Pattern.compile(regex);
|
|
||||||
Matcher matcher = pattern.matcher(text);
|
|
||||||
/*if (matcher.matches()) {
|
|
||||||
System.out.println("文本满足该正则表达式模式");
|
|
||||||
} else {
|
|
||||||
System.out.println("文本不满足该正则表达式模式");
|
|
||||||
}*/
|
|
||||||
return matcher.matches();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,6 +8,7 @@ package cc.winboll.studio.mymessagemanager.utils;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.JsonReader;
|
import android.util.JsonReader;
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
import cc.winboll.studio.libappbase.LogUtils;
|
||||||
|
import cc.winboll.studio.libapputils.utils.RegexPPiUtils;
|
||||||
import cc.winboll.studio.mymessagemanager.beans.SMSAcceptRuleBean;
|
import cc.winboll.studio.mymessagemanager.beans.SMSAcceptRuleBean;
|
||||||
import cc.winboll.studio.mymessagemanager.beans.SMSAcceptRuleBean_V1;
|
import cc.winboll.studio.mymessagemanager.beans.SMSAcceptRuleBean_V1;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import cc.winboll.studio.mymessagemanager.beans.AppConfigBean;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
public class UnitAreaUtils {
|
public class UnitAreaUtils {
|
||||||
|
|
||||||
public static final String TAG = "UnitAreaUtils";
|
public static final String TAG = "UnitAreaUtils";
|
||||||
|
|
||||||
static UnitAreaUtils _UnitAreaUtils;
|
static UnitAreaUtils _UnitAreaUtils;
|
||||||
Context mContext;
|
Context mContext;
|
||||||
|
|
||||||
@@ -26,19 +26,25 @@ public class UnitAreaUtils {
|
|||||||
}
|
}
|
||||||
return _UnitAreaUtils;
|
return _UnitAreaUtils;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCurrentUnitAreaNumber(String szPhoneNumer) {
|
public boolean isCurrentUnitAreaNumber(String szPhoneNumer) {
|
||||||
String szUnitArea = getUnitArea();
|
String szUnitArea = getUnitArea();
|
||||||
LogUtils.d(TAG, String.format("szPhoneNumer.substring(1,3) %s", szPhoneNumer.substring(1,3)));
|
try {
|
||||||
return szPhoneNumer.substring(1,3).equals(szUnitArea);
|
String szPhoneNumerUnitArea = szPhoneNumer.substring(1, 3);
|
||||||
|
LogUtils.d(TAG, String.format("szPhoneNumerUnitArea %s", szPhoneNumerUnitArea));
|
||||||
|
return szPhoneNumerUnitArea.equals(szUnitArea);
|
||||||
|
} catch (StringIndexOutOfBoundsException e) {
|
||||||
|
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String genCurrentUnitAreaNumber(String szPhoneNumer) {
|
public String genCurrentUnitAreaNumber(String szPhoneNumer) {
|
||||||
String szUnitArea = getUnitArea();
|
String szUnitArea = getUnitArea();
|
||||||
LogUtils.d(TAG, String.format("szUnitArea %s", szUnitArea));
|
LogUtils.d(TAG, String.format("szUnitArea %s", szUnitArea));
|
||||||
return "+" + szUnitArea + szPhoneNumer;
|
return "+" + szUnitArea + szPhoneNumer;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getUnitArea() {
|
String getUnitArea() {
|
||||||
String szUnitArea = AppConfigUtil.getInstance(mContext).mAppConfigBean.getCountryCode();
|
String szUnitArea = AppConfigUtil.getInstance(mContext).mAppConfigBean.getCountryCode();
|
||||||
LogUtils.d(TAG, String.format("szUnitArea %s", szUnitArea));
|
LogUtils.d(TAG, String.format("szUnitArea %s", szUnitArea));
|
||||||
|
|||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package cc.winboll.studio.mymessagemanager.views;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author ZhanGSKen&豆包大模型<zhangsken@188.com>
|
||||||
|
* @Date 2025/08/23 00:39
|
||||||
|
* @Describe 多级拉动响应自定义控件
|
||||||
|
*/
|
||||||
|
import android.content.Context;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.ViewTreeObserver;
|
||||||
|
import android.widget.ScrollView;
|
||||||
|
|
||||||
|
public class BottomPositionFixedScrollView extends ScrollView {
|
||||||
|
public static final String TAG = "BottomPositionFixedScrollView";
|
||||||
|
// 记录底部对应的内容绝对位置(即底部位置在内容中的y坐标,该位置需始终保持在视图底部)
|
||||||
|
private int mBottomContentY = 0;
|
||||||
|
// 标记是否是首次布局(避免初始加载误触发)
|
||||||
|
private boolean isFirstLayout = true;
|
||||||
|
|
||||||
|
public BottomPositionFixedScrollView(Context context) {
|
||||||
|
super(context);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BottomPositionFixedScrollView(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BottomPositionFixedScrollView(Context context, AttributeSet attrs, int defStyle) {
|
||||||
|
super(context, attrs, defStyle);
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init() {
|
||||||
|
// 监听布局变化(高度改变时触发)
|
||||||
|
getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||||
|
@Override
|
||||||
|
public void onGlobalLayout() {
|
||||||
|
if (isFirstLayout) {
|
||||||
|
isFirstLayout = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 布局变化后,恢复底部位置
|
||||||
|
restoreBottomPosition();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重写滚动事件,记录“底部对应的内容绝对位置”
|
||||||
|
* (即当前视图底部边缘对应的内容y坐标,该坐标需始终保持在视图底部)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
|
||||||
|
super.onScrollChanged(l, t, oldl, oldt);
|
||||||
|
if (getChildCount() == 0) {
|
||||||
|
mBottomContentY = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 内容总高度
|
||||||
|
int contentHeight = getChildAt(0).getMeasuredHeight();
|
||||||
|
// 视图可视高度(自身高度)
|
||||||
|
int scrollViewHeight = getMeasuredHeight();
|
||||||
|
// 当前视图底部边缘对应的内容y坐标 = 顶部滚动距离(t) + 可视高度
|
||||||
|
// (该坐标就是“底部内容的绝对位置”,需始终保持在视图底部)
|
||||||
|
mBottomContentY = t + scrollViewHeight;
|
||||||
|
|
||||||
|
// 避免超过内容总高度(比如内容不足一屏时,底部最多到内容底部)
|
||||||
|
if (mBottomContentY > contentHeight) {
|
||||||
|
mBottomContentY = contentHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 恢复底部位置:让原记录的“底部内容绝对位置”仍保持在视图底部
|
||||||
|
*/
|
||||||
|
private void restoreBottomPosition() {
|
||||||
|
if (getChildCount() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新的内容总高度
|
||||||
|
int newContentHeight = getChildAt(0).getMeasuredHeight();
|
||||||
|
// 新的视图可视高度
|
||||||
|
int newScrollViewHeight = getMeasuredHeight();
|
||||||
|
|
||||||
|
// 目标:让原mBottomContentY(底部内容绝对位置)仍位于视图底部
|
||||||
|
// 此时需要的顶部滚动距离 = mBottomContentY - 新的可视高度
|
||||||
|
int targetScrollY = mBottomContentY - newScrollViewHeight;
|
||||||
|
|
||||||
|
// 边界修正:
|
||||||
|
// 1. 不能小于0(避免滚动到负数位置)
|
||||||
|
// 2. 不能大于“最大可滚动距离”(内容高度 - 可视高度,避免超出内容范围)
|
||||||
|
int maxScrollY = Math.max(newContentHeight - newScrollViewHeight, 0);
|
||||||
|
targetScrollY = Math.max(targetScrollY, 0);
|
||||||
|
targetScrollY = Math.min(targetScrollY, maxScrollY);
|
||||||
|
|
||||||
|
// 滚动到目标位置,保持底部内容位置不变
|
||||||
|
smoothScrollTo(0, targetScrollY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外部手动设置底部内容绝对位置(可选)
|
||||||
|
*/
|
||||||
|
public void setBottomContentY(int bottomContentY) {
|
||||||
|
if (getChildCount() == 0) {
|
||||||
|
mBottomContentY = bottomContentY;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 限制不超过内容总高度
|
||||||
|
int contentHeight = getChildAt(0).getMeasuredHeight();
|
||||||
|
mBottomContentY = Math.min(bottomContentY, contentHeight);
|
||||||
|
restoreBottomPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前底部内容绝对位置(可选)
|
||||||
|
*/
|
||||||
|
public int getBottomContentY() {
|
||||||
|
return mBottomContentY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- 选中状态:深灰色背景(可根据需求调整颜色) -->
|
||||||
|
<item android:state_selected="true" android:drawable="@color/list_item_selected"/>
|
||||||
|
<!-- 按压状态:浅灰色背景 -->
|
||||||
|
<item android:state_pressed="true" android:drawable="@color/list_item_pressed"/>
|
||||||
|
<!-- 默认状态:透明背景 -->
|
||||||
|
<item android:drawable="@android:color/transparent"/>
|
||||||
|
</selector>
|
||||||
@@ -1,71 +1,112 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<cc.winboll.studio.libaes.views.AToolbar
|
<cc.winboll.studio.libaes.views.AToolbar
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/toolbar_height"
|
android:layout_height="@dimen/toolbar_height"
|
||||||
android:id="@+id/activitycomposesmsASupportToolbar1"/>
|
android:id="@+id/activitycomposesmsASupportToolbar1"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/bg_frame">
|
android:background="@drawable/bg_frame">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/activitycomposesmsRelativeLayout1">
|
android:id="@+id/activitycomposesmsRelativeLayout1">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:orientation="horizontal"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:text="SMS TO : "
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/activitycomposesmsTextView1"
|
android:id="@+id/activitycomposesmsLinearLayout1"
|
||||||
android:layout_alignParentLeft="true"
|
android:gravity="center_vertical"
|
||||||
android:layout_marginLeft="10dp"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_centerVertical="true"/>
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_alignParentLeft="true">
|
||||||
|
|
||||||
<EditText
|
<TextView
|
||||||
android:layout_toRightOf="@id/activitycomposesmsTextView1"
|
android:layout_width="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="phone"
|
android:text="(拼音搜索):"/>
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:ems="10"
|
|
||||||
android:id="@+id/activitycomposesmsEditText1"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_marginRight="10dp"
|
|
||||||
android:layout_centerVertical="true"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
<EditText
|
||||||
|
android:layout_width="80dp"
|
||||||
|
android:ems="10"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/activitycomposesmsEditText2"/>
|
||||||
|
|
||||||
</LinearLayout>
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_toRightOf="@id/activitycomposesmsEditText2"
|
||||||
|
android:id="@+id/activitycomposesmsTextView2"
|
||||||
|
android:layout_weight="1.0"/>
|
||||||
|
|
||||||
<RelativeLayout
|
</LinearLayout>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:layout_weight="1.0">
|
|
||||||
|
|
||||||
<ListView
|
<LinearLayout
|
||||||
android:layout_alignParentTop="true"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_below="@id/activitycomposesmsLinearLayout1"
|
||||||
android:layout_height="wrap_content"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_above="@+id/activitycomposesmsinclude1"
|
android:layout_marginRight="10dp"
|
||||||
android:id="@+id/activitycomposesmsListView1"/>
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
<include
|
<TextView
|
||||||
layout="@layout/view_smssend"
|
android:layout_width="wrap_content"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="match_parent"
|
android:text="(SMS TO) :"
|
||||||
android:layout_height="wrap_content"
|
android:id="@+id/activitycomposesmsTextView1"/>
|
||||||
android:id="@+id/activitycomposesmsinclude1"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
<EditText
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:inputType="phone"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:ems="10"
|
||||||
|
android:id="@+id/activitycomposesmsEditText1"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:padding="10dp"
|
||||||
|
android:layout_weight="1.0">
|
||||||
|
|
||||||
|
<!-- 关键修改:添加 listSelector 属性,关联选中样式 -->
|
||||||
|
<ListView
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_above="@+id/activitycomposesmsinclude1"
|
||||||
|
android:id="@+id/activitycomposesmsListView1"
|
||||||
|
android:listSelector="@drawable/listview_item_selector"
|
||||||
|
android:choiceMode="singleChoice"/> <!-- 开启单选模式,确保选中状态唯一 -->
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/view_smssend"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/activitycomposesmsinclude1"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="60dp"
|
android:layout_height="60dp"
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:text="@string/text_onlyreceivecontacts"
|
android:text="@string/text_norulesreceivecontacts"
|
||||||
android:id="@+id/activitymainSwitchView2"/>
|
android:id="@+id/activitymainSwitchView2"/>
|
||||||
|
|
||||||
<cc.winboll.studio.mymessagemanager.views.ConfirmSwitchView
|
<cc.winboll.studio.mymessagemanager.views.ConfirmSwitchView
|
||||||
|
|||||||
@@ -10,36 +10,40 @@
|
|||||||
android:layout_height="@dimen/toolbar_height"
|
android:layout_height="@dimen/toolbar_height"
|
||||||
android:id="@+id/activitysmsASupportToolbar1"/>
|
android:id="@+id/activitysmsASupportToolbar1"/>
|
||||||
|
|
||||||
<RelativeLayout
|
<ScrollView
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="0dp"
|
||||||
android:paddingBottom="10dp">
|
android:layout_weight="1.0"
|
||||||
|
android:id="@+id/activitysmsScrollView2">
|
||||||
|
|
||||||
<ScrollView
|
<LinearLayout
|
||||||
android:layout_alignParentTop="true"
|
android:orientation="vertical"
|
||||||
android:layout_above="@+id/activitysmsinclude1"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/activitysmsinphoneScrollView1"
|
android:id="@+id/activitysmsLinearLayout1">
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:isScrollContainer="false">
|
|
||||||
|
|
||||||
<cc.winboll.studio.mymessagemanager.views.SMSListViewForScrollView
|
<cc.winboll.studio.mymessagemanager.views.BottomPositionFixedScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="520dp"
|
||||||
|
android:isScrollContainer="false"
|
||||||
|
android:id="@+id/activitysmsScrollView1">
|
||||||
|
|
||||||
|
<cc.winboll.studio.mymessagemanager.views.SMSListViewForScrollView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/activitysmsSMSListViewForScrollView1"/>
|
||||||
|
|
||||||
|
</cc.winboll.studio.mymessagemanager.views.BottomPositionFixedScrollView>
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/view_smssend"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/activitysmsinphoneListView1"/>
|
android:id="@+id/activitysmsinclude1"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<include
|
|
||||||
android:layout_alignParentBottom="true"
|
|
||||||
layout="@layout/view_smssend"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/activitysmsinclude1"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
||||||
<cc.winboll.studio.shared.log.LogView
|
<cc.winboll.studio.libappbase.LogView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1.0"
|
android:layout_weight="1.0"
|
||||||
|
|||||||
@@ -7,6 +7,18 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="10dp">
|
android:padding="10dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:id="@+id/viewsmssendpart1TextView1"/>
|
||||||
|
|
||||||
|
<cc.winboll.studio.libaes.views.AOHPCTCSeekBar
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/viewsmssendpart1AOHPCTCSeekBar1"/>
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:scrollbars="vertical"
|
android:scrollbars="vertical"
|
||||||
android:maxHeight="150dp"
|
android:maxHeight="150dp"
|
||||||
@@ -17,17 +29,6 @@
|
|||||||
android:id="@+id/viewsmssendpart1EditText1"
|
android:id="@+id/viewsmssendpart1EditText1"
|
||||||
android:background="@drawable/bg_frame"/>
|
android:background="@drawable/bg_frame"/>
|
||||||
|
|
||||||
<cc.winboll.studio.libaes.views.AOHPCTCSeekBar
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/viewsmssendpart1AOHPCTCSeekBar1"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:id="@+id/viewsmssendpart1TextView1"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -17,26 +17,4 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/app_smsrule"
|
android:id="@+id/app_smsrule"
|
||||||
android:title="@string/text_smsrule"/>
|
android:title="@string/text_smsrule"/>
|
||||||
<item android:title="@string/app_developoptions">
|
|
||||||
<menu>
|
|
||||||
<item
|
|
||||||
android:id="@+id/app_log"
|
|
||||||
android:title="@string/app_log"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/app_unittest"
|
|
||||||
android:title="@string/app_unittest"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/app_crashtest"
|
|
||||||
android:title="@string/app_crashtest"/>
|
|
||||||
</menu>
|
|
||||||
</item>
|
|
||||||
<item
|
|
||||||
android:id="@+id/app_appsettings"
|
|
||||||
android:title="@string/text_appsettings"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/app_about"
|
|
||||||
android:title="@string/app_about"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/app_smsrecycle"
|
|
||||||
android:title="@string/app_smsrecycle"/>
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
26
mymessagemanager/src/main/res/menu/toolbar_main2.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<item android:title="@string/app_developoptions">
|
||||||
|
<menu>
|
||||||
|
<item
|
||||||
|
android:id="@+id/app_log"
|
||||||
|
android:title="@string/app_log"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/app_unittest"
|
||||||
|
android:title="@string/app_unittest"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/app_crashtest"
|
||||||
|
android:title="@string/app_crashtest"/>
|
||||||
|
</menu>
|
||||||
|
</item>
|
||||||
|
<item
|
||||||
|
android:id="@+id/app_appsettings"
|
||||||
|
android:title="@string/text_appsettings"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/app_about"
|
||||||
|
android:title="@string/app_about"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/app_smsrecycle"
|
||||||
|
android:title="@string/app_smsrecycle"/>
|
||||||
|
</menu>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<string name="text_item_rule_clean">清理设置</string>
|
<string name="text_item_rule_clean">清理设置</string>
|
||||||
<string name="text_sendsms">发送短信</string>
|
<string name="text_sendsms">发送短信</string>
|
||||||
<string name="text_mainservice">短信服务管理总开关</string>
|
<string name="text_mainservice">短信服务管理总开关</string>
|
||||||
<string name="text_onlyreceivecontacts">只接收联系人短信</string>
|
<string name="text_norulesreceivecontacts">无限制接收联系人短信</string>
|
||||||
<string name="text_usingtts">使用TTS语音播报</string>
|
<string name="text_usingtts">使用TTS语音播报</string>
|
||||||
<string name="text_usingttsrule">使用TTS语音自定义规则</string>
|
<string name="text_usingttsrule">使用TTS语音自定义规则</string>
|
||||||
<string name="text_iamhere">短信管理服务已启动。</string>
|
<string name="text_iamhere">短信管理服务已启动。</string>
|
||||||
@@ -41,6 +41,6 @@
|
|||||||
<string name="text_appsettings">应用设置</string>
|
<string name="text_appsettings">应用设置</string>
|
||||||
<string name="text_ttsplaydelaytimes">TTS播放延迟时间(秒):</string>
|
<string name="text_ttsplaydelaytimes">TTS播放延迟时间(秒):</string>
|
||||||
<string name="msg_newsms">接收到新的消息。</string>
|
<string name="msg_newsms">接收到新的消息。</string>
|
||||||
<string name="msg_100sendmsg">>>>拉图标动到 100% 以发送信息。>>></string>
|
<string name="msg_100sendmsg">>>>拉动到100%可发信息>>></string>
|
||||||
<string name="msg_100applysettings">>>>拉图标动到 100% 应用设置。>>></string>
|
<string name="msg_100applysettings">>>>拉动到100%可应用设置>>></string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
|
||||||
<color name="colorSMSSendColor">#FFDCDA3D</color>
|
<color name="colorSMSSendColor">#FFDCDA3D</color>
|
||||||
<color name="colorSMSInboxColor">#FF3DDC84</color>
|
<color name="colorSMSInboxColor">#FF3DDC84</color>
|
||||||
<color name="colorTTSRuleViewBackgroundColor">#FFDCDA3D</color>
|
<color name="colorTTSRuleViewBackgroundColor">#FFDCDA3D</color>
|
||||||
@@ -7,11 +10,11 @@
|
|||||||
<color name="colorSMSSendColorDepth">#FFA28BFF</color>
|
<color name="colorSMSSendColorDepth">#FFA28BFF</color>
|
||||||
<color name="colorSMSInboxColorDepth">#FF8BAEFF</color>
|
<color name="colorSMSInboxColorDepth">#FF8BAEFF</color>
|
||||||
<color name="colorTTSRuleViewBackgroundColorDepth">#FFA28BFF</color>
|
<color name="colorTTSRuleViewBackgroundColorDepth">#FFA28BFF</color>
|
||||||
|
|
||||||
<color name="colorSMSSendColorSky">#FFFFEB8C</color>
|
<color name="colorSMSSendColorSky">#FFFFEB8C</color>
|
||||||
<color name="colorSMSInboxColorSky">#FF8CD9FF</color>
|
<color name="colorSMSInboxColorSky">#FF8CD9FF</color>
|
||||||
<color name="colorTTSRuleViewBackgroundColorSky">#FFFFEB8C</color>
|
<color name="colorTTSRuleViewBackgroundColorSky">#FFFFEB8C</color>
|
||||||
|
|
||||||
<color name="colorSMSSendColorGolden">#FF78BDFF</color>
|
<color name="colorSMSSendColorGolden">#FF78BDFF</color>
|
||||||
<color name="colorSMSInboxColorGolden">#FFFFED78</color>
|
<color name="colorSMSInboxColorGolden">#FFFFED78</color>
|
||||||
<color name="colorTTSRuleViewBackgroundColorGolden">#FF78BDFF</color>
|
<color name="colorTTSRuleViewBackgroundColorGolden">#FF78BDFF</color>
|
||||||
@@ -19,9 +22,13 @@
|
|||||||
<color name="colorSMSSendColorMemor">#FF5AEB53</color>
|
<color name="colorSMSSendColorMemor">#FF5AEB53</color>
|
||||||
<color name="colorSMSInboxColorMemor">#FFE653EB</color>
|
<color name="colorSMSInboxColorMemor">#FFE653EB</color>
|
||||||
<color name="colorTTSRuleViewBackgroundColorMemor">#FF5AEB53</color>
|
<color name="colorTTSRuleViewBackgroundColorMemor">#FF5AEB53</color>
|
||||||
|
|
||||||
<color name="colorSMSSendColorTao">#FFB4B4B4</color>
|
<color name="colorSMSSendColorTao">#FFB4B4B4</color>
|
||||||
<color name="colorSMSInboxColorTao">#FFD9D9D9</color>
|
<color name="colorSMSInboxColorTao">#FFD9D9D9</color>
|
||||||
<color name="colorTTSRuleViewBackgroundColorTao">#FFB4B4B4</color>
|
<color name="colorTTSRuleViewBackgroundColorTao">#FFB4B4B4</color>
|
||||||
|
|
||||||
|
<!-- 列表项选中颜色(深灰) -->
|
||||||
|
<color name="list_item_selected">#FF696969</color>
|
||||||
|
<!-- 列表项按压颜色(浅灰) -->
|
||||||
|
<color name="list_item_pressed">#FFE0E0E0</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@
|
|||||||
<string name="text_item_rule_clean">Clean Setting</string>
|
<string name="text_item_rule_clean">Clean Setting</string>
|
||||||
<string name="text_sendsms">Send SMS</string>
|
<string name="text_sendsms">Send SMS</string>
|
||||||
<string name="text_mainservice">Main Service</string>
|
<string name="text_mainservice">Main Service</string>
|
||||||
<string name="text_onlyreceivecontacts">Only Receive Contacts</string>
|
<string name="text_norulesreceivecontacts">No rules Receive Contacts</string>
|
||||||
<string name="text_usingtts">Using TTS</string>
|
<string name="text_usingtts">Using TTS</string>
|
||||||
<string name="text_usingttsrule">Using TTS Rule</string>
|
<string name="text_usingttsrule">Using TTS Rule</string>
|
||||||
<string name="text_iamhere">The main service is start.</string>
|
<string name="text_iamhere">The main service is start.</string>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
// JC 项目编译设置
|
// JC 项目编译设置
|
||||||
//include ':jc'
|
//include ':jc'
|
||||||
|
//include ':libjc'
|
||||||
//rootProject.name = "jc"
|
//rootProject.name = "jc"
|
||||||
|
|
||||||
// AES 项目编译设置
|
// AES 项目编译设置
|
||||||
@@ -56,7 +57,3 @@
|
|||||||
// NumTable 项目编译设置
|
// NumTable 项目编译设置
|
||||||
//include ':numtable'
|
//include ':numtable'
|
||||||
//rootProject.name = "numtable"
|
//rootProject.name = "numtable"
|
||||||
|
|
||||||
// WebPageSources 项目编译设置
|
|
||||||
//include ':webpagesources'
|
|
||||||
//rootProject.name = "webpagesources"
|
|
||||||
|
|||||||
1
webpagesources/.gitignore
vendored
@@ -1 +0,0 @@
|
|||||||
/build
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
# webpagesources
|
|
||||||
|
|
||||||
#### 介绍
|
|
||||||
WinBoLl 网站专用网页浏览器,用于开发调试 WinBoLL 网站。
|
|
||||||
|
|
||||||
#### 软件架构
|
|
||||||
适配安卓应用 [AIDE Pro] 的 Gradle 编译结构。
|
|
||||||
也适配安卓应用 [AndroidIDE] 的 Gradle 编译结构。
|
|
||||||
|
|
||||||
|
|
||||||
#### Gradle 编译说明
|
|
||||||
调试版编译命令 :gradle assembleBetaDebug
|
|
||||||
阶段版编译命令 :bash .winboll/bashPublishAPKAddTag.sh webpagesources
|
|
||||||
|
|
||||||
#### 使用说明
|
|
||||||
|
|
||||||
#### 参与贡献
|
|
||||||
|
|
||||||
1. Fork 本仓库
|
|
||||||
2. 新建 Feat_xxx 分支
|
|
||||||
3. 提交代码 : ZhanGSKen(ZhanGSKen<zhangsken@188.com>)
|
|
||||||
4. 新建 Pull Request
|
|
||||||
|
|
||||||
|
|
||||||
#### 特技
|
|
||||||
|
|
||||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
|
||||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
|
||||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
|
||||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
|
||||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
|
||||||
6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
|
||||||
|
|
||||||
#### 参考文档
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
apply plugin: 'com.android.application'
|
|
||||||
apply from: '../.winboll/winboll_app_build.gradle'
|
|
||||||
apply from: '../.winboll/winboll_lint_build.gradle'
|
|
||||||
|
|
||||||
def genVersionName(def versionName){
|
|
||||||
// 检查编译标志位配置
|
|
||||||
assert (winbollBuildProps['stageCount'] != null)
|
|
||||||
assert (winbollBuildProps['baseVersion'] != null)
|
|
||||||
// 保存基础版本号
|
|
||||||
winbollBuildProps.setProperty("baseVersion", "${versionName}");
|
|
||||||
//保存编译标志配置
|
|
||||||
FileOutputStream fos = new FileOutputStream(winbollBuildPropsFile)
|
|
||||||
winbollBuildProps.store(fos, "${winbollBuildPropsDesc}");
|
|
||||||
fos.close();
|
|
||||||
|
|
||||||
// 返回编译版本号
|
|
||||||
return "${versionName}." + winbollBuildProps['stageCount']
|
|
||||||
}
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 32
|
|
||||||
buildToolsVersion "32.0.0"
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
applicationId "cc.winboll.studio.webpagesources"
|
|
||||||
minSdkVersion 24
|
|
||||||
targetSdkVersion 30
|
|
||||||
versionCode 1
|
|
||||||
// versionName 更新后需要手动设置
|
|
||||||
// .winboll/winbollBuildProps.properties 文件的 stageCount=0
|
|
||||||
// Gradle编译环境下合起来的 versionName 就是 "${versionName}.0"
|
|
||||||
versionName "15.0"
|
|
||||||
if(true) {
|
|
||||||
versionName = genVersionName("${versionName}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
minifyEnabled false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
api fileTree(dir: 'libs', include: ['*.jar'])
|
|
||||||
|
|
||||||
api 'io.github.medyo:android-about-page:2.0.0'
|
|
||||||
// 视图布局下拉控件
|
|
||||||
api 'com.baoyz.pullrefreshlayout:library:1.2.0'
|
|
||||||
// SSH
|
|
||||||
api 'com.jcraft:jsch:0.1.55'
|
|
||||||
// Html 解析
|
|
||||||
api 'org.jsoup:jsoup:1.13.1'
|
|
||||||
// 二维码类库
|
|
||||||
api 'com.google.zxing:core:3.4.1'
|
|
||||||
api 'com.journeyapps:zxing-android-embedded:3.6.0'
|
|
||||||
// 应用介绍页类库
|
|
||||||
api 'io.github.medyo:android-about-page:2.0.0'
|
|
||||||
// 吐司类库
|
|
||||||
api 'com.github.getActivity:ToastUtils:10.5'
|
|
||||||
// 网络连接类库
|
|
||||||
api 'com.squareup.okhttp3:okhttp:4.4.1'
|
|
||||||
// AndroidX 类库
|
|
||||||
api 'androidx.appcompat:appcompat:1.1.0'
|
|
||||||
api 'com.google.android.material:material:1.4.0'
|
|
||||||
//api 'androidx.viewpager:viewpager:1.0.0'
|
|
||||||
//api 'androidx.vectordrawable:vectordrawable:1.1.0'
|
|
||||||
//api 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
|
|
||||||
api 'androidx.fragment:fragment:1.1.0'
|
|
||||||
|
|
||||||
api 'cc.winboll.studio:libaes:15.8.0'
|
|
||||||
api 'cc.winboll.studio:libapputils:15.8.2'
|
|
||||||
api 'cc.winboll.studio:libappbase:15.8.2'
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
|
||||||
#Wed Jun 11 13:59:15 HKT 2025
|
|
||||||
stageCount=5
|
|
||||||
libraryProject=
|
|
||||||
baseVersion=15.0
|
|
||||||
publishVersion=15.0.4
|
|
||||||
buildCount=0
|
|
||||||
baseBetaVersion=15.0.5
|
|
||||||
21
webpagesources/proguard-rules.pro
vendored
@@ -1,21 +0,0 @@
|
|||||||
# 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
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools" >
|
|
||||||
|
|
||||||
<application
|
|
||||||
|
|
||||||
tools:replace="android:icon"
|
|
||||||
android:icon="@drawable/ic_winbollbeta">
|
|
||||||
|
|
||||||
<!-- Put flavor specific code here -->
|
|
||||||
<provider
|
|
||||||
android:name="androidx.core.content.FileProvider"
|
|
||||||
android:authorities="cc.winboll.studio.webpagesources.beta.fileprovider"
|
|
||||||
android:exported="false"
|
|
||||||
android:grantUriPermissions="true">
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
|
||||||
android:resource="@xml/file_provider"/>
|
|
||||||
|
|
||||||
</provider>
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
|
|
||||||
<string name="app_name">WebPageSources +</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<manifest
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="cc.winboll.studio.webpagesources">
|
|
||||||
|
|
||||||
<!-- 拥有完全的网络访问权限 -->
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
|
||||||
|
|
||||||
<!-- 读取您共享存储空间中的内容 -->
|
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
|
||||||
|
|
||||||
<!-- 修改或删除您共享存储空间中的内容 -->
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
|
||||||
|
|
||||||
<!-- 只能在前台获取精确的位置信息 -->
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:name=".App"
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:icon="@drawable/ic_winboll"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:theme="@style/WebPageSourceTheme"
|
|
||||||
android:supportsRtl="true"
|
|
||||||
android:resizeableActivity="true"
|
|
||||||
android:requestLegacyExternalStorage="true"
|
|
||||||
android:networkSecurityConfig="@xml/network_security_config">
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".MainActivity"
|
|
||||||
android:label="@string/app_name"
|
|
||||||
android:launchMode="standard"
|
|
||||||
android:exported="true">
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.BROWSABLE"/>
|
|
||||||
|
|
||||||
<data android:scheme="http"/>
|
|
||||||
|
|
||||||
<data android:scheme="https"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.BROWSABLE"/>
|
|
||||||
|
|
||||||
<data android:mimeType="text/html"/>
|
|
||||||
|
|
||||||
<data android:mimeType="application/xhtml+xml"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.BROWSABLE"/>
|
|
||||||
|
|
||||||
<data android:scheme="about"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
<intent-filter>
|
|
||||||
|
|
||||||
<action android:name="android.intent.action.VIEW"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.DEFAULT"/>
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.BROWSABLE"/>
|
|
||||||
|
|
||||||
<data android:scheme="javascript"/>
|
|
||||||
|
|
||||||
</intent-filter>
|
|
||||||
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".activities.AboutActivity"
|
|
||||||
android:label="AboutActivity"/>
|
|
||||||
|
|
||||||
<meta-data
|
|
||||||
android:name="android.max_aspect"
|
|
||||||
android:value="4.0"/>
|
|
||||||
|
|
||||||
<activity android:name=".GlobalApplication$CrashActivity"/>
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
@@ -1,345 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.ClipData;
|
|
||||||
import android.content.ClipboardManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.PackageInfo;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.graphics.Typeface;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.HorizontalScrollView;
|
|
||||||
import android.widget.ScrollView;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
import com.hjq.toast.style.WhiteToastStyle;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.Closeable;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.lang.Thread.UncaughtExceptionHandler;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
public class App extends GlobalApplication {
|
|
||||||
|
|
||||||
private static Handler MAIN_HANDLER = new Handler(Looper.getMainLooper());
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
|
|
||||||
// 初始化 Toast 框架
|
|
||||||
ToastUtils.init(this);
|
|
||||||
// 设置 Toast 布局样式
|
|
||||||
//ToastUtils.setView(R.layout.view_toast);
|
|
||||||
ToastUtils.setStyle(new WhiteToastStyle());
|
|
||||||
ToastUtils.setGravity(Gravity.BOTTOM, 0, 200);
|
|
||||||
|
|
||||||
//CrashHandler.getInstance().registerGlobal(this);
|
|
||||||
//CrashHandler.getInstance().registerPart(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void write(InputStream input, OutputStream output) throws IOException {
|
|
||||||
byte[] buf = new byte[1024 * 8];
|
|
||||||
int len;
|
|
||||||
while ((len = input.read(buf)) != -1) {
|
|
||||||
output.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void write(File file, byte[] data) throws IOException {
|
|
||||||
File parent = file.getParentFile();
|
|
||||||
if (parent != null && !parent.exists()) parent.mkdirs();
|
|
||||||
|
|
||||||
ByteArrayInputStream input = new ByteArrayInputStream(data);
|
|
||||||
FileOutputStream output = new FileOutputStream(file);
|
|
||||||
try {
|
|
||||||
write(input, output);
|
|
||||||
} finally {
|
|
||||||
closeIO(input, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toString(InputStream input) throws IOException {
|
|
||||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
||||||
write(input, output);
|
|
||||||
try {
|
|
||||||
return output.toString("UTF-8");
|
|
||||||
} finally {
|
|
||||||
closeIO(input, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void closeIO(Closeable... closeables) {
|
|
||||||
for (Closeable closeable : closeables) {
|
|
||||||
try {
|
|
||||||
if (closeable != null) closeable.close();
|
|
||||||
} catch (IOException ignored) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class CrashHandler {
|
|
||||||
|
|
||||||
public static final UncaughtExceptionHandler DEFAULT_UNCAUGHT_EXCEPTION_HANDLER = Thread.getDefaultUncaughtExceptionHandler();
|
|
||||||
|
|
||||||
private static CrashHandler sInstance;
|
|
||||||
|
|
||||||
private PartCrashHandler mPartCrashHandler;
|
|
||||||
|
|
||||||
public static CrashHandler getInstance() {
|
|
||||||
if (sInstance == null) {
|
|
||||||
sInstance = new CrashHandler();
|
|
||||||
}
|
|
||||||
return sInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerGlobal(Context context) {
|
|
||||||
registerGlobal(context, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerGlobal(Context context, String crashDir) {
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandlerImpl(context.getApplicationContext(), crashDir));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregister() {
|
|
||||||
Thread.setDefaultUncaughtExceptionHandler(DEFAULT_UNCAUGHT_EXCEPTION_HANDLER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerPart(Context context) {
|
|
||||||
unregisterPart(context);
|
|
||||||
mPartCrashHandler = new PartCrashHandler(context.getApplicationContext());
|
|
||||||
MAIN_HANDLER.postAtFrontOfQueue(mPartCrashHandler);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregisterPart(Context context) {
|
|
||||||
if (mPartCrashHandler != null) {
|
|
||||||
mPartCrashHandler.isRunning.set(false);
|
|
||||||
mPartCrashHandler = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class PartCrashHandler implements Runnable {
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
|
|
||||||
public AtomicBoolean isRunning = new AtomicBoolean(true);
|
|
||||||
|
|
||||||
public PartCrashHandler(Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
while (isRunning.get()) {
|
|
||||||
try {
|
|
||||||
Looper.loop();
|
|
||||||
} catch (final Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
if (isRunning.get()) {
|
|
||||||
MAIN_HANDLER.post(new Runnable(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
Toast.makeText(mContext, e.toString(), Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
if (e instanceof RuntimeException) {
|
|
||||||
throw (RuntimeException)e;
|
|
||||||
} else {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class UncaughtExceptionHandlerImpl implements UncaughtExceptionHandler {
|
|
||||||
|
|
||||||
private static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy_MM_dd-HH_mm_ss");
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
|
|
||||||
private final File mCrashDir;
|
|
||||||
|
|
||||||
public UncaughtExceptionHandlerImpl(Context context, String crashDir) {
|
|
||||||
this.mContext = context;
|
|
||||||
this.mCrashDir = TextUtils.isEmpty(crashDir) ? new File(mContext.getExternalCacheDir(), "crash") : new File(crashDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void uncaughtException(Thread thread, Throwable throwable) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
String log = buildLog(throwable);
|
|
||||||
writeLog(log);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Intent intent = new Intent(mContext, CrashActivity.class);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
intent.putExtra(Intent.EXTRA_TEXT, log);
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
writeLog(e.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
throwable.printStackTrace();
|
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
System.exit(0);
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
if (DEFAULT_UNCAUGHT_EXCEPTION_HANDLER != null) DEFAULT_UNCAUGHT_EXCEPTION_HANDLER.uncaughtException(thread, throwable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String buildLog(Throwable throwable) {
|
|
||||||
String time = DATE_FORMAT.format(new Date());
|
|
||||||
|
|
||||||
String versionName = "unknown";
|
|
||||||
long versionCode = 0;
|
|
||||||
try {
|
|
||||||
PackageInfo packageInfo = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
|
|
||||||
versionName = packageInfo.versionName;
|
|
||||||
versionCode = Build.VERSION.SDK_INT >= 28 ? packageInfo.getLongVersionCode() : packageInfo.versionCode;
|
|
||||||
} catch (Throwable ignored) {}
|
|
||||||
|
|
||||||
LinkedHashMap<String, String> head = new LinkedHashMap<String, String>();
|
|
||||||
head.put("Time Of Crash", time);
|
|
||||||
head.put("Device", String.format("%s, %s", Build.MANUFACTURER, Build.MODEL));
|
|
||||||
head.put("Android Version", String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT));
|
|
||||||
head.put("App Version", String.format("%s (%d)", versionName, versionCode));
|
|
||||||
head.put("Kernel", getKernel());
|
|
||||||
head.put("Support Abis", Build.VERSION.SDK_INT >= 21 && Build.SUPPORTED_ABIS != null ? Arrays.toString(Build.SUPPORTED_ABIS): "unknown");
|
|
||||||
head.put("Fingerprint", Build.FINGERPRINT);
|
|
||||||
|
|
||||||
StringBuilder builder = new StringBuilder();
|
|
||||||
|
|
||||||
for (String key : head.keySet()) {
|
|
||||||
if (builder.length() != 0) builder.append("\n");
|
|
||||||
builder.append(key);
|
|
||||||
builder.append(" : ");
|
|
||||||
builder.append(head.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.append("\n\n");
|
|
||||||
builder.append(Log.getStackTraceString(throwable));
|
|
||||||
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void writeLog(String log) {
|
|
||||||
String time = DATE_FORMAT.format(new Date());
|
|
||||||
File file = new File(mCrashDir, "crash_" + time + ".txt");
|
|
||||||
try {
|
|
||||||
write(file, log.getBytes("UTF-8"));
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getKernel() {
|
|
||||||
try {
|
|
||||||
return App.toString(new FileInputStream("/proc/version")).trim();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
return e.getMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class CrashActivity extends Activity {
|
|
||||||
|
|
||||||
private String mLog;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
setTheme(android.R.style.Theme_DeviceDefault);
|
|
||||||
setTitle("App Crash");
|
|
||||||
|
|
||||||
mLog = getIntent().getStringExtra(Intent.EXTRA_TEXT);
|
|
||||||
|
|
||||||
ScrollView contentView = new ScrollView(this);
|
|
||||||
contentView.setFillViewport(true);
|
|
||||||
|
|
||||||
HorizontalScrollView horizontalScrollView = new HorizontalScrollView(this);
|
|
||||||
|
|
||||||
TextView textView = new TextView(this);
|
|
||||||
int padding = dp2px(16);
|
|
||||||
textView.setPadding(padding, padding, padding, padding);
|
|
||||||
textView.setText(mLog);
|
|
||||||
textView.setTextIsSelectable(true);
|
|
||||||
textView.setTypeface(Typeface.DEFAULT);
|
|
||||||
textView.setLinksClickable(true);
|
|
||||||
|
|
||||||
horizontalScrollView.addView(textView);
|
|
||||||
contentView.addView(horizontalScrollView, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
|
||||||
|
|
||||||
setContentView(contentView);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void restart() {
|
|
||||||
Intent intent = getPackageManager().getLaunchIntentForPackage(getPackageName());
|
|
||||||
if (intent != null) {
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
finish();
|
|
||||||
android.os.Process.killProcess(android.os.Process.myPid());
|
|
||||||
System.exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int dp2px(float dpValue) {
|
|
||||||
final float scale = Resources.getSystem().getDisplayMetrics().density;
|
|
||||||
return (int) (dpValue * scale + 0.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
menu.add(0, android.R.id.copy, 0, android.R.string.copy)
|
|
||||||
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case android.R.id.copy:
|
|
||||||
ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
|
||||||
cm.setPrimaryClip(ClipData.newPlainText(getPackageName(), mLog));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed() {
|
|
||||||
restart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,207 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/07/02 17:10:46
|
|
||||||
* @Describe 主要启动窗口类
|
|
||||||
*/
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.webkit.ValueCallback;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.appcompat.widget.Toolbar;
|
|
||||||
import androidx.fragment.app.FragmentManager;
|
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.libappbase.LogView;
|
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
|
||||||
import cc.winboll.studio.webpagesources.R;
|
|
||||||
import cc.winboll.studio.webpagesources.activities.AboutActivity;
|
|
||||||
import cc.winboll.studio.webpagesources.fragment.SourcesFragment;
|
|
||||||
import cc.winboll.studio.webpagesources.fragment.WebFragment;
|
|
||||||
import cc.winboll.studio.webpagesources.view.StatusBarView;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements IWinBoLLActivity {
|
|
||||||
|
|
||||||
public static final String TAG = "MainActivity";
|
|
||||||
|
|
||||||
public static final int REQUEST_ABOUT_ACTIVITY = 0;
|
|
||||||
public static final int REQUEST_FILE_CHOOSER = 1;
|
|
||||||
|
|
||||||
public static final String MSG_UPDATE_URL = "MSG_UPDATE_URL";
|
|
||||||
|
|
||||||
static MainActivity _MainActivity;
|
|
||||||
StatusBarView mStatusBarView;
|
|
||||||
WebFragment mWebFragment;
|
|
||||||
SourcesFragment mSourcesFragment;
|
|
||||||
static boolean _mIsLoadedHomePage;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Activity getActivity() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_main);
|
|
||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
|
||||||
setSupportActionBar(toolbar);
|
|
||||||
|
|
||||||
FragmentTransaction ft = ((FragmentManager)getSupportFragmentManager()).beginTransaction();
|
|
||||||
mSourcesFragment = new SourcesFragment();
|
|
||||||
ft.add(R.id.activitymainFrameLayout1, mSourcesFragment, SourcesFragment.TAG);
|
|
||||||
ft.hide(mSourcesFragment);
|
|
||||||
mWebFragment = new WebFragment();
|
|
||||||
//mWebFragment.setJSOnShowSourceListener(this);
|
|
||||||
ft.add(R.id.activitymainFrameLayout1, mWebFragment, WebFragment.TAG);
|
|
||||||
ft.show(mWebFragment);
|
|
||||||
ft.commit();
|
|
||||||
|
|
||||||
// 处理 onCreate 时的 Intent
|
|
||||||
handleIntent(getIntent());
|
|
||||||
|
|
||||||
mStatusBarView = findViewById(R.id.activitymainStatusBarView1);
|
|
||||||
_MainActivity = this;
|
|
||||||
postStatusBarMessage("主窗口加载完成。");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onNewIntent(Intent intent) {
|
|
||||||
super.onNewIntent(intent);
|
|
||||||
// 处理 onNewIntent 时的 Intent(Activity 已存在时调用)
|
|
||||||
handleIntent(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleIntent(Intent intent) {
|
|
||||||
if (Intent.ACTION_VIEW.equals(intent.getAction())) {
|
|
||||||
Uri data = intent.getData();
|
|
||||||
if (data != null) {
|
|
||||||
String url = data.toString(); // 获取完整 URL
|
|
||||||
String host = data.getHost(); // 获取主机名(如 "www.example.com")
|
|
||||||
String path = data.getPath(); // 获取路径(如 "/page")
|
|
||||||
|
|
||||||
// 在界面显示 URL
|
|
||||||
//tvUrl.setText("接收到的 URL:\n" + url);
|
|
||||||
mWebFragment.loadUrl(url);
|
|
||||||
|
|
||||||
// 示例:打开系统浏览器访问该 URL
|
|
||||||
// Intent browserIntent = new Intent(Intent.ACTION_VIEW, data);
|
|
||||||
// startActivity(browserIntent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void postStatusBarMessage(String msg) {
|
|
||||||
if(_MainActivity != null) {
|
|
||||||
_MainActivity.mStatusBarView.postMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPostCreate(Bundle savedInstanceState) {
|
|
||||||
super.onPostCreate(savedInstanceState);
|
|
||||||
if (_mIsLoadedHomePage) {
|
|
||||||
//ToastUtils.show("重新加载当前页面");
|
|
||||||
mWebFragment.reloadLastUrl();
|
|
||||||
} else {
|
|
||||||
//ToastUtils.show("加载默认主页");
|
|
||||||
mWebFragment.loadUrl(getApplicationContext().getString(R.string.app_homepage));
|
|
||||||
_mIsLoadedHomePage = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_main, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
//return super.onOptionsItemSelected(item);
|
|
||||||
switch (item.getItemId()) {
|
|
||||||
case R.id.item_sources : {
|
|
||||||
LogUtils.d(TAG, "item_web");
|
|
||||||
FragmentTransaction ft = ((FragmentManager)getSupportFragmentManager()).beginTransaction();
|
|
||||||
ft.hide(mWebFragment);
|
|
||||||
ft.show(mSourcesFragment);
|
|
||||||
ft.commit();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R.id.item_web : {
|
|
||||||
LogUtils.d(TAG, "item_sources");
|
|
||||||
FragmentTransaction ft = ((FragmentManager)getSupportFragmentManager()).beginTransaction();
|
|
||||||
ft.hide(mSourcesFragment);
|
|
||||||
ft.show(mWebFragment);
|
|
||||||
ft.commit();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R.id.item_editor : {
|
|
||||||
mSourcesFragment.shareHtml();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R.id.item_log : {
|
|
||||||
GlobalApplication.getWinBoLLActivityManager().startLogActivity(this);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R.id.item_about : {
|
|
||||||
GlobalApplication.getWinBoLLActivityManager().startWinBoLLActivity(this, AboutActivity.class);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onResume() {
|
|
||||||
super.onResume();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
//ToastUtils.show("onActivityResult Main");
|
|
||||||
switch (requestCode) {
|
|
||||||
case REQUEST_ABOUT_ACTIVITY : {
|
|
||||||
LogUtils.d(TAG, "REQUEST_ABOUT_ACTIVITY");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case REQUEST_FILE_CHOOSER : {
|
|
||||||
//ToastUtils.show("MainActivity.REQUEST_FILE_CHOOSER");
|
|
||||||
ValueCallback<Uri[]> filePathCallback = mWebFragment.getWebView().getFilePathCallback();
|
|
||||||
|
|
||||||
if (filePathCallback == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Uri[] results = null;
|
|
||||||
// 检查选择的文件是否为空
|
|
||||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
|
||||||
String dataString = data.getDataString();
|
|
||||||
if (dataString != null) {
|
|
||||||
results = new Uri[]{Uri.parse(dataString)};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 传递选择的文件给WebView
|
|
||||||
filePathCallback.onReceiveValue(results);
|
|
||||||
filePathCallback = null;
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default : {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.activities;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2024/07/14 13:20:33
|
|
||||||
* @Describe AboutFragment Test
|
|
||||||
*/
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import cc.winboll.studio.libappbase.GlobalApplication;
|
|
||||||
import cc.winboll.studio.libappbase.winboll.IWinBoLLActivity;
|
|
||||||
import cc.winboll.studio.webpagesources.R;
|
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
|
|
||||||
final public class AboutActivity extends AppCompatActivity implements IWinBoLLActivity {
|
|
||||||
|
|
||||||
public static final String TAG = "AboutActivity";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag() {
|
|
||||||
return TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Activity getActivity() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
setContentView(R.layout.activity_about);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
|
||||||
getMenuInflater().inflate(R.menu.toolbar_about, menu);
|
|
||||||
return super.onCreateOptionsMenu(menu);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onOptionsItemSelected(MenuItem item) {
|
|
||||||
if (item.getItemId() == R.id.item_help) {
|
|
||||||
ToastUtils.show("R.id.item_help");
|
|
||||||
} else if (item.getItemId() == android.R.id.home) {
|
|
||||||
GlobalApplication.getWinBoLLActivityManager().getInstance().finish(this);
|
|
||||||
}
|
|
||||||
return super.onOptionsItemSelected(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,197 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2024/08/26 20:48:46
|
|
||||||
* @Describe 登录验证对话框
|
|
||||||
*/
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.webkit.HttpAuthHandler;
|
|
||||||
import android.webkit.WebView;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import androidx.appcompat.widget.PopupMenu;
|
|
||||||
import androidx.cardview.widget.CardView;
|
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
|
||||||
import cc.winboll.studio.webpagesources.R;
|
|
||||||
import cc.winboll.studio.webpagesources.models.AuthenticationBean;
|
|
||||||
import cc.winboll.studio.webpagesources.common.AuthenticationUtils;
|
|
||||||
import com.hjq.toast.ToastUtils;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class AuthLoginDialog {
|
|
||||||
|
|
||||||
public static final String TAG = "AuthLoginDialog";
|
|
||||||
|
|
||||||
WebView mWebView;
|
|
||||||
static AuthenticationBean _mLastAuthenticationBean;
|
|
||||||
EditText metUserName;
|
|
||||||
EditText metPassword;
|
|
||||||
AlertDialog mLoginAlertDialog;
|
|
||||||
HttpAuthHandler mHttpAuthHandler;
|
|
||||||
|
|
||||||
public AuthLoginDialog(WebView view, HttpAuthHandler httpAuthHandler, String host, String realm) {
|
|
||||||
mWebView = view;
|
|
||||||
mHttpAuthHandler = httpAuthHandler;
|
|
||||||
_mLastAuthenticationBean = new AuthenticationBean();
|
|
||||||
_mLastAuthenticationBean.setHost(host);
|
|
||||||
_mLastAuthenticationBean.setRealm(realm);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void show() {
|
|
||||||
// 获取要登录的URL和已知的身份验证信息
|
|
||||||
String authUrl = "[ " + _mLastAuthenticationBean.getHost() + " ] " + _mLastAuthenticationBean.getRealm();
|
|
||||||
final AuthenticationUtils authenticationUtils = AuthenticationUtils.getInstance(mWebView.getContext());
|
|
||||||
final ArrayList<AuthenticationBean> listInfo = authenticationUtils.getHostAuthenticationList(_mLastAuthenticationBean.getHost(), _mLastAuthenticationBean.getRealm());
|
|
||||||
|
|
||||||
final View llMain = mWebView.inflate(mWebView.getContext(), R.layout.dialog_login_auth, null);
|
|
||||||
metUserName = llMain.findViewById(R.id.viewloginhttpEditText1);
|
|
||||||
metPassword = llMain.findViewById(R.id.viewloginhttpEditText2);
|
|
||||||
RecyclerView recyclerView = llMain.findViewById(R.id.dialogloginauthRecyclerView1);
|
|
||||||
recyclerView.setLayoutManager(new LinearLayoutManager(mWebView.getContext(), LinearLayoutManager.HORIZONTAL, false));
|
|
||||||
AuthenticationBeanListAdapter adapter = new AuthenticationBeanListAdapter(listInfo);
|
|
||||||
// 设置 RecyclerView 的适配器
|
|
||||||
recyclerView.setAdapter(adapter);
|
|
||||||
|
|
||||||
if (listInfo.size() > 0) {
|
|
||||||
metUserName.setText(listInfo.get(0).getUserName());
|
|
||||||
metPassword.setText(listInfo.get(0).getPassword());
|
|
||||||
LogUtils.d(TAG, "listInfo setText");
|
|
||||||
}
|
|
||||||
// 弹窗提示用户输入账号密码
|
|
||||||
mLoginAlertDialog = new AlertDialog.Builder(mWebView.getContext())
|
|
||||||
.setTitle("Login Required")
|
|
||||||
.setMessage(authUrl + "\nPlease enter your credentials:")
|
|
||||||
.setView(llMain)
|
|
||||||
.setPositiveButton("OK", new DialogInterface.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialogInterface, int p) {
|
|
||||||
_mLastAuthenticationBean.setUserName(metUserName.getText().toString());
|
|
||||||
_mLastAuthenticationBean.setPassword(metPassword.getText().toString());
|
|
||||||
//LogUtils.d(TAG, "getUserName : " + _mLastAuthenticationBean.getUserName());
|
|
||||||
//LogUtils.d(TAG, "getPassword : " + _mLastAuthenticationBean.getPassword());
|
|
||||||
//LogUtils.d(TAG, "mHttpAuthHandler : " + mHttpAuthHandler);
|
|
||||||
// 进入网站
|
|
||||||
mHttpAuthHandler.proceed(_mLastAuthenticationBean.getUserName(), _mLastAuthenticationBean.getPassword());
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void checkAndSaveLastAuthenticationBean() {
|
|
||||||
if (_mLastAuthenticationBean != null) {
|
|
||||||
// 更新身份验证信息
|
|
||||||
if (!_mLastAuthenticationBean.getHost().isEmpty()
|
|
||||||
&& !_mLastAuthenticationBean.getRealm().isEmpty()
|
|
||||||
&& !_mLastAuthenticationBean.getUserName().isEmpty()
|
|
||||||
&& !_mLastAuthenticationBean.getPassword().isEmpty()) {
|
|
||||||
final AuthenticationUtils authenticationUtils = AuthenticationUtils.getInstance(mWebView.getContext());
|
|
||||||
authenticationUtils.saveAuthenticationInfo(_mLastAuthenticationBean);
|
|
||||||
// 清理已保存,或者不需要保存的登录信息
|
|
||||||
_mLastAuthenticationBean = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AuthenticationBeanListAdapter extends RecyclerView.Adapter {
|
|
||||||
|
|
||||||
ArrayList<AuthenticationBean> mDataList;
|
|
||||||
public AuthenticationBeanListAdapter(ArrayList<AuthenticationBean> listInfo) {
|
|
||||||
mDataList = listInfo;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public int getItemCount() {
|
|
||||||
return mDataList.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
void deleteSMSRecycleItem(final int position) {
|
|
||||||
YesNoAlertDialog.show(mWebView.getContext(),
|
|
||||||
"密码删除提示",
|
|
||||||
"请确认删除(" + mDataList.get(position).getUserName() + ")密码!"
|
|
||||||
, (new YesNoAlertDialog.OnDialogResultListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onYes() {
|
|
||||||
AuthenticationUtils authenticationUtils = AuthenticationUtils.getInstance(mWebView.getContext());
|
|
||||||
authenticationUtils.deleteAuthenticationInfo(mDataList.get(position));
|
|
||||||
mDataList.remove(position);
|
|
||||||
notifyDataSetChanged();
|
|
||||||
ToastUtils.show("密码已删除!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onNo() {
|
|
||||||
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) {
|
|
||||||
final AuthenticationBean item = mDataList.get(position);
|
|
||||||
if (holder.getItemViewType() == 0) {
|
|
||||||
final SimpleViewHolder viewHolder = (SimpleViewHolder) holder;
|
|
||||||
viewHolder.mtvUserName.setText(item.getUserName());
|
|
||||||
viewHolder.mCardView.setOnClickListener(new View.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
metUserName.setText(item.getUserName());
|
|
||||||
metPassword.setText(item.getPassword());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
viewHolder.mCardView.setOnLongClickListener(new View.OnLongClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View p1) {
|
|
||||||
// 弹出复制菜单
|
|
||||||
PopupMenu menu = new PopupMenu(mWebView.getContext(), viewHolder.mCardView);
|
|
||||||
//加载菜单资源
|
|
||||||
menu.getMenuInflater().inflate(R.menu.toolbar_authinfo, menu.getMenu());
|
|
||||||
//设置点击事件的响应
|
|
||||||
menu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onMenuItemClick(MenuItem menuItem) {
|
|
||||||
int nItemId = menuItem.getItemId();
|
|
||||||
if (nItemId == R.id.item_delete_authinfo) {
|
|
||||||
deleteSMSRecycleItem(position);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//一定要调用show()来显示弹出式菜单
|
|
||||||
menu.show();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
||||||
if (viewType == 0) {
|
|
||||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.listview_authinfo, parent, false);
|
|
||||||
return new SimpleViewHolder(view);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
class SimpleViewHolder extends RecyclerView.ViewHolder {
|
|
||||||
TextView mtvUserName;
|
|
||||||
CardView mCardView;
|
|
||||||
SimpleViewHolder(View itemView) {
|
|
||||||
super(itemView);
|
|
||||||
mtvUserName = itemView.findViewById(R.id.viewitemauthinfoTextView1);
|
|
||||||
mCardView = itemView.findViewById(R.id.listviewauthinfoCardView1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2024/08/26 16:16:00
|
|
||||||
* @Describe 网站登录验证工具类
|
|
||||||
*/
|
|
||||||
import android.content.Context;
|
|
||||||
import cc.winboll.studio.libappbase.dialogs.YesNoAlertDialog;
|
|
||||||
import cc.winboll.studio.webpagesources.models.AuthenticationBean;
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class AuthenticationUtils {
|
|
||||||
|
|
||||||
public static final String TAG = "AuthenticationUtils";
|
|
||||||
|
|
||||||
static AuthenticationUtils _mAuthenticationUtils;
|
|
||||||
static String _mBeanPath;
|
|
||||||
Context mContext;
|
|
||||||
ArrayList<AuthenticationBean> mData;
|
|
||||||
|
|
||||||
AuthenticationUtils(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
File beanDir = new File(context.getDataDir(), TAG);
|
|
||||||
if (!beanDir.exists()) {
|
|
||||||
beanDir.mkdirs();
|
|
||||||
}
|
|
||||||
_mBeanPath = beanDir.getPath() + "/" + AuthenticationBean.class.getName() + ".json";
|
|
||||||
mData = new ArrayList<AuthenticationBean>();
|
|
||||||
AuthenticationBean.loadBeanListFromFile(_mBeanPath, mData, AuthenticationBean.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static AuthenticationUtils getInstance(Context context) {
|
|
||||||
if (_mAuthenticationUtils == null) {
|
|
||||||
_mAuthenticationUtils = new AuthenticationUtils(context);
|
|
||||||
}
|
|
||||||
return _mAuthenticationUtils;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArrayList<AuthenticationBean> loadAuthenticationData(String szHost, String szRealm) {
|
|
||||||
ArrayList<AuthenticationBean> listReturn = new ArrayList<AuthenticationBean>();
|
|
||||||
for (AuthenticationBean item : getInstance(mContext).mData) {
|
|
||||||
if (szHost.equals(item.getHost())
|
|
||||||
&& szRealm.equals(item.getRealm())) {
|
|
||||||
listReturn.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return listReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<AuthenticationBean> getHostAuthenticationList(String szHost, String szRealm) {
|
|
||||||
ArrayList<AuthenticationBean> listReturn = new ArrayList<AuthenticationBean>();
|
|
||||||
for (final AuthenticationBean item : mData) {
|
|
||||||
if (szHost.equals(item.getHost())
|
|
||||||
&& szRealm.equals(item.getRealm())) {
|
|
||||||
listReturn.add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return listReturn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteAuthenticationInfo(AuthenticationBean bean) {
|
|
||||||
for (final AuthenticationBean item : mData) {
|
|
||||||
if (bean.getHost().equals(item.getHost())
|
|
||||||
&& bean.getRealm().equals(item.getRealm())
|
|
||||||
&& bean.getUserName().equals(item.getUserName())) {
|
|
||||||
mData.remove(item);
|
|
||||||
AuthenticationBean.saveBeanListToFile(_mBeanPath, mData);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void putAuthenticationBeanToTheFirstPosition(AuthenticationBean bean) {
|
|
||||||
for (AuthenticationBean item : mData) {
|
|
||||||
if (bean.getHost().equals(item.getHost())
|
|
||||||
&& bean.getRealm().equals(item.getRealm())
|
|
||||||
&& bean.getUserName().equals(item.getUserName())) {
|
|
||||||
mData.add(0, new AuthenticationBean(item));
|
|
||||||
mData.remove(item);
|
|
||||||
AuthenticationBean.saveBeanListToFile(_mBeanPath, mData);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveAuthenticationInfo(AuthenticationBean bean) {
|
|
||||||
saveAuthenticationInfo(bean.getHost(), bean.getRealm(), bean.getUserName(), bean.getPassword());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveAuthenticationInfo(String szHost, String szRealm, String szUserName, final String szPassword) {
|
|
||||||
boolean isFindUserName = false;
|
|
||||||
AuthenticationBean.loadBeanListFromFile(_mBeanPath, mData, AuthenticationBean.class);
|
|
||||||
for (final AuthenticationBean item : mData) {
|
|
||||||
if (szHost.equals(item.getHost())
|
|
||||||
&& szRealm.equals(item.getRealm())
|
|
||||||
&& szUserName.equals(item.getUserName())) {
|
|
||||||
isFindUserName = true;
|
|
||||||
if (!szPassword.equals(item.getPassword())) {
|
|
||||||
// 如果找到同名信息,就提示是否更新
|
|
||||||
YesNoAlertDialog.show(mContext, "Ask Update Password", "Is update " + item.getUserName() + " Password?", new YesNoAlertDialog.OnDialogResultListener(){
|
|
||||||
@Override
|
|
||||||
public void onNo() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onYes() {
|
|
||||||
item.setPassword(szPassword);
|
|
||||||
AuthenticationBean.saveBeanListToFile(_mBeanPath, mData);
|
|
||||||
putAuthenticationBeanToTheFirstPosition(item);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
putAuthenticationBeanToTheFirstPosition(item);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果找不到同名信息,就新建一个
|
|
||||||
if (!isFindUserName) {
|
|
||||||
AuthenticationBean bean = new AuthenticationBean(szHost, szRealm, szUserName, szPassword);
|
|
||||||
mData.add(bean);
|
|
||||||
AuthenticationBean.saveBeanListToFile(_mBeanPath, mData);
|
|
||||||
putAuthenticationBeanToTheFirstPosition(bean);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,242 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/06/22 15:01:43
|
|
||||||
* @Describe 下载线程基类
|
|
||||||
*/
|
|
||||||
import android.content.Context;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLDecoder;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
abstract public class BaseDownLoadThread implements Runnable {
|
|
||||||
|
|
||||||
public static final String TAG = "BaseDownLoadThread";
|
|
||||||
|
|
||||||
Context mContext;
|
|
||||||
//UserLogonUtil mUserLogonUtil;
|
|
||||||
String mszUrl;
|
|
||||||
String mszDowndloadName;
|
|
||||||
protected File mfDownloadDir;
|
|
||||||
protected File mfDownloadFile;
|
|
||||||
|
|
||||||
//
|
|
||||||
// 构造函数
|
|
||||||
//
|
|
||||||
public BaseDownLoadThread(Context context) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 构造函数
|
|
||||||
//
|
|
||||||
public BaseDownLoadThread(Context context, String szUrl) {
|
|
||||||
mContext = context;
|
|
||||||
File fDownloadDir = new File(context.getExternalCacheDir(), "Download");
|
|
||||||
initDownLoadEnvironment(fDownloadDir, szUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// 构造函数
|
|
||||||
//
|
|
||||||
public BaseDownLoadThread(Context context, String szUrl, String szDowndloadName) {
|
|
||||||
mContext = context;
|
|
||||||
mszDowndloadName = szDowndloadName;
|
|
||||||
File fDownloadDir = new File(context.getExternalCacheDir(), "Download");
|
|
||||||
initDownLoadEnvironment(fDownloadDir, szUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 构造函数
|
|
||||||
//
|
|
||||||
public BaseDownLoadThread(File fDownloadDir, String szUrl) {
|
|
||||||
initDownLoadEnvironment(fDownloadDir, szUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 初始化下载环境参数
|
|
||||||
//
|
|
||||||
void initDownLoadEnvironment(File fDownloadDir, String szUrl) {
|
|
||||||
mfDownloadDir = fDownloadDir;
|
|
||||||
//LogUtils.d(TAG, "mfDownloadDir is : " + mfDownloadDir);
|
|
||||||
if (!mfDownloadDir.exists()) {
|
|
||||||
mfDownloadDir.mkdir();
|
|
||||||
}
|
|
||||||
this.mszUrl = szUrl;
|
|
||||||
//LogUtils.d(TAG, "mszUrl is : " + mszUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
//LogUtils.d(TAG, "DownLoad Start : " + mszUrl);
|
|
||||||
InputStream in = null;
|
|
||||||
FileOutputStream fout = null;
|
|
||||||
try {
|
|
||||||
//LogUtils.d(TAG, "mszUrl is " + mszUrl);
|
|
||||||
URL httpUrl = new URL(mszUrl);
|
|
||||||
HttpURLConnection conn = (HttpURLConnection) httpUrl.openConnection();
|
|
||||||
//conn.setRequestProperty(UserLogonUtil.getInstance(mContext).getWinBollAppHeaderKey(),
|
|
||||||
// UserLogonUtil.getInstance(mContext).getWinBollAppHeaderValue());
|
|
||||||
conn.setDoInput(true);
|
|
||||||
conn.setDoOutput(false);
|
|
||||||
in = conn.getInputStream();
|
|
||||||
|
|
||||||
// 打印 Header Fields
|
|
||||||
/*Map<String, List<String>> map = conn.getHeaderFields();
|
|
||||||
for (String str : map.keySet()) {
|
|
||||||
if (str != null) {
|
|
||||||
LogUtils.d(TAG, str + map.get(str));
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// 设置文件名
|
|
||||||
//URL absUrl = conn.getURL();
|
|
||||||
String filename = "";
|
|
||||||
|
|
||||||
// 文件名生成方法 1
|
|
||||||
// 读取 Content-Disposition
|
|
||||||
try {
|
|
||||||
//LogUtils.d(TAG, "文件名生成方法 1");
|
|
||||||
// 通过Content-Disposition获取文件名,这点跟服务器有关,需要灵活变通
|
|
||||||
String szTemp = conn.getHeaderField("Content-Disposition");
|
|
||||||
if (szTemp != null) {
|
|
||||||
String szSearch = "filename=\"";
|
|
||||||
int nSearchStart = szTemp.indexOf(szSearch);
|
|
||||||
int nFileNameStart = nSearchStart + szSearch.length();
|
|
||||||
//LogUtils.d(TAG, "nFileNameStart : " + Integer.toString(nFileNameStart));
|
|
||||||
int nFileNameEnd = szTemp.indexOf("\"", nFileNameStart);
|
|
||||||
//LogUtils.d(TAG, "nFileNameEnd : " + Integer.toString(nFileNameEnd));
|
|
||||||
filename = szTemp.substring(nFileNameStart, nFileNameEnd);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
|
|
||||||
}
|
|
||||||
//LogUtils.d(TAG, "filename is : " + filename);
|
|
||||||
|
|
||||||
// 文件名生成方法 2
|
|
||||||
// 读取 mszUrl
|
|
||||||
// 如果文件名包含"/"字符
|
|
||||||
// (例如 https://studio.zhangsken.cc/gitweb/libapputils.git/blob_plain/2aa898149aa7f0e34fe5bc11b2e70187f9f206bc:/libapputils/src/main/java/cc/winboll/studio/libapputils/LogView.java
|
|
||||||
// 的文件名方法1就得到"filename is : libapputils/src/main/java/cc/winboll/studio/libapputils/LogView.java")
|
|
||||||
// 或者为空就执行以下函数段
|
|
||||||
if ((filename.lastIndexOf("/") > 0)
|
|
||||||
|| filename.trim().equals("")) {
|
|
||||||
//LogUtils.d(TAG, "文件名生成方法 2");
|
|
||||||
// 示例 https://studio.zhangsken.cc/gitweb/libaes.git/rss
|
|
||||||
// 截取最后的名称"rss"。
|
|
||||||
// 示例 https://studio.zhangsken.cc/gitweb/libaes.git/
|
|
||||||
// 最后是反斜杆结尾。就截取最后两个斜杆之间的名称"libaes.git"。
|
|
||||||
Pattern pattern = Pattern.compile(".*[/]([^/]+)[/]?$", Pattern.MULTILINE);
|
|
||||||
Matcher matcher = pattern.matcher(mszUrl);
|
|
||||||
if (matcher.find()) {
|
|
||||||
filename = matcher.replaceAll("$1");
|
|
||||||
}
|
|
||||||
|
|
||||||
//LogUtils.d(TAG, "转化文件名为可操作易读写格式");
|
|
||||||
//LogUtils.d(TAG, "filename is : " + filename);
|
|
||||||
// 转化文件名为可操作易读写格式
|
|
||||||
String filenameTemp = URLDecoder.decode(filename, "UTF-8");
|
|
||||||
//filenameTemp = filenameTemp.replace("/", "_");
|
|
||||||
//filename = filenameTemp.replace(".", "-");
|
|
||||||
filename = filenameTemp;
|
|
||||||
|
|
||||||
// 如果文件名没有".*"后缀,就加上".dat"后缀
|
|
||||||
if (filename.lastIndexOf(".") < 0) {
|
|
||||||
filename += ".dat";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//LogUtils.d(TAG, "filename is : " + filename);
|
|
||||||
|
|
||||||
// 如果指定了保存名称就用指定的名称
|
|
||||||
if (mszDowndloadName != null && !mszDowndloadName.equals("")) {
|
|
||||||
filename = mszDowndloadName;
|
|
||||||
}
|
|
||||||
|
|
||||||
mfDownloadFile = createSavedFile(filename);
|
|
||||||
// 如果文件存在就退出,没有就创建一个并下载
|
|
||||||
if (mfDownloadFile.exists()) {
|
|
||||||
LogUtils.d(TAG, "mfDownloadFile : " + mfDownloadFile.getPath());
|
|
||||||
fout = new FileOutputStream(mfDownloadFile);
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
int len;
|
|
||||||
while ((len = in.read(buffer)) != -1) {
|
|
||||||
fout.write(buffer, 0, len);
|
|
||||||
}
|
|
||||||
LogUtils.i(TAG, "DownLoad is well done : " + mfDownloadFile.getPath());
|
|
||||||
// 处理接收到的项目列表文件
|
|
||||||
handleDownloadFile();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
|
|
||||||
} finally {
|
|
||||||
if (in != null) {
|
|
||||||
try {
|
|
||||||
in.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (fout != null) {
|
|
||||||
try {
|
|
||||||
fout.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogUtils.d(TAG, e.getMessage(), Thread.currentThread().getStackTrace());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
//
|
|
||||||
File createSavedFile(String szOriginDownloadName) {
|
|
||||||
File fOriginDownload = new File(mfDownloadDir, szOriginDownloadName);
|
|
||||||
if (!fOriginDownload.exists()) {
|
|
||||||
// 如果该文件名的文件不存在,就表示可以保存为该文件名
|
|
||||||
// 预先创建新文件
|
|
||||||
try {
|
|
||||||
fOriginDownload.createNewFile();
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
|
||||||
}
|
|
||||||
return fOriginDownload;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 校验文件是否已存在,若存在就重命名新文件名
|
|
||||||
File fCheck = fOriginDownload;
|
|
||||||
int nAddName = 1;
|
|
||||||
while (fCheck.exists()) {
|
|
||||||
int nPoint = szOriginDownloadName.lastIndexOf(".");
|
|
||||||
if (nPoint > -1) {
|
|
||||||
LogUtils.d(TAG, "nPoint > -1");
|
|
||||||
fCheck = new File(mfDownloadDir, File.separator + szOriginDownloadName.substring(0, nPoint) + "(" + Integer.toString(nAddName) + ")." + szOriginDownloadName.substring(nPoint + 1));
|
|
||||||
} else {
|
|
||||||
LogUtils.d(TAG, "nPoint > -1 else");
|
|
||||||
fCheck = new File(mfDownloadDir, File.separator + szOriginDownloadName + "(" + Integer.toString(nAddName) + ")");
|
|
||||||
}
|
|
||||||
LogUtils.d(TAG, "nAddName++");
|
|
||||||
nAddName++;
|
|
||||||
}
|
|
||||||
// 预先创建新文件
|
|
||||||
try {
|
|
||||||
fCheck.createNewFile();
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
|
|
||||||
}
|
|
||||||
return fCheck;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 文件下载后的文件处理函数
|
|
||||||
//
|
|
||||||
abstract protected void handleDownloadFile();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,398 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.common;
|
|
||||||
|
|
||||||
import android.content.ClipData;
|
|
||||||
import android.content.ClipboardManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.net.http.SslError;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.view.GestureDetector;
|
|
||||||
import android.view.Gravity;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.webkit.DownloadListener;
|
|
||||||
import android.webkit.HttpAuthHandler;
|
|
||||||
import android.webkit.JavascriptInterface;
|
|
||||||
import android.webkit.SslErrorHandler;
|
|
||||||
import android.webkit.ValueCallback;
|
|
||||||
import android.webkit.WebChromeClient;
|
|
||||||
import android.webkit.WebResourceError;
|
|
||||||
import android.webkit.WebResourceRequest;
|
|
||||||
import android.webkit.WebResourceResponse;
|
|
||||||
import android.webkit.WebSettings;
|
|
||||||
import android.webkit.WebView;
|
|
||||||
import android.webkit.WebViewClient;
|
|
||||||
import android.widget.Toast;
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
|
||||||
import androidx.core.view.GestureDetectorCompat;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.webpagesources.MainActivity;
|
|
||||||
import cc.winboll.studio.webpagesources.R;
|
|
||||||
import cc.winboll.studio.webpagesources.thread.LinkDownLoadThread;
|
|
||||||
import cc.winboll.studio.webpagesources.util.UIUtil;
|
|
||||||
import cc.winboll.studio.webpagesources.view.ItemLongClickedPopWindow;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
public class BaseWebView extends WebView {
|
|
||||||
|
|
||||||
public static final String TAG = "BaseWebView";
|
|
||||||
|
|
||||||
public static final int WEB_CopyLink = 0;
|
|
||||||
public static final int WEB_DownLoadLink = 1;
|
|
||||||
|
|
||||||
protected Context mContext;
|
|
||||||
static String _mszLastUrl = "";
|
|
||||||
IOnPageFinished mIOnPageFinished;
|
|
||||||
protected MyWebChromeClient mMyWebChromeClient;
|
|
||||||
protected BaseWebViewClient mBaseWebViewClient;
|
|
||||||
protected BaseWebViewHandler mBaseWebViewHandler;
|
|
||||||
private int downX, downY;
|
|
||||||
private GestureDetectorCompat mGestureDetector;
|
|
||||||
ValueCallback<Uri[]> mFilePathCallback;
|
|
||||||
WebChromeClient.FileChooserParams mFileChooserParams;
|
|
||||||
|
|
||||||
AuthLoginDialog mAuthLoginDialog;
|
|
||||||
|
|
||||||
public BaseWebView(Context context) {
|
|
||||||
super(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseWebView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
mContext = context;
|
|
||||||
|
|
||||||
mBaseWebViewHandler = new BaseWebViewHandler();
|
|
||||||
MyWebChromeClient mMyWebChromeClient = new MyWebChromeClient();
|
|
||||||
setWebChromeClient(mMyWebChromeClient);
|
|
||||||
mBaseWebViewClient = new BaseWebViewClient();
|
|
||||||
setWebViewClient(mBaseWebViewClient);
|
|
||||||
|
|
||||||
WebSettings mWebSettings = getSettings();
|
|
||||||
|
|
||||||
// ------------------- 优化后的 WebSettings 配置 -------------------
|
|
||||||
// 基础功能配置
|
|
||||||
mWebSettings.setJavaScriptEnabled(true); // 启用JavaScript
|
|
||||||
mWebSettings.setJavaScriptCanOpenWindowsAutomatically(true); // 允许JS打开新窗口
|
|
||||||
mWebSettings.setDomStorageEnabled(true); // 启用DOM存储
|
|
||||||
mWebSettings.setDatabaseEnabled(true); // 启用数据库存储
|
|
||||||
//mWebSettings.setAppCacheEnabled(true); // 启用应用缓存
|
|
||||||
String appCachePath = context.getCacheDir().getAbsolutePath();
|
|
||||||
//mWebSettings.setAppCachePath(appCachePath);
|
|
||||||
mWebSettings.setCacheMode(WebSettings.LOAD_DEFAULT); // 缓存模式
|
|
||||||
|
|
||||||
// 页面渲染与缩放
|
|
||||||
mWebSettings.setUseWideViewPort(true); // 支持viewport标签
|
|
||||||
mWebSettings.setLoadWithOverviewMode(true); // 自动加载时适应屏幕
|
|
||||||
mWebSettings.setSupportZoom(true); // 支持缩放
|
|
||||||
mWebSettings.setBuiltInZoomControls(true); // 显示缩放控件
|
|
||||||
mWebSettings.setDisplayZoomControls(false); // 隐藏默认缩放控件
|
|
||||||
mWebSettings.setDefaultTextEncodingName("utf-8"); // 默认编码
|
|
||||||
mWebSettings.setMinimumFontSize(12); // 最小字体大小
|
|
||||||
|
|
||||||
// 性能优化
|
|
||||||
mWebSettings.setLoadsImagesAutomatically(true); // 自动加载图片
|
|
||||||
mWebSettings.setBlockNetworkImage(false); // 不阻止图片加载
|
|
||||||
mWebSettings.setRenderPriority(WebSettings.RenderPriority.HIGH); // 高渲染优先级
|
|
||||||
|
|
||||||
// 混合内容配置(Android 5.0+)
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
mWebSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 安全配置
|
|
||||||
mWebSettings.setSafeBrowsingEnabled(true); // 启用安全浏览
|
|
||||||
mWebSettings.setAllowFileAccess(true); // 允许访问文件URL
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
|
||||||
mWebSettings.setAllowFileAccessFromFileURLs(false); // 禁止文件URL访问其他文件
|
|
||||||
mWebSettings.setAllowUniversalAccessFromFileURLs(false); // 禁止文件URL执行JS
|
|
||||||
}
|
|
||||||
|
|
||||||
// 高级功能(可选)
|
|
||||||
mWebSettings.setGeolocationEnabled(true); // 启用地理位置
|
|
||||||
mWebSettings.setNeedInitialFocus(true); // 获取初始焦点
|
|
||||||
mWebSettings.setSaveFormData(true); // 保存表单数据
|
|
||||||
mWebSettings.setEnableSmoothTransition(true); // 平滑过渡动画
|
|
||||||
|
|
||||||
// 硬件加速(Android 3.0+)
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
|
||||||
setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 字体缩放(100%为默认)
|
|
||||||
mWebSettings.setTextZoom(100);
|
|
||||||
// ------------------- WebSettings 配置结束 -------------------
|
|
||||||
|
|
||||||
mWebSettings.setSafeBrowsingEnabled(true);
|
|
||||||
addJavascriptInterface(new JSConsole(mContext), "console");
|
|
||||||
addJavascriptInterface(new JS(mContext), "local_obj");
|
|
||||||
|
|
||||||
setInitialScale(60);
|
|
||||||
|
|
||||||
mGestureDetector = new GestureDetectorCompat(mContext, new GestureDetector.SimpleOnGestureListener() {
|
|
||||||
@Override
|
|
||||||
public void onLongPress(MotionEvent e) {
|
|
||||||
downX = (int) e.getX();
|
|
||||||
downY = (int) e.getY();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
setOnLongClickListener(new View.OnLongClickListener() {
|
|
||||||
String szUrl = "";
|
|
||||||
@Override
|
|
||||||
public boolean onLongClick(View v) {
|
|
||||||
|
|
||||||
WebView.HitTestResult result = ((WebView)v).getHitTestResult();
|
|
||||||
if (null == result)
|
|
||||||
return false;
|
|
||||||
int type = result.getType();
|
|
||||||
if (type == WebView.HitTestResult.UNKNOWN_TYPE)
|
|
||||||
return false;
|
|
||||||
if (type == WebView.HitTestResult.EDIT_TEXT_TYPE) {
|
|
||||||
}
|
|
||||||
final ItemLongClickedPopWindow itemLongClickedPopWindow = new ItemLongClickedPopWindow(mContext, ItemLongClickedPopWindow.IMAGE_VIEW_POPUPWINDOW, UIUtil.dip2px(mContext, 180), ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
||||||
|
|
||||||
szUrl = result.getExtra();
|
|
||||||
|
|
||||||
itemLongClickedPopWindow.showAtLocation(v, Gravity.TOP | Gravity.LEFT, downX, downY + 10);
|
|
||||||
|
|
||||||
itemLongClickedPopWindow.getView(R.id.item_longclicked_copylink)
|
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
ClipboardManager clipboard = (ClipboardManager) mContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
|
||||||
ClipData clip = ClipData.newPlainText("simple text", szUrl);
|
|
||||||
clipboard.setPrimaryClip(clip);
|
|
||||||
Toast.makeText(mContext, "Copy to clipboard.", Toast.LENGTH_SHORT).show();
|
|
||||||
itemLongClickedPopWindow.dismiss();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
itemLongClickedPopWindow.getView(R.id.item_longclicked_downloadlink)
|
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
itemLongClickedPopWindow.dismiss();
|
|
||||||
new Thread(new LinkDownLoadThread(szUrl)).start();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseWebView(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLastUrl() {
|
|
||||||
return _mszLastUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void loadUrl(String url) {
|
|
||||||
MainActivity.postStatusBarMessage(String.format("正在加载:%s", url));
|
|
||||||
Pattern patternHttp = Pattern.compile("(?i)^http[s]{0,1}://", Pattern.CASE_INSENSITIVE);
|
|
||||||
Matcher matcherHttp = patternHttp.matcher(url);
|
|
||||||
if (matcherHttp.matches()) {
|
|
||||||
stopLoading();
|
|
||||||
loadUrl(url);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
Pattern pattern = Pattern.compile("^[a-z]+:.*", Pattern.MULTILINE);
|
|
||||||
Matcher matcher = pattern.matcher(url);
|
|
||||||
if (matcher.find()) {
|
|
||||||
super.loadUrl(url);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFilePathCallback(ValueCallback<Uri[]> mFilePathCallback) {
|
|
||||||
this.mFilePathCallback = mFilePathCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ValueCallback<Uri[]> getFilePathCallback() {
|
|
||||||
return mFilePathCallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFileChooserParams(WebChromeClient.FileChooserParams mFileChooserParams) {
|
|
||||||
this.mFileChooserParams = mFileChooserParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
public WebChromeClient.FileChooserParams getFileChooserParams() {
|
|
||||||
return mFileChooserParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MyWebChromeClient extends WebChromeClient {
|
|
||||||
@Override
|
|
||||||
public void onProgressChanged(WebView view, int newProgress) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) {
|
|
||||||
setFilePathCallback(filePathCallback);
|
|
||||||
setFileChooserParams(fileChooserParams);
|
|
||||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
||||||
intent.setType("*/*");
|
|
||||||
((AppCompatActivity)mContext).startActivityForResult(intent, MainActivity.REQUEST_FILE_CHOOSER);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onTouchEvent(MotionEvent event) {
|
|
||||||
boolean ret = mGestureDetector.onTouchEvent(event);
|
|
||||||
LogUtils.d(TAG, String.format("onTouchEvent ret : %s", ret));
|
|
||||||
|
|
||||||
return super.onTouchEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
class BaseWebViewHandler extends Handler {
|
|
||||||
|
|
||||||
public static final String TAG = "BaseWebViewHandler";
|
|
||||||
|
|
||||||
public static final int MSG_RELOAD_LOG = 0X100;
|
|
||||||
public static final int MSG_SHOW_DATA = 0X123;
|
|
||||||
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
switch (msg.what) {
|
|
||||||
case MSG_SHOW_DATA:{
|
|
||||||
loadDataWithBaseURL("", (String)msg.obj, "text/html", "UTF-8", "");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.handleMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final class InJavaScriptLocalObj {
|
|
||||||
@JavascriptInterface
|
|
||||||
public void getSource(String html) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MyDownLoadListener implements DownloadListener {
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public MyDownLoadListener(Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
|
||||||
Uri uri = Uri.parse(url);
|
|
||||||
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class BaseWebViewClient extends WebViewClient {
|
|
||||||
|
|
||||||
public static final String TAG = "BaseWebViewClient";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageFinished(WebView view, String url) {
|
|
||||||
view.loadUrl("javascript:window.local_obj.showSource('<head>'+" +
|
|
||||||
"document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
|
||||||
super.onPageFinished(view, url);
|
|
||||||
mIOnPageFinished.onPageFinished(url);
|
|
||||||
LogUtils.d(TAG, "Page load finished : " + url);
|
|
||||||
_mszLastUrl = url;
|
|
||||||
MainActivity.postStatusBarMessage(String.format("加载完成:%s", url));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
|
|
||||||
LogUtils.d(TAG, "onReceivedSslError 0\nerror : " + error.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
|
|
||||||
int statusCode = errorResponse.getStatusCode();
|
|
||||||
LogUtils.d(TAG, "onReceivedHttpError statusCode " + Integer.toString(statusCode));
|
|
||||||
super.onReceivedHttpError(view, request, errorResponse);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceivedError(WebView view, int errorCode,
|
|
||||||
String description, String failingUrl) {
|
|
||||||
super.onReceivedError(view, errorCode, description, failingUrl);
|
|
||||||
LogUtils.d(TAG, "onReceivedError 1\nerrorCode : " + errorCode
|
|
||||||
+ "\ndescription :" + description + "\nfailingUrl : " + failingUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
|
||||||
super.onReceivedError(view, request, error);
|
|
||||||
LogUtils.d(TAG, "onReceivedError 2\nUrl : " + request.getUrl()
|
|
||||||
+ "\nErrorCode : " + error.getErrorCode()
|
|
||||||
+ "\nDescription : " + error.getDescription());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceivedLoginRequest(WebView view, String realm, String account, String args) {
|
|
||||||
super.onReceivedLoginRequest(view, realm, account, args);
|
|
||||||
LogUtils.d(TAG, "onReceivedLoginRequest");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onLoadResource(WebView view, String url) {
|
|
||||||
super.onLoadResource(view, url);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceivedHttpAuthRequest(WebView view,
|
|
||||||
HttpAuthHandler handler, String host, String realm) {
|
|
||||||
mAuthLoginDialog = new AuthLoginDialog(view, handler, host, realm);
|
|
||||||
mAuthLoginDialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {
|
|
||||||
super.onPageStarted(view, url, favicon);
|
|
||||||
LogUtils.d(TAG, "Page load started : " + url);
|
|
||||||
_mszLastUrl = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
|
||||||
view.loadUrl(url);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
|
||||||
// 修复Android 5.0点击无反应的问题
|
|
||||||
view.loadUrl(request.getUrl().toString());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IOnPageFinished {
|
|
||||||
void onPageFinished(String url);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnPageFinished(IOnPageFinished iOnPageFinished) {
|
|
||||||
mIOnPageFinished = iOnPageFinished;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class JSConsole {
|
|
||||||
private Context mContext;
|
|
||||||
|
|
||||||
public JSConsole(Context context) {
|
|
||||||
this.mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public void log(String message) {
|
|
||||||
LogUtils.d(TAG, message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/07/13 13:54:13
|
|
||||||
* @Describe 获取网页内容的接口类
|
|
||||||
*/
|
|
||||||
import android.content.Context;
|
|
||||||
import android.webkit.JavascriptInterface;
|
|
||||||
import cc.winboll.studio.webpagesources.fragment.SourcesFragment;
|
|
||||||
|
|
||||||
public final class JS {
|
|
||||||
|
|
||||||
public static final String TAG = "JS";
|
|
||||||
|
|
||||||
Context mContext;
|
|
||||||
|
|
||||||
public JS(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public void showSource(String html) {
|
|
||||||
//LogUtils.d(TAG, "showSource");
|
|
||||||
SourcesFragment.sendSourcesUpdateMessage(html);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2024/08/23 02:15:03
|
|
||||||
* @Describe Javascript Console Log 接收类。
|
|
||||||
*/
|
|
||||||
import android.content.Context;
|
|
||||||
import android.webkit.JavascriptInterface;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
|
|
||||||
public class JSConsole {
|
|
||||||
|
|
||||||
public static final String TAG = "JSConsole";
|
|
||||||
|
|
||||||
Context mContext;
|
|
||||||
|
|
||||||
public JSConsole(Context context) {
|
|
||||||
//LogUtils.d(TAG, "JSConsole(Context context)");
|
|
||||||
mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public void log(String tag, String message) {
|
|
||||||
LogUtils.i(TAG, "console.log(...)\n" + tag + " : " + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public void log(String message) {
|
|
||||||
LogUtils.i(TAG, "console.log(...)\n" + message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,111 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.fragment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/07/04 13:45:57
|
|
||||||
* @Describe 网页源码视图 Fragment
|
|
||||||
*/
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import androidx.core.content.FileProvider;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.webpagesources.R;
|
|
||||||
import cc.winboll.studio.webpagesources.handler.SourcesFragmentHandler;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
|
|
||||||
public class SourcesFragment extends Fragment {
|
|
||||||
|
|
||||||
public static final String TAG = "SourcesFragment";
|
|
||||||
|
|
||||||
View mView;
|
|
||||||
EditText mEditText;
|
|
||||||
String mszHtmlPath;
|
|
||||||
String mszHtmlFileName;
|
|
||||||
static SourcesFragmentHandler _mSourcesFragmentHandler;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
//return super.onCreateView(inflater, container, savedInstanceState);
|
|
||||||
mView = inflater.inflate(R.layout.fragment_sources, container, false);
|
|
||||||
mEditText = mView.findViewById(R.id.fragmentsourcesEditText1);
|
|
||||||
|
|
||||||
_mSourcesFragmentHandler = new SourcesFragmentHandler(this);
|
|
||||||
mszHtmlFileName = getString(R.string.app_name) + ".html";
|
|
||||||
mszHtmlPath = getActivity().getExternalFilesDir(TAG) + "/" + mszHtmlFileName;
|
|
||||||
|
|
||||||
return mView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void showCurrentWebPageHtml(String szHtml) {
|
|
||||||
/*File fHtml = new File(App._fTempHtmlPath);
|
|
||||||
StringBuffer sb = new StringBuffer();
|
|
||||||
try {
|
|
||||||
BufferedReader in = null;
|
|
||||||
in = new BufferedReader(new InputStreamReader(new FileInputStream(fHtml), "UTF-8"));
|
|
||||||
String line = "";
|
|
||||||
while ((line = in.readLine()) != null) {
|
|
||||||
sb.append(line);
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
|
||||||
mEditText.setText(sb.toString());
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogUtils.d(TAG, "IOException : " + e.getMessage());
|
|
||||||
}*/
|
|
||||||
mEditText.setText(szHtml);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void shareHtml() {
|
|
||||||
saveHtml(mEditText.getText().toString());
|
|
||||||
|
|
||||||
Uri uri;
|
|
||||||
File file = new File(mszHtmlPath);
|
|
||||||
if (Build.VERSION.SDK_INT >= 24) {//android 7.0以上
|
|
||||||
uri = FileProvider.getUriForFile(getActivity().getApplicationContext(), getActivity().getApplicationContext().getPackageName() + ".fileprovider", file);
|
|
||||||
} else {
|
|
||||||
uri = Uri.fromFile(file);
|
|
||||||
}
|
|
||||||
Intent shareIntent = new Intent("android.intent.action.VIEW");
|
|
||||||
shareIntent.setDataAndType(uri, "text/html");
|
|
||||||
if (Build.VERSION.SDK_INT >= 24) {
|
|
||||||
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
||||||
}
|
|
||||||
startActivity(Intent.createChooser(shareIntent, mszHtmlFileName));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sendSourcesUpdateMessage(String szHtml) {
|
|
||||||
if (_mSourcesFragmentHandler != null) {
|
|
||||||
Message message = _mSourcesFragmentHandler.obtainMessage(SourcesFragmentHandler.MSG_UPDATE);
|
|
||||||
Bundle bundle = new Bundle();
|
|
||||||
bundle.putString(SourcesFragmentHandler.BUNDLE_KEY_HTML, szHtml);
|
|
||||||
message.setData(bundle);
|
|
||||||
_mSourcesFragmentHandler.sendMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void saveHtml(String szHtml) {
|
|
||||||
try {
|
|
||||||
File fTempHtml = new File(mszHtmlPath);
|
|
||||||
if (fTempHtml.exists()) {
|
|
||||||
fTempHtml.delete();
|
|
||||||
}
|
|
||||||
BufferedWriter out = null;
|
|
||||||
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fTempHtml, false), "UTF-8"));
|
|
||||||
out.write(szHtml);
|
|
||||||
out.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogUtils.d(TAG, "IOException : " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.fragment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/07/04 13:45:32
|
|
||||||
* @Describe 网页浏览视图 Fragment
|
|
||||||
*/
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.view.ViewParent;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import cc.winboll.studio.libaes.views.AButton;
|
|
||||||
import cc.winboll.studio.webpagesources.R;
|
|
||||||
import cc.winboll.studio.webpagesources.common.BaseWebView;
|
|
||||||
import cc.winboll.studio.webpagesources.view.URLAddressView;
|
|
||||||
import com.baoyz.widget.PullRefreshLayout;
|
|
||||||
|
|
||||||
public class WebFragment extends Fragment {
|
|
||||||
|
|
||||||
public static final String TAG = "WebFragment";
|
|
||||||
|
|
||||||
View mView;
|
|
||||||
BaseWebView mBaseWebView;
|
|
||||||
URLAddressView mURLAddressView;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
//return super.onCreateView(inflater, container, savedInstanceState);
|
|
||||||
mView = inflater.inflate(R.layout.fragment_web, container, false);
|
|
||||||
|
|
||||||
mURLAddressView = mView.findViewById(R.id.fragmentwebURLAddressView1);
|
|
||||||
mURLAddressView.initAnchorView((LinearLayout)mView.findViewById(R.id.fragmentwebLinearLayout1));
|
|
||||||
|
|
||||||
AButton btnGoback = mView.findViewById(R.id.fragmentwebAButton1);
|
|
||||||
btnGoback.setOnClickListener(new AButton.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
mBaseWebView.goBack();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AButton btnGoForward = mView.findViewById(R.id.fragmentwebAButton2);
|
|
||||||
btnGoForward.setOnClickListener(new AButton.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (mURLAddressView.getURLAddressText().equals(mBaseWebView.getUrl())) {
|
|
||||||
mBaseWebView.goForward();
|
|
||||||
} else {
|
|
||||||
mBaseWebView.stopLoading();
|
|
||||||
mBaseWebView.loadUrl(mURLAddressView.getURLAddressText());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AButton btnReload = mView.findViewById(R.id.fragmentwebAButton3);
|
|
||||||
btnReload.setOnClickListener(new AButton.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
mBaseWebView.stopLoading();
|
|
||||||
mBaseWebView.clearCache(true);
|
|
||||||
mBaseWebView.reload();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
AButton btnStopLoading = mView.findViewById(R.id.fragmentwebAButton4);
|
|
||||||
btnStopLoading.setOnClickListener(new AButton.OnClickListener(){
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
mBaseWebView.stopLoading();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mBaseWebView = mView.findViewById(R.id.fragmentwebBaseWebView1);
|
|
||||||
mBaseWebView.setOnPageFinished(new BaseWebView.IOnPageFinished(){
|
|
||||||
@Override
|
|
||||||
public void onPageFinished(String url) {
|
|
||||||
mURLAddressView.setURLAddressText(url);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
final PullRefreshLayout layout = mView.findViewById(R.id.fragmentwebPullRefreshLayout1);
|
|
||||||
// listen refresh event
|
|
||||||
layout.setOnRefreshListener(new PullRefreshLayout.OnRefreshListener() {
|
|
||||||
@Override
|
|
||||||
public void onRefresh() {
|
|
||||||
// start refresh
|
|
||||||
mBaseWebView.stopLoading();
|
|
||||||
mBaseWebView.clearCache(true);
|
|
||||||
mBaseWebView.reload();
|
|
||||||
layout.setRefreshing(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return mView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BaseWebView getWebView() {
|
|
||||||
return mBaseWebView;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadUrl(String szUrl) {
|
|
||||||
mBaseWebView.loadUrl(szUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reloadLastUrl() {
|
|
||||||
mBaseWebView.stopLoading();
|
|
||||||
mBaseWebView.loadUrl(mBaseWebView.getLastUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDestroy() {
|
|
||||||
if (mBaseWebView != null) {
|
|
||||||
mBaseWebView.destroy();
|
|
||||||
|
|
||||||
ViewParent parent = mBaseWebView.getParent();
|
|
||||||
if (parent != null) {
|
|
||||||
((ViewGroup) parent).removeView(mBaseWebView);
|
|
||||||
}
|
|
||||||
mBaseWebView.stopLoading();
|
|
||||||
// 退出时调用此方法,移除绑定的服务,否则某些特定系统会报错
|
|
||||||
mBaseWebView.getSettings().setJavaScriptEnabled(false);
|
|
||||||
mBaseWebView.clearHistory();
|
|
||||||
mBaseWebView.clearView();
|
|
||||||
mBaseWebView.removeAllViews();
|
|
||||||
mBaseWebView.destroy();
|
|
||||||
}
|
|
||||||
super.onDestroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.handler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/07/13 15:43:48
|
|
||||||
* @Describe 源码视图窗口事务处理类
|
|
||||||
*/
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import cc.winboll.studio.webpagesources.fragment.SourcesFragment;
|
|
||||||
|
|
||||||
public class SourcesFragmentHandler extends Handler {
|
|
||||||
|
|
||||||
public static final String TAG = "SourcesFragmentHandler";
|
|
||||||
|
|
||||||
public static final int MSG_UPDATE = 0;
|
|
||||||
public static final String BUNDLE_KEY_HTML = "BUNDLE_KEY_HTML";
|
|
||||||
|
|
||||||
SourcesFragment mSourcesFragment;
|
|
||||||
public SourcesFragmentHandler(SourcesFragment fragment) {
|
|
||||||
mSourcesFragment = fragment;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
switch (msg.what) {
|
|
||||||
case MSG_UPDATE:{
|
|
||||||
Bundle bundle = msg.getData();
|
|
||||||
String szHtml = (String)bundle.getSerializable(BUNDLE_KEY_HTML);
|
|
||||||
mSourcesFragment.showCurrentWebPageHtml(szHtml);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.handleMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2024/08/26 15:43:22
|
|
||||||
* @Describe 验证信息数据类
|
|
||||||
*/
|
|
||||||
import android.util.JsonReader;
|
|
||||||
import android.util.JsonWriter;
|
|
||||||
import cc.winboll.studio.libappbase.BaseBean;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class AuthenticationBean extends BaseBean {
|
|
||||||
|
|
||||||
public static final String TAG = "AuthenticationBean";
|
|
||||||
|
|
||||||
// 主机名
|
|
||||||
String host;
|
|
||||||
// 认证区域
|
|
||||||
String realm;
|
|
||||||
// 用户名
|
|
||||||
String userName;
|
|
||||||
// 密码
|
|
||||||
String password;
|
|
||||||
|
|
||||||
public AuthenticationBean(String host, String realm, String userName, String password) {
|
|
||||||
this.host = host;
|
|
||||||
this.realm = realm;
|
|
||||||
this.userName = userName;
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthenticationBean(AuthenticationBean bean) {
|
|
||||||
this.host = bean.getHost();
|
|
||||||
this.realm = bean.getRealm();
|
|
||||||
this.userName = bean.getUserName();
|
|
||||||
this.password = bean.getPassword();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AuthenticationBean() {
|
|
||||||
this.host = "";
|
|
||||||
this.realm = "";
|
|
||||||
this.userName = "";
|
|
||||||
this.password = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRealm(String realm) {
|
|
||||||
this.realm = realm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRealm() {
|
|
||||||
return realm;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHost(String host) {
|
|
||||||
this.host = host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHost() {
|
|
||||||
return host;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserName(String userName) {
|
|
||||||
this.userName = userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUserName() {
|
|
||||||
return userName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return AuthenticationBean.class.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeThisToJsonWriter(JsonWriter jsonWriter) throws IOException {
|
|
||||||
super.writeThisToJsonWriter(jsonWriter);
|
|
||||||
AuthenticationBean bean = this;
|
|
||||||
jsonWriter.name("host").value(bean.getHost());
|
|
||||||
jsonWriter.name("realm").value(bean.getRealm());
|
|
||||||
jsonWriter.name("userName").value(bean.getUserName());
|
|
||||||
jsonWriter.name("password").value(bean.getPassword());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean initObjectsFromJsonReader(JsonReader jsonReader, String name) throws IOException {
|
|
||||||
if (super.initObjectsFromJsonReader(jsonReader, name)) { return true; } else {
|
|
||||||
if (name.equals("host")) {
|
|
||||||
setHost(jsonReader.nextString());
|
|
||||||
} else if (name.equals("realm")) {
|
|
||||||
setRealm(jsonReader.nextString());
|
|
||||||
} else if (name.equals("userName")) {
|
|
||||||
setUserName(jsonReader.nextString());
|
|
||||||
} else if (name.equals("password")) {
|
|
||||||
setPassword(jsonReader.nextString());
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BaseBean readBeanFromJsonReader(JsonReader jsonReader) throws IOException {
|
|
||||||
jsonReader.beginObject();
|
|
||||||
while (jsonReader.hasNext()) {
|
|
||||||
String name = jsonReader.nextName();
|
|
||||||
if (!initObjectsFromJsonReader(jsonReader, name)) {
|
|
||||||
jsonReader.skipValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 结束 JSON 对象
|
|
||||||
jsonReader.endObject();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.thread;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/06/22 21:19:59
|
|
||||||
* @Describe 链接下载进程类
|
|
||||||
*/
|
|
||||||
import android.os.Environment;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.webpagesources.common.BaseDownLoadThread;
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public class LinkDownLoadThread extends BaseDownLoadThread {
|
|
||||||
|
|
||||||
public static final String TAG = "LinkDownLoadThread";
|
|
||||||
|
|
||||||
public LinkDownLoadThread(String szUrl) {
|
|
||||||
super(new File(Environment.getExternalStorageDirectory(), "Download"), szUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void handleDownloadFile() {
|
|
||||||
LogUtils.d(TAG, "handleDownloadFile");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.util;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 网站证书校验工具类
|
|
||||||
* Power By :
|
|
||||||
* ZhanGSKen@QQ.COM
|
|
||||||
* https://blog.csdn.net/
|
|
||||||
* https://blog.csdn.net/lsyz0021/article/details/54669914
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
import android.net.http.SslCertificate;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.cert.Certificate;
|
|
||||||
import java.security.cert.CertificateFactory;
|
|
||||||
import java.security.cert.X509Certificate;
|
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public class SSLUtil {
|
|
||||||
public static final String TAG = "SSLUtil";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SSL证书错误,手动校验https证书
|
|
||||||
*
|
|
||||||
* @param cert https证书
|
|
||||||
* @param sha256Str sha256值
|
|
||||||
* @return true通过,false失败
|
|
||||||
*/
|
|
||||||
public static boolean isSSLCertOk(SslCertificate cert, String sha256Str) {
|
|
||||||
byte[] SSLSHA256 = hexToBytes(sha256Str.toLowerCase());
|
|
||||||
Bundle bundle = SslCertificate.saveState(cert);
|
|
||||||
if (bundle != null) {
|
|
||||||
byte[] bytes = bundle.getByteArray("x509-certificate");
|
|
||||||
if (bytes != null) {
|
|
||||||
try {
|
|
||||||
CertificateFactory cf = CertificateFactory.getInstance("X.509");
|
|
||||||
Certificate ca = cf.generateCertificate(new ByteArrayInputStream(bytes));
|
|
||||||
MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
|
|
||||||
byte[] key = sha256.digest(((X509Certificate) ca).getEncoded());
|
|
||||||
return Arrays.equals(key, SSLSHA256);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.d(TAG, "Exception : " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* hexString转byteArr
|
|
||||||
* <p>例如:</p>
|
|
||||||
* hexString2Bytes("00A8") returns { 0, (byte) 0xA8 }
|
|
||||||
*
|
|
||||||
* @param hexString
|
|
||||||
* @return 字节数组
|
|
||||||
*/
|
|
||||||
public static byte[] hexToBytes(String hexString) {
|
|
||||||
|
|
||||||
if (hexString == null || hexString.trim().length() == 0)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
int length = hexString.length() / 2;
|
|
||||||
char[] hexChars = hexString.toCharArray();
|
|
||||||
byte[] bytes = new byte[length];
|
|
||||||
String hexDigits = "0123456789abcdef";
|
|
||||||
for (int i = 0; i < length; i++) {
|
|
||||||
int pos = i * 2; // 两个字符对应一个byte
|
|
||||||
int h = hexDigits.indexOf(hexChars[pos]) << 4; // 注1
|
|
||||||
int l = hexDigits.indexOf(hexChars[pos + 1]); // 注2
|
|
||||||
if (h == -1 || l == -1) { // 非16进制字符
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
bytes[i] = (byte) (h | l);
|
|
||||||
}
|
|
||||||
return bytes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.util;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/06/23 03:57:30
|
|
||||||
* @Describe 视图辅助工具类
|
|
||||||
*/
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
public class UIUtil {
|
|
||||||
|
|
||||||
public static final String TAG = "UIUtil";
|
|
||||||
|
|
||||||
public static int dip2px(Context context, float dpValue) {
|
|
||||||
float scale = context.getResources().getDisplayMetrics().density;
|
|
||||||
return (int) (dpValue * scale + 0.5f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.view;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/06/23 03:45:50
|
|
||||||
* @Describe 网页浏览长按弹出菜单类
|
|
||||||
*/
|
|
||||||
import android.content.Context;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.PopupWindow;
|
|
||||||
import cc.winboll.studio.webpagesources.R;
|
|
||||||
|
|
||||||
public class ItemLongClickedPopWindow extends PopupWindow {
|
|
||||||
/**
|
|
||||||
* 书签条目弹出菜单 * @value * {@value} *
|
|
||||||
*/
|
|
||||||
public static final int FAVORITES_ITEM_POPUPWINDOW = 0;
|
|
||||||
/**
|
|
||||||
* 书签页面弹出菜单 * @value * {@value} *
|
|
||||||
*/
|
|
||||||
public static final int FAVORITES_VIEW_POPUPWINDOW = 1;
|
|
||||||
/**
|
|
||||||
* 历史条目弹出菜单 * @value * {@value} *
|
|
||||||
*/
|
|
||||||
public static final int HISTORY_ITEM_POPUPWINDOW = 3;
|
|
||||||
/**
|
|
||||||
* 历史页面弹出菜单 * @value * {@value} *
|
|
||||||
*/
|
|
||||||
public static final int HISTORY_VIEW_POPUPWINDOW = 4;
|
|
||||||
/**
|
|
||||||
* 图片项目弹出菜单 * @value * {@value} *
|
|
||||||
*/
|
|
||||||
public static final int IMAGE_VIEW_POPUPWINDOW = 5;
|
|
||||||
/**
|
|
||||||
* 超链接项目弹出菜单 * @value * {@value} *
|
|
||||||
*/
|
|
||||||
public static final int ACHOR_VIEW_POPUPWINDOW = 6;
|
|
||||||
private LayoutInflater itemLongClickedPopWindowInflater;
|
|
||||||
private View itemLongClickedPopWindowView;
|
|
||||||
private Context context;
|
|
||||||
private int type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造函数 * @param context 上下文 * @param width 宽度 * @param height 高度 *
|
|
||||||
*/
|
|
||||||
public ItemLongClickedPopWindow(Context context, int type, int width, int height) {
|
|
||||||
super(context);
|
|
||||||
this.context = context;
|
|
||||||
this.type = type;
|
|
||||||
//创建
|
|
||||||
this.initTab();
|
|
||||||
//设置默认选项
|
|
||||||
setWidth(width);
|
|
||||||
setHeight(height);
|
|
||||||
setContentView(this.itemLongClickedPopWindowView);
|
|
||||||
setOutsideTouchable(true);
|
|
||||||
setFocusable(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//实例化
|
|
||||||
private void initTab() {
|
|
||||||
this.itemLongClickedPopWindowInflater = LayoutInflater.from(this.context);
|
|
||||||
switch (type) {
|
|
||||||
// case FAVORITES_ITEM_POPUPWINDOW:
|
|
||||||
// this.itemLongClickedPopWindowView = this.itemLongClickedPopWindowInflater.inflate(R.layout.list_item_longclicked_favorites, null);
|
|
||||||
// break;
|
|
||||||
// case FAVORITES_VIEW_POPUPWINDOW: //对于书签内容弹出菜单,未作处理
|
|
||||||
// break;
|
|
||||||
// case HISTORY_ITEM_POPUPWINDOW:
|
|
||||||
// this.itemLongClickedPopWindowView = this.itemLongClickedPopWindowInflater.inflate(R.layout.list_item_longclicked_history, null);
|
|
||||||
// break;
|
|
||||||
// case HISTORY_VIEW_POPUPWINDOW: //对于历史内容弹出菜单,未作处理
|
|
||||||
// break;
|
|
||||||
// case ACHOR_VIEW_POPUPWINDOW: //超链接
|
|
||||||
// break;
|
|
||||||
case IMAGE_VIEW_POPUPWINDOW: //图片
|
|
||||||
this.itemLongClickedPopWindowView = this.itemLongClickedPopWindowInflater.inflate(R.layout.list_item_longclicked_img, null);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public View getView(int id) {
|
|
||||||
return this.itemLongClickedPopWindowView.findViewById(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.view;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import cc.winboll.studio.webpagesources.R;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen<zhangsken@188.com>
|
|
||||||
* @Date 2025/06/11 04:11
|
|
||||||
* @Describe 网页状态信息栏
|
|
||||||
*/
|
|
||||||
public class StatusBarView extends LinearLayout {
|
|
||||||
|
|
||||||
public static final String TAG = "StatusBar";
|
|
||||||
|
|
||||||
public static final int MESSAGE_NEWS = 0;
|
|
||||||
|
|
||||||
Context mContext;
|
|
||||||
TextView mtvMessage;
|
|
||||||
|
|
||||||
public StatusBarView(Context context) {
|
|
||||||
super(context);
|
|
||||||
initView(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public StatusBarView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
initView(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public StatusBarView(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
initView(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public StatusBarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
|
||||||
initView(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
void initView(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
View viewMain = inflate(context, R.layout.view_statusbar, null);
|
|
||||||
mtvMessage = viewMain.findViewById(R.id.tv_message);
|
|
||||||
|
|
||||||
// 设置布局参数为MATCH_PARENT,并确保最大尺寸显示
|
|
||||||
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
|
||||||
);
|
|
||||||
addView(viewMain, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void postMessage(String msg) {
|
|
||||||
if (mContext != null) {
|
|
||||||
Message message = new Message();
|
|
||||||
message.what = MESSAGE_NEWS;
|
|
||||||
message.obj = msg;
|
|
||||||
mHandler.dispatchMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Handler mHandler = new Handler(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
if (msg.what == MESSAGE_NEWS) {
|
|
||||||
mtvMessage.setText((String)msg.obj);
|
|
||||||
}
|
|
||||||
//super.handleMessage(msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,481 +0,0 @@
|
|||||||
package cc.winboll.studio.webpagesources.view;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author ZhanGSKen@QQ.COM
|
|
||||||
* @Date 2023/07/16 17:52:43
|
|
||||||
* @Describe 网页地址栏
|
|
||||||
*/
|
|
||||||
import android.content.Context;
|
|
||||||
import android.text.Editable;
|
|
||||||
import android.text.TextWatcher;
|
|
||||||
import android.util.AttributeSet;
|
|
||||||
import android.util.JsonReader;
|
|
||||||
import android.util.JsonWriter;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.AdapterView;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageView;
|
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.PopupWindow;
|
|
||||||
import androidx.appcompat.widget.ListPopupWindow;
|
|
||||||
import cc.winboll.studio.libappbase.LogUtils;
|
|
||||||
import cc.winboll.studio.webpagesources.R;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
public class URLAddressView extends LinearLayout {
|
|
||||||
|
|
||||||
public static final String TAG = "URLEditText";
|
|
||||||
|
|
||||||
Context mContext;
|
|
||||||
EditText mURLAddressEditText;
|
|
||||||
ImageView mRightImageView;
|
|
||||||
ImageView mLeftImageView;
|
|
||||||
ListPopupWindow mListPopupWindow;
|
|
||||||
boolean mIsListPopupWindow_OnShow = false;
|
|
||||||
long mnRightImageViewTouchCount = 0;
|
|
||||||
String mszConfigPath;
|
|
||||||
ArrayList<URLInfo> mlistURLInfo;
|
|
||||||
//Drawable drawable_r;
|
|
||||||
//Drawable drawable_l_no;
|
|
||||||
//Drawable drawable_l_yes;
|
|
||||||
LinearLayout mllAnchorView;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在java代码里new的时候会用到
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
public URLAddressView(Context context) {
|
|
||||||
super(context);
|
|
||||||
init(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 在xml布局文件中使用时自动调用
|
|
||||||
* @param context
|
|
||||||
*/
|
|
||||||
public URLAddressView(Context context, AttributeSet attrs) {
|
|
||||||
super(context, attrs);
|
|
||||||
init(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 不会自动调用,如果有默认style时,在第二个构造函数中调用
|
|
||||||
* @param context
|
|
||||||
* @param attrs
|
|
||||||
* @param defStyleAttr
|
|
||||||
*/
|
|
||||||
public URLAddressView(Context context, AttributeSet attrs, int defStyleAttr) {
|
|
||||||
super(context, attrs, defStyleAttr);
|
|
||||||
init(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 只有在API版本>21时才会用到
|
|
||||||
* 不会自动调用,如果有默认style时,在第二个构造函数中调用
|
|
||||||
* @param context
|
|
||||||
* @param attrs
|
|
||||||
* @param defStyleAttr
|
|
||||||
* @param defStyleRes
|
|
||||||
*/
|
|
||||||
//@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
|
||||||
public URLAddressView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
|
||||||
init(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initAnchorView(LinearLayout llAnchorView) {
|
|
||||||
mllAnchorView = llAnchorView;
|
|
||||||
}
|
|
||||||
|
|
||||||
void init(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
View viewMain = inflate(mContext, R.layout.view_urladdress, null);
|
|
||||||
mURLAddressEditText = viewMain.findViewById(R.id.viewurladdressEditText1);
|
|
||||||
mLeftImageView = viewMain.findViewById(R.id.viewurladdressImageView1);
|
|
||||||
mRightImageView = viewMain.findViewById(R.id.viewurladdressImageView2);
|
|
||||||
addView(viewMain);
|
|
||||||
|
|
||||||
mszConfigPath = context.getExternalFilesDir(TAG) + File.separator + "_mszConfigPath.json";
|
|
||||||
mlistURLInfo = new ArrayList<URLInfo>();
|
|
||||||
mlistURLInfo = loadListURLInfo();
|
|
||||||
|
|
||||||
mURLAddressEditText.addTextChangedListener(new TextWatcher() {
|
|
||||||
@Override
|
|
||||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
||||||
// 当文本发生改变时,这个方法会被调用
|
|
||||||
//LogUtils.d(TAG, "Text changed to: " + s.toString());
|
|
||||||
for (int i = 0; i < 0; i++) {
|
|
||||||
if (mURLAddressEditText.equals(mlistURLInfo.get(i).getUrl())) {
|
|
||||||
updateFavoriteButtonStatus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateFavoriteButtonStatus();
|
|
||||||
/*if (mIOnTextChanged != null) {
|
|
||||||
if (text != null) {
|
|
||||||
mIOnTextChanged.onTextChanged(text.toString());
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterTextChanged(Editable s) {}
|
|
||||||
});
|
|
||||||
|
|
||||||
mURLAddressEditText.setOnTouchListener(new View.OnTouchListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
|
||||||
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
|
|
||||||
//ToastUtils.show("mURLAddressEditText ACTION_DOWN");
|
|
||||||
if(!mIsListPopupWindow_OnShow) {
|
|
||||||
mnRightImageViewTouchCount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mLeftImageView.setOnTouchListener(new View.OnTouchListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
|
||||||
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
|
|
||||||
changeURLFavoriteStatus(mURLAddressEditText.getText().toString());
|
|
||||||
} else {
|
|
||||||
LogUtils.d(TAG, "MotionEvent : " + Integer.toString(motionEvent.getAction()));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mRightImageView.setOnTouchListener(new View.OnTouchListener(){
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
|
||||||
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
|
|
||||||
if (mnRightImageViewTouchCount % 2 == 0) {
|
|
||||||
// 弹出网址列表
|
|
||||||
showListPopulWindow();
|
|
||||||
}
|
|
||||||
mnRightImageViewTouchCount++;
|
|
||||||
} else {
|
|
||||||
LogUtils.d(TAG, "MotionEvent : " + Integer.toString(motionEvent.getAction()));
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.test);
|
|
||||||
String text = ta.getString(R.styleable.test_text);
|
|
||||||
setText(text + " ZhanGSKen.CN");
|
|
||||||
ta.recycle();*/
|
|
||||||
//drawable_r = getResources().getDrawable(R.drawable.ic_form_dropdown);
|
|
||||||
//drawable_n.setBounds(0, 0, drawable_n.getMinimumWidth(),drawable_n.getMinimumHeight()); //此为必须写的
|
|
||||||
//drawable_r.setBounds(0, 0, 80, 80); //此为必须写的
|
|
||||||
|
|
||||||
//drawable_l_no = getResources().getDrawable(R.drawable.ic_favorite_outline);
|
|
||||||
//drawable_n.setBounds(0, 0, drawable_n.getMinimumWidth(),drawable_n.getMinimumHeight()); //此为必须写的
|
|
||||||
//drawable_l_no.setBounds(0, 0, 80, 80); //此为必须写的
|
|
||||||
|
|
||||||
//drawable_l_yes = getResources().getDrawable(R.drawable.ic_favorite);
|
|
||||||
//drawable_n.setBounds(0, 0, drawable_n.getMinimumWidth(),drawable_n.getMinimumHeight()); //此为必须写的
|
|
||||||
//drawable_l_yes.setBounds(0, 0, 80, 80); //此为必须写的
|
|
||||||
|
|
||||||
//setFavoriteNo();
|
|
||||||
//setOnTouchListener(mOnTouchListener);
|
|
||||||
//setMinWidth(100);
|
|
||||||
//setPadding(10,0,10,0);
|
|
||||||
//setPaddingRelative(0,0,0,0);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getURLAddressText() {
|
|
||||||
return mURLAddressEditText.getText().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setURLAddressText(String szUrl) {
|
|
||||||
mURLAddressEditText.setText(szUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 更新收藏按钮显示状态
|
|
||||||
//
|
|
||||||
void updateFavoriteButtonStatus() {
|
|
||||||
if (isFavoritedURL(mURLAddressEditText.getText().toString())) {
|
|
||||||
mLeftImageView.setBackgroundResource(R.drawable.ic_favorite);
|
|
||||||
//setCompoundDrawables(drawable_l_yes, null, drawable_r, null);
|
|
||||||
} else {
|
|
||||||
mLeftImageView.setBackgroundResource(R.drawable.ic_favorite_outline);
|
|
||||||
//setCompoundDrawables(drawable_l_no, null, drawable_r, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*@Override
|
|
||||||
public void setOnTouchListener(View.OnTouchListener l) {
|
|
||||||
super.setOnTouchListener(l);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*View.OnTouchListener mOnTouchListener = new View.OnTouchListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View view, MotionEvent event) {
|
|
||||||
final int DRAWABLE_LEFT = 0;
|
|
||||||
//final int DRAWABLE_TOP = 1;
|
|
||||||
final int DRAWABLE_RIGHT = 2;
|
|
||||||
//final int DRAWABLE_BOTTOM = 3;
|
|
||||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
|
||||||
if (event.getX() >= (getWidth() - getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width())) {
|
|
||||||
// 弹出网址列表
|
|
||||||
LogUtils.d(TAG, "mOnTouchListener 1");
|
|
||||||
showListPopulWindow();
|
|
||||||
return false;
|
|
||||||
} else if (event.getX() <= (getCompoundDrawables()[DRAWABLE_LEFT].getBounds().width())) {
|
|
||||||
// 修改输入框网址收藏状态
|
|
||||||
LogUtils.d(TAG, "mOnTouchListener 2");
|
|
||||||
changeURLFavoriteStatus(getText().toString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};*/
|
|
||||||
|
|
||||||
//
|
|
||||||
// 改变网址的收藏状态:
|
|
||||||
// @返回值:收藏状态
|
|
||||||
// 如果没收藏就设置收藏,收藏状态返回true;
|
|
||||||
// 如果收藏了就取消收藏,收藏状态返回false;
|
|
||||||
//
|
|
||||||
public boolean changeURLFavoriteStatus(String szUrl) {
|
|
||||||
if (szUrl == null || szUrl.equals("")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (URLInfo item : mlistURLInfo) {
|
|
||||||
if (item.getUrl().equals(szUrl)) {
|
|
||||||
mlistURLInfo.remove(item);
|
|
||||||
saveListURLInfo();
|
|
||||||
updateFavoriteButtonStatus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
URLInfo newItem = new URLInfo(szUrl);
|
|
||||||
mlistURLInfo.add(newItem);
|
|
||||||
saveListURLInfo();
|
|
||||||
updateFavoriteButtonStatus();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 读取网址的收藏状态
|
|
||||||
//
|
|
||||||
public boolean isFavoritedURL(String szUrl) {
|
|
||||||
if ((mlistURLInfo == null) || (szUrl == null) || szUrl.equals("")) {return false;}
|
|
||||||
|
|
||||||
for (URLInfo item : mlistURLInfo) {
|
|
||||||
if (item.getUrl().equals(szUrl)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 前置网址在收藏列表里的位置
|
|
||||||
//
|
|
||||||
public boolean postposesURL(String szUrl) {
|
|
||||||
for (URLInfo item : mlistURLInfo) {
|
|
||||||
if (item.getUrl().equals(szUrl)) {
|
|
||||||
mlistURLInfo.add(0, new URLInfo(szUrl));
|
|
||||||
mlistURLInfo.remove(item);
|
|
||||||
saveListURLInfo();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 加载收藏的网址列表
|
|
||||||
//
|
|
||||||
public ArrayList<URLInfo> loadListURLInfo() {
|
|
||||||
File fJson = new File(mszConfigPath);
|
|
||||||
try {
|
|
||||||
ArrayList<URLInfo> listTemp = readJsonStream(new FileInputStream(fJson));
|
|
||||||
if (listTemp != null && listTemp.size() > 0) {
|
|
||||||
mlistURLInfo.clear();
|
|
||||||
mlistURLInfo.addAll(listTemp);
|
|
||||||
} else {
|
|
||||||
mlistURLInfo.clear();
|
|
||||||
saveListURLInfo();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogUtils.d(TAG, "IOException : " + e.getMessage());
|
|
||||||
mlistURLInfo = new ArrayList<URLInfo>();
|
|
||||||
saveListURLInfo();
|
|
||||||
}
|
|
||||||
return mlistURLInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 读取 Json 文件
|
|
||||||
//
|
|
||||||
ArrayList<URLInfo> readJsonStream(InputStream in) throws IOException {
|
|
||||||
JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
|
|
||||||
return readURLInfoArrayList(reader);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 读取 Json 文件的每一 Json 项
|
|
||||||
//
|
|
||||||
ArrayList<URLInfo> readURLInfoArrayList(JsonReader reader) throws IOException {
|
|
||||||
ArrayList<URLInfo> list = new ArrayList<URLInfo>();
|
|
||||||
reader.beginArray();
|
|
||||||
while (reader.hasNext()) {
|
|
||||||
list.add(readURLInfo(reader));
|
|
||||||
}
|
|
||||||
reader.endArray();
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 读取 Json 文件的某一 Json 项
|
|
||||||
//
|
|
||||||
URLInfo readURLInfo(JsonReader reader) throws IOException {
|
|
||||||
URLInfo urlInfo = new URLInfo();
|
|
||||||
reader.beginObject();
|
|
||||||
while (reader.hasNext()) {
|
|
||||||
String name = reader.nextName();
|
|
||||||
if (name.equals("url")) {
|
|
||||||
urlInfo.setUrl(reader.nextString());
|
|
||||||
} else {
|
|
||||||
reader.skipValue();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
reader.endObject();
|
|
||||||
return urlInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 写入 Json 文件的某一 Json 项
|
|
||||||
//
|
|
||||||
static void writeConfigs(JsonWriter writer, URLInfo urlInfo) throws IOException {
|
|
||||||
writer.beginObject();
|
|
||||||
writer.name("url").value(urlInfo.getUrl());
|
|
||||||
writer.endObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 保存收藏的网址列表
|
|
||||||
//
|
|
||||||
void saveListURLInfo() {
|
|
||||||
try {
|
|
||||||
File fJson = new File(mszConfigPath);
|
|
||||||
writeJsonStream(new FileOutputStream(fJson, false), mlistURLInfo);
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogUtils.d(TAG, "IOException : " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 写入 Json 文件
|
|
||||||
//
|
|
||||||
void writeJsonStream(OutputStream out, ArrayList<URLInfo> listURLInfo) throws IOException {
|
|
||||||
JsonWriter writer = new JsonWriter(new OutputStreamWriter(out, "UTF-8"));
|
|
||||||
writer.setIndent(" ");
|
|
||||||
writeConfigsArray(writer, listURLInfo);
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 记录 Json 文件的某一 Json 项
|
|
||||||
//
|
|
||||||
void writeConfigsArray(JsonWriter writer, ArrayList<URLInfo> listURLInfo) throws IOException {
|
|
||||||
writer.beginArray();
|
|
||||||
for (URLInfo urlInfo : listURLInfo) {
|
|
||||||
writeConfigs(writer, urlInfo);
|
|
||||||
}
|
|
||||||
writer.endArray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class URLInfo {
|
|
||||||
String url;
|
|
||||||
|
|
||||||
public URLInfo() {}
|
|
||||||
public URLInfo(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrl(String url) {
|
|
||||||
this.url = url;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUrl() {
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 弹出网址下拉框
|
|
||||||
// @ llAnchorView : 设置下拉列表基准控件
|
|
||||||
//
|
|
||||||
void showListPopulWindow() {
|
|
||||||
//final String[] list = {"asg","hshsh"};
|
|
||||||
int nListSize = mlistURLInfo.size();
|
|
||||||
final String[] list = new String[nListSize];
|
|
||||||
for (int i = 0; i < nListSize; i++) {
|
|
||||||
list[i] = mlistURLInfo.get(i).getUrl();
|
|
||||||
}
|
|
||||||
//final String[] list = (String[])mSetStringFavorite.toArray(new String[0]);
|
|
||||||
|
|
||||||
|
|
||||||
mListPopupWindow = new ListPopupWindow(mContext);
|
|
||||||
mListPopupWindow.setWidth(LayoutParams.WRAP_CONTENT);
|
|
||||||
mListPopupWindow.setHeight(LayoutParams.WRAP_CONTENT);
|
|
||||||
//listPopupWindow.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, list));//用android内置布局,或设计自己的样式
|
|
||||||
mListPopupWindow.setAdapter(new ArrayAdapter<String>(mContext, R.layout.view_popurllist, R.id.viewpopurllistTextView1, list));//用android内置布局,或设计自己的样式
|
|
||||||
//设置下拉列表基准控件
|
|
||||||
//LinearLayout llAnchorView = findViewById(R.id.activitytesturlLinearLayout2);
|
|
||||||
mListPopupWindow.setAnchorView(mllAnchorView);
|
|
||||||
mListPopupWindow.setModal(false);
|
|
||||||
// 透明度
|
|
||||||
//listPopupWindow.setBackgroundDrawable(new ColorDrawable(0xEEAAAAAA));
|
|
||||||
mListPopupWindow.setBackgroundDrawable(mContext.getDrawable(R.drawable.bg_shadow));
|
|
||||||
|
|
||||||
mListPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {//设置项点击监听
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
|
||||||
mURLAddressEditText.setText(list[i]);//展示选择的内容
|
|
||||||
postposesURL(list[i]);
|
|
||||||
updateFavoriteButtonStatus();
|
|
||||||
//setWebViewURL(list[i]);
|
|
||||||
mListPopupWindow.dismiss();//如果已经选择了,隐藏起来
|
|
||||||
mnRightImageViewTouchCount = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mListPopupWindow.setOnDismissListener(new PopupWindow.OnDismissListener(){
|
|
||||||
@Override
|
|
||||||
public void onDismiss() {
|
|
||||||
mIsListPopupWindow_OnShow = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
mIsListPopupWindow_OnShow = true;
|
|
||||||
mListPopupWindow.show();//下拉列表展示出来
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportHeight="108"
|
|
||||||
android:viewportWidth="108">
|
|
||||||
<path
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
|
||||||
android:strokeColor="#00000000"
|
|
||||||
android:strokeWidth="1">
|
|
||||||
<aapt:attr name="android:fillColor">
|
|
||||||
<gradient
|
|
||||||
android:endX="78.5885"
|
|
||||||
android:endY="90.9159"
|
|
||||||
android:startX="48.7653"
|
|
||||||
android:startY="61.0927"
|
|
||||||
android:type="linear">
|
|
||||||
<item
|
|
||||||
android:color="#44000000"
|
|
||||||
android:offset="0.0" />
|
|
||||||
<item
|
|
||||||
android:color="#00000000"
|
|
||||||
android:offset="1.0" />
|
|
||||||
</gradient>
|
|
||||||
</aapt:attr>
|
|
||||||
</path>
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFF"
|
|
||||||
android:fillType="nonZero"
|
|
||||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
|
||||||
android:strokeColor="#00000000"
|
|
||||||
android:strokeWidth="1" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
|
||||||
<!-- 阴影部分 -->
|
|
||||||
<!-- 个人觉得更形象的表达:top代表下边的阴影高度,left代表右边的阴影宽度。其实也就是相对应的offset,solid中的颜色是阴影的颜色,也可以设置角度等等 -->
|
|
||||||
<item
|
|
||||||
android:left="2dp"
|
|
||||||
android:top="2dp"
|
|
||||||
android:right="2dp"
|
|
||||||
android:bottom="2dp">
|
|
||||||
<shape android:shape="rectangle" >
|
|
||||||
<gradient
|
|
||||||
android:angle="270"
|
|
||||||
android:endColor="#0F000000"
|
|
||||||
android:startColor="#0F000000" />
|
|
||||||
<corners
|
|
||||||
android:bottomLeftRadius="6dip"
|
|
||||||
android:bottomRightRadius="6dip"
|
|
||||||
android:topLeftRadius="6dip"
|
|
||||||
android:topRightRadius="6dip" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
<!-- 背景部分 -->
|
|
||||||
<!-- 形象的表达:bottom代表背景部分在上边缘超出阴影的高度,right代表背景部分在左边超出阴影的宽度(相对应的offset) -->
|
|
||||||
<item
|
|
||||||
android:left="3dp"
|
|
||||||
android:top="3dp"
|
|
||||||
android:right="3dp"
|
|
||||||
android:bottom="5dp">
|
|
||||||
<shape android:shape="rectangle" >
|
|
||||||
<gradient
|
|
||||||
android:angle="270"
|
|
||||||
android:endColor="@color/colorAccent"
|
|
||||||
android:startColor="@color/colorAccent" />
|
|
||||||
<corners
|
|
||||||
android:bottomLeftRadius="6dip"
|
|
||||||
android:bottomRightRadius="6dip"
|
|
||||||
android:topLeftRadius="6dip"
|
|
||||||
android:topRightRadius="6dip" />
|
|
||||||
</shape>
|
|
||||||
</item>
|
|
||||||
</layer-list>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="?attr/colorAppTextColor"
|
|
||||||
android:pathData="M5.59,3.41L7,4.82L3.82,8L7,11.18L5.59,12.6L1,8L5.59,3.41M11.41,3.41L16,8L11.41,12.6L10,11.18L13.18,8L10,4.82L11.41,3.41M22,6V18C22,19.11 21.11,20 20,20H4C2.9,20 2,19.11 2,18V14H4V18H20V6H17.03V4H20C21.11,4 22,4.89 22,6Z"/>
|
|
||||||
|
|
||||||
</vector>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="@color/colorAppTextColor"
|
|
||||||
android:pathData="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z"/>
|
|
||||||
|
|
||||||
</vector>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="@color/colorAppTextColor"
|
|
||||||
android:pathData="M12,15.39L8.24,17.66L9.23,13.38L5.91,10.5L10.29,10.13L12,6.09L13.71,10.13L18.09,10.5L14.77,13.38L15.76,17.66M22,9.24L14.81,8.63L12,2L9.19,8.63L2,9.24L7.45,13.97L5.82,21L12,17.27L18.18,21L16.54,13.97L22,9.24Z"/>
|
|
||||||
|
|
||||||
</vector>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="?attr/colorAppTextColor"
|
|
||||||
android:pathData="M10,20H6V4H13V9H18V12.1L20,10.1V8L14,2H6C4.9,2 4,2.9 4,4V20C4,21.1 4.9,22 6,22H10V20M20.2,13C20.3,13 20.5,13.1 20.6,13.2L21.9,14.5C22.1,14.7 22.1,15.1 21.9,15.3L20.9,16.3L18.8,14.2L19.8,13.2C19.9,13.1 20,13 20.2,13M20.2,16.9L14.1,23H12V20.9L18.1,14.8L20.2,16.9Z"/>
|
|
||||||
|
|
||||||
</vector>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="@color/colorAppTextColor"
|
|
||||||
android:pathData="M17,5H20L18.5,7L17,5M3,2H21C22.11,2 23,2.9 23,4V8C23,9.11 22.11,10 21,10H16V20C16,21.11 15.11,22 14,22H3C1.9,22 1,21.11 1,20V4C1,2.9 1.9,2 3,2M3,4V8H14V4H3M21,8V4H16V8H21M3,20H14V10H3V20M5,12H12V14H5V12M5,16H12V18H5V16Z"/>
|
|
||||||
|
|
||||||
</vector>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:clickable="true">
|
|
||||||
<item android:drawable="@drawable/ic_launcher_background"/>
|
|
||||||
<item
|
|
||||||
android:left="15dp"
|
|
||||||
android:top="15dp"
|
|
||||||
android:right="15dp"
|
|
||||||
android:bottom="15dp"
|
|
||||||
android:drawable="@drawable/ic_launcher_foreground"/>
|
|
||||||
</layer-list>
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="108dp"
|
|
||||||
android:height="108dp"
|
|
||||||
android:viewportHeight="108"
|
|
||||||
android:viewportWidth="108">
|
|
||||||
<path
|
|
||||||
android:fillColor="@color/colorPrimary"
|
|
||||||
android:pathData="M0,0h108v108h-108z" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M9,0L9,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,0L19,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,0L29,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,0L39,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,0L49,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,0L59,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,0L69,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,0L79,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M89,0L89,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M99,0L99,108"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,9L108,9"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,19L108,19"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,29L108,29"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,39L108,39"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,49L108,49"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,59L108,59"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,69L108,69"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,79L108,79"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,89L108,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M0,99L108,99"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,29L89,29"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,39L89,39"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,49L89,49"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,59L89,59"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,69L89,69"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M19,79L89,79"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M29,19L29,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M39,19L39,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M49,19L49,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M59,19L59,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M69,19L69,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
<path
|
|
||||||
android:fillColor="#00000000"
|
|
||||||
android:pathData="M79,19L79,89"
|
|
||||||
android:strokeColor="#33FFFFFF"
|
|
||||||
android:strokeWidth="0.8" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="M16.61,15.15C16.15,15.15 15.77,14.78 15.77,14.32S16.15,13.5 16.61,13.5H16.61C17.07,13.5 17.45,13.86 17.45,14.32C17.45,14.78 17.07,15.15 16.61,15.15M7.41,15.15C6.95,15.15 6.57,14.78 6.57,14.32C6.57,13.86 6.95,13.5 7.41,13.5H7.41C7.87,13.5 8.24,13.86 8.24,14.32C8.24,14.78 7.87,15.15 7.41,15.15M16.91,10.14L18.58,7.26C18.67,7.09 18.61,6.88 18.45,6.79C18.28,6.69 18.07,6.75 18,6.92L16.29,9.83C14.95,9.22 13.5,8.9 12,8.91C10.47,8.91 9,9.24 7.73,9.82L6.04,6.91C5.95,6.74 5.74,6.68 5.57,6.78C5.4,6.87 5.35,7.08 5.44,7.25L7.1,10.13C4.25,11.69 2.29,14.58 2,18H22C21.72,14.59 19.77,11.7 16.91,10.14H16.91Z"/>
|
|
||||||
</vector>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0,0 0,12 22A10,10 0,0 0,22 12A10,10 0,0 0,12 2Z"/>
|
|
||||||
</vector>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:viewportWidth="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="?attr/colorAppTextColor"
|
|
||||||
android:pathData="M16.36,14C16.44,13.34 16.5,12.68 16.5,12C16.5,11.32 16.44,10.66 16.36,10H19.74C19.9,10.64 20,11.31 20,12C20,12.69 19.9,13.36 19.74,14M14.59,19.56C15.19,18.45 15.65,17.25 15.97,16H18.92C17.96,17.65 16.43,18.93 14.59,19.56M14.34,14H9.66C9.56,13.34 9.5,12.68 9.5,12C9.5,11.32 9.56,10.65 9.66,10H14.34C14.43,10.65 14.5,11.32 14.5,12C14.5,12.68 14.43,13.34 14.34,14M12,19.96C11.17,18.76 10.5,17.43 10.09,16H13.91C13.5,17.43 12.83,18.76 12,19.96M8,8H5.08C6.03,6.34 7.57,5.06 9.4,4.44C8.8,5.55 8.35,6.75 8,8M5.08,16H8C8.35,17.25 8.8,18.45 9.4,19.56C7.57,18.93 6.03,17.65 5.08,16M4.26,14C4.1,13.36 4,12.69 4,12C4,11.31 4.1,10.64 4.26,10H7.64C7.56,10.66 7.5,11.32 7.5,12C7.5,12.68 7.56,13.34 7.64,14M12,4.03C12.83,5.23 13.5,6.57 13.91,8H10.09C10.5,6.57 11.17,5.23 12,4.03M18.92,8H15.97C15.65,6.75 15.19,5.55 14.59,4.44C16.43,5.07 17.96,6.34 18.92,8M12,2C6.47,2 2,6.5 2,12A10,10 0,0 0,12 22A10,10 0,0 0,22 12A10,10 0,0 0,12 2Z"/>
|
|
||||||
|
|
||||||
</vector>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:clickable="true">
|
|
||||||
<item
|
|
||||||
android:left="24dp"
|
|
||||||
android:top="24dp"
|
|
||||||
android:right="24dp"
|
|
||||||
android:bottom="24dp"
|
|
||||||
android:drawable="@drawable/ic_launcher_foreground_web_white"/>
|
|
||||||
</layer-list>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<gradient
|
|
||||||
android:angle="180"
|
|
||||||
android:endColor="#FFFFFFFF"
|
|
||||||
android:startColor="#FFFFFFFF"
|
|
||||||
android:type="linear" />
|
|
||||||
|
|
||||||
<corners android:radius="10dp" />
|
|
||||||
</shape>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/activityaboutToolbar1"/>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<!--<cc.winboll.studio.shared.view.AboutView
|
|
||||||
app:appname="WebPageSource"
|
|
||||||
app:appprojectname="WebPageSource"
|
|
||||||
app:appdescription="一个简单的网站浏览器。"
|
|
||||||
app:appicon="@drawable/ic_winboll"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:id="@+id/activityaboutAboutView1"/>-->
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/toolbar"/>
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1.0">
|
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:id="@+id/activitymainFrameLayout1"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<cc.winboll.studio.webpagesources.view.StatusBarView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="36dp"
|
|
||||||
android:id="@+id/activitymainStatusBarView1"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:paddingLeft="20dp"
|
|
||||||
android:paddingRight="20dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="User Name :"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:ems="10"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/viewloginhttpEditText1"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Password :"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:ems="10"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/viewloginhttpEditText2"
|
|
||||||
android:inputType="textPassword"/>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/dialogloginauthRecyclerView1"
|
|
||||||
android:background="@drawable/bg_shadow"
|
|
||||||
android:padding="10dp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:inputType="textMultiLine"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:ems="10"
|
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:background="#FFEBEBEB"
|
|
||||||
android:id="@+id/fragmentsourcesEditText1"
|
|
||||||
android:gravity="top"
|
|
||||||
android:padding="10dp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/fragmentwebLinearLayout1">
|
|
||||||
|
|
||||||
<cc.winboll.studio.webpagesources.view.URLAddressView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1.0"
|
|
||||||
android:id="@+id/fragmentwebURLAddressView1"/>
|
|
||||||
|
|
||||||
<cc.winboll.studio.libaes.views.AButton
|
|
||||||
style="@style/NormalButtonStyle"
|
|
||||||
android:text="⇦"
|
|
||||||
android:id="@+id/fragmentwebAButton1"/>
|
|
||||||
|
|
||||||
<cc.winboll.studio.libaes.views.AButton
|
|
||||||
style="@style/NormalButtonStyle"
|
|
||||||
android:text="⇨"
|
|
||||||
android:id="@+id/fragmentwebAButton2"/>
|
|
||||||
|
|
||||||
<cc.winboll.studio.libaes.views.AButton
|
|
||||||
style="@style/NormalButtonStyle"
|
|
||||||
android:text="↺"
|
|
||||||
android:id="@+id/fragmentwebAButton3"/>
|
|
||||||
|
|
||||||
<cc.winboll.studio.libaes.views.AButton
|
|
||||||
style="@style/NormalButtonStyle"
|
|
||||||
android:text="×"
|
|
||||||
android:id="@+id/fragmentwebAButton4"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<com.baoyz.widget.PullRefreshLayout
|
|
||||||
android:id="@+id/fragmentwebPullRefreshLayout1"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="1.0">
|
|
||||||
|
|
||||||
<cc.winboll.studio.webpagesources.common.BaseWebView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:id="@+id/fragmentwebBaseWebView1"/>
|
|
||||||
|
|
||||||
</com.baoyz.widget.PullRefreshLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:background="?attr/colorAccent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/item_longclicked_copylink"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Copy Link"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:padding="15dp"/>
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:background="#55555555"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/item_longclicked_downloadlink"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Download Link"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:padding="15dp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.cardview.widget.CardView
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:cardBackgroundColor="#F5F5F5"
|
|
||||||
app:cardElevation="4dp"
|
|
||||||
app:cardCornerRadius="4dp"
|
|
||||||
android:id="@+id/listviewauthinfoCardView1"
|
|
||||||
android:layout_marginLeft="10dp"
|
|
||||||
android:layout_marginRight="10dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Text"
|
|
||||||
android:id="@+id/viewitemauthinfoTextView1"
|
|
||||||
android:padding="5dp"/>
|
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
|
||||||
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="6dp"
|
|
||||||
android:paddingRight="6dp"
|
|
||||||
android:background="@drawable/bg_shadow">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Text"
|
|
||||||
android:id="@+id/viewpopurllistTextView1"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:padding="6dp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:background="#FFCCCCCC">
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Text"
|
|
||||||
android:id="@+id/tv_message"
|
|
||||||
android:textIsSelectable="true"/>
|
|
||||||
|
|
||||||
</ScrollView>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@drawable/shape_gradient"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:padding="10dp">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:src="@drawable/ic_launcher"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/message"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:textColor="#FF000000"
|
|
||||||
android:textSize="16sp"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:id="@+id/viewurladdressLinearLayout1">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="35dp"
|
|
||||||
android:layout_height="35dp"
|
|
||||||
android:background="@drawable/ic_favorite_outline"
|
|
||||||
android:id="@+id/viewurladdressImageView1"/>
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:ems="10"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/viewurladdressEditText1"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:layout_weight="1.0"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="35dp"
|
|
||||||
android:layout_height="35dp"
|
|
||||||
android:background="@drawable/ic_form_dropdown"
|
|
||||||
android:id="@+id/viewurladdressImageView2"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_help"
|
|
||||||
android:title="HELP"
|
|
||||||
android:icon="@drawable/ic_winboll"
|
|
||||||
app:showAsAction="ifRoom"/>
|
|
||||||
|
|
||||||
</menu>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_delete_authinfo"
|
|
||||||
android:title="删除密码"/>
|
|
||||||
|
|
||||||
</menu>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_web"
|
|
||||||
android:title="Web"
|
|
||||||
android:icon="@drawable/ic_web"
|
|
||||||
app:showAsAction="ifRoom"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_sources"
|
|
||||||
android:title="Sources"
|
|
||||||
android:icon="@drawable/ic_code_block_html"
|
|
||||||
app:showAsAction="ifRoom"/>
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_editor"
|
|
||||||
android:title="Editor"
|
|
||||||
android:icon="@drawable/ic_file_edit_outline"
|
|
||||||
app:showAsAction="ifRoom"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_log"
|
|
||||||
android:title="Log"
|
|
||||||
android:icon="@drawable/ic_winboll"
|
|
||||||
app:showAsAction="ifRoom"/>
|
|
||||||
<item
|
|
||||||
android:id="@+id/item_about"
|
|
||||||
android:title="About"
|
|
||||||
android:icon="@drawable/ic_winboll"
|
|
||||||
app:showAsAction="ifRoom"/>
|
|
||||||
</menu>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@drawable/ic_launcher_background" />
|
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
|
||||||
</adaptive-icon>
|
|
||||||
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 10 KiB |