diff --git a/samples/ApiDemos/res/layout-h974dp/resources_height.xml b/samples/ApiDemos/res/layout-h974dp/resources_height.xml new file mode 100644 index 000000000..5eb120d4d --- /dev/null +++ b/samples/ApiDemos/res/layout-h974dp/resources_height.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/ApiDemos/res/layout-w1024dp/resources_width.xml b/samples/ApiDemos/res/layout-w1024dp/resources_width.xml new file mode 100644 index 000000000..05ea7ba27 --- /dev/null +++ b/samples/ApiDemos/res/layout-w1024dp/resources_width.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/ApiDemos/res/layout/fragment_pager.xml b/samples/ApiDemos/res/layout/fragment_pager_support.xml similarity index 66% rename from samples/ApiDemos/res/layout/fragment_pager.xml rename to samples/ApiDemos/res/layout/fragment_pager_support.xml index 3867f46f4..a082e2e54 100644 --- a/samples/ApiDemos/res/layout/fragment_pager.xml +++ b/samples/ApiDemos/res/layout/fragment_pager_support.xml @@ -28,10 +28,17 @@ android:layout_weight="1"> - + + + + diff --git a/samples/ApiDemos/res/layout/fragment_pager_list.xml b/samples/ApiDemos/res/layout/fragment_pager_support_list.xml similarity index 100% rename from samples/ApiDemos/res/layout/fragment_pager_list.xml rename to samples/ApiDemos/res/layout/fragment_pager_support_list.xml diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml index d7858f061..024975af9 100644 --- a/samples/ApiDemos/res/values/strings.xml +++ b/samples/ApiDemos/res/values/strings.xml @@ -175,6 +175,8 @@ Support/App/Fragment/Stack Support/App/Fragment/Pager + First + Last App/Loader/Cursor diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentPagerSupport.java b/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentPagerSupport.java index 46d29ace5..c78c6d3ca 100644 --- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentPagerSupport.java +++ b/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentPagerSupport.java @@ -40,26 +40,28 @@ public class FragmentPagerSupport extends FragmentActivity static final int NUM_ITEMS = 10; FragmentPager mPager; - int mCurPos; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.fragment_pager); + setContentView(R.layout.fragment_pager_support); mPager = (FragmentPager)findViewById(R.id.pager); mPager.setAdapter(this); + Button button; + // Watch for button clicks. - Button button = (Button)findViewById(R.id.new_fragment); + button = (Button)findViewById(R.id.goto_first); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { - mCurPos++; - if (mCurPos < NUM_ITEMS) { - mPager.setCurrentItem(mCurPos); - } else { - mCurPos--; - } + mPager.setCurrentItem(0); + } + }); + button = (Button)findViewById(R.id.goto_last); + button.setOnClickListener(new OnClickListener() { + public void onClick(View v) { + mPager.setCurrentItem(NUM_ITEMS-1); } }); } @@ -108,7 +110,7 @@ public class FragmentPagerSupport extends FragmentActivity @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View v = inflater.inflate(R.layout.fragment_pager_list, container, false); + View v = inflater.inflate(R.layout.fragment_pager_support_list, container, false); View tv = v.findViewById(R.id.text); ((TextView)tv).setText("Fragment #" + mNum); return v;