Allow plugins to add panes to mobile nav drawer
This commit is contained in:
parent
40d25ad8ef
commit
ad6a447bde
@ -50,6 +50,10 @@
|
||||
// iitcLoaded: called after IITC and all plugins loaded
|
||||
// portalDetailLoaded: called when a request to load full portal detail
|
||||
// completes. guid, success, details parameters
|
||||
// paneChanged called when the current pane has changed. On desktop,
|
||||
// this only selects the current chat pane; on mobile, it
|
||||
// also switches between map, info and other panes defined
|
||||
// by plugins
|
||||
|
||||
window._hooks = {}
|
||||
window.VALID_HOOKS = [
|
||||
@ -60,7 +64,7 @@ window.VALID_HOOKS = [
|
||||
'publicChatDataAvailable', 'factionChatDataAvailable',
|
||||
'requestFinished', 'nicknameClicked',
|
||||
'geoSearch', 'iitcLoaded',
|
||||
'portalDetailLoaded'];
|
||||
'portalDetailLoaded', 'paneChanged'];
|
||||
|
||||
window.runHooks = function(event, data) {
|
||||
if(VALID_HOOKS.indexOf(event) === -1) throw('Unknown event type: ' + event);
|
||||
|
@ -3,6 +3,8 @@
|
||||
window.show = function(id) {
|
||||
window.hideall();
|
||||
|
||||
runHooks("paneChanged", id);
|
||||
|
||||
switch(id) {
|
||||
case 'full':
|
||||
window.chat.show('full');
|
||||
@ -27,9 +29,6 @@ window.show = function(id) {
|
||||
case 'info':
|
||||
window.smartphone.sideButton.click();
|
||||
break;
|
||||
default:
|
||||
window.smartphone.mapButton.click();
|
||||
break;
|
||||
}
|
||||
|
||||
if (typeof android !== 'undefined' && android && android.switchToPane) {
|
||||
|
@ -168,4 +168,14 @@ public class IITC_JSInterface {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void addPane(final String name, final String label, final String icon) {
|
||||
mIitc.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mIitc.getNavigationHelper().addPane(name, label, icon);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -168,6 +168,11 @@ public class IITC_NavigationHelper extends ActionBarDrawerToggle implements OnIt
|
||||
}
|
||||
}
|
||||
|
||||
public void addPane(String name, String label, String icon) {
|
||||
// TODO handle icon
|
||||
mNavigationAdapter.add(new Pane(name, label, 0));
|
||||
}
|
||||
|
||||
public void closeDrawers() {
|
||||
mDrawerLayout.closeDrawers();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user