Commit 649dbe7c authored by feihuaduo's avatar feihuaduo

修复选择图片跳转多个图片选择器的问题

parent 4e988e3a
...@@ -108,8 +108,8 @@ dependencies { ...@@ -108,8 +108,8 @@ dependencies {
implementation(name: 'dialogutils2-release', ext: 'aar') implementation(name: 'dialogutils2-release', ext: 'aar')
//recyclerview的adapter库 //recyclerview的adapter库
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30' implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
api 'androidx.appcompat:appcompat:1.0.2' implementation 'androidx.appcompat:appcompat:1.0.2'
api 'com.google.android.material:material:1.0.0' implementation 'com.google.android.material:material:1.0.0'
//图片选择 //图片选择
implementation 'com.yuyh.imgsel:library:2.0.6' implementation 'com.yuyh.imgsel:library:2.0.6'
} }
...@@ -3,10 +3,16 @@ package cn.garymb.ygomobile; ...@@ -3,10 +3,16 @@ package cn.garymb.ygomobile;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.widget.ImageView;
import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.app.AppCompatDelegate;
import com.bumptech.glide.Glide;
import com.yuyh.library.imgsel.ISNav;
import com.yuyh.library.imgsel.common.ImageLoader;
import cn.garymb.ygomobile.utils.CrashHandler; import cn.garymb.ygomobile.utils.CrashHandler;
public class App extends GameApplication { public class App extends GameApplication {
...@@ -23,7 +29,8 @@ public class App extends GameApplication { ...@@ -23,7 +29,8 @@ public class App extends GameApplication {
initSoundEffectPool(); initSoundEffectPool();
setInitSoundEffectPool(true); setInitSoundEffectPool(true);
} }
//初始化图片选择器
initImgsel();
// QbSdk.initX5Environment(this, null); // QbSdk.initX5Environment(this, null);
// QbSdk.setCurrentID(""); // QbSdk.setCurrentID("");
} }
...@@ -122,4 +129,14 @@ public class App extends GameApplication { ...@@ -122,4 +129,14 @@ public class App extends GameApplication {
intent.setAction("RUN_WINDBOT"); intent.setAction("RUN_WINDBOT");
getBaseContext().sendBroadcast(intent); getBaseContext().sendBroadcast(intent);
} }
private void initImgsel() {
// 自定义图片加载器
ISNav.getInstance().init(new ImageLoader() {
@Override
public void displayImage(Context context, String path, ImageView imageView) {
Glide.with(context).load(path).into(imageView);
}
});
}
} }
...@@ -65,8 +65,6 @@ public class MainActivity extends HomeActivity { ...@@ -65,8 +65,6 @@ public class MainActivity extends HomeActivity {
// ActivityCompat.requestPermissions(this, PERMISSIONS, 0); // ActivityCompat.requestPermissions(this, PERMISSIONS, 0);
//资源复制 //资源复制
checkRes(); checkRes();
// 自定义图片加载器
Startimgsel();
} }
@SuppressLint({"StringFormatMatches", "StringFormatInvalid"}) @SuppressLint({"StringFormatMatches", "StringFormatInvalid"})
...@@ -256,13 +254,5 @@ public class MainActivity extends HomeActivity { ...@@ -256,13 +254,5 @@ public class MainActivity extends HomeActivity {
/* checkResourceDownload((result, isNewVersion) -> { /* checkResourceDownload((result, isNewVersion) -> {
Toast.makeText(this, R.string.tip_reset_game_res, Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.tip_reset_game_res, Toast.LENGTH_SHORT).show();
});*/ });*/
public void Startimgsel() {
// 自定义图片加载器
ISNav.getInstance().init(new ImageLoader() {
@Override
public void displayImage(Context context, String path, ImageView imageView) {
Glide.with(context).load(path).into(imageView);
}
});
}
} }
...@@ -98,7 +98,6 @@ public abstract class PreferenceFragmentPlus extends BasePreferenceFragment { ...@@ -98,7 +98,6 @@ public abstract class PreferenceFragmentPlus extends BasePreferenceFragment {
// Intent intent = FileActivity.getIntent(getActivity(), title, "*.[jpg|png|bmp]", defPath, false, FileOpenType.SelectFile); // Intent intent = FileActivity.getIntent(getActivity(), title, "*.[jpg|png|bmp]", defPath, false, FileOpenType.SelectFile);
// startActivityForResult(intent, REQUEST_CHOOSE_IMG); // startActivityForResult(intent, REQUEST_CHOOSE_IMG);
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
// intent.addCategory(Intent.CATEGORY_OPENABLE); // intent.addCategory(Intent.CATEGORY_OPENABLE);
// intent.setType("image/*"); // intent.setType("image/*");
ISListConfig config = new ISListConfig.Builder() ISListConfig config = new ISListConfig.Builder()
...@@ -131,13 +130,6 @@ public abstract class PreferenceFragmentPlus extends BasePreferenceFragment { ...@@ -131,13 +130,6 @@ public abstract class PreferenceFragmentPlus extends BasePreferenceFragment {
// 跳转到图片选择器 // 跳转到图片选择器
ISNav.getInstance().toListActivity(this, config, REQUEST_CHOOSE_IMG); ISNav.getInstance().toListActivity(this, config, REQUEST_CHOOSE_IMG);
try {
startActivityForResult(intent, REQUEST_CHOOSE_IMG);
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(getActivity(), ex + "", Toast.LENGTH_LONG)
.show();
onChooseFileFail(preference);
}
} }
//已弃用裁剪 //已弃用裁剪
......
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