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_width="wrap_content"
android:layout_height="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> </LinearLayout>

View file

@ -20,6 +20,13 @@
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="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 <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

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

View file

@ -67,7 +67,7 @@ public class ChatStorage {
private ChatStorage(Context c) { private ChatStorage(Context c) {
context = c; context = c;
boolean useLinphoneStorage = c.getResources().getBoolean(R.bool.use_linphone_chat_storage); 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); boolean updateNeeded = prefs.getBoolean(c.getString(R.string.pref_first_time_linphone_chat_storage), true);
useNativeAPI = useLinphoneStorage && !updateNeeded; useNativeAPI = useLinphoneStorage && !updateNeeded;
Log.d("Using native API: " + useNativeAPI); Log.d("Using native API: " + useNativeAPI);

View file

@ -29,7 +29,7 @@ public class KeepAliveHandler extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
Log.i("Keep alive handler invoked"); Log.i("Keep alive handler invoked");
if (LinphoneManager.getLcIfManagerNotDestroyedOrNull()!=null) { if (LinphoneManager.getLcIfManagerNotDestroyedOrNull() != null) {
//first refresh registers //first refresh registers
LinphoneManager.getLc().refreshRegisters(); LinphoneManager.getLc().refreshRegisters();
//make sure iterate will have enough time, device will not sleep until exit from this method //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 RelativeLayout view;
private ImageView statusView; 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) { 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); view = new RelativeLayout(context);
@ -162,9 +162,9 @@ public class BubbleChat {
}); });
} }
download = (Button) layout.findViewById(R.id.download); downloadOrShow = (Button) layout.findViewById(R.id.download);
if (download != null && image == null && message == null) { if (downloadOrShow != null && image == null && message == null) {
download.setVisibility(View.VISIBLE); downloadOrShow.setVisibility(View.VISIBLE);
} }
TextView timeView = (TextView) layout.findViewById(R.id.time); TextView timeView = (TextView) layout.findViewById(R.id.time);
@ -282,14 +282,14 @@ public class BubbleChat {
} }
public void setShowOrDownloadImageButtonListener(OnClickListener onClickListener) { public void setShowOrDownloadImageButtonListener(OnClickListener onClickListener) {
if (download != null) { if (downloadOrShow != null) {
download.setOnClickListener(onClickListener); downloadOrShow.setOnClickListener(onClickListener);
} }
} }
public void setShowOrDownloadText(String buttonName) { public void setShowOrDownloadText(String buttonName) {
if (download != null) { if (downloadOrShow != null) {
download.setText(buttonName); downloadOrShow.setText(buttonName);
} }
} }
} }