Commit f47f990f authored by fallenstardust's avatar fallenstardust

fix 背景图选择尺寸不正确

add bgs
parent d173a991
......@@ -28,6 +28,7 @@
根据文件类型自动存放到对应位置;
3.安卓15系统自动开启沉浸式;
4.提高图片选择时的缓存大小降低闪退可能;
5.为头像、卡背、背景添加备选图片;
</pre>
<h3 style="color:#ff0000">注意</h3>
<pre>
......
......@@ -3,6 +3,7 @@ package cn.garymb.ygomobile.adapter;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
......@@ -29,14 +30,15 @@ public class DialogImageAdapter extends BaseAdapter {
private int itemWidth;
private int itemHeight;
private String mFilename;
private AppsSettings mSettings; // 假设AppsSettings是你的设置类
private CurImageInfo mCurImageInfo;
private AppsSettings mSettings;
public DialogImageAdapter(DialogPlus dlg, Context context, ImageView imageView, ArrayList<ImageItem> imageItems, int[] itemWidth_itemHeight, String outFile, OnImageSelectedListener listener) {
this.mDialogPlus = dlg;
this.context = context;
this.mImageView = imageView;
this.imageItems = imageItems;
if (itemWidth_itemHeight[0] >= 960) itemWidth_itemHeight[0]/= 7;
if (itemWidth_itemHeight[1] >= 540) itemWidth_itemHeight[1]/= 7;
this.itemWidth = itemWidth_itemHeight[0];
this.itemHeight = itemWidth_itemHeight[1];
this.mFilename = outFile;
......@@ -76,7 +78,7 @@ public class DialogImageAdapter extends BaseAdapter {
public View getView(final int position, View convertView, ViewGroup parent) {
ImageView iv;
final ImageItem item = imageItems.get(position);
//初始化item的布局iv
if (convertView == null) {
iv = new ImageView(context);
iv.setLayoutParams(new GridView.LayoutParams(itemWidth, itemHeight));
......
......@@ -55,18 +55,6 @@ public abstract class PreferenceFragmentPlus extends BasePreferenceFragment {
curPreference = preference;
Intent intent = FileActivity.getIntent(getActivity(), title, type, defPath, false, FileOpenType.SelectFile);
startActivityForResult(intent, REQUEST_CHOOSE_FILE);
//
// Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
//// intent.addCategory(Intent.CATEGORY_OPENABLE);
// intent.setType(type);
// try {
// startActivityForResult(intent,
// REQUEST_CHOOSE_FILE);
// } catch (android.content.ActivityNotFoundException ex) {
// Toast.makeText(getActivity(), R.string.no_find_file_selectotr, Toast.LENGTH_SHORT)
// .show();
// onChooseFileFail(preference);
// }
}
public Context getContext() {
......
......@@ -683,6 +683,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
final DialogPlus dlg = new DialogPlus(getContext());
dlg.setContentView(R.layout.dialog_image_select);
dlg.setTitle(R.string.dialog_select_image);
dlg.show();
GridView vImgSel = dlg.findViewById(R.id.gridView);
ArrayList<ImageItem> items = new ArrayList<>();
// 添加相册选择item
......@@ -696,6 +697,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
}
}
}
// 从Intent中获取传递的图片路径
if (imagePath != null) {
// 设置适配器
......@@ -711,7 +713,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
dlg.dismiss();
showImageCropChooser(preference, getString(R.string.dialog_select_image), outFile, true, itemWidth_itemHeight[0], itemWidth_itemHeight[1]);
}
dlg.show();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment