/** Handle when the window is pressed */ public void handlePopupWindowClicked() { // Dismisses the window for now adminTipView.getWindow().dismiss(); }
/** Handle when the accept button is pressed */ public void handleAcceptButtonClicked() { adminTipView.getAcceptBarOverlay().setVisibility(View.VISIBLE); // Dismisses the window for now adminTipView.getWindow().dismiss(); }
@Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (!D) return true; if (event.getAction() != KeyEvent.ACTION_DOWN) { return true; } switch (keyCode) { case KeyEvent.KEYCODE_1: { Log.v(TAG, "pressed 1 key - confirmation screen"); LayoutInflater inflater = (LayoutInflater) MainApplication.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); ConfirmationView confirmationView = new ConfirmationView(inflater); confirmationView.launch(); break; } case KeyEvent.KEYCODE_2: { Log.v(TAG, "pressed 2 key - invitation screen"); LayoutInflater inflater = (LayoutInflater) MainApplication.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); InvitationView invitationView = new InvitationView(inflater); invitationView.launch(); break; } case KeyEvent.KEYCODE_3: { Log.v(TAG, "pressed 3 key - login screen"); LayoutInflater inflater = (LayoutInflater) MainApplication.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // LoginView loginView = new LoginView(inflater); // loginView.launch(); break; } case KeyEvent.KEYCODE_4: { Log.v(TAG, "pressed 4 key - tip screen"); LayoutInflater inflater = (LayoutInflater) MainApplication.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); TipView tipView = new TipView(inflater); tipView.launch(); break; } case KeyEvent.KEYCODE_5: { Log.v(TAG, "pressed 5 key - admin tip screen"); LayoutInflater inflater = (LayoutInflater) MainApplication.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); AdminTipView adminTipView = new AdminTipView(inflater); adminTipView.launch(); break; } case KeyEvent.KEYCODE_6: { Log.v(TAG, "pressed 6 key - dashboard screen"); LayoutInflater inflater = (LayoutInflater) MainApplication.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); // DashboardView dashboardView = new DashboardView(inflater); // dashboardView.launch(); break; } case KeyEvent.KEYCODE_7: { Log.v(TAG, "pressed 7 key - sound settings screen"); LayoutInflater inflater = (LayoutInflater) MainApplication.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); SoundSettingsView soundSettingsView = new SoundSettingsView(inflater); soundSettingsView.launch(); break; } case KeyEvent.KEYCODE_8: { Log.v(TAG, "Pressed 8 key - Signup"); SignupView view = new SignupView(MainApplication.this); view.launch(); break; } case KeyEvent.KEYCODE_M: { // invite a user to the mainspace. Assume inviter is owner int i = 0; Log.v(TAG, "pressed M key - invitation" + i++); (Space.getMainSpace().getInvitationController()).inviteUser(debug, "You're fun!"); break; } case KeyEvent.KEYCODE_N: { Log.v(TAG, "pressed N key - kickout"); Space.getMainSpace().getKickoutController().kickoutUser(debug, "You suck!"); break; } case KeyEvent.KEYCODE_V: { Log.v(TAG, "pressed V key - change owner"); Space.getMainSpace() .getParticipantController() .grantOwnership("opencommsec@" + Network.DEFAULT_HOSTNAME, false); break; } case KeyEvent.KEYCODE_Z: { Iterator<String> affiliates = Space.getMainSpace().getMUC().getOccupants(); while (affiliates.hasNext()) { String a = affiliates.next(); Log.v( TAG, a + "'s affiliaton is " + Space.getMainSpace().getMUC().getOccupant(a).getAffiliation()); } break; } case KeyEvent.KEYCODE_J: { Log.v(TAG, "Pressed J key - join"); Space.getMainSpace() .getParticipantStatusController() .joined("roomname@" + Network.DEFAULT_CONFERENCE + "/" + debug1.getNickname()); break; } case KeyEvent.KEYCODE_S: { Log.v(TAG, "Pressed S key - create a new private space"); try { SpaceController.addSpace((Context) MainApplication.screen.getContext()); } catch (XMPPException e) { Log.v(TAG, "Can't create another private space :("); } break; } case KeyEvent.KEYCODE_MENU: { Log.v(TAG, "Clicked on MENU key"); LayoutInflater inflater = (LayoutInflater) MainApplication.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); MenuView menuView = new MenuView(inflater); menuView.launch(); break; } case KeyEvent.KEYCODE_B: { Log.v(TAG, "pressed B key - leave space"); Space.getMainSpace().getParticipantController().leaveSpace(false); break; } case KeyEvent.KEYCODE_Q: { Log.v(TAG, "pressed Q key - you (a moderator) received an invite request"); InvitationController ic = MainApplication.screen.getSpace().getInvitationController(); // fake invite request String inviteRequest = "" + Network.REQUEST_INVITE + "@inviter" + debug.getUsername() + "@invitee" + debug1.getUsername() + "@reason" + "Because you're a cool cat."; ic.receiveInvitationRequest(inviteRequest); break; } case KeyEvent.KEYCODE_W: { Log.v(TAG, "pressed W key - you received an invite to a chat"); InvitationController ic = MainApplication.screen.getSpace().getInvitationController(); // fake invite request String inviteRequest = "" + Network.REQUEST_INVITE + "@requester" + debug.getUsername() + "@invitee" + MainApplication.userPrimary.getUsername() + "@reason" + "Because you're a cool cat."; ic.receiveInvitationRequest(inviteRequest); /* * LoginController.xmppService.getInvitiationListener(). * invitationReceived(LoginController.xmppConnection, "", * debug.getUsername(), "reason", "password", new * Message("blah message")); */ break; } case KeyEvent.KEYCODE_E: { Log.v(TAG, "pressed E key - you (a moderator) received a kickout request"); KickoutController kc = MainApplication.screen.getSpace().getKickoutController(); // fake kickout request String kickoutRequest = "" + Network.REQUEST_KICKOUT + "@requester" + debug.getUsername() + "@kickee" + debug1.getUsername() + "@reason" + "Because you didn't give me food."; kc.receiveKickoutRequest(kickoutRequest); break; } case KeyEvent.KEYCODE_R: { Log.v(TAG, "pressed R key - you received a kickout confirmation"); KickoutController kc = MainApplication.screen.getSpace().getKickoutController(); // fake kickout request String kickoutRequest = "" + Network.REQUEST_KICKOUT + "@requester" + debug.getUsername() + "@kickee" + MainApplication.userPrimary.getUsername() + "@reason" + "Because you didn't give me food."; kc.receiveKickoutRequest(kickoutRequest); break; } case KeyEvent.KEYCODE_A: { Log.v(TAG, "pressed A key - logout"); MainApplication.this.disconnect(); break; } case KeyEvent.KEYCODE_H: { Log.v(TAG, "pressed H key - invite request"); Space.getMainSpace() .getInvitationController() .inviteUser(debug1, Network.DEFAULT_INVITE); break; } case KeyEvent.KEYCODE_Y: { Log.d(TAG, "contacts button clicked"); Intent i = new Intent(); // LayoutInflater ifl=dashboardView.getInflater(); LayoutInflater ifl = (LayoutInflater) MainApplication.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); ResetPasswordView cpv = new ResetPasswordView(ifl, MainApplication.this); // cpv.setContext(Space.getMainSpace().getContext()); cpv.launch(); } } ; return true; }