added alt as possible modifier key. use mod+(0..9) to jump to a conversation
This commit is contained in:
parent
6bb9983d58
commit
650abf1c52
|
@ -883,7 +883,7 @@ public class ConversationActivity extends XmppActivity
|
||||||
upKey = KeyEvent.KEYCODE_DPAD_UP;
|
upKey = KeyEvent.KEYCODE_DPAD_UP;
|
||||||
downKey = KeyEvent.KEYCODE_DPAD_DOWN;
|
downKey = KeyEvent.KEYCODE_DPAD_DOWN;
|
||||||
}
|
}
|
||||||
final boolean modifier = event.isCtrlPressed();
|
final boolean modifier = event.isCtrlPressed() || event.isAltPressed();
|
||||||
if (modifier && key == KeyEvent.KEYCODE_TAB && isConversationsOverviewHideable()) {
|
if (modifier && key == KeyEvent.KEYCODE_TAB && isConversationsOverviewHideable()) {
|
||||||
toggleConversationsOverview();
|
toggleConversationsOverview();
|
||||||
return true;
|
return true;
|
||||||
|
@ -891,14 +891,32 @@ public class ConversationActivity extends XmppActivity
|
||||||
if (isConversationsOverviewHideable() && !isConversationsOverviewVisable()) {
|
if (isConversationsOverviewHideable() && !isConversationsOverviewVisable()) {
|
||||||
showConversationsOverview();;
|
showConversationsOverview();;
|
||||||
}
|
}
|
||||||
selectDownConversation();
|
return selectDownConversation();
|
||||||
return true;
|
|
||||||
} else if (modifier && key == upKey) {
|
} else if (modifier && key == upKey) {
|
||||||
if (isConversationsOverviewHideable() && !isConversationsOverviewVisable()) {
|
if (isConversationsOverviewHideable() && !isConversationsOverviewVisable()) {
|
||||||
showConversationsOverview();;
|
showConversationsOverview();
|
||||||
}
|
}
|
||||||
selectUpConversation();
|
return selectUpConversation();
|
||||||
return true;
|
} else if (modifier && key == KeyEvent.KEYCODE_1) {
|
||||||
|
return openConversationByIndex(0);
|
||||||
|
} else if (modifier && key == KeyEvent.KEYCODE_2) {
|
||||||
|
return openConversationByIndex(1);
|
||||||
|
} else if (modifier && key == KeyEvent.KEYCODE_3) {
|
||||||
|
return openConversationByIndex(2);
|
||||||
|
} else if (modifier && key == KeyEvent.KEYCODE_4) {
|
||||||
|
return openConversationByIndex(3);
|
||||||
|
} else if (modifier && key == KeyEvent.KEYCODE_5) {
|
||||||
|
return openConversationByIndex(4);
|
||||||
|
} else if (modifier && key == KeyEvent.KEYCODE_6) {
|
||||||
|
return openConversationByIndex(5);
|
||||||
|
} else if (modifier && key == KeyEvent.KEYCODE_7) {
|
||||||
|
return openConversationByIndex(6);
|
||||||
|
} else if (modifier && key == KeyEvent.KEYCODE_8) {
|
||||||
|
return openConversationByIndex(7);
|
||||||
|
} else if (modifier && key == KeyEvent.KEYCODE_9) {
|
||||||
|
return openConversationByIndex(8);
|
||||||
|
} else if (modifier && key == KeyEvent.KEYCODE_0) {
|
||||||
|
return openConversationByIndex(9);
|
||||||
} else {
|
} else {
|
||||||
return super.onKeyUp(key, event);
|
return super.onKeyUp(key, event);
|
||||||
}
|
}
|
||||||
|
@ -915,38 +933,39 @@ public class ConversationActivity extends XmppActivity
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectUpConversation() {
|
private boolean selectUpConversation() {
|
||||||
Log.d(Config.LOGTAG,"select up conversation");
|
|
||||||
if (this.mSelectedConversation != null) {
|
if (this.mSelectedConversation != null) {
|
||||||
int index = this.conversationList.indexOf(this.mSelectedConversation);
|
int index = this.conversationList.indexOf(this.mSelectedConversation);
|
||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
int next = index - 1;
|
return openConversationByIndex(index - 1);
|
||||||
this.conversationWasSelectedByKeyboard = true;
|
|
||||||
setSelectedConversation(this.conversationList.get(next));
|
|
||||||
this.mConversationFragment.reInit(getSelectedConversation());
|
|
||||||
if (next > listView.getLastVisiblePosition() -1 || next < listView.getFirstVisiblePosition() + 1) {
|
|
||||||
this.listView.setSelection(next);
|
|
||||||
}
|
|
||||||
openConversation();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectDownConversation() {
|
private boolean selectDownConversation() {
|
||||||
Log.d(Config.LOGTAG, "select down conversation");
|
|
||||||
if (this.mSelectedConversation != null) {
|
if (this.mSelectedConversation != null) {
|
||||||
int index = this.conversationList.indexOf(this.mSelectedConversation);
|
int index = this.conversationList.indexOf(this.mSelectedConversation);
|
||||||
if (index != -1 && index < this.conversationList.size() - 1) {
|
if (index != -1 && index < this.conversationList.size() - 1) {
|
||||||
int next = index + 1;
|
return openConversationByIndex(index + 1);
|
||||||
this.conversationWasSelectedByKeyboard = true;
|
|
||||||
setSelectedConversation(this.conversationList.get(next));
|
|
||||||
this.mConversationFragment.reInit(getSelectedConversation());
|
|
||||||
if (next > listView.getLastVisiblePosition() -1 || next < listView.getFirstVisiblePosition() + 1) {
|
|
||||||
this.listView.setSelection(next);
|
|
||||||
}
|
|
||||||
openConversation();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean openConversationByIndex(int index) {
|
||||||
|
try {
|
||||||
|
this.conversationWasSelectedByKeyboard = true;
|
||||||
|
setSelectedConversation(this.conversationList.get(index));
|
||||||
|
this.mConversationFragment.reInit(getSelectedConversation());
|
||||||
|
if (index > listView.getLastVisiblePosition() - 1 || index < listView.getFirstVisiblePosition() + 1) {
|
||||||
|
this.listView.setSelection(index);
|
||||||
|
}
|
||||||
|
openConversation();
|
||||||
|
return true;
|
||||||
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1200,6 +1200,7 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa
|
||||||
if (status == Account.State.ONLINE && conversation.setOutgoingChatState(ChatState.COMPOSING)) {
|
if (status == Account.State.ONLINE && conversation.setOutgoingChatState(ChatState.COMPOSING)) {
|
||||||
activity.xmppConnectionService.sendChatState(conversation);
|
activity.xmppConnectionService.sendChatState(conversation);
|
||||||
}
|
}
|
||||||
|
activity.hideConversationsOverview();
|
||||||
updateSendButton();
|
updateSendButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue