This commit is contained in:
2025-12-05 18:19:49 +08:00
commit 2a74fd2c30
1439 changed files with 94814 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
<?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 -->
</application>
</manifest>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">APPUtils+</string>
</resources>

View File

@@ -0,0 +1,48 @@
<?xml version='1.0' encoding='utf-8'?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="cc.winboll.studio.apputils">
<!-- 读取外部存储权限Android 10 以下) -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<application
android:name=".App"
android:allowBackup="true"
android:icon="@drawable/ic_winboll"
android:label="@string/app_name"
android:theme="@style/MyUtilsTheme"
android:supportsRtl="true"
android:resizeableActivity="true"
android:screenOrientation="unspecified"
android:requestLegacyExternalStorage="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:launchMode="singleTask"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".TestStringToQRCodeViewActivity"/>
<activity android:name=".TestBBMorseCodeActivity"/>
<activity android:name=".AssetsHtmlActivity"/>
<activity android:name=".QRCodeDecodeActivity"/>
<activity android:name=".QRGeneratorActivity"/>
</application>
</manifest>

View File

@@ -0,0 +1,20 @@
package cc.winboll.studio.apputils;
/**
* @Author ZhanGSKen<zhangsken@qq.com>
* @Date 2024/12/08 15:10:51
* @Describe 全局应用类
*/
import android.app.Application;
import android.content.Context;
import cc.winboll.studio.libappbase.GlobalApplication;
public class App extends GlobalApplication {
public static final String TAG = "App";
@Override
public void onCreate() {
super.onCreate();
}
}

View File

@@ -0,0 +1,135 @@
package cc.winboll.studio.apputils;
/**
* @Author ZhanGSKen<zhangsken@qq.com>
* @Date 2025/01/03 11:02:49
* @Describe 一个可以浏览随 APP 附带的 Html 文档的窗口
*/
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 android.widget.Toolbar;
import cc.winboll.studio.apputils.R;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libapputils.views.SimpleWebView;
import java.io.IOException;
import java.io.InputStream;
public class AssetsHtmlActivity extends Activity {
public static final String TAG = "AssetsHtmlActivity";
public static final String EXTRA_HTMLFILENAME = "EXTRA_HTMLFILENAME";
String mszHelpIndexFilePath = "";
Uri mszHelpIndexFileUri;
Context mContext;
// Assets 文件夹里的 Html 文件的名称
String mszHtmlFileName;
@Override
public boolean onCreateOptionsMenu(Menu menu) {
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// if (item.getItemId() == android.R.id.home) {
// WinBoLLActivityManager.getInstance(this).finish(this);
// }
return super.onOptionsItemSelected(item);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_assetshtml);
// 初始化工具栏
Toolbar mToolbar = findViewById(R.id.toolbar);
setActionBar(mToolbar);
mszHtmlFileName = "index.html";
Intent intent = getIntent();
if (intent != null) {
String szTemp = intent.getStringExtra(EXTRA_HTMLFILENAME);
if (szTemp != null && !szTemp.trim().equals("")) {
mszHtmlFileName = szTemp.trim();
}
//ToastUtils.show(mszHtmlFileName);
}
// 与其他应用分享 html 帮助
//FileUtils.shareHtmlFile(this, mszHelpIndexFilePath);
// 直接读取 assets 文件显示 WebView
//
initWebViewFromAssets(mszHtmlFileName);
// 复制 assets 文件到数据目录 files 后,
// 显示 WebView
//
// if (App.isDebug()) {
// initAssetsToSD();
// }
// MyWebView myWebView = findViewById(R.id.activityhelpMyWebView1);
// myWebView.getSettings().setSupportZoom(true);
//
// // 使用file协议加载本地HTML文件
// //Test OK //String url = "content://cc.winboll.studio.app.beta.fileprovider/files_path/winboll/studio/html/index.html";
// //myWebView.loadUrl(url);
//
// myWebView.loadUrl(mszHelpIndexFileUri.toString());
}
//
void initWebViewFromAssets(String szHtmlFileName) {
try {
SimpleWebView webView = findViewById(R.id.activityassetshtmlSimpleWebView1);
webView.getSettings().setSupportZoom(true);
// 读取assets文件夹下的index.html文件
InputStream inputStream = getAssets().open("winboll/studio/html/" + szHtmlFileName);
int size = inputStream.available();
byte[] buffer = new byte[size];
inputStream.read(buffer);
inputStream.close();
String html = new String(buffer);
webView.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);
} catch (IOException e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
}
}
// void initAssetsToSD() {
// String szHtmlFileName = "index.html";
// String szAssetsFilePath = "winboll/studio/html/" + szHtmlFileName;
// StringBuilder sbDst = new StringBuilder();
// sbDst.append(getFilesDir());
// sbDst.append(File.separator);
// sbDst.append("winboll");
// sbDst.append(File.separator);
// sbDst.append("studio");
// sbDst.append(File.separator);
// sbDst.append("html");
// sbDst.append(File.separator);
// File fDstFolder = new File(sbDst.toString());
// if (!fDstFolder.exists()) {
// fDstFolder.mkdirs();
// }
// File fDst = new File(fDstFolder, szHtmlFileName);
//
// mszHelpIndexFilePath = fDst.getPath();
// mszHelpIndexFileUri = FileProvider.getUriForFile(this, getPackageName() + ".fileprovider", fDst);
//
// FileUtils.copyAssetsToSD(this, szAssetsFilePath, mszHelpIndexFilePath);
//
// // 设置只读权限
// //fDst.setReadOnly();
// }
}

View File

@@ -0,0 +1,311 @@
package cc.winboll.studio.apputils;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import android.widget.Toolbar;
import cc.winboll.studio.apputils.R;
import cc.winboll.studio.libappbase.LogUtils;
import cc.winboll.studio.libappbase.LogView;
import cc.winboll.studio.libappbase.ToastUtils;
import java.util.List;
import java.util.Set;
import cc.winboll.studio.libappbase.LogActivity;
final public class MainActivity extends Activity {
public static final String TAG = "MainActivity";
public static final int REQUEST_QRCODEDECODE_ACTIVITY = 0;
Toolbar mToolbar;
//LogView mLogView;
//
// @Override
// public Activity getActivity() {
// return this;
// }
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// mLogView = findViewById(R.id.logview);
// mLogView.start();
// 初始化工具栏
mToolbar = findViewById(R.id.toolbar);
setActionBar(mToolbar);
// if (isEnableDisplayHomeAsUp()) {
// // 显示后退按钮
// getActionBar().setDisplayHomeAsUpEnabled(true);
// }
// getActionBar().setSubtitle(getTag());
checkResolveActivity();
archiveInstance();
// 接收并处理 Intent 数据,函数 Intent 处理接收就直接返回
//if (prosessIntents(getIntent())) return;
// 以下正常创建主窗口
// // 设置 WinBoLL 应用 UI 类型
// WinBoLLApplication.setWinBoLLUI_TYPE(WinBoLLApplication.WinBoLLUI_TYPE.Aplication);
// //ToastUtils.show("WinBoLLUI_TYPE " + WinBoLLApplication.getWinBoLLUI_TYPE());
// LogUtils.d(TAG, "BuildConfig.DEBUG : " + Boolean.toString(BuildConfig.DEBUG));
}
boolean checkResolveActivity() {
PackageManager packageManager = getPackageManager();
//Intent intent = new Intent("your_action_here");
Intent intent = getIntent();
if (intent != null) {
List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (resolveInfoList.size() > 0) {
// 传入的Intent action在Activity清单的intent-filter的action节点里有定义
if (intent.getAction() != null) {
// if (intent.getAction().equals(cc.winboll.studio.libapputils.intent.action.DEBUGVIEW)) {
// App.setIsDebug(true);
// //ToastUtils.show!("WinBoLLApplication.setIsDebug(true) by action : " + intent.getAction());
//
// }
}
return true;
} else {
// 传入的Intent action在Activity清单的intent-filter的action节点里没有定义
//ToastUtils.show("false : " + intent.getAction());
return false;
}
}
// action在清单文件中没有声明
ToastUtils.show("false");
return false;
}
void archiveInstance() {
Intent intent = getIntent();
StringBuilder sb = new StringBuilder("\n### Archive Instance ###\n");
if (intent != null) {
ComponentName componentName = intent.getComponent();
if (componentName != null) {
String packageName = componentName.getPackageName();
//Log.d("AppStarter", "启动本应用的应用包名: " + packageName);
sb.append("启动本应用的应用包名: \n" + packageName);
}
sb.append("\nImplicit Intent Tracker \n接收到的 Intent 动作: \n" + intent.getAction());
Set<String> categories = intent.getCategories();
if (categories != null) {
for (String category : categories) {
sb.append("\n接收到的 Intent 类别 :\n" + category);
}
}
Uri data = intent.getData();
if (data != null) {
sb.append("\n接收到的 Intent 数据 :\n" + data.toString());
}
} else {
sb.append("Intent is null.");
}
sb.append("\n\n");
LogUtils.d(TAG, sb.toString());
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// 缓存当前 activity
//WinBoLLActivityManager.getInstance(this).add(this);
}
@Override
public void onDestroy() {
//WinBoLLActivityManager.getInstance(this).registeRemove(this);
super.onDestroy();
}
public void onTestLogClick(View view) {
LogUtils.d(TAG, "onTestLogClick");
Toast.makeText(getApplication(), "onTestLogClick", Toast.LENGTH_SHORT).show();
}
public void onTestLogActivity(View view) {
/* 分屏代码有效
// 1. 创建启动 SecondActivity 的 Intent
Intent splitIntent = new Intent(MainActivity.this, LogActivity.class);
// 2. 添加分屏启动必需的两个标志API 30 兼容)
// FLAG_ACTIVITY_LAUNCH_ADJACENT相邻分屏显示
// FLAG_ACTIVITY_NEW_TASK分屏需要新任务栈
splitIntent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT
| Intent.FLAG_ACTIVITY_NEW_TASK);
// 3. 启动分屏活动(若设备不支持分屏,会默认全屏启动)
startActivity(splitIntent);
*/
LogActivity.startLogActivity(this);
}
//
// 处理传入的 Intent 数据
//
boolean prosessIntents(Intent intent) {
if (intent == null
|| intent.getAction() == null
|| intent.getAction().equals(""))
return false;
// if (intent.getAction().equals(StringToQrCodeView.ACTION_UNITTEST_QRCODE)) {
// try {
// WinBoLLActivity clazzActivity = UnitTestActivity.class.newInstance();
// String tag = clazzActivity.getTag();
// LogUtils.d(TAG, "String tag = clazzActivity.getTag(); tag " + tag);
// Intent subIntent = new Intent(this, UnitTestActivity.class);
// subIntent.setAction(intent.getAction());
// File file = new File(getCacheDir(), UUID.randomUUID().toString());
// //取出文件uri
// Uri uri = intent.getData();
// if (uri == null) {
// uri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
// }
// //获取文件真实地址
// String szSrcPath = UriUtils.getFileFromUri(getApplication(), uri);
// if (TextUtils.isEmpty(szSrcPath)) {
// return false;
// }
//
// Files.copy(Paths.get(szSrcPath), Paths.get(file.getPath()));
// //startWinBoLLActivity(subIntent, tag);
// WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, subIntent, UnitTestActivity.class);
// } catch (IllegalAccessException | InstantiationException | IOException e) {
// LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
// // 函数处理异常返回失败
// return false;
// }
// } else {
// LogUtils.d(TAG, "prosessIntents|" + intent.getAction() + "|yet");
// return false;
// }
return true;
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//ToastUtils.show("onCreateOptionsMenu");
getMenuInflater().inflate(R.menu.toolbar_main, menu);
// if (isAddWinBoLLToolBar()) {
// //ToastUtils.show("mIWinBoLL.isAddWinBoLLToolBar()");
// getMenuInflater().inflate(R.menu.toolbar_winboll_shared_main, menu);
// }
if (App.isDebuging()) {
getMenuInflater().inflate(R.menu.toolbar_studio_debug, menu);
}
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.item_exit) {
//exit();
return true;
} else if (item.getItemId() == R.id.item_testqrgeneratoractivity) {
Intent intent = new Intent(this, QRGeneratorActivity.class);
startActivity(intent);
} else if (item.getItemId() == R.id.item_testqrcodedecodeactivity) {
Intent intent = new Intent(this, QRCodeDecodeActivity.class);
startActivityForResult(intent, REQUEST_QRCODEDECODE_ACTIVITY);
} else if (item.getItemId() == R.id.item_testcrashreport) {
for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; i++) {
getString(i);
}
return true;
} else if (item.getItemId() == R.id.item_log) {
//WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, LogActivity.class);
return true;
} else if (item.getItemId() == R.id.item_exitdebug) {
//AboutView.setApp2NormalMode(this);
return true;
} else if (item.getItemId() == android.R.id.home) {
//WinBoLLActivityManager.getInstance(this).finish(this);
return true;
}
return super.onOptionsItemSelected(item);
}
// void exit() {
// YesNoAlertDialog.OnDialogResultListener listener = new YesNoAlertDialog.OnDialogResultListener(){
//
// @Override
// public void onYes() {
// //WinBoLLActivityManager.getInstance(getApplicationContext()).finishAll();
// }
//
// @Override
// public void onNo() {
// }
// };
// YesNoAlertDialog.show(this, "[ " + getString(R.string.app_name) + " ]", "Exit(Yes/No).\nIs close all activity?", listener);
//
// }
@Override
public void onBackPressed() {
// if (WinBoLLActivityManager.getInstance(getApplicationContext()).isFirstIWinBoLLActivity(this)) {
// exit();
// } else {
// WinBoLLActivityManager.getInstance(this).finish(this);
// super.onBackPressed();
// }
}
public void onTestAssetsHtmlActivity(View view) {
Intent intent = new Intent(this, AssetsHtmlActivity.class);
intent.putExtra(AssetsHtmlActivity.EXTRA_HTMLFILENAME, "javascript_test.html");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
startActivity(intent);
//WinBoLLActivityManager.getInstance(this).startWinBoLLActivity(this, intent, AssetsHtmlActivity.class);
}
@Override
protected void onResume() {
super.onResume();
//mLogView.start();
}
/*@Override
protected void onActivithyResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case REQUEST_QRCODEDECODE_ACTIVITY : {
if (data != null) {
String text = data.getStringExtra(QRCodeDecodeActivity.EXTRA_RESULT);
ToastUtils.show(text);
}
break;
}
default : {
//ToastUtils.show(String.format("%d, %d", requestCode, resultCode));
super.prosessActivityResult(requestCode, resultCode, data);
}
}
}*/
}

View File

@@ -0,0 +1,436 @@
package cc.winboll.studio.apputils;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
* @Date 2025/01/18 10:32:21
* @Describe 二维码解码窗口
*/
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.widget.Button;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toolbar;
import cc.winboll.studio.apputils.R;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.LuminanceSource;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.NotFoundException;
import com.google.zxing.RGBLuminanceSource;
import com.google.zxing.Result;
import com.google.zxing.ResultPoint;
import com.google.zxing.common.HybridBinarizer;
import com.journeyapps.barcodescanner.BarcodeCallback;
import com.journeyapps.barcodescanner.BarcodeResult;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;
import com.journeyapps.barcodescanner.DefaultDecoderFactory;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
public class QRCodeDecodeActivity extends Activity {
public static final String TAG = "QRCodeDecodeActivity";
public static final String EXTRA_RESULT = "EXTRA_RESULT";
private static final int REQUEST_CAMERA_PERMISSION = 1;
private static final int REQUEST_PICK_IMAGE = 2;
private static final int REQUEST_READ_STORAGE_PERMISSION = 3;
// 图片压缩阈值超过1000px时压缩避免内存溢出和解码效率低
private static final int MAX_BITMAP_SIZE = 1000;
private TextView resultTextView;
private DecoratedBarcodeView barcodeView;
private Button btnDecodeFromAlbum;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_qrcodedecode);
initToolbar();
initViews();
checkCameraPermission();
setAlbumDecodeClickListener();
}
private void initToolbar() {
Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
if (mToolbar != null) {
setActionBar(mToolbar);
if (getActionBar() != null) {
getActionBar().setDisplayHomeAsUpEnabled(true);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
}
}
}
private void initViews() {
resultTextView = (TextView) findViewById(R.id.activityqrcodedecodeTextView1);
barcodeView = (DecoratedBarcodeView) findViewById(R.id.activityqrcodedecodeDecoratedBarcodeView1);
btnDecodeFromAlbum = (Button) findViewById(R.id.btn_decode_from_album);
// 初始化扫码解码器支持所有常见码制避免仅支持QR_CODE的局限
List<BarcodeFormat> formats = new ArrayList<BarcodeFormat>();
formats.add(BarcodeFormat.QR_CODE);
formats.add(BarcodeFormat.CODE_128);
formats.add(BarcodeFormat.EAN_13);
barcodeView.getBarcodeView().setDecoderFactory(new DefaultDecoderFactory(formats));
}
private void setAlbumDecodeClickListener() {
btnDecodeFromAlbum.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE)
!= PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{android.Manifest.permission.READ_EXTERNAL_STORAGE},
REQUEST_READ_STORAGE_PERMISSION);
} else {
openAlbum();
}
}
});
}
private void openAlbum() {
Intent pickImageIntent = new Intent(Intent.ACTION_PICK);
pickImageIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
startActivityForResult(pickImageIntent, REQUEST_PICK_IMAGE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_PICK_IMAGE && resultCode == RESULT_OK && data != null) {
Uri selectedImageUri = data.getData();
if (selectedImageUri != null) {
try {
// 1. 读取图片并压缩(关键优化:避免大图片解码失败)
InputStream imageStream = getContentResolver().openInputStream(selectedImageUri);
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true; // 先获取图片尺寸,不加载像素
BitmapFactory.decodeStream(imageStream, null, options);
imageStream.close(); // 关闭流,重新读取
// 计算压缩比例超过MAX_BITMAP_SIZE时按比例压缩
options.inSampleSize = calculateInSampleSize(options, MAX_BITMAP_SIZE, MAX_BITMAP_SIZE);
options.inJustDecodeBounds = false; // 开始加载压缩后的像素
imageStream = getContentResolver().openInputStream(selectedImageUri);
Bitmap originalBitmap = BitmapFactory.decodeStream(imageStream, null, options);
imageStream.close();
if (originalBitmap == null) {
showToast("图片损坏,无法解析");
return;
}
// 2. 图片预处理:转为灰度图+提高对比度(解决模糊/低对比度图片识别问题)
Bitmap processedBitmap = processBitmap(originalBitmap);
// 3. 解码预处理后的图片
String decodeResult = decodeQrFromBitmap(processedBitmap);
// 4. 结果处理
if (decodeResult != null && !decodeResult.isEmpty()) {
resultTextView.setText("图片解码结果:" + decodeResult);
showDecodeResultDialog(decodeResult);
returnResultToPreviousPage(decodeResult);
} else {
// 尝试直接解码原图(防止预处理过度导致识别失败)
String originalResult = decodeQrFromBitmap(originalBitmap);
if (originalResult != null && !originalResult.isEmpty()) {
resultTextView.setText("图片解码结果:" + originalResult);
showDecodeResultDialog(originalResult);
returnResultToPreviousPage(originalResult);
} else {
new AlertDialog.Builder(this)
.setTitle("解码失败")
.setMessage("图片中未识别到二维码/条码,建议选择清晰、完整的图片")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.show();
}
}
// 回收Bitmap避免内存泄漏
if (!originalBitmap.isRecycled()) originalBitmap.recycle();
if (!processedBitmap.isRecycled() && processedBitmap != originalBitmap) {
processedBitmap.recycle();
}
} catch (Exception e) {
e.printStackTrace();
showToast("图片处理失败:" + e.getMessage());
}
} else {
showToast("未选择图片");
}
}
}
/**
* 核心优化1计算图片压缩比例
*/
private int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
final int halfHeight = height / 2;
final int halfWidth = width / 2;
// 找到最接近reqWidth/reqHeight的压缩比例2的倍数保证图片质量
while ((halfHeight / inSampleSize) >= reqHeight
&& (halfWidth / inSampleSize) >= reqWidth) {
inSampleSize *= 2;
}
}
return inSampleSize;
}
/**
* 核心优化2图片预处理灰度化+提高对比度)
* 解决模糊、低亮度、低对比度图片识别率低的问题
*/
private Bitmap processBitmap(Bitmap bitmap) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
// 创建灰度图
Bitmap grayBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(grayBitmap);
Paint paint = new Paint();
// 1. 灰度化矩阵
ColorMatrix grayMatrix = new ColorMatrix();
grayMatrix.setSaturation(0); // 饱和度设为0转为灰度
// 2. 提高对比度矩阵alpha=1.5,亮度=0可根据需求调整
ColorMatrix contrastMatrix = new ColorMatrix();
contrastMatrix.set(new float[]{
1.5f, 0, 0, 0, 0, // 红通道对比度
0, 1.5f, 0, 0, 0, // 绿通道对比度
0, 0, 1.5f, 0, 0, // 蓝通道对比度
0, 0, 0, 1f, 0 // alpha通道不变
});
// 合并灰度+对比度矩阵
ColorMatrix combinedMatrix = new ColorMatrix();
combinedMatrix.postConcat(grayMatrix);
combinedMatrix.postConcat(contrastMatrix);
paint.setColorFilter(new ColorMatrixColorFilter(combinedMatrix));
canvas.drawBitmap(bitmap, 0, 0, paint);
return grayBitmap;
}
/**
* 核心优化3修复解码参数支持更多场景
*/
private String decodeQrFromBitmap(Bitmap bitmap) {
if (bitmap == null) return null;
try {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int[] pixels = new int[width * height];
bitmap.getPixels(pixels, 0, width, 0, 0, width, height);
// 修复1使用RGBLuminanceSource避免YUV格式导致的颜色偏差
LuminanceSource source = new RGBLuminanceSource(width, height, pixels);
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));
// 修复2完善解码参数解决模糊、变形二维码识别问题
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
// 支持所有常见码制不仅限于QR_CODE
List<BarcodeFormat> formats = new ArrayList<BarcodeFormat>();
formats.add(BarcodeFormat.QR_CODE);
formats.add(BarcodeFormat.CODE_128);
formats.add(BarcodeFormat.EAN_8);
formats.add(BarcodeFormat.EAN_13);
hints.put(DecodeHintType.POSSIBLE_FORMATS, formats);
// 字符编码:支持中文等多语言
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
// 容错模式:允许二维码有一定损坏(关键!解决轻微变形/污染的二维码)
hints.put(DecodeHintType.TRY_HARDER, Boolean.TRUE);
// 不使用纯条码模式兼容带logo的二维码
hints.put(DecodeHintType.PURE_BARCODE, Boolean.FALSE);
MultiFormatReader reader = new MultiFormatReader();
reader.setHints(hints);
Result result = reader.decode(binaryBitmap);
return result.getText();
} catch (NotFoundException e) {
// 正常未识别到,不打印异常(避免日志冗余)
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
// ==================== 原有逻辑(不变) ====================
private void checkCameraPermission() {
if (checkSelfPermission(android.Manifest.permission.CAMERA)
!= PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[]{android.Manifest.permission.CAMERA},
REQUEST_CAMERA_PERMISSION);
} else {
startScanning();
}
}
private void startScanning() {
barcodeView.decodeContinuous(barcodeCallback);
}
private BarcodeCallback barcodeCallback = new BarcodeCallback() {
@Override
public void barcodeResult(BarcodeResult result) {
if (result != null && result.getText() != null) {
barcodeView.pause();
String decodeResult = result.getText();
resultTextView.setText("扫码结果:" + decodeResult);
showDecodeResultDialog(decodeResult);
returnResultToPreviousPage(decodeResult);
}
}
@Override
public void possibleResultPoints(List<ResultPoint> resultPoints) {
}
};
private void showDecodeResultDialog(String result) {
ScrollView scrollView = new ScrollView(this);
scrollView.setPadding(dip2px(16), dip2px(16), dip2px(16), dip2px(16));
TextView dialogTv = new TextView(this);
dialogTv.setTextSize(16);
dialogTv.setTextColor(getResources().getColor(android.R.color.black));
dialogTv.setText(result);
scrollView.addView(dialogTv);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("解码结果");
builder.setView(scrollView);
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
barcodeView.resume();
}
});
builder.setCancelable(false);
builder.show();
}
private void returnResultToPreviousPage(String result) {
Intent intent = new Intent();
intent.putExtra(EXTRA_RESULT, result);
setResult(RESULT_OK, intent);
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_CAMERA_PERMISSION) {
if (grantResults != null && grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
startScanning();
} else {
new AlertDialog.Builder(this)
.setTitle("权限申请")
.setMessage("扫码需要相机权限,请在设置中开启")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
finish();
}
})
.setCancelable(false)
.show();
}
}
} else if (requestCode == REQUEST_READ_STORAGE_PERMISSION) {
if (grantResults != null && grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
openAlbum();
} else {
new AlertDialog.Builder(this)
.setTitle("权限申请")
.setMessage("从相册解码需要存储权限,请在设置中开启")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.setCancelable(false)
.show();
}
}
}
}
@Override
protected void onResume() {
super.onResume();
if (barcodeView != null) {
barcodeView.resume();
}
}
@Override
protected void onPause() {
super.onPause();
if (barcodeView != null) {
barcodeView.pause();
}
}
private int dip2px(float dpValue) {
final float scale = getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
return true;
}
return super.onOptionsItemSelected(item);
}
private void showToast(String message) {
android.widget.Toast.makeText(this, message, android.widget.Toast.LENGTH_SHORT).show();
}
}

View File

@@ -0,0 +1,97 @@
package cc.winboll.studio.apputils;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
* @Date 2025/09/22 07:09
* @Describe 二维码生成窗口
*/
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.journeyapps.barcodescanner.BarcodeEncoder;
public class QRGeneratorActivity extends Activity {
public static final String TAG = "QrGeneratorActivity";
// 控件引用
private EditText etInputText;
private ImageView ivQrPreview;
private Button btnGenerateQr;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_qrgenerator);
// 初始化控件
initViews();
// 设置按钮点击事件
setGenerateClickListener();
}
/**
* 初始化布局控件
*/
private void initViews() {
etInputText = findViewById(R.id.et_input_text);
ivQrPreview = findViewById(R.id.iv_qr_preview);
btnGenerateQr = findViewById(R.id.btn_generate_qr);
}
/**
* 设置生成按钮点击事件:获取输入文字 → 生成二维码 → 显示到 ImageView
*/
private void setGenerateClickListener() {
btnGenerateQr.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// 1. 获取输入框文字(去除前后空格)
String inputText = etInputText.getText().toString().trim();
// 2. 空输入判断
if (inputText.isEmpty()) {
Toast.makeText(QRGeneratorActivity.this, "请先输入要生成二维码的文字", Toast.LENGTH_SHORT).show();
return;
}
// 3. 生成二维码 Bitmap宽高 500px可调整
Bitmap qrBitmap = generateQrCodeBitmap(inputText, 500, 500);
// 4. 显示二维码到 ImageView
if (qrBitmap != null) {
ivQrPreview.setImageBitmap(qrBitmap);
} else {
Toast.makeText(QRGeneratorActivity.this, "二维码生成失败,请重试", Toast.LENGTH_SHORT).show();
}
}
});
}
/**
* 核心方法:生成二维码 Bitmap
* @param content 二维码内容(输入的文字)
* @param width 二维码宽度px
* @param height 二维码高度px
* @return 生成的二维码 Bitmap失败返回 null
*/
private Bitmap generateQrCodeBitmap(String content, int width, int height) {
try {
// 初始化二维码编码器(指定格式为 QR_CODE
BarcodeEncoder encoder = new BarcodeEncoder();
// 生成二维码 Bitmap参数内容、格式、宽、高
return encoder.encodeBitmap(content, BarcodeFormat.QR_CODE, width, height);
} catch (WriterException e) {
// 生成失败(如内容过长、宽高非法),打印异常信息
e.printStackTrace();
return null;
}
}
}

View File

@@ -0,0 +1,20 @@
package cc.winboll.studio.apputils;
/**
* @Author ZhanGSKen<zhangsken@qq.com>
* @Date 2025/03/23 16:14:45
*/
import android.app.Activity;
import android.os.Bundle;
public class TestBBMorseCodeActivity extends Activity {
public static final String TAG = "TestBBMorseCodeActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_testbbmorsecode);
}
}

View File

@@ -0,0 +1,14 @@
package cc.winboll.studio.apputils;
/**
* @Author ZhanGSKen<zhangsken@qq.com>
* @Date 2025/05/13 11:15
* @Describe WinBoLLActivity
*/
import android.app.Activity;
public class WinBoLLActivity extends Activity {
public static final String TAG = "WinBoLLActivity";
}

View File

@@ -0,0 +1,11 @@
<?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>

View File

@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="@color/colorPrimary"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

View File

@@ -0,0 +1,10 @@
<?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>

View File

@@ -0,0 +1,10 @@
<?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>

View File

@@ -0,0 +1,21 @@
<?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.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"/>
<cc.winboll.studio.libapputils.views.SimpleWebView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:id="@+id/activityassetshtmlSimpleWebView1"/>
</LinearLayout>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"/>
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="right"
android:layout_weight="1.0">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TestLog"
android:textAllCaps="false"
android:onClick="onTestLogClick"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TestLogActivity"
android:textAllCaps="false"
android:onClick="onTestLogActivity"/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAllCaps="false"
android:text="TestAssetsHtmlActivity"
android:onClick="onTestAssetsHtmlActivity"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,43 @@
<?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="match_parent"
android:orientation="vertical">
<!-- 工具栏(原有) -->
<Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<!-- 扫码控件(原有) -->
<com.journeyapps.barcodescanner.DecoratedBarcodeView
android:id="@+id/activityqrcodedecodeDecoratedBarcodeView1"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<!-- 新增:从相册解码按钮 -->
<Button
android:id="@+id/btn_decode_from_album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="从相册选图解码"
android:textSize="16sp"
android:textColor="@android:color/white"
android:background="#2196F3"
android:paddingVertical="12dp"
android:layout_margin="16dp"/>
<!-- 结果显示TextView原有 -->
<TextView
android:id="@+id/activityqrcodedecodeTextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp"
android:text="等待扫码或选择图片..."
android:textSize="16sp"/>
</LinearLayout>

View File

@@ -0,0 +1,45 @@
<?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="match_parent"
android:orientation="vertical"
android:padding="20dp"
android:gravity="top|center_horizontal">
<!-- 文字输入框 -->
<EditText
android:id="@+id/et_input_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入要生成二维码的文字"
android:inputType="textMultiLine"
android:minLines="3"
android:maxLines="5"
android:padding="12dp"
android:background="@android:drawable/editbox_background_normal"
android:layout_marginBottom="16dp"/>
<!-- 生成二维码按钮 -->
<Button
android:id="@+id/btn_generate_qr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="生成二维码"
android:textSize="16sp"
android:background="#4CAF50"
android:textColor="@android:color/white"
android:paddingVertical="12dp"
android:layout_marginBottom="24dp"/>
<!-- 二维码预览图片 -->
<ImageView
android:id="@+id/iv_qr_preview"
android:layout_width="280dp"
android:layout_height="280dp"
android:scaleType="fitCenter"
android:background="@android:drawable/dialog_holo_light_frame"
android:contentDescription="二维码预览"/>
</LinearLayout>

View File

@@ -0,0 +1,9 @@
<?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>

View File

@@ -0,0 +1,28 @@
<?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.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0">
<cc.winboll.studio.libapputils.views.StringToQrCodeView
android:layout_width="300dp"
android:layout_height="300dp"
android:id="@+id/activityteststringtoqrcodeviewStringToQrCodeView1"/>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,17 @@
<?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="#FF36B5B3">
<android.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/activitytestwinbollToolbar1"/>
</LinearLayout>

View File

@@ -0,0 +1,13 @@
<?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_testqrgeneratoractivity"
android:title="TestQRGeneratorActivity"/>
<item
android:id="@+id/item_testqrcodedecodeactivity"
android:title="TestQRCodeDecodeActivity"/>
<item
android:id="@+id/item_testcrashreport"
android:title="TestCrashReportActivity"/>
</menu>

View File

@@ -0,0 +1,9 @@
<?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"
android:title="Item"/>
</menu>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- WinBoLL 默认方案 -->
<color name="colorPrimary">#FF196ABC</color>
<color name="colorPrimaryDark">#FF002B57</color>
<color name="colorAccent">#FF80BFFF</color>
</resources>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">APPUtils</string>
</resources>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyUtilsTheme" parent="UtilsTheme">
<item name="attrColorPrimary">@color/colorPrimary</item>
<item name="themeGlobalCrashActivity">@style/MyUtilsGlobalCrashActivityTheme</item>
</style>
<style name="MyUtilsGlobalCrashActivityTheme" parent="@android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="colorTittle">#FFF2F2F2</item>
<item name="colorTittleBackgound">#FF55ABF8</item>
<item name="colorText">#FF55ABF8</item>
<item name="colorTextBackgound">#FFF2F2F2</item>
</style>
</resources>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
name="external_storage_root"
path="." />
<files-path
name="files_path"
path="." />
<cache-path
name="cache_path"
path="." />
<!--/storage/emulated/0/Android/data/...-->
<external-files-path
name="external_file_path"
path="." />
<!--代表app 外部存储区域根目录下的文件 Context.getExternalCacheDir目录下的目录-->
<external-cache-path
name="external_cache_path"
path="." />
<!--配置root-path。这样子可以读取到sd卡和一些应用分身的目录否则微信分身保存的图片就会导致 java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/emulated/999/tencent/MicroMsg/WeiXin/export1544062754693.jpg在小米6的手机上微信分身有这个crash华为没有
-->
<root-path
name="root_path"
path="" />
</paths>

View File

@@ -0,0 +1,12 @@
<?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>
<!-- Put flavor specific code here -->
</application>
</manifest>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Put flavor specific strings here -->
</resources>