Merge pull request #5822 from nextcloud/conflictToast

Fix crash while showing ConflictDialog
This commit is contained in:
Tobias Kaminsky 2020-04-08 07:12:25 +02:00 committed by GitHub
commit ade73c3e57
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -46,8 +46,7 @@ import androidx.fragment.app.FragmentTransaction;
/**
* Wrapper activity which will be launched if keep-in-sync file will be modified by external
* application.
* Wrapper activity which will be launched if keep-in-sync file will be modified by external application.
*/
public class ConflictsResolveActivity extends FileActivity implements OnConflictDecisionMadeListener {
/**
@ -226,7 +225,7 @@ public class ConflictsResolveActivity extends FileActivity implements OnConflict
}
private void showErrorAndFinish() {
Toast.makeText(this, R.string.conflict_dialog_error, Toast.LENGTH_LONG).show();
runOnUiThread(() -> Toast.makeText(this, R.string.conflict_dialog_error, Toast.LENGTH_LONG).show());
finish();
}

View file

@ -214,13 +214,16 @@ public class PreviewTextFileFragment extends PreviewTextFragment {
if (textView != null) {
mOriginalText = stringWriter.toString();
mSearchView.setOnQueryTextListener(PreviewTextFileFragment.this);
setText(textView, mOriginalText, getFile(), requireActivity());
if (mSearchView != null) {
mSearchView.setOnQueryTextListener(PreviewTextFileFragment.this);
if (mSearchOpen) {
mSearchView.setQuery(mSearchQuery, true);
}
}
textView.setVisibility(View.VISIBLE);
}