mirror of
https://gitea.winboll.cc/Studio/OriginMaster.git
synced 2026-02-04 16:31:31 +08:00
Compare commits
7 Commits
positions-
...
positions-
| Author | SHA1 | Date | |
|---|---|---|---|
| 51cdbfefab | |||
| e07e5fa8a8 | |||
| 5901cc5d75 | |||
| a7617a378c | |||
| b0dfb4be76 | |||
| 07859f316f | |||
| 08fc5a47cd |
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Mon Dec 08 14:36:50 HKT 2025
|
||||
stageCount=4
|
||||
#Tue Dec 09 10:36:26 HKT 2025
|
||||
stageCount=6
|
||||
libraryProject=
|
||||
baseVersion=15.12
|
||||
publishVersion=15.12.3
|
||||
publishVersion=15.12.5
|
||||
buildCount=0
|
||||
baseBetaVersion=15.12.4
|
||||
baseBetaVersion=15.12.6
|
||||
|
||||
@@ -4,6 +4,8 @@ import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
@@ -19,14 +21,15 @@ import androidx.core.content.ContextCompat;
|
||||
import cc.winboll.studio.libaes.interfaces.IWinBoLLActivity;
|
||||
import cc.winboll.studio.libaes.utils.AESThemeUtil;
|
||||
import cc.winboll.studio.libaes.utils.DevelopUtils;
|
||||
import cc.winboll.studio.libaes.utils.WinBoLLActivityManager;
|
||||
import cc.winboll.studio.libaes.views.ADsBannerView;
|
||||
import cc.winboll.studio.libappbase.LogUtils;
|
||||
import cc.winboll.studio.positions.R;
|
||||
import cc.winboll.studio.positions.activities.LocationActivity;
|
||||
import cc.winboll.studio.positions.activities.SettingsActivity;
|
||||
import cc.winboll.studio.positions.activities.WinBoLLActivity;
|
||||
import cc.winboll.studio.positions.utils.AppConfigsUtil;
|
||||
import cc.winboll.studio.positions.utils.ServiceUtil;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
/**
|
||||
* 主页面:仅负责
|
||||
@@ -102,8 +105,22 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
||||
|
||||
mADsBannerView = findViewById(R.id.adsbanner);
|
||||
|
||||
setLLMainBackgroundColor();
|
||||
}
|
||||
|
||||
// 在 Activity 的 onCreate() 或需要获取颜色的方法中调用
|
||||
private void setLLMainBackgroundColor() {
|
||||
// 1. 定义要解析的主题属性(这里是 colorAccent)
|
||||
TypedArray a = getTheme().obtainStyledAttributes(new int[]{android.R.attr.colorAccent});
|
||||
// 2. 获取对应的颜色值(默认值可设为你需要的 fallback 颜色,如 Color.GRAY)
|
||||
int colorAccent = a.getColor(0, Color.GRAY);
|
||||
// 3. 必须回收,避免内存泄漏
|
||||
a.recycle();
|
||||
|
||||
LinearLayout llmain = findViewById(R.id.llmain);
|
||||
llmain.setBackgroundColor(colorAccent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
@@ -151,7 +168,7 @@ public class MainActivity extends WinBoLLActivity implements IWinBoLLActivity {
|
||||
|
||||
mManagePositionsButton = (Button) findViewById(R.id.btn_manage_positions);
|
||||
mManagePositionsButton.setEnabled(mServiceSwitch.isChecked());
|
||||
|
||||
|
||||
// Java 7 用匿名内部类实现 CompoundButton.OnCheckedChangeListener
|
||||
mServiceSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
|
||||
BIN
positions/src/main/res/drawable/activity_background.png
Normal file
BIN
positions/src/main/res/drawable/activity_background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
14
positions/src/main/res/drawable/btn_selector.xml
Normal file
14
positions/src/main/res/drawable/btn_selector.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 禁用状态:仅此处自定义(灰化样式) -->
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#E0E0E0" /> <!-- 禁用背景灰(浅灰,贴近系统禁用色) -->
|
||||
<stroke android:width="1px" android:color="#CCCCCC" /> <!-- 禁用边框灰 -->
|
||||
<corners android:radius="2dp" /> <!-- 匹配系统按钮圆角弧度 -->
|
||||
</shape>
|
||||
</item>
|
||||
<!-- 启用状态:直接复用系统默认按钮样式(与普通按钮完全一致) -->
|
||||
<item android:state_enabled="true" android:drawable="@android:drawable/btn_default" />
|
||||
</selector>
|
||||
|
||||
8
positions/src/main/res/drawable/btn_text_selector.xml
Normal file
8
positions/src/main/res/drawable/btn_text_selector.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- 禁用状态:文字灰(系统默认禁用文字色) -->
|
||||
<item android:state_enabled="false" android:color="#9E9E9E" />
|
||||
<!-- 启用状态:复用系统默认按钮文字色(与普通按钮一致) -->
|
||||
<item android:state_enabled="true" android:color="@android:color/black" />
|
||||
</selector>
|
||||
|
||||
15
positions/src/main/res/drawable/shape_2px_border.xml
Normal file
15
positions/src/main/res/drawable/shape_2px_border.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle"> <!-- 矩形形状(匹配 LinearLayout ) -->
|
||||
|
||||
<!-- 1px 边框(关键:stroke 标签控制边框) -->
|
||||
<stroke
|
||||
android:width="2px"
|
||||
android:color="?attr/colorAccent" /> <!-- 边框颜色(替换为你的颜色,如 #CCCCCC) -->
|
||||
|
||||
<!-- 可选:设置 LinearLayout 背景色(若需要) -->
|
||||
<solid android:color="#00000000" /> <!-- 内部填充色,默认透明可删除 -->
|
||||
|
||||
<!-- 可选:设置圆角(不需要圆角可删除) -->
|
||||
<corners android:radius="0dp" />
|
||||
</shape>
|
||||
@@ -1,10 +1,10 @@
|
||||
<?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:layout_height="match_parent"
|
||||
android:id="@+id/llmain">
|
||||
|
||||
<cc.winboll.studio.libaes.views.ASupportToolbar
|
||||
android:layout_width="match_parent"
|
||||
@@ -13,33 +13,61 @@
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
<LinearLayout
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:background="#00000000"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switch_service_control"
|
||||
android:layout_margin="16dp"
|
||||
android:text="GPS服务开关"
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/activity_background"
|
||||
android:layout_margin="0dp">
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:onClick="onPositions"
|
||||
android:text="位置与任务管理"
|
||||
android:id="@+id/btn_manage_positions"/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<Switch
|
||||
android:id="@+id/switch_service_control"
|
||||
android:text="GPS服务开关"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="120dp"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:layout_marginRight="50dp"
|
||||
android:background="@drawable/shape_2px_border"
|
||||
android:paddingLeft="10dp"/>
|
||||
|
||||
<Button
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginLeft="50dp"
|
||||
android:layout_marginRight="50dp"
|
||||
android:onClick="onPositions"
|
||||
android:text="位置与任务管理"
|
||||
android:id="@+id/btn_manage_positions"
|
||||
android:background="@drawable/btn_selector"
|
||||
android:textColor="@drawable/btn_text_selector"
|
||||
android:padding="12dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<cc.winboll.studio.libaes.views.ADsBannerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/adsbanner"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<cc.winboll.studio.libaes.views.ADsBannerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/adsbanner"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user