mirror of
https://github.com/MatomoCamp/matomocamp-companion-android.git
synced 2024-09-19 16:13:46 +02:00
Added big central indeterminate progressbar while loading cursor in
TrackScheduleEventActivity
This commit is contained in:
parent
673385aad9
commit
5e5485e058
2 changed files with 42 additions and 16 deletions
|
@ -1,18 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
android:layout_height="match_parent" >
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleLarge"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<com.viewpagerindicator.UnderlinePageIndicator
|
||||
android:id="@+id/indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp" />
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
<com.viewpagerindicator.UnderlinePageIndicator
|
||||
android:id="@+id/indicator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="2dp" />
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -11,7 +11,7 @@ import android.support.v4.view.ViewPager;
|
|||
import android.support.v7.app.ActionBar;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Window;
|
||||
import android.view.View;
|
||||
import be.digitalia.fosdem.R;
|
||||
import be.digitalia.fosdem.db.DatabaseManager;
|
||||
import be.digitalia.fosdem.fragments.EventDetailsFragment;
|
||||
|
@ -38,16 +38,19 @@ public class TrackScheduleEventActivity extends ActionBarActivity implements Loa
|
|||
private Day day;
|
||||
private Track track;
|
||||
private int initialPosition = -1;
|
||||
private View progress;
|
||||
private View content;
|
||||
private ViewPager pager;
|
||||
private TrackScheduleEventAdapter adapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
|
||||
setContentView(R.layout.track_schedule_event);
|
||||
|
||||
progress = findViewById(R.id.progress);
|
||||
content = findViewById(R.id.content);
|
||||
pager = (ViewPager) findViewById(R.id.pager);
|
||||
adapter = new TrackScheduleEventAdapter(getSupportFragmentManager());
|
||||
|
||||
|
@ -63,10 +66,20 @@ public class TrackScheduleEventActivity extends ActionBarActivity implements Loa
|
|||
bar.setTitle(R.string.event_details);
|
||||
bar.setSubtitle(track.getName());
|
||||
|
||||
setSupportProgressBarIndeterminateVisibility(true);
|
||||
setCustomProgressVisibility(true);
|
||||
getSupportLoaderManager().initLoader(EVENTS_LOADER_ID, null, this);
|
||||
}
|
||||
|
||||
private void setCustomProgressVisibility(boolean isVisible) {
|
||||
if (isVisible) {
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
content.setVisibility(View.GONE);
|
||||
} else {
|
||||
progress.setVisibility(View.GONE);
|
||||
content.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
|
@ -84,7 +97,7 @@ public class TrackScheduleEventActivity extends ActionBarActivity implements Loa
|
|||
|
||||
@Override
|
||||
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
|
||||
setSupportProgressBarIndeterminateVisibility(false);
|
||||
setCustomProgressVisibility(false);
|
||||
|
||||
if (data != null) {
|
||||
adapter.setCursor(data);
|
||||
|
|
Loading…
Reference in a new issue