固定参数属性初始化方法综合

This commit is contained in:
ZhanGSKen 2025-04-15 20:43:18 +08:00
parent e1dadfa41c
commit 0460613aea
4 changed files with 17 additions and 7 deletions

View File

@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Mon Apr 14 14:22:32 GMT 2025 #Tue Apr 15 12:41:31 GMT 2025
stageCount=3 stageCount=3
libraryProject= libraryProject=
baseVersion=15.2 baseVersion=15.2
publishVersion=15.2.2 publishVersion=15.2.2
buildCount=6 buildCount=9
baseBetaVersion=15.2.3 baseBetaVersion=15.2.3

View File

@ -59,11 +59,13 @@ implements BackgroundPicturePreviewDialog.IOnRecivedPictureListener {
static String _mszCommonFileType = "jpeg"; static String _mszCommonFileType = "jpeg";
// 背景图片的压缩比 // 背景图片的压缩比
int mnPictureCompress = 100; int mnPictureCompress = 100;
static String _RecivedPictureFileName;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_backgroundpicture); setContentView(R.layout.activity_backgroundpicture);
initEnv();
mBackgroundPictureUtils = BackgroundPictureUtils.getInstance(this); mBackgroundPictureUtils = BackgroundPictureUtils.getInstance(this);
mfBackgroundDir = new File(mBackgroundPictureUtils.getBackgroundDir()); mfBackgroundDir = new File(mBackgroundPictureUtils.getBackgroundDir());
@ -130,6 +132,10 @@ implements BackgroundPicturePreviewDialog.IOnRecivedPictureListener {
dlg.show(); dlg.show();
} }
} }
void initEnv() {
_RecivedPictureFileName = "Recived.data";
}
public static String getBackgroundFileName() { public static String getBackgroundFileName() {
return _mszRecivedCropPicture; return _mszRecivedCropPicture;
@ -331,10 +337,9 @@ implements BackgroundPicturePreviewDialog.IOnRecivedPictureListener {
} }
public static File getRecivedPictureFile(Context context) { public static File getRecivedPictureFile(Context context) {
String szRecivedPictureFileName = "Recived.data";
BackgroundPictureUtils utils = BackgroundPictureUtils.getInstance(context); BackgroundPictureUtils utils = BackgroundPictureUtils.getInstance(context);
utils.loadBackgroundPictureBean(); utils.loadBackgroundPictureBean();
return new File(utils.getBackgroundDir(), szRecivedPictureFileName); return new File(utils.getBackgroundDir(), _RecivedPictureFileName);
} }
@Override @Override

View File

@ -37,6 +37,8 @@ public class BackgroundPicturePreviewDialog extends Dialog {
public BackgroundPicturePreviewDialog(Context context) { public BackgroundPicturePreviewDialog(Context context) {
super(context); super(context);
setContentView(R.layout.dialog_backgroundpicturepreview); setContentView(R.layout.dialog_backgroundpicturepreview);
initEnv();
mContext = context; mContext = context;
mBackgroundPictureUtils = ((BackgroundPictureActivity)context).mBackgroundPictureUtils; mBackgroundPictureUtils = ((BackgroundPictureActivity)context).mBackgroundPictureUtils;
@ -68,6 +70,10 @@ public class BackgroundPicturePreviewDialog extends Dialog {
} }
}); });
} }
void initEnv() {
mszPreReceivedFileName = "PreReceived.data";
}
void copyAndViewRecivePicture(ImageView imageView) { void copyAndViewRecivePicture(ImageView imageView) {
//AppConfigUtils appConfigUtils = AppConfigUtils.getInstance((GlobalApplication)mContext.getApplicationContext()); //AppConfigUtils appConfigUtils = AppConfigUtils.getInstance((GlobalApplication)mContext.getApplicationContext());
@ -87,7 +93,6 @@ public class BackgroundPicturePreviewDialog extends Dialog {
} }
File fSrcImage = new File(szSrcImage); File fSrcImage = new File(szSrcImage);
mszPreReceivedFileName = "PreReceived.data";
//mszPreReceivedFileName = DateUtils.getDateNowString() + "-" + fSrcImage.getName(); //mszPreReceivedFileName = DateUtils.getDateNowString() + "-" + fSrcImage.getName();
File mfPreReceivedPhoto = new File(activity.mBackgroundPictureUtils.getBackgroundDir(), mszPreReceivedFileName); File mfPreReceivedPhoto = new File(activity.mBackgroundPictureUtils.getBackgroundDir(), mszPreReceivedFileName);
// 复制源图片到剪裁文件 // 复制源图片到剪裁文件
@ -96,7 +101,7 @@ public class BackgroundPicturePreviewDialog extends Dialog {
LogUtils.d(TAG, "copyFileUsingFileChannels"); LogUtils.d(TAG, "copyFileUsingFileChannels");
Drawable drawable = Drawable.createFromPath(mfPreReceivedPhoto.getPath()); Drawable drawable = Drawable.createFromPath(mfPreReceivedPhoto.getPath());
imageView.setBackground(drawable); imageView.setBackground(drawable);
LogUtils.d(TAG, "mszPreReceivedFileName : " + mszPreReceivedFileName); //LogUtils.d(TAG, "mszPreReceivedFileName : " + mszPreReceivedFileName);
} catch (IOException e) { } catch (IOException e) {
LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); LogUtils.d(TAG, e, Thread.currentThread().getStackTrace());
} }

View File

@ -32,7 +32,7 @@ import java.io.File;
public class MainViewFragment extends Fragment { public class MainViewFragment extends Fragment {
public static final String TAG = MainViewFragment.class.getSimpleName(); public static final String TAG = "MainViewFragment";
public static final int MSG_RELOAD_APPCONFIG = 0; public static final int MSG_RELOAD_APPCONFIG = 0;
public static final int MSG_CURRENTVALUEBATTERY = 1; public static final int MSG_CURRENTVALUEBATTERY = 1;