Fixed goToHistory when clicking on missed call notification
This commit is contained in:
parent
b16923ac1c
commit
37fed6852d
6 changed files with 16 additions and 38 deletions
|
@ -165,15 +165,10 @@ public final class LinphoneService extends Service {
|
|||
}
|
||||
|
||||
if (state == State.End || state == State.Released || state == State.Error) {
|
||||
if (LinphoneManager.isInstanciated() && LinphoneManager.getLc() != null && LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getStatusFragment() != null) {
|
||||
LinphoneActivity.instance().getStatusFragment().setisZrtpAsk(false);
|
||||
}
|
||||
}
|
||||
destroyOverlay();
|
||||
}
|
||||
|
||||
if (state == State.End && call.getCallLog().getStatus() == Call.Status.Missed) {
|
||||
if (state == State.Released && call.getCallLog().getStatus() == Call.Status.Missed) {
|
||||
mNotificationManager.displayMissedCallNotification(call);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -186,9 +186,6 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
@Override
|
||||
public void onCallStateChanged(Core lc, final Call call, Call.State state, String message) {
|
||||
if (LinphoneManager.getLc().getCallsNb() == 0) {
|
||||
if (status != null) {
|
||||
status.setisZrtpAsk(false);
|
||||
}
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
@ -273,9 +270,6 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
TimeRemind = savedInstanceState.getLong("TimeRemind");
|
||||
createTimerForDialog(TimeRemind);
|
||||
}
|
||||
if (status != null && savedInstanceState.getBoolean("AskingZrtp")) {
|
||||
status.setisZrtpAsk(savedInstanceState.getBoolean("AskingZrtp"));
|
||||
}
|
||||
refreshInCallActions();
|
||||
return;
|
||||
} else {
|
||||
|
@ -334,7 +328,6 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
outState.putBoolean("VideoCallPaused", isVideoCallPaused);
|
||||
outState.putBoolean("AskingVideo", isVideoAsk);
|
||||
outState.putLong("TimeRemind", TimeRemind);
|
||||
if (status != null) outState.putBoolean("AskingZrtp", status.getisZrtpAsk());
|
||||
if (dialog != null) dialog.dismiss();
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
@ -1179,8 +1172,11 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
|||
refreshIncallUi();
|
||||
handleViewIntent();
|
||||
|
||||
if (status != null && status.getisZrtpAsk() && lc != null) {
|
||||
status.showZRTPDialog(lc.getCurrentCall());
|
||||
if (status != null && lc != null) {
|
||||
Call currentCall = lc.getCurrentCall();
|
||||
if (!currentCall.getAuthenticationTokenVerified()) {
|
||||
status.showZRTPDialog(currentCall);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isVideoEnabled(LinphoneManager.getLc().getCurrentCall())) {
|
||||
|
|
|
@ -128,10 +128,6 @@ public class ApiTwentyOnePlus {
|
|||
return notif;
|
||||
}
|
||||
|
||||
public static void removeGlobalLayoutListener(ViewTreeObserver viewTreeObserver, OnGlobalLayoutListener keyboardListener) {
|
||||
viewTreeObserver.removeOnGlobalLayoutListener(keyboardListener);
|
||||
}
|
||||
|
||||
public static Notification createMissedCallNotification(Context context, String title, String text, PendingIntent intent) {
|
||||
Notification notif = new Notification.Builder(context)
|
||||
.setContentTitle(title)
|
||||
|
@ -141,7 +137,7 @@ public class ApiTwentyOnePlus {
|
|||
.setContentIntent(intent)
|
||||
.setDefaults(Notification.DEFAULT_SOUND
|
||||
| Notification.DEFAULT_VIBRATE)
|
||||
.setCategory(Notification.CATEGORY_MESSAGE)
|
||||
.setCategory(Notification.CATEGORY_EVENT)
|
||||
.setVisibility(Notification.VISIBILITY_PRIVATE)
|
||||
.setLights(ContextCompat.getColor(context, R.color.notification_color_led),
|
||||
context.getResources().getInteger(R.integer.notification_ms_on),
|
||||
|
|
|
@ -206,7 +206,7 @@ public class ApiTwentySixPlus {
|
|||
.setContentIntent(intent)
|
||||
.setDefaults(Notification.DEFAULT_SOUND
|
||||
| Notification.DEFAULT_VIBRATE)
|
||||
.setCategory(Notification.CATEGORY_MESSAGE)
|
||||
.setCategory(Notification.CATEGORY_EVENT)
|
||||
.setVisibility(Notification.VISIBILITY_PRIVATE)
|
||||
.setPriority(Notification.PRIORITY_HIGH)
|
||||
.setWhen(System.currentTimeMillis())
|
||||
|
|
|
@ -60,7 +60,7 @@ public class StatusFragment extends Fragment {
|
|||
private TextView statusText, voicemailCount;
|
||||
private ImageView statusLed, callQuality, encryption, menu, voicemail;
|
||||
private Runnable mCallQualityUpdater;
|
||||
private boolean isInCall, isAttached = false, isZrtpAsk;
|
||||
private boolean isInCall, isAttached = false;
|
||||
private CoreListenerStub mListener;
|
||||
private Dialog ZRTPdialog = null;
|
||||
private int mDisplayedQuality = -1;
|
||||
|
@ -418,7 +418,6 @@ public class StatusFragment extends Fragment {
|
|||
ZRTPdialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||
ZRTPdialog.getWindow().setBackgroundDrawable(d);
|
||||
String zrtpToRead, zrtpToListen;
|
||||
isZrtpAsk = true;
|
||||
|
||||
if (call.getDir().equals(Call.Dir.Incoming)) {
|
||||
zrtpToRead = token.substring(0, 2);
|
||||
|
@ -461,7 +460,6 @@ public class StatusFragment extends Fragment {
|
|||
encryption.setImageResource(R.drawable.security_ko);
|
||||
}
|
||||
}
|
||||
isZrtpAsk = false;
|
||||
ZRTPdialog.dismiss();
|
||||
}
|
||||
});
|
||||
|
@ -473,19 +471,10 @@ public class StatusFragment extends Fragment {
|
|||
if (encryption != null) {
|
||||
encryption.setImageResource(R.drawable.security_ok);
|
||||
}
|
||||
isZrtpAsk = false;
|
||||
ZRTPdialog.dismiss();
|
||||
}
|
||||
});
|
||||
ZRTPdialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean getisZrtpAsk() {
|
||||
return isZrtpAsk;
|
||||
}
|
||||
|
||||
public void setisZrtpAsk(boolean bool) {
|
||||
isZrtpAsk = bool;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.content.Intent;
|
|||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.provider.MediaStore;
|
||||
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphonePreferences;
|
||||
|
@ -82,6 +81,7 @@ public class NotificationsManager {
|
|||
bm = BitmapFactory.decodeResource(mContext.getResources(), R.mipmap.ic_launcher);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
mServiceNotification = Compatibility.createNotification(mContext, mContext.getString(R.string.service_name), "",
|
||||
R.drawable.linphone_notification_icon, R.mipmap.ic_launcher, bm, pendingIntent, true,
|
||||
|
@ -143,6 +143,7 @@ public class NotificationsManager {
|
|||
mLastNotificationId += 1;
|
||||
mChatNotifMap.put(conferenceAddress, notif);
|
||||
}
|
||||
|
||||
notifMessage.setSenderBitmap(bm);
|
||||
notif.addMessage(notifMessage);
|
||||
notif.setIsGroup(true);
|
||||
|
@ -173,6 +174,7 @@ public class NotificationsManager {
|
|||
mLastNotificationId += 1;
|
||||
mChatNotifMap.put(fromSipUri, notif);
|
||||
}
|
||||
|
||||
notifMessage.setSenderBitmap(bm);
|
||||
notif.addMessage(notifMessage);
|
||||
notif.setIsGroup(false);
|
||||
|
@ -184,7 +186,7 @@ public class NotificationsManager {
|
|||
}
|
||||
|
||||
public void displayMissedCallNotification(Call call) {
|
||||
Intent missedCallNotifIntent = new Intent(mContext, LinphoneService.instance().getIncomingReceivedActivity());
|
||||
Intent missedCallNotifIntent = new Intent(mContext, LinphoneActivity.class);
|
||||
missedCallNotifIntent.putExtra("GoToHistory", true);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, missedCallNotifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
|
@ -204,14 +206,15 @@ public class NotificationsManager {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Notification notif = Compatibility.createMissedCallNotification(mContext, mContext.getString(R.string.missed_calls_notif_title), body, pendingIntent);
|
||||
sendNotification(MISSED_CALLS_NOTIF_ID, notif);
|
||||
}
|
||||
|
||||
public void displayCallNotification(Call call) {
|
||||
if (call == null) return;
|
||||
Intent callNotifIntent = new Intent(mContext, LinphoneService.instance().getIncomingReceivedActivity());
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, callNotifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
if (call == null) return;
|
||||
|
||||
Address address = call.getRemoteAddress();
|
||||
String addressAsString = address.asStringUriOnly();
|
||||
|
@ -264,7 +267,6 @@ public class NotificationsManager {
|
|||
Notification notification = Compatibility.createInCallNotification(mContext, notif.getNotificationId(),
|
||||
showAnswerAction, mContext.getString(R.string.service_name),
|
||||
mContext.getString(notificationTextId), iconId, bm, name, pendingIntent);
|
||||
|
||||
sendNotification(notif.getNotificationId(), notification);
|
||||
}
|
||||
|
||||
|
@ -281,8 +283,8 @@ public class NotificationsManager {
|
|||
Intent notifIntent = new Intent(mContext, LinphoneActivity.class);
|
||||
notifIntent.putExtra("GoToInapp", true);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, notifIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
Notification notif = Compatibility.createSimpleNotification(mContext, mContext.getString(R.string.inapp_notification_title), message, pendingIntent);
|
||||
|
||||
Notification notif = Compatibility.createSimpleNotification(mContext, mContext.getString(R.string.inapp_notification_title), message, pendingIntent);
|
||||
sendNotification(IN_APP_NOTIF_ID, notif);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue