mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Fix success/failure status on conversation item.
This commit is contained in:
parent
cffedb09a1
commit
7883d09573
BIN
res/drawable-hdpi/ic_list_alert_sms_failed.png
Normal file
BIN
res/drawable-hdpi/ic_list_alert_sms_failed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
res/drawable-mdpi/ic_list_alert_sms_failed.png
Normal file
BIN
res/drawable-mdpi/ic_list_alert_sms_failed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 824 B |
BIN
res/drawable-xhdpi/ic_list_alert_sms_failed.png
Normal file
BIN
res/drawable-xhdpi/ic_list_alert_sms_failed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
@ -131,7 +131,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_sms_mms_not_delivered"
|
||||
android:src="@drawable/ic_list_alert_sms_failed"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_sms_mms_not_delivered"
|
||||
android:src="@drawable/ic_list_alert_sms_failed"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -81,7 +81,9 @@ import java.io.IOException;
|
||||
* @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_IMAGE = 2;
|
||||
@ -678,4 +680,9 @@ public class ConversationActivity extends SherlockFragmentActivity {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setComposeText(String text) {
|
||||
this.composeText.setText(text);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
@ -31,6 +32,8 @@ public class ConversationFragment extends SherlockListFragment
|
||||
implements LoaderManager.LoaderCallbacks<Cursor>
|
||||
{
|
||||
|
||||
private ConversationFragmentListener listener;
|
||||
|
||||
private MasterSecret masterSecret;
|
||||
private Recipients recipients;
|
||||
private long threadId;
|
||||
@ -73,6 +76,12 @@ public class ConversationFragment extends SherlockListFragment
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
this.listener = (ConversationFragmentListener)activity;
|
||||
}
|
||||
|
||||
public void reload(Recipients recipients, long threadId) {
|
||||
this.recipients = recipients;
|
||||
this.threadId = threadId;
|
||||
@ -170,10 +179,14 @@ public class ConversationFragment extends SherlockListFragment
|
||||
private class FailedIconClickHandler extends Handler {
|
||||
@Override
|
||||
public void handleMessage(android.os.Message message) {
|
||||
assert(false);
|
||||
// String failedMessageText = (String)message.obj;
|
||||
// ConversationActivity.this.composeText.setText(failedMessageText);
|
||||
if (listener != null) {
|
||||
listener.setComposeText((String)message.obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface ConversationFragmentListener {
|
||||
public void setComposeText(String text);
|
||||
}
|
||||
|
||||
}
|
@ -135,10 +135,7 @@ public class ConversationItem extends LinearLayout {
|
||||
|
||||
public void setMessageRecord(MessageRecord messageRecord) {
|
||||
setBody(messageRecord);
|
||||
setDate(messageRecord.getDate());
|
||||
|
||||
setStatusIcons(messageRecord);
|
||||
|
||||
setEvents(messageRecord);
|
||||
}
|
||||
|
||||
@ -268,10 +265,6 @@ public class ConversationItem extends LinearLayout {
|
||||
return (number != null) && (number.trim().length() > 0);
|
||||
}
|
||||
|
||||
private void setDate(long date) {
|
||||
dateText.setText(DateUtils.getRelativeTimeSpanString(getContext(), date, false));
|
||||
}
|
||||
|
||||
private void setStatusIcons(MessageRecord messageRecord) {
|
||||
failedImage.setVisibility(messageRecord.isFailed() ? 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);
|
||||
mmsDownloadButton.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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user