images pager: add circle indicator

This commit is contained in:
Andrew Dolgov 2015-02-12 20:33:25 +03:00
parent 29f105b14e
commit f5b80fe39f
4 changed files with 24 additions and 3 deletions

View File

@ -34,4 +34,5 @@ dependencies {
compile 'com.shamanland:fab:0.0.5'
compile 'ch.acra:acra:4.5.0'
compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.1.0@aar'
compile 'me.relex:circleindicator:1.1.1@aar'
}

View File

@ -91,6 +91,7 @@
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
<orderEntry type="library" exported="" name="acra-4.5.0" level="project" />
<orderEntry type="library" exported="" name="circleindicator-1.1.1" level="project" />
<orderEntry type="library" exported="" name="universal-image-loader-1.9.3" level="project" />
<orderEntry type="library" exported="" name="dashclock-api-r1.1" level="project" />
<orderEntry type="library" exported="" name="fab-0.0.5" level="project" />

View File

@ -43,6 +43,7 @@ import java.util.ArrayList;
import java.util.List;
import it.sephiroth.android.library.imagezoom.ImageViewTouch;
import me.relex.circleindicator.CircleIndicator;
public class ArticleImagesPagerActivity extends CommonActivity implements GestureDetector.OnDoubleTapListener {
private final String TAG = this.getClass().getSimpleName();
@ -54,6 +55,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
private String m_content;
private GestureDetector m_detector;
private ProgressBar m_progress;
private ViewPager m_pager;
@Override
public boolean onSingleTapConfirmed(MotionEvent motionEvent) {
@ -234,6 +236,14 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
@Override
protected void onPostExecute(Integer result) {
m_progress.setVisibility(View.GONE);
CircleIndicator indicator = (CircleIndicator) findViewById(R.id.article_images_indicator);
if (indicator != null) {
indicator.setViewPager(m_pager);
indicator.setVisibility(View.VISIBLE);
}
}
}
@ -311,9 +321,9 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
m_adapter = new ArticleImagesPagerAdapter(m_checkedUrls);
ViewPager pager = (ViewPager) findViewById(R.id.article_images_pager);
pager.setAdapter(m_adapter);
pager.setPageTransformer(true, new DepthPageTransformer());
m_pager = (ViewPager) findViewById(R.id.article_images_pager);
m_pager.setAdapter(m_adapter);
m_pager.setPageTransformer(true, new DepthPageTransformer());
}
@SuppressLint("NewApi")

View File

@ -29,4 +29,13 @@
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<me.relex.circleindicator.CircleIndicator
android:id="@+id/article_images_indicator"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:visibility="invisible" />
</RelativeLayout>