Fix some crashes
This commit is contained in:
4 files changed
+49
-21
No files matched your search
@@ -125,7 +125,13 @@ public class AdvancedFragment extends BaseSettingsFragment {
|
||||
if (data != null) {
|
||||
Uri uri = data.getData();
|
||||
if (uri != null) {
|
||||
requireActivity().grantUriPermission(BuildConfig.APPLICATION_ID, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||
try {
|
||||
// grantUriPermission might throw RemoteException on MIUI
|
||||
requireActivity().grantUriPermission(BuildConfig.APPLICATION_ID, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||
} catch (Exception e){
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
AlertDialog alertDialog = new MaterialAlertDialogBuilder(requireActivity())
|
||||
.setCancelable(false)
|
||||
@@ -153,7 +159,13 @@ public class AdvancedFragment extends BaseSettingsFragment {
|
||||
if (data != null) {
|
||||
Uri uri = data.getData();
|
||||
if (uri != null) {
|
||||
requireActivity().grantUriPermission(BuildConfig.APPLICATION_ID, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
try {
|
||||
// grantUriPermission might throw RemoteException on MIUI
|
||||
requireActivity().grantUriPermission(BuildConfig.APPLICATION_ID, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
} catch (Exception e){
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
AlertDialog alertDialog = new MaterialAlertDialogBuilder(requireActivity())
|
||||
.setCancelable(false)
|
||||
@@ -181,7 +193,13 @@ public class AdvancedFragment extends BaseSettingsFragment {
|
||||
if (data != null) {
|
||||
Uri uri = data.getData();
|
||||
if (uri != null) {
|
||||
requireActivity().grantUriPermission(BuildConfig.APPLICATION_ID, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||
try {
|
||||
// grantUriPermission might throw RemoteException on MIUI
|
||||
requireActivity().grantUriPermission(BuildConfig.APPLICATION_ID, uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
|
||||
} catch (Exception e){
|
||||
ExceptionUtils.throwIfFatal(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
boolean ok = LogCat.save(requireActivity().getContentResolver().openOutputStream(uri));
|
||||
((SettingsActivity) requireActivity()).showTip(
|
||||
|
||||
@@ -1040,9 +1040,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
|
||||
private String getAllRatingText(float rating, int ratingCount) {
|
||||
Resources resources = getResources2();
|
||||
AssertUtils.assertNotNull(resources);
|
||||
return resources.getString(R.string.rating_text, getRatingText(rating), rating, ratingCount);
|
||||
return getString(R.string.rating_text, getRatingText(rating), rating, ratingCount);
|
||||
}
|
||||
|
||||
private void setTransitionName() {
|
||||
|
||||
@@ -152,10 +152,20 @@ public class SearchBar extends MaterialCardView implements View.OnClickListener,
|
||||
mListView.addItemDecoration(decoration);
|
||||
mListView.setLayoutManager(layoutManager);
|
||||
mListView.setOnItemClickListener((parent, view, position, id) -> {
|
||||
mSuggestionList.get(position).onClick();
|
||||
return true;
|
||||
if (position < mSuggestionList.size() - 1) {
|
||||
mSuggestionList.get(position).onClick();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mListView.setOnItemLongClickListener((parent, view, position, id) -> {
|
||||
if (position < mSuggestionList.size() - 1) {
|
||||
return mSuggestionList.get(position).onLongClick();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
mListView.setOnItemLongClickListener((parent, view, position, id) -> mSuggestionList.get(position).onLongClick());
|
||||
}
|
||||
|
||||
private void addListHeader() {
|
||||
|
||||
@@ -271,23 +271,25 @@ public class SearchLayout extends EasyRecyclerView implements CompoundButton.OnC
|
||||
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
int oldItemCount = mAdapter.getItemCount();
|
||||
post(() -> {
|
||||
int oldItemCount = mAdapter.getItemCount();
|
||||
|
||||
mSearchMode++;
|
||||
if (mSearchMode > SEARCH_MODE_IMAGE) {
|
||||
mSearchMode = SEARCH_MODE_NORMAL;
|
||||
}
|
||||
mSearchMode++;
|
||||
if (mSearchMode > SEARCH_MODE_IMAGE) {
|
||||
mSearchMode = SEARCH_MODE_NORMAL;
|
||||
}
|
||||
|
||||
int newItemCount = mAdapter.getItemCount();
|
||||
int newItemCount = mAdapter.getItemCount();
|
||||
|
||||
mAdapter.notifyItemRangeRemoved(0, oldItemCount - 1);
|
||||
mAdapter.notifyItemRangeInserted(0, newItemCount - 1);
|
||||
mAdapter.notifyItemRangeRemoved(0, oldItemCount - 1);
|
||||
mAdapter.notifyItemRangeInserted(0, newItemCount - 1);
|
||||
|
||||
mSearchMode = tab.getPosition();
|
||||
mSearchMode = tab.getPosition();
|
||||
|
||||
if (mHelper != null) {
|
||||
mHelper.onChangeSearchMode();
|
||||
}
|
||||
if (mHelper != null) {
|
||||
mHelper.onChangeSearchMode();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user