Close radical view when pressing back on main activity.

Julien LepillerFri Jun 19 23:56:18+0200 2020

ea56927

Close radical view when pressing back on main activity.

CHANGELOG.md

11
Changelog
22
=========
33
4+
Changes Since 0.3.0
5+
-------------------
6+
7+
### UI Fixes
8+
9+
* Clicking the back button when the radical panel is open will now close the panel
10+
  instead of exiting the app. No change the behavior when the panel is already
11+
  closed.
12+
13+
### Translations
14+
15+
* Update fr translation.
16+
* Translations are now hosted on [fedora's weblate](https://translate.fedoraproject.org/projects/nani/).
17+
418
Changes In 0.3.0
519
----------------
620

app/src/main/java/eu/lepiller/nani/MainActivity.java

336336
337337
        return super.onOptionsItemSelected(item);
338338
    }
339+
340+
    @Override
341+
    public void onBackPressed() {
342+
        if(radical_selector.getVisibility() == View.VISIBLE) {
343+
            radical_selector.close();
344+
        } else {
345+
            super.onBackPressed();
346+
        }
347+
    }
339348
}

app/src/main/java/eu/lepiller/nani/RadicalSelectorView.java

209209
        kanjiSelectionListener = listener;
210210
    }
211211
212+
    public void close() {
213+
        close_button.callOnClick();
214+
    }
215+
212216
    public void updateSelection(Map<Integer, List<String>> kanji) {
213217
        LinearLayout row = kanji_row1;
214218
        kanji_row1.removeAllViews();