去除support依赖

This commit is contained in:
ZhanGSKen 2025-03-18 08:32:17 +08:00
parent d3b12207e0
commit 8d9d308c68
35 changed files with 443 additions and 700 deletions

View File

@ -29,7 +29,7 @@ android {
// versionName
// build.gradle stageCount=0
// Gradle编译环境下合起来的 versionName "${versionName}.0"
versionName "9.4"
versionName "15.0"
if(true) {
versionName = genVersionName("${versionName}")
}
@ -41,38 +41,26 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}
dependencies {
api project(':libapputils')
api fileTree(dir: 'libs', include: ['*.jar'])
implementation 'cc.winboll.studio:libappbase:15.0.3'
// SSH
implementation 'com.jcraft:jsch:0.1.55'
// Html
implementation 'org.jsoup:jsoup:1.13.1'
//
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
//
implementation 'io.github.medyo:android-about-page:2.0.0'
//
implementation 'com.github.getActivity:ToastUtils:10.5'
//
implementation 'com.squareup.okhttp3:okhttp:4.4.1'
//implementation 'com.squareup.okhttp3:okhttp:4.4.1'
// Android
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
// Html
//implementation 'org.jsoup:jsoup:1.13.1'
implementation 'cc.winboll.studio:libappbase:2.1.5'
// SSH
//implementation 'com.jcraft:jsch:0.1.55'
//
//implementation 'io.github.medyo:android-about-page:2.0.0'
}

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sun Mar 09 09:34:24 HKT 2025
stageCount=5
#Tue Mar 18 00:30:41 GMT 2025
stageCount=0
libraryProject=libapputils
baseVersion=9.4
publishVersion=9.4.4
buildCount=0
baseBetaVersion=9.4.5
baseVersion=15.0
publishVersion=15.0.0
buildCount=6
baseBetaVersion=15.0.0

View File

@ -1,5 +1,7 @@
package cc.winboll.studio.apputils;
import cc.winboll.studio.apputils.R;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
@ -10,11 +12,10 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.apputils.R;
import android.widget.Toolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.libapputils.activities.AssetsHtmlActivity;
import cc.winboll.studio.libapputils.activities.LogActivity;
import cc.winboll.studio.libapputils.activities.QRCodeDecodeActivity;
@ -24,11 +25,10 @@ import cc.winboll.studio.libapputils.app.WinBollActivityManager;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.view.AboutView;
import cc.winboll.studio.libapputils.view.YesNoAlertDialog;
import com.hjq.toast.ToastUtils;
import java.util.List;
import java.util.Set;
final public class MainActivity extends AppCompatActivity implements IWinBollActivity {
final public class MainActivity extends Activity implements IWinBollActivity {
public static final String TAG = "MainActivity";
@ -38,7 +38,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
LogView mLogView;
@Override
public AppCompatActivity getActivity() {
public Activity getActivity() {
return this;
}
@ -91,12 +91,12 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
// 初始化工具栏
mToolbar = findViewById(R.id.activitymainToolbar1);
setSupportActionBar(mToolbar);
setActionBar(mToolbar);
if (isEnableDisplayHomeAsUp()) {
// 显示后退按钮
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setDisplayHomeAsUpEnabled(true);
}
getSupportActionBar().setSubtitle(getTag());
getActionBar().setSubtitle(getTag());
checkResolveActivity();
archiveInstance();
@ -281,7 +281,7 @@ final public class MainActivity extends AppCompatActivity implements IWinBollAct
WinBollActivityManager.getInstance(this).startWinBollActivity(this, LogActivity.class);
return true;
} else if (item.getItemId() == R.id.item_exitdebug) {
AboutView.setApp2NormalMode(this);
//AboutView.setApp2NormalMode(this);
return true;
} else if (item.getItemId() == android.R.id.home) {
WinBollActivityManager.getInstance(this).finish(this);

View File

@ -1,24 +1,25 @@
package cc.winboll.studio.apputils;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.view.StringToQrCodeView;
/**
* @Author ZhanGSKen@QQ.COM
* @Date 2025/01/17 19:50:46
*/
public class TestStringToQrCodeViewActivity extends AppCompatActivity implements IWinBollActivity {
import cc.winboll.studio.apputils.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Toolbar;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.view.StringToQrCodeView;
public class TestStringToQrCodeViewActivity extends Activity implements IWinBollActivity {
public static final String TAG = "TestStringToQrCodeViewActivity";
StringToQrCodeView mStringToQrCodeView;
@Override
public AppCompatActivity getActivity() {
public Activity getActivity() {
return this;
}

View File

@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activitymainToolbar1"/>

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activityteststringtoqrcodeviewToolbar1"/>

View File

@ -7,7 +7,7 @@
android:layout_height="match_parent"
android:background="#FF36B5B3">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activitytestwinbollToolbar1"/>

View File

@ -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>

View File

@ -3,14 +3,11 @@
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/item_testwinboll"
android:title="TestWinBollActivity"
app:showAsAction="ifRoom"/>
android:title="TestWinBollActivity"/>
<item
android:id="@+id/item_teststringtoqrcodeview"
android:title="TestStringToQrCodeViewActivity"
app:showAsAction="ifRoom"/>
android:title="TestStringToQrCodeViewActivity"/>
<item
android:id="@+id/item_testqrcodedecodeactivity"
android:title="TestQRCodeDecodeActivity"
app:showAsAction="ifRoom"/>
android:title="TestQRCodeDecodeActivity"/>
</menu>

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyAppTheme" parent="APPBaseTheme">
<item name="attrColorPrimary">@color/colorPrimary</item>
<item name="themeGlobalCrashActivity">@style/MyGlobalCrashActivityTheme</item>
</style>
<style name="GlobalCrashActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="colorTittle">@color/colorAccent</item>
<item name="colorTittleBackgound">@color/colorPrimary</item>
<item name="colorText">@color/colorAccent</item>
<item name="colorTextBackgound">@color/colorPrimaryDark</item>
<style name="MyGlobalCrashActivityTheme" parent="GlobalCrashActivityTheme">
<item name="colorTittle">#FFFFFFFF</item>
<item name="colorTittleBackgound">#FF00A4B3</item>
<item name="colorText">#FFFFFFFF</item>
<item name="colorTextBackgound">#FF000000</item>
</style>
</resources>

View File

@ -21,28 +21,18 @@ android {
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
implementation 'cc.winboll.studio:libappbase:15.0.3'
// SSH
implementation 'com.jcraft:jsch:0.1.55'
// Html
implementation 'org.jsoup:jsoup:1.13.1'
//
implementation 'com.google.zxing:core:3.4.1'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
//
implementation 'io.github.medyo:android-about-page:2.0.0'
//
implementation 'com.github.getActivity:ToastUtils:10.5'
//
implementation 'com.squareup.okhttp3:okhttp:4.4.1'
//implementation 'com.squareup.okhttp3:okhttp:4.4.1'
// Android
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.viewpager:viewpager:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.fragment:fragment:1.1.0'
implementation 'com.google.android.material:material:1.4.0'
// Html
//implementation 'org.jsoup:jsoup:1.13.1'
implementation 'cc.winboll.studio:libappbase:2.1.5'
// SSH
//implementation 'com.jcraft:jsch:0.1.55'
}

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Sun Mar 09 09:34:16 HKT 2025
stageCount=5
#Tue Mar 18 00:30:41 GMT 2025
stageCount=0
libraryProject=libapputils
baseVersion=9.4
publishVersion=9.4.4
buildCount=0
baseBetaVersion=9.4.5
baseVersion=15.0
publishVersion=15.0.0
buildCount=6
baseBetaVersion=15.0.0

View File

@ -5,20 +5,20 @@ package cc.winboll.studio.libapputils.activities;
* @Date 2024/07/14 13:20:33
* @Describe 应用介绍页
*/
import cc.winboll.studio.libapputils.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.LinearLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libapputils.R;
import android.widget.Toolbar;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.view.AboutView;
final public class AboutActivity extends AppCompatActivity implements IWinBollActivity {
final public class AboutActivity extends Activity implements IWinBollActivity {
public static final String TAG = "AboutActivity";
@ -28,7 +28,7 @@ final public class AboutActivity extends AppCompatActivity implements IWinBollAc
APPInfo mAPPInfo;
@Override
public AppCompatActivity getActivity() {
public Activity getActivity() {
return this;
}

View File

@ -5,23 +5,23 @@ package cc.winboll.studio.libapputils.activities;
* @Date 2025/01/03 11:02:49
* @Describe 一个可以浏览随 APP 附带的 Html 文档的窗口
*/
import cc.winboll.studio.libapputils.R;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.widget.Toolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libapputils.R;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.view.SimpleWebView;
import java.io.IOException;
import java.io.InputStream;
public class AssetsHtmlActivity extends AppCompatActivity implements IWinBollActivity {
public class AssetsHtmlActivity extends Activity implements IWinBollActivity {
public static final String TAG = "AssetsHtmlActivity";
@ -35,7 +35,7 @@ public class AssetsHtmlActivity extends AppCompatActivity implements IWinBollAct
String mszHtmlFileName;
@Override
public AppCompatActivity getActivity() {
public Activity getActivity() {
return this;
}

View File

@ -5,24 +5,23 @@ package cc.winboll.studio.libapputils.activities;
* @Date 2025/03/08 00:19:39
* @Describe LogActivity
*/
import cc.winboll.studio.libapputils.R;
import android.app.Activity;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import cc.winboll.studio.libappbase.GlobalApplication;
import android.widget.Toolbar;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libapputils.R;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.bean.APPInfo;
public class LogActivity extends AppCompatActivity implements IWinBollActivity {
public class LogActivity extends Activity implements IWinBollActivity {
public static final String TAG = "LogActivity";
LogView mLogView;
@Override
public AppCompatActivity getActivity() {
public Activity getActivity() {
return this;
}

View File

@ -5,15 +5,13 @@ package cc.winboll.studio.libapputils.activities;
* @Date 2025/01/18 10:32:21
* @Describe 二维码扫码解码窗口
*/
import cc.winboll.studio.libapputils.R;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import cc.winboll.studio.libapputils.R;
import android.widget.Toolbar;
import cc.winboll.studio.libapputils.app.IWinBollActivity;
import cc.winboll.studio.libapputils.bean.APPInfo;
import com.google.zxing.ResultPoint;
@ -22,7 +20,7 @@ import com.journeyapps.barcodescanner.BarcodeResult;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
import java.util.List;
public class QRCodeDecodeActivity extends AppCompatActivity implements IWinBollActivity {
public class QRCodeDecodeActivity extends Activity implements IWinBollActivity {
public static final String TAG = "QRCodeDecodeActivity";
@ -33,7 +31,7 @@ public class QRCodeDecodeActivity extends AppCompatActivity implements IWinBollA
DecoratedBarcodeView barcodeView;
@Override
public AppCompatActivity getActivity() {
public Activity getActivity() {
return this;
}
@ -70,14 +68,15 @@ public class QRCodeDecodeActivity extends AppCompatActivity implements IWinBollA
resultTextView = findViewById(R.id.activityqrcodedecodeTextView1);
barcodeView = findViewById(R.id.activityqrcodedecodeDecoratedBarcodeView1);
// 请求相机权限
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this,
new String[]{android.Manifest.permission.CAMERA},
REQUEST_CAMERA_PERMISSION);
} else {
// if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
// != PackageManager.PERMISSION_GRANTED) {
// ActivityCompat.requestPermissions(this,
// new String[]{android.Manifest.permission.CAMERA},
// REQUEST_CAMERA_PERMISSION);
// } else {
// startScanning();
// }
startScanning();
}
}

View File

@ -5,8 +5,8 @@ package cc.winboll.studio.libapputils.app;
* @Date 2025/03/08 00:15:36
* @Describe WinBoll 活动窗口通用接口
*/
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.app.Activity;
import android.widget.Toolbar;
import cc.winboll.studio.libapputils.bean.APPInfo;
public interface IWinBollActivity {
@ -14,7 +14,7 @@ public interface IWinBollActivity {
public static final String TAG = "IWinBollActivity";
// 获取当前具有 IWinBoll 特征的 AppCompatActivity 活动窗口
abstract public AppCompatActivity getActivity();
abstract public Activity getActivity();
abstract public APPInfo getAppInfo();
abstract public String getTag();
abstract public Toolbar initToolBar();

View File

@ -9,7 +9,7 @@ import android.app.Application;
import android.content.Intent;
import android.os.Bundle;
import cc.winboll.studio.libappbase.LogUtils;
import com.hjq.toast.ToastUtils;
import cc.winboll.studio.libappbase.utils.ToastUtils;
public class MyActivityLifecycleCallbacks implements Application.ActivityLifecycleCallbacks {

View File

@ -9,9 +9,9 @@ package cc.winboll.studio.libapputils.app;
* https://blog.csdn.net/qq_29364417/article/details/109379915?app_version=6.4.2&code=app_1562916241&csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22%3A%22109379915%22%2C%22source%22%3A%22weixin_38986226%22%7D&uLinkId=usr1mkqgl919blen&utm_source=app
*/
import android.app.ActivityManager;
import android.app.TaskStackBuilder;
import android.content.Context;
import android.content.Intent;
import androidx.core.app.TaskStackBuilder;
import cc.winboll.studio.libappbase.LogUtils;
import java.util.HashMap;
import java.util.Iterator;

View File

@ -8,8 +8,8 @@ import android.content.ServiceConnection;
import android.graphics.drawable.Drawable;
import android.os.IBinder;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.libapputils.util.ServiceUtils;
import com.hjq.toast.ToastUtils;
/**
* @Author ZhanGSKen@QQ.COM

View File

@ -9,7 +9,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
import android.net.Uri;
import androidx.core.content.FileProvider;
import cc.winboll.studio.libappbase.LogUtils;
import java.io.File;
import java.io.FileInputStream;
@ -23,6 +22,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import android.support.v4.content.FileProvider;
public class FileUtils {

View File

@ -5,6 +5,7 @@ package cc.winboll.studio.libapputils.view;
* @Date 2024/08/12 14:38:03
* @Describe AboutView
*/
import cc.winboll.studio.libapputils.R;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
@ -18,22 +19,19 @@ import android.widget.EditText;
import android.widget.LinearLayout;
import cc.winboll.studio.libappbase.GlobalApplication;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libapputils.R;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.libapputils.app.AppVersionUtils;
import cc.winboll.studio.libapputils.app.WinBollActivityManager;
import cc.winboll.studio.libapputils.bean.APPInfo;
import cc.winboll.studio.libapputils.bean.DebugBean;
import cc.winboll.studio.libapputils.util.PrefUtils;
import com.hjq.toast.ToastUtils;
import java.io.IOException;
import mehdi.sakout.aboutpage.AboutPage;
import mehdi.sakout.aboutpage.Element;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.Credentials;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
//import okhttp3.Call;
//import okhttp3.Callback;
//import okhttp3.Credentials;
//import okhttp3.OkHttpClient;
//import okhttp3.Request;
//import okhttp3.Response;
public class AboutView extends LinearLayout {
@ -45,7 +43,7 @@ public class AboutView extends LinearLayout {
APPInfo mAPPInfo;
WinBollServiceStatusView mWinBollServiceStatusView;
OnRequestDevUserInfoAutofillListener mOnRequestDevUserInfoAutofillListener;
//OnRequestDevUserInfoAutofillListener mOnRequestDevUserInfoAutofillListener;
String mszAppName = "";
String mszAppAPKFolderName = "";
String mszAppAPKName = "";
@ -97,57 +95,58 @@ public class AboutView extends LinearLayout {
typedArray.recycle();
return appInfo;
}
void initView(Context context) {}
void initView(Context context) {
mszAppName = mAPPInfo.getAppName();
mszAppAPKFolderName = mAPPInfo.getAppAPKFolderName();
mszAppAPKName = mAPPInfo.getAppAPKName();
mszAppGitName = mAPPInfo.getAppGitName();
mszAppDescription = mAPPInfo.getAppDescription();
mnAppIcon = mAPPInfo.getAppIcon();
mszWinBollServerHost = GlobalApplication.isDebuging() ? "https://dev.winboll.cc": "https://www.winboll.cc";
try {
mszAppVersionName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
mszCurrentAppPackageName = mszAppAPKName + "_" + mszAppVersionName + ".apk";
mszHomePage = mszWinBollServerHost + "/studio/details.php?app=" + mszAppAPKFolderName;
if(mAPPInfo.getAppGitAPPBranch().equals("")) {
mszGitea = "https://gitea.winboll.cc/" + mAPPInfo.getAppGitOwner() + "/" + mszAppGitName;
} else {
mszGitea = "https://gitea.winboll.cc/" + mAPPInfo.getAppGitOwner() + "/" + mszAppGitName + "/src/branch/" + mAPPInfo.getAppGitAPPBranch() + "/" + mAPPInfo.getAppGitAPPSubProjectFolder();
}
if (GlobalApplication.isDebuging()) {
LayoutInflater inflater = LayoutInflater.from(mContext);
View addedView = inflater.inflate(R.layout.view_about_dev, this, false);
LinearLayout llMain = addedView.findViewById(R.id.viewaboutdevLinearLayout1);
metDevUserName = addedView.findViewById(R.id.viewaboutdevEditText1);
metDevUserPassword = addedView.findViewById(R.id.viewaboutdevEditText2);
metDevUserName.setText(PrefUtils.getString(mContext, "metDevUserName", ""));
metDevUserPassword.setText(PrefUtils.getString(mContext, "metDevUserPassword", ""));
//mDevelopHostConnectionStatusView = new DevelopHostConnectionStatusView(context);
mWinBollServiceStatusView = addedView.findViewById(R.id.viewaboutdevWinBollServiceStatusView1);
mWinBollServiceStatusView.setServerHost(mszWinBollServerHost);
mWinBollServiceStatusView.setAuthInfo(metDevUserName.getText().toString(), metDevUserPassword.getText().toString());
//llMain.addView(mDevelopHostConnectionStatusView);
llMain.addView(createAboutPage());
addView(addedView);
} else {
LayoutInflater inflater = LayoutInflater.from(mContext);
View addedView = inflater.inflate(R.layout.view_about_www, this, false);
LinearLayout llMain = addedView.findViewById(R.id.viewaboutwwwLinearLayout1);
//mDevelopHostConnectionStatusView = new DevelopHostConnectionStatusView(context);
mWinBollServiceStatusView = addedView.findViewById(R.id.viewaboutwwwWinBollServiceStatusView1);
mWinBollServiceStatusView.setServerHost(mszWinBollServerHost);
mWinBollServiceStatusView.setAuthInfo("", "");
//llMain.addView(mDevelopHostConnectionStatusView);
llMain.addView(createAboutPage());
addView(addedView);
}
// void initView(Context context) {
// mszAppName = mAPPInfo.getAppName();
// mszAppAPKFolderName = mAPPInfo.getAppAPKFolderName();
// mszAppAPKName = mAPPInfo.getAppAPKName();
// mszAppGitName = mAPPInfo.getAppGitName();
// mszAppDescription = mAPPInfo.getAppDescription();
// mnAppIcon = mAPPInfo.getAppIcon();
//
// mszWinBollServerHost = GlobalApplication.isDebuging() ? "https://dev.winboll.cc": "https://www.winboll.cc";
//
// try {
// mszAppVersionName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;
// } catch (PackageManager.NameNotFoundException e) {
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
// }
// mszCurrentAppPackageName = mszAppAPKName + "_" + mszAppVersionName + ".apk";
// mszHomePage = mszWinBollServerHost + "/studio/details.php?app=" + mszAppAPKFolderName;
// if(mAPPInfo.getAppGitAPPBranch().equals("")) {
// mszGitea = "https://gitea.winboll.cc/" + mAPPInfo.getAppGitOwner() + "/" + mszAppGitName;
// } else {
// mszGitea = "https://gitea.winboll.cc/" + mAPPInfo.getAppGitOwner() + "/" + mszAppGitName + "/src/branch/" + mAPPInfo.getAppGitAPPBranch() + "/" + mAPPInfo.getAppGitAPPSubProjectFolder();
//}
//
// if (GlobalApplication.isDebuging()) {
// LayoutInflater inflater = LayoutInflater.from(mContext);
// View addedView = inflater.inflate(R.layout.view_about_dev, this, false);
// LinearLayout llMain = addedView.findViewById(R.id.viewaboutdevLinearLayout1);
// metDevUserName = addedView.findViewById(R.id.viewaboutdevEditText1);
// metDevUserPassword = addedView.findViewById(R.id.viewaboutdevEditText2);
// metDevUserName.setText(PrefUtils.getString(mContext, "metDevUserName", ""));
// metDevUserPassword.setText(PrefUtils.getString(mContext, "metDevUserPassword", ""));
// //mDevelopHostConnectionStatusView = new DevelopHostConnectionStatusView(context);
// mWinBollServiceStatusView = addedView.findViewById(R.id.viewaboutdevWinBollServiceStatusView1);
// mWinBollServiceStatusView.setServerHost(mszWinBollServerHost);
// mWinBollServiceStatusView.setAuthInfo(metDevUserName.getText().toString(), metDevUserPassword.getText().toString());
// //llMain.addView(mDevelopHostConnectionStatusView);
// llMain.addView(createAboutPage());
// addView(addedView);
// } else {
// LayoutInflater inflater = LayoutInflater.from(mContext);
// View addedView = inflater.inflate(R.layout.view_about_www, this, false);
// LinearLayout llMain = addedView.findViewById(R.id.viewaboutwwwLinearLayout1);
// //mDevelopHostConnectionStatusView = new DevelopHostConnectionStatusView(context);
// mWinBollServiceStatusView = addedView.findViewById(R.id.viewaboutwwwWinBollServiceStatusView1);
// mWinBollServiceStatusView.setServerHost(mszWinBollServerHost);
// mWinBollServiceStatusView.setAuthInfo("", "");
// //llMain.addView(mDevelopHostConnectionStatusView);
// llMain.addView(createAboutPage());
// addView(addedView);
// }
// 初始化标题栏
//setSubtitle(getContext().getString(R.string.text_about));
@ -165,225 +164,226 @@ public class AboutView extends LinearLayout {
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
// }
// mszReleaseAPKName = mszAppAPKName + "_" + szReleaseAppVersionName + ".apk";
}
// }
void initView(Context context, AttributeSet attrs) {
mAPPInfo = createAppInfo(context, attrs);
initView(context);
}
public static String subBetaSuffix(String input) {
if (input.endsWith(".beta")) {
return input.substring(0, input.length() - ".beta".length());
}
return input;
}
android.os.Handler mHandler = new android.os.Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case MSG_APPUPDATE_CHECKED : {
/*//检查当前应用包文件名是否是测试版如果是就忽略检查
if(mszCurrentAppPackageName.matches(".*_\\d+\\.\\d+\\.\\d+-beta.*\\.apk")) {
ToastUtils.show("APP is the beta Version. Version check ignore.");
return;
}*/
// if (!AppVersionUtils.isHasNewStageReleaseVersion(mszReleaseAPKName, mszNewestAppPackageName)) {
// ToastUtils.delayedShow("Current app is the newest.", 5000);
// public static String subBetaSuffix(String input) {
// if (input.endsWith(".beta")) {
// return input.substring(0, input.length() - ".beta".length());
// }
if (!AppVersionUtils.isHasNewVersion2(mszCurrentAppPackageName, mszNewestAppPackageName)) {
ToastUtils.delayedShow("Current app is the newest.", 5000);
} else {
String szMsg = "Current app is :\n[ " + mszCurrentAppPackageName
+ " ]\nThe last app is :\n[ " + mszNewestAppPackageName
+ " ]\nIs download the last app?";
YesNoAlertDialog.show(mContext, "Application Update Prompt", szMsg, mIsDownlaodUpdateListener);
}
break;
}
}
}
};
// return input;
// }
//
// android.os.Handler mHandler = new android.os.Handler() {
// @Override
// public void handleMessage(Message msg) {
// super.handleMessage(msg);
// switch (msg.what) {
// case MSG_APPUPDATE_CHECKED : {
// /*//检查当前应用包文件名是否是测试版如果是就忽略检查
// if(mszCurrentAppPackageName.matches(".*_\\d+\\.\\d+\\.\\d+-beta.*\\.apk")) {
// ToastUtils.show("APP is the beta Version. Version check ignore.");
// return;
// }*/
//
//// if (!AppVersionUtils.isHasNewStageReleaseVersion(mszReleaseAPKName, mszNewestAppPackageName)) {
//// ToastUtils.delayedShow("Current app is the newest.", 5000);
//// }
// if (!AppVersionUtils.isHasNewVersion2(mszCurrentAppPackageName, mszNewestAppPackageName)) {
// ToastUtils.show("Current app is the newest.");
// } else {
// String szMsg = "Current app is :\n[ " + mszCurrentAppPackageName
// + " ]\nThe last app is :\n[ " + mszNewestAppPackageName
// + " ]\nIs download the last app?";
// YesNoAlertDialog.show(mContext, "Application Update Prompt", szMsg, mIsDownlaodUpdateListener);
// }
// break;
// }
// }
// }
// };
protected View createAboutPage() {
// 定义应用调试按钮
//
Element elementAppMode;
if (GlobalApplication.isDebuging()) {
elementAppMode = new Element(mContext.getString(R.string.app_normal), R.drawable.ic_winboll);
elementAppMode.setOnClickListener(mAppNormalOnClickListener);
} else {
elementAppMode = new Element(mContext.getString(R.string.app_debug), R.drawable.ic_winboll);
elementAppMode.setOnClickListener(mAppDebugOnClickListener);
}
// 定义 GitWeb 按钮
//
Element elementGitWeb = new Element(mContext.getString(R.string.gitea_home), R.drawable.ic_winboll);
elementGitWeb.setOnClickListener(mGitWebOnClickListener);
// 定义检查更新按钮
//
Element elementAppUpdate = new Element(mContext.getString(R.string.app_update), R.drawable.ic_winboll);
elementAppUpdate.setOnClickListener(mAppUpdateOnClickListener);
// protected View createAboutPage() {
// // 定义应用调试按钮
// //
// Element elementAppMode;
// if (GlobalApplication.isDebuging()) {
// elementAppMode = new Element(mContext.getString(R.string.app_normal), R.drawable.ic_winboll);
// elementAppMode.setOnClickListener(mAppNormalOnClickListener);
// } else {
// elementAppMode = new Element(mContext.getString(R.string.app_debug), R.drawable.ic_winboll);
// elementAppMode.setOnClickListener(mAppDebugOnClickListener);
// }
// // 定义 GitWeb 按钮
// //
// Element elementGitWeb = new Element(mContext.getString(R.string.gitea_home), R.drawable.ic_winboll);
// elementGitWeb.setOnClickListener(mGitWebOnClickListener);
// // 定义检查更新按钮
// //
// Element elementAppUpdate = new Element(mContext.getString(R.string.app_update), R.drawable.ic_winboll);
// elementAppUpdate.setOnClickListener(mAppUpdateOnClickListener);
//
// String szAppInfo = "";
// try {
// szAppInfo = mszAppName + " "
// + mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName
// + "\n" + mszAppDescription;
// } catch (PackageManager.NameNotFoundException e) {
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
// }
// View aboutPage = new AboutPage(mContext)
// .setDescription(szAppInfo)
// //.isRTL(false)
// //.setCustomFont(String) // or Typeface
// .setImage(mnAppIcon)
// //.addItem(versionElement)
// //.addItem(adsElement)
// //.addGroup("Connect with us")
// .addEmail("ZhanGSKen@AliYun.Com")
// .addWebsite(mszHomePage)
// .addItem(elementAppMode)
// .addItem(elementGitWeb)
// .addItem(elementAppUpdate)
// //.addFacebook("the.medy")
// //.addTwitter("medyo80")
// //.addYoutube("UCdPQtdWIsg7_pi4mrRu46vA")
// //.addPlayStore("com.ideashower.readitlater.pro")
// //.addGitHub("medyo")
// //.addInstagram("medyo80")
// .create();
// return aboutPage;
// }
String szAppInfo = "";
try {
szAppInfo = mszAppName + " "
+ mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName
+ "\n" + mszAppDescription;
} catch (PackageManager.NameNotFoundException e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
View aboutPage = new AboutPage(mContext)
.setDescription(szAppInfo)
//.isRTL(false)
//.setCustomFont(String) // or Typeface
.setImage(mnAppIcon)
//.addItem(versionElement)
//.addItem(adsElement)
//.addGroup("Connect with us")
.addEmail("ZhanGSKen@AliYun.Com")
.addWebsite(mszHomePage)
.addItem(elementAppMode)
.addItem(elementGitWeb)
.addItem(elementAppUpdate)
//.addFacebook("the.medy")
//.addTwitter("medyo80")
//.addYoutube("UCdPQtdWIsg7_pi4mrRu46vA")
//.addPlayStore("com.ideashower.readitlater.pro")
//.addGitHub("medyo")
//.addInstagram("medyo80")
.create();
return aboutPage;
}
View.OnClickListener mAppDebugOnClickListener = new View.OnClickListener(){
@Override
public void onClick(View view) {
setApp2DebugMode(mContext);
}
};
View.OnClickListener mAppNormalOnClickListener = new View.OnClickListener(){
@Override
public void onClick(View view) {
setApp2NormalMode(mContext);
}
};
public static void setApp2DebugMode(Context context) {
Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
if (intent != null) {
intent.setAction(cc.winboll.studio.libapputils.intent.action.DEBUGVIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
GlobalApplication.setIsDebuging(context, true);
DebugBean.saveBean(context, new DebugBean(true));
WinBollActivityManager.getInstance(context).finishAll();
context.startActivity(intent);
}
}
public static void setApp2NormalMode(Context context) {
Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
if (intent != null) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
GlobalApplication.setIsDebuging(context, false);
DebugBean.saveBean(context, new DebugBean(false));
WinBollActivityManager.getInstance(context).finishAll();
context.startActivity(intent);
}
}
View.OnClickListener mGitWebOnClickListener = new View.OnClickListener(){
@Override
public void onClick(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(mszGitea));
mContext.startActivity(browserIntent);
}
};
View.OnClickListener mAppUpdateOnClickListener = new View.OnClickListener(){
@Override
public void onClick(View view) {
ToastUtils.show("Start app update checking.");
new Thread(new Runnable() {
@Override
public void run() {
String szUrl = mszWinBollServerHost + "/studio/details.php?app=" + mszAppAPKFolderName;
// 构建包含认证信息的请求
String credential = "";
if (GlobalApplication.isDebuging()) {
credential = Credentials.basic(metDevUserName.getText().toString(), metDevUserPassword.getText().toString());
PrefUtils.saveString(mContext, "metDevUserName", metDevUserName.getText().toString());
PrefUtils.saveString(mContext, "metDevUserPassword", metDevUserPassword.getText().toString());
}
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(szUrl)
.header("Accept", "text/plain") // 设置正确的Content-Type头
.header("Authorization", credential)
.build();
Call call = client.newCall(request);
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
// 处理网络请求失败
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
@Override
public void onResponse(Call call, Response response) throws IOException {
if (!response.isSuccessful()) {
LogUtils.d(TAG, "Unexpected code " + response, Thread.currentThread().getStackTrace());
return;
}
try {
// 读取响应体作为字符串注意这里可能需要解码
String text = response.body().string();
org.jsoup.nodes.Document doc = org.jsoup.Jsoup.parse(text);
LogUtils.v(TAG, doc.text());
// 使用id选择器找到具有特定id的元素
org.jsoup.nodes.Element elementWithId = doc.select("#LastRelease").first(); // 获取第一个匹配的元素
// 提取并打印元素的文本内容
mszNewestAppPackageName = elementWithId.text();
//ToastUtils.delayedShow(text + "\n" + mszNewestAppPackageName, 5000);
mHandler.sendMessage(mHandler.obtainMessage(MSG_APPUPDATE_CHECKED));
} catch (Exception e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
}
});
}
}).start();
}
};
YesNoAlertDialog.OnDialogResultListener mIsDownlaodUpdateListener = new YesNoAlertDialog.OnDialogResultListener() {
@Override
public void onYes() {
String szUrl = mszWinBollServerHost + "/studio/download.php?appname=" + mszAppAPKFolderName + "&apkname=" + mszNewestAppPackageName;
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(szUrl));
mContext.startActivity(browserIntent);
}
@Override
public void onNo() {
}
};
public interface OnRequestDevUserInfoAutofillListener {
void requestAutofill(EditText etDevUserName, EditText etDevUserPassword);
}
public void setOnRequestDevUserInfoAutofillListener(OnRequestDevUserInfoAutofillListener l) {
mOnRequestDevUserInfoAutofillListener = l;
}
// View.OnClickListener mAppDebugOnClickListener = new View.OnClickListener(){
// @Override
// public void onClick(View view) {
// setApp2DebugMode(mContext);
// }
// };
//
// View.OnClickListener mAppNormalOnClickListener = new View.OnClickListener(){
// @Override
// public void onClick(View view) {
// setApp2NormalMode(mContext);
// }
// };
//
// public static void setApp2DebugMode(Context context) {
// Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
// if (intent != null) {
// intent.setAction(cc.winboll.studio.libapputils.intent.action.DEBUGVIEW);
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// GlobalApplication.setIsDebuging(context, true);
// DebugBean.saveBean(context, new DebugBean(true));
//
// WinBollActivityManager.getInstance(context).finishAll();
// context.startActivity(intent);
// }
// }
//
// public static void setApp2NormalMode(Context context) {
// Intent intent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
// if (intent != null) {
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// GlobalApplication.setIsDebuging(context, false);
// DebugBean.saveBean(context, new DebugBean(false));
//
// WinBollActivityManager.getInstance(context).finishAll();
// context.startActivity(intent);
// }
// }
//
// View.OnClickListener mGitWebOnClickListener = new View.OnClickListener(){
// @Override
// public void onClick(View view) {
// Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(mszGitea));
// mContext.startActivity(browserIntent);
// }
// };
//
// View.OnClickListener mAppUpdateOnClickListener = new View.OnClickListener(){
// @Override
// public void onClick(View view) {
// ToastUtils.show("Start app update checking.");
// new Thread(new Runnable() {
// @Override
// public void run() {
// String szUrl = mszWinBollServerHost + "/studio/details.php?app=" + mszAppAPKFolderName;
// // 构建包含认证信息的请求
// String credential = "";
// if (GlobalApplication.isDebuging()) {
// credential = Credentials.basic(metDevUserName.getText().toString(), metDevUserPassword.getText().toString());
// PrefUtils.saveString(mContext, "metDevUserName", metDevUserName.getText().toString());
// PrefUtils.saveString(mContext, "metDevUserPassword", metDevUserPassword.getText().toString());
// }
// OkHttpClient client = new OkHttpClient();
// Request request = new Request.Builder()
// .url(szUrl)
// .header("Accept", "text/plain") // 设置正确的Content-Type头
// .header("Authorization", credential)
// .build();
// Call call = client.newCall(request);
// call.enqueue(new Callback() {
// @Override
// public void onFailure(Call call, IOException e) {
// // 处理网络请求失败
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
// }
//
// @Override
// public void onResponse(Call call, Response response) throws IOException {
// if (!response.isSuccessful()) {
// LogUtils.d(TAG, "Unexpected code " + response, Thread.currentThread().getStackTrace());
// return;
// }
//
// try {
// // 读取响应体作为字符串注意这里可能需要解码
// String text = response.body().string();
// org.jsoup.nodes.Document doc = org.jsoup.Jsoup.parse(text);
// LogUtils.v(TAG, doc.text());
//
// // 使用id选择器找到具有特定id的元素
// org.jsoup.nodes.Element elementWithId = doc.select("#LastRelease").first(); // 获取第一个匹配的元素
//
// // 提取并打印元素的文本内容
// mszNewestAppPackageName = elementWithId.text();
// //ToastUtils.delayedShow(text + "\n" + mszNewestAppPackageName, 5000);
//
// mHandler.sendMessage(mHandler.obtainMessage(MSG_APPUPDATE_CHECKED));
// } catch (Exception e) {
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
// }
// }
// });
// }
// }).start();
// }
// };
//
// YesNoAlertDialog.OnDialogResultListener mIsDownlaodUpdateListener = new YesNoAlertDialog.OnDialogResultListener() {
// @Override
// public void onYes() {
// String szUrl = mszWinBollServerHost + "/studio/download.php?appname=" + mszAppAPKFolderName + "&apkname=" + mszNewestAppPackageName;
// Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(szUrl));
// mContext.startActivity(browserIntent);
// }
//
// @Override
// public void onNo() {
// }
// };
//
// public interface OnRequestDevUserInfoAutofillListener {
// void requestAutofill(EditText etDevUserName, EditText etDevUserPassword);
// }
//
// public void setOnRequestDevUserInfoAutofillListener(OnRequestDevUserInfoAutofillListener l) {
// mOnRequestDevUserInfoAutofillListener = l;
// }
}

View File

@ -9,7 +9,6 @@ import android.content.Context;
import android.util.AttributeSet;
import android.webkit.WebSettings;
import android.webkit.WebView;
import com.hjq.toast.ToastUtils;
public class SimpleWebView extends WebView {

View File

@ -5,6 +5,7 @@ package cc.winboll.studio.libapputils.view;
* @Date 2024/12/19 13:49:14
* @Describe 把字符串转化为二维码的视图
*/
import cc.winboll.studio.libapputils.R;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
@ -13,12 +14,7 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import cc.winboll.studio.libapputils.R;
import cc.winboll.studio.libapputils.util.QRCodeGenerator;
import com.google.zxing.Result;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
public class StringToQrCodeView extends LinearLayout {

View File

@ -5,6 +5,7 @@ package cc.winboll.studio.libapputils.view;
* @Date 2024/12/07 20:15:47
* @Describe WinBoll 服务主机连接状态视图
*/
import cc.winboll.studio.libapputils.R;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@ -18,22 +19,20 @@ import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libapputils.R;
import cc.winboll.studio.libappbase.utils.ToastUtils;
import cc.winboll.studio.libapputils.service.IWinBollClientServiceBinder;
import cc.winboll.studio.libapputils.service.WinBollClientService;
import cc.winboll.studio.libapputils.service.WinBollClientServiceBean;
import com.hjq.toast.ToastUtils;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import okhttp3.Authenticator;
import okhttp3.Credentials;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.Route;
//import okhttp3.Authenticator;
//import okhttp3.Credentials;
//import okhttp3.OkHttpClient;
//import okhttp3.Request;
//import okhttp3.Response;
//import okhttp3.Route;
public class WinBollServiceStatusView extends LinearLayout {
@ -211,7 +210,7 @@ public class WinBollServiceStatusView extends LinearLayout {
void setImageViewByConnection(ImageView imageView, boolean isConnected) {
//mIsConnected = isConnected;
// 获取vector drawable
Drawable drawable = ContextCompat.getDrawable(mContext, isConnected ? R.drawable.ic_dev_connected : R.drawable.ic_dev_disconnected);
Drawable drawable = mContext.getDrawable(isConnected ? R.drawable.ic_dev_connected : R.drawable.ic_dev_disconnected);
if (drawable != null) {
imageView.setImageDrawable(drawable);
}
@ -222,49 +221,49 @@ public class WinBollServiceStatusView extends LinearLayout {
//String username = "your_username";
//String password = "your_password";
OkHttpClient client = new OkHttpClient.Builder()
.authenticator(new Authenticator() {
@Override
public Request authenticate(Route route, Response response) throws IOException {
String credential = Credentials.basic(username, password);
return response.request().newBuilder()
.header("Authorization", credential)
.build();
}
})
.build();
Request request = new Request.Builder()
.url(targetUrl) // 替换为实际要请求的网页地址
.build();
try {
Response response = client.newCall(request).execute();
if (response.isSuccessful()) {
//System.out.println(response.body().string());
//ToastUtils.show("Develop Host Connection IP is : " + response.body().string());
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 定义时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
// 按照指定格式格式化时间并输出
String formattedDateTime = now.format(formatter);
//System.out.println(formattedDateTime);
textViewHandler.postMessageText("ClientIP<" + formattedDateTime + ">: " + response.body().string());
textViewHandler.postMessageConnectionStatus(true);
} else {
String sz = "请求失败,状态码: " + response.code();
setImageViewByConnection(mImageView, false);
textViewHandler.postMessageText(sz);
textViewHandler.postMessageConnectionStatus(false);
LogUtils.d(TAG, sz);
}
} catch (IOException e) {
textViewHandler.postMessageText(e.getMessage());
textViewHandler.postMessageConnectionStatus(false);
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
// OkHttpClient client = new OkHttpClient.Builder()
// .authenticator(new Authenticator() {
// @Override
// public Request authenticate(Route route, Response response) throws IOException {
// String credential = Credentials.basic(username, password);
// return response.request().newBuilder()
// .header("Authorization", credential)
// .build();
// }
// })
// .build();
//
// Request request = new Request.Builder()
// .url(targetUrl) // 替换为实际要请求的网页地址
// .build();
//
// try {
// Response response = client.newCall(request).execute();
// if (response.isSuccessful()) {
// //System.out.println(response.body().string());
// //ToastUtils.show("Develop Host Connection IP is : " + response.body().string());
// // 获取当前时间
// LocalDateTime now = LocalDateTime.now();
//
// // 定义时间格式
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");
// // 按照指定格式格式化时间并输出
// String formattedDateTime = now.format(formatter);
// //System.out.println(formattedDateTime);
// textViewHandler.postMessageText("ClientIP<" + formattedDateTime + ">: " + response.body().string());
// textViewHandler.postMessageConnectionStatus(true);
// } else {
// String sz = "请求失败,状态码: " + response.code();
// setImageViewByConnection(mImageView, false);
// textViewHandler.postMessageText(sz);
// textViewHandler.postMessageConnectionStatus(false);
// LogUtils.d(TAG, sz);
// }
// } catch (IOException e) {
// textViewHandler.postMessageText(e.getMessage());
// textViewHandler.postMessageConnectionStatus(false);
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
// }
}
class WinBollServiceViewHandler extends Handler {

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activityaboutToolbar1"/>

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activityassetshtmlToolbar1"/>

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activityqrcodedecodeToolbar1"/>

View File

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF000000">
<RelativeLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:background="@drawable/bg_shadow"
android:id="@+id/viewlogRelativeLayoutToolbar">
<Button
android:layout_width="wrap_content"
android:layout_height="36dp"
android:text="Clean"
android:textSize="14dp"
android:layout_centerVertical="true"
android:id="@+id/viewlogButtonClean"
android:layout_marginLeft="5dp"/>
<TextView
android:background="#FF000000"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:text="LV:"
android:layout_toRightOf="@+id/viewlogButtonClean"
android:layout_centerVertical="true"
android:id="@+id/viewlogTextView1"
android:textColor="#FFFFFFFF"/>
<Spinner
android:background="#FFFFFFFF"
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_toRightOf="@+id/viewlogTextView1"
android:layout_centerVertical="true"
android:id="@+id/viewlogSpinner1"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_toLeftOf="@+id/viewlogButtonCopy"
android:layout_centerVertical="true"
android:text="Selectable"
android:background="#FFFFFFFF"
android:paddingRight="10dp"
android:textSize="16dp"
android:id="@+id/viewlogCheckBoxSelectable"/>
<Button
android:layout_width="wrap_content"
android:layout_height="36dp"
android:text="Copy"
android:layout_alignParentRight="true"
android:textSize="14dp"
android:layout_centerVertical="true"
android:id="@+id/viewlogButtonCopy"
android:layout_marginRight="5dp"/>
</RelativeLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/bg_shadow"
android:layout_below="@+id/viewlogRelativeLayoutToolbar"
android:id="@+id/viewlogLinearLayout1"
android:gravity="center_vertical">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ALL"
android:id="@+id/viewlogCheckBox1"/>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/view_border"
android:id="@+id/viewlogRecyclerView1"
android:layout_weight="1.0"
android:layout_marginRight="5dp"
android:padding="2dp"/>
</LinearLayout>
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:layout_alignParentBottom="true"
android:layout_below="@+id/viewlogLinearLayout1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF000000"
android:id="@+id/viewlogScrollViewLog">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Text"
android:textColor="#FF00FF00"
android:textIsSelectable="true"
android:id="@+id/viewlogTextViewLog"/>
</ScrollView>
</RelativeLayout>
</RelativeLayout>

View File

@ -1,33 +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="0dp"
android:layout_marginRight="5dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="24dp"
android:layout_marginLeft="5dp"
android:id="@+id/viewlogtagTextView1"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="24dp"
android:id="@+id/viewlogtagCheckBox1"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

View File

@ -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>

View File

@ -23,8 +23,7 @@
android:title="UnitTest"/>
<item
android:id="@+id/item_log"
android:title="APPLOG"
app:showAsAction="always"/>
android:title="APPLOG"/>
<item
android:id="@+id/item_info"
android:title="Info"/>

View File

@ -4,6 +4,5 @@
<item
android:id="@+id/item_help"
android:title="HELP"
android:icon="@drawable/winboll_help"
app:showAsAction="always"/>
android:icon="@drawable/winboll_help"/>
</menu>

View File

@ -4,11 +4,9 @@
<item
android:id="@+id/item_exit"
android:title="EXIT"
android:icon="@drawable/winboll_point"
app:showAsAction="always"/>
android:icon="@drawable/winboll_point"/>
<item
android:id="@+id/item_about"
android:title="About"
android:icon="@drawable/winboll_logo"
app:showAsAction="always"/>
android:icon="@drawable/winboll_logo"/>
</menu>

View File

@ -1,17 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="WinBoll.SupportThemeNoActionBar"/>
<style name="MyAppTheme" parent="APPBaseTheme">
<item name="attrColorPrimary">@color/colorPrimary</item>
<item name="themeGlobalCrashActivity">@style/MyGlobalCrashActivityTheme</item>
</style>
<style name="WinBoll.Theme" parent="@android:style/Theme.DeviceDefault.Light">
<!-- Customize your theme here. -->
</style>
<style name="WinBoll.SupportTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
</style>
<style name="WinBoll.ThemeNoActionBar" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
<style name="WinBoll.SupportThemeNoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<style name="MyGlobalCrashActivityTheme" parent="GlobalCrashActivityTheme">
<item name="colorTittle">#FFFFFFFF</item>
<item name="colorTittleBackgound">#FF00A4B3</item>
<item name="colorText">#FFFFFFFF</item>
<item name="colorTextBackgound">#FF000000</item>
</style>
</resources>