Fix success/failure status on conversation item.

pull/1/head
Moxie Marlinspike 13 years ago
parent cffedb09a1
commit 7883d09573

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

@ -131,7 +131,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:src="@drawable/ic_sms_mms_not_delivered" android:src="@drawable/ic_list_alert_sms_failed"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>

@ -40,7 +40,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:src="@drawable/ic_sms_mms_not_delivered" android:src="@drawable/ic_list_alert_sms_failed"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>

@ -81,7 +81,9 @@ import java.io.IOException;
* @author Moxie Marlinspike * @author Moxie Marlinspike
* *
*/ */
public class ConversationActivity extends SherlockFragmentActivity { public class ConversationActivity extends SherlockFragmentActivity
implements ConversationFragment.ConversationFragmentListener
{
private static final int PICK_CONTACT = 1; private static final int PICK_CONTACT = 1;
private static final int PICK_IMAGE = 2; private static final int PICK_IMAGE = 2;
@ -678,4 +680,9 @@ public class ConversationActivity extends SherlockFragmentActivity {
return false; return false;
} }
} }
@Override
public void setComposeText(String text) {
this.composeText.setText(text);
}
} }

@ -1,5 +1,6 @@
package org.thoughtcrime.securesms; package org.thoughtcrime.securesms;
import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
@ -31,6 +32,8 @@ public class ConversationFragment extends SherlockListFragment
implements LoaderManager.LoaderCallbacks<Cursor> implements LoaderManager.LoaderCallbacks<Cursor>
{ {
private ConversationFragmentListener listener;
private MasterSecret masterSecret; private MasterSecret masterSecret;
private Recipients recipients; private Recipients recipients;
private long threadId; private long threadId;
@ -73,6 +76,12 @@ public class ConversationFragment extends SherlockListFragment
return false; return false;
} }
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
this.listener = (ConversationFragmentListener)activity;
}
public void reload(Recipients recipients, long threadId) { public void reload(Recipients recipients, long threadId) {
this.recipients = recipients; this.recipients = recipients;
this.threadId = threadId; this.threadId = threadId;
@ -170,10 +179,14 @@ public class ConversationFragment extends SherlockListFragment
private class FailedIconClickHandler extends Handler { private class FailedIconClickHandler extends Handler {
@Override @Override
public void handleMessage(android.os.Message message) { public void handleMessage(android.os.Message message) {
assert(false); if (listener != null) {
// String failedMessageText = (String)message.obj; listener.setComposeText((String)message.obj);
// ConversationActivity.this.composeText.setText(failedMessageText); }
} }
} }
public interface ConversationFragmentListener {
public void setComposeText(String text);
}
} }

@ -135,10 +135,7 @@ public class ConversationItem extends LinearLayout {
public void setMessageRecord(MessageRecord messageRecord) { public void setMessageRecord(MessageRecord messageRecord) {
setBody(messageRecord); setBody(messageRecord);
setDate(messageRecord.getDate());
setStatusIcons(messageRecord); setStatusIcons(messageRecord);
setEvents(messageRecord); setEvents(messageRecord);
} }
@ -268,10 +265,6 @@ public class ConversationItem extends LinearLayout {
return (number != null) && (number.trim().length() > 0); return (number != null) && (number.trim().length() > 0);
} }
private void setDate(long date) {
dateText.setText(DateUtils.getRelativeTimeSpanString(getContext(), date, false));
}
private void setStatusIcons(MessageRecord messageRecord) { private void setStatusIcons(MessageRecord messageRecord) {
failedImage.setVisibility(messageRecord.isFailed() ? View.VISIBLE : View.GONE); failedImage.setVisibility(messageRecord.isFailed() ? View.VISIBLE : View.GONE);
secureImage.setVisibility(messageRecord.isSecure() ? View.VISIBLE : View.GONE); secureImage.setVisibility(messageRecord.isSecure() ? View.VISIBLE : View.GONE);
@ -280,6 +273,12 @@ public class ConversationItem extends LinearLayout {
mmsThumbnail.setVisibility(View.GONE); mmsThumbnail.setVisibility(View.GONE);
mmsDownloadButton.setVisibility(View.GONE); mmsDownloadButton.setVisibility(View.GONE);
mmsDownloadingLabel.setVisibility(View.GONE); mmsDownloadingLabel.setVisibility(View.GONE);
if (messageRecord.isFailed()) dateText.setText("Error sending message");
else if (messageRecord.isPending()) dateText.setText("Sending...");
else dateText.setText(DateUtils.getRelativeTimeSpanString(getContext(),
messageRecord.getDate(),
false));
} }
private void setEvents(MessageRecord messageRecord) { private void setEvents(MessageRecord messageRecord) {

Loading…
Cancel
Save