This will ensure the onPause method of removed fragment is called before onResume of the new one
This commit is contained in:
parent
128deb8791
commit
3e38e98384
6 changed files with 22 additions and 1 deletions
|
@ -486,6 +486,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
}
|
||||
|
||||
Compatibility.setFragmentTransactionReorderingAllowed(transaction, false);
|
||||
transaction.replace(R.id.fragmentContainer, newFragment, newFragmentType.toString());
|
||||
transaction.commitAllowingStateLoss();
|
||||
fm.executePendingTransactions();
|
||||
|
|
|
@ -141,7 +141,7 @@ public class ChatListFragment extends Fragment implements OnItemClickListener, C
|
|||
|
||||
refreshChatRoomsList();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
Core lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
|
|
|
@ -110,6 +110,9 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
|
|||
}
|
||||
|
||||
public void clear() {
|
||||
for (ChatRoom room : mRooms) {
|
||||
room.setListener(null);
|
||||
}
|
||||
mRooms.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.linphone.compatibility;
|
|||
import org.linphone.R;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
|
@ -142,4 +143,8 @@ public class ApiSixteenPlus {
|
|||
public static void startService(Context context, Intent intent) {
|
||||
context.startService(intent);
|
||||
}
|
||||
|
||||
public static void setFragmentTransactionReorderingAllowed(FragmentTransaction transaction, boolean allowed) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.linphone.compatibility;
|
|||
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
|
@ -180,4 +181,8 @@ public class ApiTwentySixPlus {
|
|||
public static void startService(Context context, Intent intent) {
|
||||
context.startForegroundService(intent);
|
||||
}
|
||||
|
||||
public static void setFragmentTransactionReorderingAllowed(FragmentTransaction transaction, boolean allowed) {
|
||||
transaction.setReorderingAllowed(allowed);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
import org.linphone.mediastream.Version;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.app.Notification;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
|
@ -163,4 +164,10 @@ public class Compatibility {
|
|||
ApiSixteenPlus.startService(context, intent);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setFragmentTransactionReorderingAllowed(FragmentTransaction transaction, boolean allowed) {
|
||||
if (Version.sdkAboveOrEqual(Version.API26_O_80)) {
|
||||
ApiTwentySixPlus.setFragmentTransactionReorderingAllowed(transaction, allowed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue