1
0
Fork 0
mirror of https://github.com/MatomoCamp/matomocamp-companion-android.git synced 2024-09-19 16:13:46 +02:00

Fixed problem during menu creation in TrackScheduleEventActivity in

Android 4.0.x
This commit is contained in:
Christophe Beyls 2014-01-21 03:26:22 +01:00
parent 3aa100a2fc
commit 4be572c336
2 changed files with 9 additions and 21 deletions

View file

@ -8,10 +8,10 @@
style="?android:attr/progressBarStyleLarge" style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" /> android:layout_gravity="center"
android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/content"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" > android:orientation="vertical" >

View file

@ -39,7 +39,6 @@ public class TrackScheduleEventActivity extends ActionBarActivity implements Loa
private Track track; private Track track;
private int initialPosition = -1; private int initialPosition = -1;
private View progress; private View progress;
private View content;
private ViewPager pager; private ViewPager pager;
private TrackScheduleEventAdapter adapter; private TrackScheduleEventAdapter adapter;
@ -50,9 +49,11 @@ public class TrackScheduleEventActivity extends ActionBarActivity implements Loa
setContentView(R.layout.track_schedule_event); setContentView(R.layout.track_schedule_event);
progress = findViewById(R.id.progress); progress = findViewById(R.id.progress);
content = findViewById(R.id.content);
pager = (ViewPager) findViewById(R.id.pager); pager = (ViewPager) findViewById(R.id.pager);
adapter = new TrackScheduleEventAdapter(getSupportFragmentManager()); adapter = new TrackScheduleEventAdapter(getSupportFragmentManager());
pager.setAdapter(adapter);
PageIndicator pageIndicator = (PageIndicator) findViewById(R.id.indicator);
pageIndicator.setViewPager(pager);
Bundle extras = getIntent().getExtras(); Bundle extras = getIntent().getExtras();
day = extras.getParcelable(EXTRA_DAY); day = extras.getParcelable(EXTRA_DAY);
@ -71,13 +72,7 @@ public class TrackScheduleEventActivity extends ActionBarActivity implements Loa
} }
private void setCustomProgressVisibility(boolean isVisible) { private void setCustomProgressVisibility(boolean isVisible) {
if (isVisible) { progress.setVisibility(isVisible ? View.VISIBLE : View.GONE);
progress.setVisibility(View.VISIBLE);
content.setVisibility(View.GONE);
} else {
progress.setVisibility(View.GONE);
content.setVisibility(View.VISIBLE);
}
} }
@Override @Override
@ -101,16 +96,9 @@ public class TrackScheduleEventActivity extends ActionBarActivity implements Loa
if (data != null) { if (data != null) {
adapter.setCursor(data); adapter.setCursor(data);
if (pager.getAdapter() == null) { if (initialPosition != -1) {
pager.setAdapter(adapter); pager.setCurrentItem(initialPosition, false);
initialPosition = -1;
PageIndicator pageIndicator = (PageIndicator) findViewById(R.id.indicator);
pageIndicator.setViewPager(pager);
if (initialPosition != -1) {
pager.setCurrentItem(initialPosition, false);
initialPosition = -1;
}
} }
} }
} }