Only setup player activities once

This commit is contained in:
Martin Fietz 2016-01-26 11:46:54 +01:00
parent f9afe0d488
commit bc97221048
2 changed files with 12 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import android.widget.ListView;
import com.viewpagerindicator.CirclePageIndicator;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.adapter.ChaptersListAdapter;
@ -83,6 +84,8 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
AddFeedFragment.TAG
};
private AtomicBoolean isSetup = new AtomicBoolean(false);
private DrawerLayout drawerLayout;
private NavListAdapter navAdapter;
private ListView navList;
@ -193,6 +196,9 @@ public class AudioplayerActivity extends MediaplayerActivity implements NavDrawe
@Override
protected void setupGUI() {
if(isSetup.getAndSet(true)) {
return;
}
super.setupGUI();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

View File

@ -20,6 +20,7 @@ import android.widget.ProgressBar;
import android.widget.SeekBar;
import java.lang.ref.WeakReference;
import java.util.concurrent.atomic.AtomicBoolean;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.feed.MediaType;
@ -43,6 +44,8 @@ public class VideoplayerActivity extends MediaplayerActivity {
private VideoControlsHider videoControlsHider = new VideoControlsHider(this);
private AtomicBoolean isSetup = new AtomicBoolean(false);
private LinearLayout controls;
private LinearLayout videoOverlay;
private AspectRatioVideoView videoview;
@ -115,6 +118,9 @@ public class VideoplayerActivity extends MediaplayerActivity {
@Override
protected void setupGUI() {
if(isSetup.getAndSet(true)) {
return;
}
super.setupGUI();
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
controls = (LinearLayout) findViewById(R.id.controls);