mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-20 15:30:11 +00:00
Fix duplicated fragments
This commit is contained in:
@@ -110,7 +110,8 @@ public class AppView extends Activity implements AdapterFragmentCallbacks {
|
|||||||
populateAppGridWithCache();
|
populateAppGridWithCache();
|
||||||
|
|
||||||
getFragmentManager().beginTransaction()
|
getFragmentManager().beginTransaction()
|
||||||
.add(R.id.appFragmentContainer, new AdapterFragment()).commitAllowingStateLoss();
|
.replace(R.id.appFragmentContainer, new AdapterFragment())
|
||||||
|
.commitAllowingStateLoss();
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ import android.widget.Toast;
|
|||||||
import android.widget.AdapterView.AdapterContextMenuInfo;
|
import android.widget.AdapterView.AdapterContextMenuInfo;
|
||||||
|
|
||||||
public class PcView extends Activity implements AdapterFragmentCallbacks {
|
public class PcView extends Activity implements AdapterFragmentCallbacks {
|
||||||
private AdapterFragment adapterFragment;
|
|
||||||
private RelativeLayout noPcFoundLayout;
|
private RelativeLayout noPcFoundLayout;
|
||||||
private PcGridAdapter pcGridAdapter;
|
private PcGridAdapter pcGridAdapter;
|
||||||
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
private ComputerManagerService.ComputerManagerBinder managerBinder;
|
||||||
@@ -122,14 +121,9 @@ public class PcView extends Activity implements AdapterFragmentCallbacks {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
FragmentTransaction transaction = getFragmentManager().beginTransaction();
|
getFragmentManager().beginTransaction()
|
||||||
if (adapterFragment != null) {
|
.replace(R.id.pcFragmentContainer, new AdapterFragment())
|
||||||
// Remove the old fragment
|
.commitAllowingStateLoss();
|
||||||
transaction.remove(adapterFragment);
|
|
||||||
}
|
|
||||||
adapterFragment = new AdapterFragment();
|
|
||||||
transaction.add(R.id.pcFragmentContainer, adapterFragment);
|
|
||||||
transaction.commitAllowingStateLoss();
|
|
||||||
|
|
||||||
noPcFoundLayout = (RelativeLayout) findViewById(R.id.no_pc_found_layout);
|
noPcFoundLayout = (RelativeLayout) findViewById(R.id.no_pc_found_layout);
|
||||||
if (pcGridAdapter.getCount() == 0) {
|
if (pcGridAdapter.getCount() == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user