Skip to content

Commit

Permalink
Notify the user that emoji can't be opened in multi-window (close #1101)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniele Ricci <[email protected]>
  • Loading branch information
daniele-athome committed Oct 31, 2018
1 parent 2524351 commit 216b8a9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
10 changes: 10 additions & 0 deletions app/src/main/java/org/kontalk/ui/AbstractComposeFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,16 @@ public void onTextEntryFocus() {
tryHideAttachmentView(true);
}

@Override
public boolean canOpenEmoji() {
if (SystemUtils.supportsMultiWindow() && getActivity().isInMultiWindowMode()) {
Toast.makeText(getContext(), R.string.err_emoji_disabled_in_multiwindow,
Toast.LENGTH_LONG).show();
return false;
}
return true;
}

/**
* Sends out the text message in the composing entry.
*/
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/org/kontalk/ui/view/ComposerBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ else if (mDistMove > mMoveOffset) {
mEmojiButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
toggleEmojiDrawer();
if (mListener != null && mListener.canOpenEmoji())
toggleEmojiDrawer();
}
});

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/org/kontalk/ui/view/ComposerListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@ void sendBinaryMessage(Uri uri, String mime, boolean media,
/** The text entry has gained focus. */
void onTextEntryFocus();

/** Return false if for whatever reason the emoji panel can't be opened. */
boolean canOpenEmoji();

}
4 changes: 4 additions & 0 deletions app/src/main/java/org/kontalk/util/SystemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,10 @@ public static boolean supportsJobScheduler() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
}

public static boolean supportsMultiWindow() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
}

/** Return true if the platform can and will broadcast network state change *implicit* intents. */
public static boolean isReceivingNetworkStateChanges() {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.N;
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,8 @@

<string name="err_validation_phone_state_denied">If you allow Kontalk to manage phone calls, it can automatically detect your phone number.\nKontalk won\'t use the granted permission for anything else.</string>

<string name="err_emoji_disabled_in_multiwindow">Emoji can\'t be used in multi-window mode.</string>

<string name="permission_messages_label">Access to Kontalk messages</string>
<string name="permission_messages_description">Can read from and write to the Kontalk messages database</string>
<string name="permission_users_label">Access to Kontalk users information</string>
Expand Down

0 comments on commit 216b8a9

Please sign in to comment.