mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-02-13 09:28:44 +01:00
Handle no browser when trying to opening links. Fixed app crashes in various cases.
This commit is contained in:
parent
11f6b5dc91
commit
9b24fff160
@ -207,7 +207,11 @@ public class LinkResolverActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
if (!packageNames.isEmpty()) {
|
if (!packageNames.isEmpty()) {
|
||||||
intent.setPackage(packageNames.get(0));
|
intent.setPackage(packageNames.get(0));
|
||||||
|
try {
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
Toast.makeText(this, R.string.no_browser_found, Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, R.string.no_browser_found, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, R.string.no_browser_found, Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
|
@ -640,7 +640,7 @@ public class ViewPostDetailActivity extends BaseActivity implements FlairBottomS
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void refresh(boolean fetchPost, boolean fetchComments) {
|
private void refresh(boolean fetchPost, boolean fetchComments) {
|
||||||
if (!isRefreshing) {
|
if (mAdapter != null && !isRefreshing) {
|
||||||
isRefreshing = true;
|
isRefreshing = true;
|
||||||
mChildrenStartingIndex = 0;
|
mChildrenStartingIndex = 0;
|
||||||
|
|
||||||
|
@ -979,16 +979,14 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getParentPosition(int position) {
|
private int getParentPosition(int position) {
|
||||||
if (position >= mVisibleComments.size()) {
|
if (position < mVisibleComments.size()) {
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int childDepth = mVisibleComments.get(position).getDepth();
|
int childDepth = mVisibleComments.get(position).getDepth();
|
||||||
for (int i = position; i >= 0; i--) {
|
for (int i = position; i >= 0; i--) {
|
||||||
if (mVisibleComments.get(i).getDepth() < childDepth) {
|
if (mVisibleComments.get(i).getDepth() < childDepth) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1557,6 +1555,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
expandButton.setOnClickListener(view -> {
|
expandButton.setOnClickListener(view -> {
|
||||||
if (expandButton.getVisibility() == View.VISIBLE) {
|
if (expandButton.getVisibility() == View.VISIBLE) {
|
||||||
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
|
int commentPosition = mIsSingleCommentThreadMode ? getAdapterPosition() - 2 : getAdapterPosition() - 1;
|
||||||
|
if(commentPosition < mVisibleComments.size()) {
|
||||||
if (mVisibleComments.get(commentPosition).isExpanded()) {
|
if (mVisibleComments.get(commentPosition).isExpanded()) {
|
||||||
collapseChildren(commentPosition);
|
collapseChildren(commentPosition);
|
||||||
expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
|
expandButton.setImageResource(R.drawable.ic_expand_more_black_20dp);
|
||||||
@ -1566,6 +1565,7 @@ public class CommentAndPostRecyclerViewAdapter extends RecyclerView.Adapter<Recy
|
|||||||
expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
|
expandButton.setImageResource(R.drawable.ic_expand_less_black_20dp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
commentMarkdownView.setOnLongClickListener(view -> {
|
commentMarkdownView.setOnLongClickListener(view -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user