Skip to content

Commit

Permalink
Toasts when selecting the 'mention' option, and when tapping a user i…
Browse files Browse the repository at this point in the history
…n the list
  • Loading branch information
c99koder committed Jan 23, 2013
1 parent 9e00a45 commit a7317c5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/com/irccloud/android/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ public boolean onOptionsItemSelected(MenuItem item) {
editor.remove("mentionTip");
editor.remove("userSwipeTip");
editor.remove("bufferSwipeTip");
editor.remove("longPressTip");
editor.commit();
ServersDataSource.getInstance().clear();
BuffersDataSource.getInstance().clear();
Expand Down
16 changes: 14 additions & 2 deletions src/com/irccloud/android/MessageActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,12 @@ public void onMessageDoubleClicked(EventsDataSource.Event event) {
public void onUserDoubleClicked(String from) {
if(messageTxt == null || from == null || from.length() == 0)
return;

if(!getSharedPreferences("prefs", 0).getBoolean("mentionTip", false)) {
SharedPreferences.Editor editor = getSharedPreferences("prefs", 0).edit();
editor.putBoolean("mentionTip", true);
editor.commit();
}

if(scrollView != null)
scrollView.scrollTo((int)getResources().getDimension(R.dimen.drawer_width), 0);
Expand Down Expand Up @@ -1737,7 +1743,7 @@ private void showUserPopup(UsersDataSource.User user, Spanned message) {
if(selected_user != null) {
itemList.add("WhoisÉ");
itemList.add("Send a message");
itemList.add("Mention (double tap)");
itemList.add("Mention");
itemList.add("Invite to a channelÉ");
itemList.add("Ignore");
if(type.equalsIgnoreCase("channel")) {
Expand Down Expand Up @@ -1819,7 +1825,13 @@ public void onClick(DialogInterface dialogInterface, int item) {
}
startActivity(i);
}
} else if(items[item].equals("Mention (double tap)")) {
} else if(items[item].equals("Mention")) {
if(!getSharedPreferences("prefs", 0).getBoolean("mentionTip", false)) {
Toast.makeText(MessageActivity.this, "Double-tap a message to quickly reply to the sender", Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor = getSharedPreferences("prefs", 0).edit();
editor.putBoolean("mentionTip", true);
editor.commit();
}
onUserDoubleClicked(selected_user.nick);
} else if(items[item].equals("Invite to a channelÉ")) {
view = inflater.inflate(R.layout.dialog_textprompt,null);
Expand Down
12 changes: 11 additions & 1 deletion src/com/irccloud/android/UsersListFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.json.JSONException;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
Expand All @@ -18,6 +19,7 @@
import android.view.View.OnClickListener;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockListFragment;

Expand Down Expand Up @@ -392,8 +394,16 @@ public void run() {
@Override
public void run() {
UserListAdapter.UserListEntry e = (UserListAdapter.UserListEntry)adapter.getItem(position);
if(e.type == TYPE_USER)
if(e.type == TYPE_USER) {
mListener.onUserSelected(cid, channel, e.text);

if(!getActivity().getSharedPreferences("prefs", 0).getBoolean("longPressTip", false)) {
Toast.makeText(getActivity(), "Long-press a message to quickly interact with the sender", Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor = getActivity().getSharedPreferences("prefs", 0).edit();
editor.putBoolean("longPressTip", true);
editor.commit();
}
}
}
});
tapTimer = null;
Expand Down

0 comments on commit a7317c5

Please sign in to comment.