feat: 初始化bj_power_app扫码app项目骨架
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
|
||||
<uses-feature
|
||||
android:name="android.hardware.camera"
|
||||
android:required="true" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.BjPowerApp">
|
||||
|
||||
<activity
|
||||
android:name=".LoginActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/title_login" />
|
||||
|
||||
<activity
|
||||
android:name=".SettingsActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/title_settings" />
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- 拍照输出文件用 FileProvider 暴露给系统相机 -->
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths" />
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.bjpower.app;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
/**
|
||||
* 本地配置持久化:服务器地址、登录令牌、账号。
|
||||
* 骨架阶段仅提供读写能力,网络层后续接入。
|
||||
*/
|
||||
public final class AppConfig {
|
||||
|
||||
private static final String SP_NAME = "bj_power_app";
|
||||
private static final String KEY_BASE_URL = "base_url";
|
||||
private static final String KEY_TOKEN = "access_token";
|
||||
private static final String KEY_USERNAME = "username";
|
||||
|
||||
/** 默认服务器地址(MES 服务,端口 8888),可在登录页或设置页修改。 */
|
||||
public static final String DEFAULT_BASE_URL = "http://192.168.1.100:8888";
|
||||
|
||||
private AppConfig() {
|
||||
}
|
||||
|
||||
private static SharedPreferences sp(Context ctx) {
|
||||
return ctx.getApplicationContext().getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public static String getBaseUrl(Context ctx) {
|
||||
return sp(ctx).getString(KEY_BASE_URL, DEFAULT_BASE_URL);
|
||||
}
|
||||
|
||||
public static void setBaseUrl(Context ctx, String baseUrl) {
|
||||
sp(ctx).edit().putString(KEY_BASE_URL, normalize(baseUrl)).apply();
|
||||
}
|
||||
|
||||
public static String getToken(Context ctx) {
|
||||
return sp(ctx).getString(KEY_TOKEN, "");
|
||||
}
|
||||
|
||||
public static void setToken(Context ctx, String token) {
|
||||
sp(ctx).edit().putString(KEY_TOKEN, token == null ? "" : token).apply();
|
||||
}
|
||||
|
||||
public static String getUsername(Context ctx) {
|
||||
return sp(ctx).getString(KEY_USERNAME, "");
|
||||
}
|
||||
|
||||
public static void setUsername(Context ctx, String username) {
|
||||
sp(ctx).edit().putString(KEY_USERNAME, username == null ? "" : username).apply();
|
||||
}
|
||||
|
||||
/** 规整地址:允许只填 192.168.1.100:8888,自动补 http:// 并去掉末尾斜杠。 */
|
||||
public static String normalize(String baseUrl) {
|
||||
String url = baseUrl == null ? "" : baseUrl.trim();
|
||||
if (url.isEmpty()) {
|
||||
return DEFAULT_BASE_URL;
|
||||
}
|
||||
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
||||
url = "http://" + url;
|
||||
}
|
||||
while (url.endsWith("/")) {
|
||||
url = url.substring(0, url.length() - 1);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.bjpower.app;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
/**
|
||||
* 登录页骨架:服务器地址 + MES 账号。
|
||||
* TODO 接入 POST /api/v1/login,保存 accessToken 后再进入主界面。
|
||||
*/
|
||||
public class LoginActivity extends AppCompatActivity {
|
||||
|
||||
private TextInputEditText etBaseUrl;
|
||||
private TextInputEditText etUsername;
|
||||
private TextInputEditText etPassword;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_login);
|
||||
|
||||
etBaseUrl = findViewById(R.id.et_base_url);
|
||||
etUsername = findViewById(R.id.et_username);
|
||||
etPassword = findViewById(R.id.et_password);
|
||||
MaterialButton btnLogin = findViewById(R.id.btn_login);
|
||||
|
||||
etBaseUrl.setText(AppConfig.getBaseUrl(this));
|
||||
etUsername.setText(AppConfig.getUsername(this));
|
||||
|
||||
btnLogin.setOnClickListener(v -> doLogin());
|
||||
}
|
||||
|
||||
private void doLogin() {
|
||||
String baseUrl = AppConfig.normalize(text(etBaseUrl));
|
||||
AppConfig.setBaseUrl(this, baseUrl);
|
||||
etBaseUrl.setText(baseUrl);
|
||||
|
||||
String username = text(etUsername);
|
||||
String password = text(etPassword);
|
||||
if (username.isEmpty() || password.isEmpty()) {
|
||||
Toast.makeText(this, R.string.tip_skeleton, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
AppConfig.setUsername(this, username);
|
||||
// TODO 调用 /api/v1/login 校验账号密码并保存 accessToken
|
||||
Toast.makeText(this, R.string.tip_skeleton, Toast.LENGTH_SHORT).show();
|
||||
|
||||
startActivity(new Intent(this, MainActivity.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
private static String text(TextInputEditText et) {
|
||||
return et.getText() == null ? "" : et.getText().toString().trim();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.bjpower.app;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
|
||||
/**
|
||||
* 主界面骨架:扫码入口 + 工件信息 + 现场照片。
|
||||
* 骨架阶段各业务按钮仅做占位提示,逻辑待后续接入。
|
||||
*/
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
private TextView tvServer;
|
||||
private EditText etSn;
|
||||
private TextView tvWorkpieceResult;
|
||||
private ImageView ivPhoto;
|
||||
private TextView tvPhotoState;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
tvServer = findViewById(R.id.tv_server);
|
||||
etSn = findViewById(R.id.et_sn);
|
||||
tvWorkpieceResult = findViewById(R.id.tv_workpiece_result);
|
||||
ivPhoto = findViewById(R.id.iv_photo);
|
||||
tvPhotoState = findViewById(R.id.tv_photo_state);
|
||||
|
||||
MaterialButton btnScan = findViewById(R.id.btn_scan);
|
||||
MaterialButton btnQuery = findViewById(R.id.btn_query);
|
||||
MaterialButton btnTakePhoto = findViewById(R.id.btn_take_photo);
|
||||
MaterialButton btnUploadPhoto = findViewById(R.id.btn_upload_photo);
|
||||
MaterialButton btnSettings = findViewById(R.id.btn_settings);
|
||||
MaterialButton btnSwitchAccount = findViewById(R.id.btn_switch_account);
|
||||
|
||||
btnSettings.setOnClickListener(v ->
|
||||
startActivity(new Intent(this, SettingsActivity.class)));
|
||||
btnSwitchAccount.setOnClickListener(v ->
|
||||
startActivity(new Intent(this, LoginActivity.class)));
|
||||
|
||||
// TODO 接入 ZXing 扫码,扫到结果后写入 et_sn 并触发查询
|
||||
btnScan.setOnClickListener(v -> tipSkeleton());
|
||||
// TODO 接入 GET /api/v1/trace?sn=<SN>,渲染工件详情与工序时间线到 tv_workpiece_result
|
||||
btnQuery.setOnClickListener(v -> tipSkeleton());
|
||||
// TODO 接入系统相机 + FileProvider,拍照结果写入 iv_photo / tv_photo_state
|
||||
btnTakePhoto.setOnClickListener(v -> tipSkeleton());
|
||||
// TODO 接入 POST /api/v1/inspections/upload(multipart,字段名 file)
|
||||
btnUploadPhoto.setOnClickListener(v -> tipSkeleton());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
tvServer.setText(getString(R.string.label_current_server, AppConfig.getBaseUrl(this)));
|
||||
}
|
||||
|
||||
private void tipSkeleton() {
|
||||
Toast.makeText(this, R.string.tip_skeleton, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.bjpower.app;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.google.android.material.textfield.TextInputEditText;
|
||||
|
||||
/**
|
||||
* 设置页骨架:仅配置服务器地址(MES 地址,形如 http://192.168.1.100:8888)。
|
||||
*/
|
||||
public class SettingsActivity extends AppCompatActivity {
|
||||
|
||||
private TextInputEditText etBaseUrl;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_settings);
|
||||
|
||||
etBaseUrl = findViewById(R.id.et_base_url);
|
||||
MaterialButton btnSave = findViewById(R.id.btn_save);
|
||||
MaterialButton btnReset = findViewById(R.id.btn_reset);
|
||||
|
||||
etBaseUrl.setText(AppConfig.getBaseUrl(this));
|
||||
|
||||
btnSave.setOnClickListener(v -> {
|
||||
AppConfig.setBaseUrl(this, text());
|
||||
etBaseUrl.setText(AppConfig.getBaseUrl(this));
|
||||
Toast.makeText(this, R.string.action_save, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
});
|
||||
|
||||
btnReset.setOnClickListener(v -> {
|
||||
AppConfig.setBaseUrl(this, AppConfig.DEFAULT_BASE_URL);
|
||||
etBaseUrl.setText(AppConfig.getBaseUrl(this));
|
||||
});
|
||||
}
|
||||
|
||||
private String text() {
|
||||
return etBaseUrl.getText() == null ? "" : etBaseUrl.getText().toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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="#1565C0"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M24,36h6v36h-6z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M34,36h3v36h-3z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M41,36h7v36h-7z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M52,36h3v36h-3z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M59,36h6v36h-6z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M69,36h3v36h-3z" />
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M76,36h8v36h-8z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="24dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="24sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
style="@style/Text.BjPower.Label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/title_login" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:hint="@string/label_base_url">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/et_base_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textUri"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:hint="@string/label_username">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/et_username"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:hint="@string/label_password"
|
||||
app:endIconMode="password_toggle">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/et_password"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textPassword"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_login"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="52dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/action_login" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<!-- 顶部:标题 + 切换账号 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_settings"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="0dp"
|
||||
android:text="@string/title_settings"
|
||||
android:textColor="@color/brand" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_switch_account"
|
||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:minWidth="0dp"
|
||||
android:text="@string/action_switch_account"
|
||||
android:textColor="@color/brand" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_server"
|
||||
style="@style/Text.BjPower.Label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="2dp" />
|
||||
|
||||
<!-- 扫码 -->
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_scan"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="72dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="@string/action_scan"
|
||||
android:textSize="20sp"
|
||||
app:cornerRadius="10dp" />
|
||||
|
||||
<!-- 工件查询卡片 -->
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/Widget.BjPower.Card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="14dp">
|
||||
|
||||
<TextView
|
||||
style="@style/Text.BjPower.Value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/section_workpiece"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_sn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:hint="@string/hint_sn"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="text"
|
||||
android:singleLine="true" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_query"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/action_query" />
|
||||
|
||||
<!-- TODO 待接入 /api/v1/trace?sn= 后,这里渲染工件详情与工序时间线 -->
|
||||
<TextView
|
||||
android:id="@+id/tv_workpiece_result"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:lineSpacingExtra="4dp"
|
||||
android:text="@string/tip_skeleton"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="14sp" />
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<!-- 现场照片卡片 -->
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/Widget.BjPower.Card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="14dp">
|
||||
|
||||
<TextView
|
||||
style="@style/Text.BjPower.Value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/section_photo"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_photo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@color/bg"
|
||||
android:contentDescription="@string/section_photo"
|
||||
android:scaleType="centerCrop" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_photo_state"
|
||||
style="@style/Text.BjPower.Label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:text="@string/photo_none" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_take_photo"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/action_take_photo" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_upload_photo"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/action_upload_photo" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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:background="@color/bg"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/label_base_url">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/et_base_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:importantForAutofill="no"
|
||||
android:inputType="textUri"
|
||||
android:singleLine="true" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_save"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/action_save" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_reset"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:text="@string/action_reset_default" />
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="brand">#1565C0</color>
|
||||
<color name="brand_dark">#0D47A1</color>
|
||||
<color name="white">#FFFFFF</color>
|
||||
<color name="bg">#F5F6F8</color>
|
||||
<color name="card">#FFFFFF</color>
|
||||
<color name="stroke">#E0E3E8</color>
|
||||
<color name="text_primary">#1F2937</color>
|
||||
<color name="text_secondary">#6B7280</color>
|
||||
</resources>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">bj_power 扫码枪</string>
|
||||
<string name="title_login">登录</string>
|
||||
<string name="title_settings">设置</string>
|
||||
|
||||
<!-- 通用 -->
|
||||
<string name="action_save">保存</string>
|
||||
<string name="action_cancel">取消</string>
|
||||
<string name="action_back">返回</string>
|
||||
|
||||
<!-- 登录 / 设置 -->
|
||||
<string name="label_base_url">服务器地址</string>
|
||||
<string name="hint_base_url">例如 192.168.1.100:8888</string>
|
||||
<string name="label_username">账号</string>
|
||||
<string name="hint_username">请输入账号</string>
|
||||
<string name="label_password">密码</string>
|
||||
<string name="hint_password">请输入密码</string>
|
||||
<string name="action_login">登录</string>
|
||||
<string name="action_reset_default">恢复默认地址</string>
|
||||
<string name="label_current_server">当前服务器:%1$s</string>
|
||||
|
||||
<!-- 主界面 -->
|
||||
<string name="action_scan">扫 码</string>
|
||||
<string name="action_switch_account">切换账号</string>
|
||||
<string name="label_sn">工件 SN</string>
|
||||
<string name="hint_sn">扫码后自动填入,也可手动输入</string>
|
||||
<string name="action_query">查询工件信息</string>
|
||||
<string name="action_take_photo">拍照</string>
|
||||
<string name="action_upload_photo">上传照片</string>
|
||||
<string name="section_workpiece">工件信息</string>
|
||||
<string name="section_photo">现场照片</string>
|
||||
<string name="photo_none">尚未拍照</string>
|
||||
<string name="tip_skeleton">骨架阶段:该功能待接入</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.BjPowerApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<item name="colorPrimary">@color/brand</item>
|
||||
<item name="colorPrimaryVariant">@color/brand_dark</item>
|
||||
<item name="colorOnPrimary">@color/white</item>
|
||||
<item name="colorSecondary">@color/brand</item>
|
||||
<item name="colorOnSecondary">@color/white</item>
|
||||
<item name="android:statusBarColor">@color/brand_dark</item>
|
||||
<item name="android:windowBackground">@color/bg</item>
|
||||
</style>
|
||||
|
||||
<!-- 卡片:白底 + 细描边 + 圆角 -->
|
||||
<style name="Widget.BjPower.Card" parent="Widget.MaterialComponents.CardView">
|
||||
<item name="cardBackgroundColor">@color/card</item>
|
||||
<item name="cardCornerRadius">10dp</item>
|
||||
<item name="cardElevation">0dp</item>
|
||||
<item name="strokeColor">@color/stroke</item>
|
||||
<item name="strokeWidth">1dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Text.BjPower.Label" parent="">
|
||||
<item name="android:textColor">@color/text_secondary</item>
|
||||
<item name="android:textSize">13sp</item>
|
||||
</style>
|
||||
|
||||
<style name="Text.BjPower.Value" parent="">
|
||||
<item name="android:textColor">@color/text_primary</item>
|
||||
<item name="android:textSize">16sp</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths>
|
||||
<!-- 拍照原图存放目录:getCacheDir()/images -->
|
||||
<cache-path
|
||||
name="images"
|
||||
path="images/" />
|
||||
</paths>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 内网 MES 走 http(如 http://192.168.x.x:8888),Android 9+ 默认禁止明文,这里放开 -->
|
||||
<network-security-config>
|
||||
<base-config cleartextTrafficPermitted="true" />
|
||||
</network-security-config>
|
||||
Reference in New Issue
Block a user