moved last seen to contact details

This commit is contained in:
iNPUTmice 2014-06-13 11:50:47 +02:00
parent 899da61555
commit eb7ed78605
6 changed files with 14 additions and 51 deletions

View file

@ -17,7 +17,8 @@
android:text="@string/action_contact_details" /> android:text="@string/action_contact_details" />
<RelativeLayout <RelativeLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="88dp" android:layout_height="wrap_content"
android:minHeight="88dp"
android:padding="8dp"> android:padding="8dp">
<QuickContactBadge <QuickContactBadge
@ -52,6 +53,14 @@
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:textSize="24sp" android:textSize="24sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView
android:id="@+id/details_lastseen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:singleLine="true"
android:textColor="#5b5b5b"
android:textSize="14sp" />
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>

View file

@ -147,24 +147,4 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/last_seen"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#7f333333"
android:orientation="vertical"
android:visibility="gone"
android:layout_below="@+id/info_box">
<TextView
android:id="@+id/last_seen_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="4dp"
android:text="@string/never_seen"
android:textColor="#e5e5e5"
android:textSize="14sp" />
</LinearLayout>
</RelativeLayout> </RelativeLayout>

View file

@ -72,11 +72,6 @@
android:title="@string/pref_conference_name" android:title="@string/pref_conference_name"
android:summary="@string/pref_conference_name_summary" android:summary="@string/pref_conference_name_summary"
android:defaultValue="true"/> android:defaultValue="true"/>
<CheckBoxPreference
android:key="show_last_seen"
android:title="@string/pref_show_last_seen"
android:summary="@string/pref_show_last_seen_summary"
android:defaultValue="false"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory
android:title="@string/pref_advanced_options"> android:title="@string/pref_advanced_options">

View file

@ -48,6 +48,7 @@ public class ContactDetailsActivity extends XmppActivity {
private TextView accountJidTv; private TextView accountJidTv;
private TextView status; private TextView status;
private TextView askAgain; private TextView askAgain;
private TextView lastseen;
private CheckBox send; private CheckBox send;
private CheckBox receive; private CheckBox receive;
private QuickContactBadge badge; private QuickContactBadge badge;
@ -111,6 +112,7 @@ public class ContactDetailsActivity extends XmppActivity {
contactJidTv = (TextView) findViewById(R.id.details_contactjid); contactJidTv = (TextView) findViewById(R.id.details_contactjid);
accountJidTv = (TextView) findViewById(R.id.details_account); accountJidTv = (TextView) findViewById(R.id.details_account);
status = (TextView) findViewById(R.id.details_contactstatus); status = (TextView) findViewById(R.id.details_contactstatus);
lastseen = (TextView) findViewById(R.id.details_lastseen);
send = (CheckBox) findViewById(R.id.details_send_presence); send = (CheckBox) findViewById(R.id.details_send_presence);
receive = (CheckBox) findViewById(R.id.details_receive_presence); receive = (CheckBox) findViewById(R.id.details_receive_presence);
askAgain = (TextView) findViewById(R.id.ask_again); askAgain = (TextView) findViewById(R.id.ask_again);
@ -203,6 +205,8 @@ public class ContactDetailsActivity extends XmppActivity {
} }
} }
lastseen.setText(UIHelper.lastseen(getApplicationContext(),contact.lastseen.time));
switch (contact.getMostAvailableStatus()) { switch (contact.getMostAvailableStatus()) {
case Presences.CHAT: case Presences.CHAT:
status.setText(R.string.contact_status_free_to_chat); status.setText(R.string.contact_status_free_to_chat);

View file

@ -269,11 +269,6 @@ public class ConversationActivity extends XmppActivity {
getActionBar().setTitle(R.string.app_name); getActionBar().setTitle(R.string.app_name);
invalidateOptionsMenu(); invalidateOptionsMenu();
hideKeyboard(); hideKeyboard();
ConversationFragment selectedFragment = (ConversationFragment) getFragmentManager()
.findFragmentByTag("conversation");
if (selectedFragment != null) {
selectedFragment.lastSeen.setVisibility(View.GONE);
}
} }
@Override @Override
@ -293,11 +288,6 @@ public class ConversationActivity extends XmppActivity {
getConversationList(), null, false); getConversationList(), null, false);
listView.invalidateViews(); listView.invalidateViews();
} }
ConversationFragment selectedFragment = (ConversationFragment) getFragmentManager()
.findFragmentByTag("conversation");
if ((selectedFragment != null) && (showLastseen())) {
selectedFragment.lastSeen.setVisibility(View.VISIBLE);
}
} }
} }

View file

@ -107,9 +107,7 @@ public class ConversationFragment extends Fragment {
private LinearLayout pgpInfo; private LinearLayout pgpInfo;
private LinearLayout mucError; private LinearLayout mucError;
public LinearLayout lastSeen;
private TextView mucErrorText; private TextView mucErrorText;
private TextView lastSeenText;
private OnClickListener clickToMuc = new OnClickListener() { private OnClickListener clickToMuc = new OnClickListener() {
@Override @Override
@ -163,8 +161,6 @@ public class ConversationFragment extends Fragment {
mucError = (LinearLayout) view.findViewById(R.id.muc_error); mucError = (LinearLayout) view.findViewById(R.id.muc_error);
mucError.setOnClickListener(clickToMuc); mucError.setOnClickListener(clickToMuc);
mucErrorText = (TextView) view.findViewById(R.id.muc_error_msg); mucErrorText = (TextView) view.findViewById(R.id.muc_error_msg);
lastSeen = (LinearLayout) view.findViewById(R.id.last_seen);
lastSeenText = (TextView) view.findViewById(R.id.last_seen_text);
messagesView = (ListView) view.findViewById(R.id.messages_view); messagesView = (ListView) view.findViewById(R.id.messages_view);
messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL); messagesView.setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL);
@ -607,11 +603,6 @@ public class ConversationFragment extends Fragment {
activity.getActionBar().setTitle( activity.getActionBar().setTitle(
conversation.getName(useSubject)); conversation.getName(useSubject));
activity.invalidateOptionsMenu(); activity.invalidateOptionsMenu();
if (activity.showLastseen()) {
lastSeen.setVisibility(View.VISIBLE);
}
} else {
lastSeen.setVisibility(View.GONE);
} }
} }
if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getMode() == Conversation.MODE_MULTI) {
@ -687,11 +678,6 @@ public class ConversationFragment extends Fragment {
break; break;
} }
} }
if (activity.showLastseen()) {
Contact contact = conversation.getContact();
lastSeenText.setText(UIHelper.lastseen(getActivity(),
contact.lastseen.time));
}
for(Message message : this.conversation.getMessages()) { for(Message message : this.conversation.getMessages()) {
if (!this.messageList.contains(message)) { if (!this.messageList.contains(message)) {
this.messageList.add(message); this.messageList.add(message);
@ -899,7 +885,6 @@ public class ConversationFragment extends Fragment {
public void onPresenceSelected(boolean success, public void onPresenceSelected(boolean success,
String presence) { String presence) {
if (success) { if (success) {
Log.d("xmppService","selected presence "+presence);
message.setPresence(presence); message.setPresence(presence);
xmppService.sendMessage(message); xmppService.sendMessage(message);
messageSent(); messageSent();