Fix issue with sent image message

This commit is contained in:
Sylvain Berfini 2013-08-27 11:09:07 +02:00
parent 3ebf127b69
commit 1065718477
6 changed files with 30 additions and 11 deletions

View file

@ -37,4 +37,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/download"
android:text="@string/download_image"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>

View file

@ -21,6 +21,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="@+id/download"
android:visibility="gone"
android:text="@string/download_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -796,7 +796,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
//Update url path in liblinphone database
if (message == null) {
LinphoneChatMessage[] history = chatRoom.getHistory();
message = history[id-1];
for (LinphoneChatMessage msg : history) {
if (msg.getStorageId() == id) {
message = msg;
break;
}
}
}
message.setExternalBodyUrl(path + filename);
chatRoom.updateUrl(message);

View file

@ -67,7 +67,7 @@ public class ChatStorage {
private ChatStorage(Context c) {
context = c;
boolean useLinphoneStorage = c.getResources().getBoolean(R.bool.use_linphone_chat_storage);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneActivity.instance());
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneService.instance());
boolean updateNeeded = prefs.getBoolean(c.getString(R.string.pref_first_time_linphone_chat_storage), true);
useNativeAPI = useLinphoneStorage && !updateNeeded;
Log.d("Using native API: " + useNativeAPI);

View file

@ -29,7 +29,7 @@ public class KeepAliveHandler extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("Keep alive handler invoked");
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull()!=null) {
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
//first refresh registers
LinphoneManager.getLc().refreshRegisters();
//make sure iterate will have enough time, device will not sleep until exit from this method

View file

@ -87,7 +87,7 @@ public class BubbleChat {
private RelativeLayout view;
private ImageView statusView;
private Button download;
private Button downloadOrShow;
public BubbleChat(final Context context, int id, String message, Bitmap image, long time, boolean isIncoming, LinphoneChatMessage.State status, final String url, int previousID) {
view = new RelativeLayout(context);
@ -162,9 +162,9 @@ public class BubbleChat {
});
}
download = (Button) layout.findViewById(R.id.download);
if (download != null && image == null && message == null) {
download.setVisibility(View.VISIBLE);
downloadOrShow = (Button) layout.findViewById(R.id.download);
if (downloadOrShow != null && image == null && message == null) {
downloadOrShow.setVisibility(View.VISIBLE);
}
TextView timeView = (TextView) layout.findViewById(R.id.time);
@ -282,14 +282,14 @@ public class BubbleChat {
}
public void setShowOrDownloadImageButtonListener(OnClickListener onClickListener) {
if (download != null) {
download.setOnClickListener(onClickListener);
if (downloadOrShow != null) {
downloadOrShow.setOnClickListener(onClickListener);
}
}
public void setShowOrDownloadText(String buttonName) {
if (download != null) {
download.setText(buttonName);
if (downloadOrShow != null) {
downloadOrShow.setText(buttonName);
}
}
}