Skip to content

Commit

Permalink
IllegalStateException on Error Dialog in Search Activity (#57)
Browse files Browse the repository at this point in the history
* Updated onBackPressed to finish

* Fixed deprecation warning
  • Loading branch information
Ninjaman494 authored Mar 7, 2021
1 parent 881ab72 commit 6fa1866
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void onDataReceived(List<List<ConjugationFragment>> conjugations) {
public void onError(Throwable e) {
e.printStackTrace();
Utils.handleError(e, ConjugationActivity.this,4,
(dialogInterface, i) -> ConjugationActivity.this.onBackPressed());
(dialogInterface, i) -> ConjugationActivity.this.finish());
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void onError(Throwable e) {
e.printStackTrace();
AppCompatActivity activity = ConjugatorActivity.this;
Utils.handleError(e, activity,11,
(dialogInterface, i) -> activity.onBackPressed());
(dialogInterface, i) -> activity.finish());
}

@Override
Expand Down Expand Up @@ -183,7 +183,7 @@ public void onDataReceived(List<List<ConjugationFragment>> conjugations) {
public void onError(Throwable e) {
e.printStackTrace();
Utils.handleError(e, ConjugatorActivity.this,10,
(dialogInterface, i) -> ConjugatorActivity.this.onBackPressed());
(dialogInterface, i) -> ConjugatorActivity.this.finish());
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected void onCreate(Bundle savedInstanceState) {
// Make sure extras were passed
if(id == null){
Exception exception = new Exception("ID was null in DisplayActivity");
Utils.handleError(exception, this, 5, (dialogInterface, i) -> onBackPressed());
Utils.handleError(exception, this, 5, (dialogInterface, i) -> finish());
return;
}

Expand All @@ -66,7 +66,7 @@ protected void onCreate(Bundle savedInstanceState) {
@Override
public void onError(Throwable t) {
t.printStackTrace();
Utils.handleError(t, DisplayActivity.this,2, (dialogInterface, i) -> DisplayActivity.this.onBackPressed());
Utils.handleError(t, DisplayActivity.this,2, (dialogInterface, i) -> DisplayActivity.this.finish());
}

@Override
Expand Down Expand Up @@ -111,7 +111,7 @@ public void onComplete() {
// If no conjugations, create an empty list to prevent a null exception
.map(o -> o instanceof String
? new FavoritesQuery.Data(new ArrayList<>())
: ((Response<FavoritesQuery.Data>) o).data())
: ((Response<FavoritesQuery.Data>) o).getData())
.subscribeWith(observer);

LinearLayout linearLayout = findViewById(R.id.disp_root);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void onNext(Response<SearchQuery.Data> dataResponse) {
@Override
public void onError(Throwable e) {
e.printStackTrace();
Utils.handleError(e, SearchActivity.this, 1, (dialogInterface, i) -> SearchActivity.this.onBackPressed());
Utils.handleError(e, SearchActivity.this, 1, (dialogInterface, i) -> SearchActivity.this.finish());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected void onCreate(Bundle savedInstanceState) {
String query = getIntent().getStringExtra(EXTRA_QUERY);
if(query == null){ // Null check for extra
Exception exception = new Exception("Query was null in SearchResultsActivity");
Utils.handleError(exception, this, 6, (dialogInterface, i) -> onBackPressed());
Utils.handleError(exception, this, 6, (dialogInterface, i) -> finish());
return;
}

Expand Down Expand Up @@ -130,7 +130,7 @@ public void onNext(Response<SearchQuery.Data> dataResponse) {
@Override
public void onError(Throwable e) {
e.printStackTrace();
Utils.handleError(e, SearchResultsActivity.this, 3, (dialogInterface, i) -> SearchResultsActivity.this.onBackPressed());
Utils.handleError(e, SearchResultsActivity.this, 3, (dialogInterface, i) -> SearchResultsActivity.this.finish());
}

@Override
Expand Down

0 comments on commit 6fa1866

Please sign in to comment.