mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 704879 - (4.5/6) Refactor message handling code into separate private messages. r=lucasr
This commit is contained in:
parent
7873ab994b
commit
c5e13ea346
@ -98,30 +98,38 @@ public class FormAssistPopup extends ListView implements GeckoEventListener {
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
try {
|
||||
if (event.equals("FormAssist:AutoComplete")) {
|
||||
final JSONArray suggestions = message.getJSONArray("suggestions");
|
||||
final JSONArray rect = message.getJSONArray("rect");
|
||||
final double zoom = message.getDouble("zoom");
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
// Don't show autocomplete popup when using fullscreen // VKB
|
||||
InputMethodManager imm =
|
||||
(InputMethodManager) GeckoApp.mAppContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (!imm.isFullscreenMode())
|
||||
show(suggestions, rect, zoom);
|
||||
}
|
||||
});
|
||||
handleAutoCompleteMessage(message);
|
||||
} else if (event.equals("FormAssist:Hide")) {
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
handleHideMessage(message);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(LOGTAG, "Exception handling message \"" + event + "\":", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAutoCompleteMessage(JSONObject message) throws JSONException {
|
||||
final JSONArray suggestions = message.getJSONArray("suggestions");
|
||||
final JSONArray rect = message.getJSONArray("rect");
|
||||
final double zoom = message.getDouble("zoom");
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
// Don't show autocomplete popup when using fullscreen VKB
|
||||
InputMethodManager imm =
|
||||
(InputMethodManager) GeckoApp.mAppContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (!imm.isFullscreenMode())
|
||||
show(suggestions, rect, zoom);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleHideMessage(JSONObject message) {
|
||||
GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
|
||||
public void run() {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void show(JSONArray suggestions, JSONArray rect, double zoom) {
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(mContext, R.layout.autocomplete_list_item);
|
||||
for (int i = 0; i < suggestions.length(); i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user