Skip to content

Commit

Permalink
Fix AutoScrollViewPagerInnerDemo Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinea committed Apr 26, 2014
1 parent 3249fcb commit 379b24f
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions res/layout/auto_scroll_view_pager_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
android:id="@+id/auto_scroll_view_pager_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginBottom="@dimen/dp_40"
android:text="@string/auto_scroll_view_pager_inner" />

Expand Down
3 changes: 2 additions & 1 deletion res/layout/auto_scroll_view_pager_inner_fragment_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<cn.trinea.android.view.autoscrollviewpager.AutoScrollViewPager
android:id="@+id/view_pager"
android:layout_width="@dimen/view_pager_witdh"
android:layout_height="@dimen/view_pager_height" />
android:layout_height="@dimen/view_pager_height"
android:layout_marginTop="@dimen/dp_40" />

<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/indicator"
Expand Down
3 changes: 1 addition & 2 deletions res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
<string name="app_status_downloading">下载中</string>
<string name="tip_download_file">文件将下载到:</string>

<string name="auto_scroll_view_pager_single">单个ViewPager</string>
<string name="auto_scroll_view_pager_inner">ViewPager嵌套</string>
<string name="auto_scroll_view_pager_inner">ViewPager嵌套示例</string>

<string name="update_at">更新于:&#160;</string>

Expand Down
3 changes: 1 addition & 2 deletions res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
<string name="app_status_downloading">下載中</string>
<string name="tip_download_file">文件將下載到:</string>

<string name="auto_scroll_view_pager_single">單個ViewPager</string>
<string name="auto_scroll_view_pager_inner">ViewPager嵌套</string>
<string name="auto_scroll_view_pager_inner">ViewPager嵌套示例</string>

<string name="update_at">更新于:&#160;</string>

Expand Down
3 changes: 1 addition & 2 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@
<string name="app_status_downloading">downloading</string>
<string name="tip_download_file">file will be saved to sdcard, the path is: </string>

<string name="auto_scroll_view_pager_single">Single ViewPager</string>
<string name="auto_scroll_view_pager_inner">ViewPager in ViewPager</string>
<string name="auto_scroll_view_pager_inner">ViewPager in ViewPager Demo</string>

<string name="update_at">updated at:&#160;</string>
<string name="github">GitHub</string>
Expand Down
6 changes: 3 additions & 3 deletions src/cn/trinea/android/demo/AutoScrollViewPagerInnerDemo.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class AutoScrollViewPagerInnerDemo extends BaseFragmentActivity {
public static final String EXTRA_INDEX = "index";
public static final String EXTRA_TITLE = "title";

static final int DEFAULT_INDEX = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState, R.layout.view_pager_demo);
Expand All @@ -45,9 +47,7 @@ protected void onCreate(Bundle savedInstanceState) {
viewPager.setAdapter(new myPagerAdapter(getSupportFragmentManager(), fragmentList, titleList));
viewPager.setOnPageChangeListener(new MyOnPageChangeListener());

int defaultPosition = 1;
viewPager.setCurrentItem(defaultPosition);
sendSelectedBroadcast(defaultPosition);
viewPager.setCurrentItem(DEFAULT_INDEX);
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/cn/trinea/android/demo/ImagePagerFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
Bundle bundle = getArguments();
if (bundle != null) {
index = bundle.getInt(AutoScrollViewPagerInnerDemo.EXTRA_INDEX);
if (index == AutoScrollViewPagerInnerDemo.DEFAULT_INDEX) {
viewPager.startAutoScroll();
}
}

return v;
Expand Down

0 comments on commit 379b24f

Please sign in to comment.