背景布局调试...

This commit is contained in:
2025-12-03 20:19:18 +08:00
parent ca1850fe8a
commit ca66120e55
4 changed files with 43 additions and 17 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle
#Wed Dec 03 11:30:35 GMT 2025
#Wed Dec 03 12:17:39 GMT 2025
stageCount=13
libraryProject=
baseVersion=15.11
publishVersion=15.11.12
buildCount=131
buildCount=137
baseBetaVersion=15.11.13

View File

@@ -11,6 +11,9 @@ import cc.winboll.studio.powerbell.R;
import android.widget.Button;
import cc.winboll.studio.powerbell.MainActivity;
import android.content.Intent;
import cc.winboll.studio.powerbell.model.BackgroundBean;
import cc.winboll.studio.powerbell.utils.BackgroundSourceUtils;
import cc.winboll.studio.powerbell.views.BackgroundView;
/**
* @Author ZhanGSKen&豆包大模型<zhangsken@qq.com>
@@ -22,17 +25,18 @@ public class BackgroundViewTestFragment extends Fragment {
public static final String TAG = "BackgroundViewTestFragment";
View mainView;
BackgroundSourceUtils mBgSourceUtils;
BackgroundView mBackgroundView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
//super.onCreateView(inflater, container, savedInstanceState);
// 非调试状态就结束本线程
if (!GlobalApplication.isDebugging()) {
Thread.currentThread().destroy();
}
mBgSourceUtils = BackgroundSourceUtils.getInstance(getActivity());
mBgSourceUtils.loadSettings();
mainView = inflater.inflate(R.layout.fragment_test_backgroundview, container, false);
mBackgroundView = mainView.findViewById(R.id.backgroundview);
((Button)mainView.findViewById(R.id.btn_main_activity)).setOnClickListener(new View.OnClickListener(){
@@ -41,8 +45,23 @@ public class BackgroundViewTestFragment extends Fragment {
getActivity().startActivity(new Intent(getActivity(), MainActivity.class));
}
});
loadBackground();
ToastUtils.show(String.format("%s onCreate", TAG));
return mainView;
}
@Override
public void onResume() {
super.onResume();
loadBackground();
}
void loadBackground() {
mBgSourceUtils.loadSettings();
BackgroundBean bean = mBgSourceUtils.getCurrentBackgroundBean();
mBackgroundView.loadBackground(bean);
}
}

View File

@@ -370,11 +370,11 @@ public class BackgroundView extends RelativeLayout {
layoutParams.height = imageViewHeight;
mivBackground.setLayoutParams(layoutParams);
// LogUtils.d(TAG, "【adjustImageViewSize】尺寸调整成功");
// LogUtils.d(TAG, "→ 父控件尺寸:" + parentWidth + "x" + parentHeight);
// LogUtils.d(TAG, "→ ImageView调整后尺寸" + imageViewWidth + "x" + imageViewHeight);
// LogUtils.d(TAG, "→ 图片宽高比:" + mnImageAspectRatio);
// LogUtils.d(TAG, "=== adjustImageViewSize调整ImageView尺寸完成调整成功===");
LogUtils.d(TAG, "【adjustImageViewSize】尺寸调整成功");
LogUtils.d(TAG, "→ 父控件尺寸:" + parentWidth + "x" + parentHeight);
LogUtils.d(TAG, "→ ImageView调整后尺寸" + imageViewWidth + "x" + imageViewHeight);
LogUtils.d(TAG, "→ 图片宽高比:" + mnImageAspectRatio);
LogUtils.d(TAG, "=== adjustImageViewSize调整ImageView尺寸完成调整成功===");
}
/**

View File

@@ -1,15 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<cc.winboll.studio.powerbell.views.BackgroundView
<RelativeLayout
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="#FF7381FF">
android:background="#FF0C6BBF">
<cc.winboll.studio.powerbell.views.BackgroundView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/backgroundview"/>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:background="#AF4FDA4E">
<Button
android:layout_width="wrap_content"
@@ -19,5 +26,5 @@
</HorizontalScrollView>
</cc.winboll.studio.powerbell.views.BackgroundView>
</RelativeLayout>