summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-06-03 12:31:09 -0700
committerDianne Hackborn <hackbod@google.com>2011-06-03 12:31:09 -0700
commit47f569e460adaef04b75174706b7c95471567ca8 (patch)
tree7d50a2d8154f66918b8fbdfa6767be7f13d47622
parent7e408e8be4cd546206b45c51fa41cc09939dbe33 (diff)
downloadandroid_development-47f569e460adaef04b75174706b7c95471567ca8.tar.gz
android_development-47f569e460adaef04b75174706b7c95471567ca8.tar.bz2
android_development-47f569e460adaef04b75174706b7c95471567ca8.zip
Lost and found.
Change-Id: I3aa4824e2c2157be715d93b698963c54dd98e099
-rw-r--r--samples/Support13Demos/res/layout/fragment_pager.xml19
-rw-r--r--samples/Support13Demos/res/values/strings.xml4
-rw-r--r--samples/Support13Demos/src/com/example/android/supportv13/app/FragmentPagerSupport.java16
-rw-r--r--samples/Support13Demos/src/com/example/android/supportv13/app/FragmentStatePagerSupport.java16
-rw-r--r--samples/Support4Demos/res/layout/fragment_pager.xml19
-rw-r--r--samples/Support4Demos/res/values/strings.xml2
-rw-r--r--samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.java16
7 files changed, 54 insertions, 38 deletions
diff --git a/samples/Support13Demos/res/layout/fragment_pager.xml b/samples/Support13Demos/res/layout/fragment_pager.xml
index 2268c8902..cc07d84df 100644
--- a/samples/Support13Demos/res/layout/fragment_pager.xml
+++ b/samples/Support13Demos/res/layout/fragment_pager.xml
@@ -28,10 +28,17 @@
android:layout_weight="1">
</android.support.v13.view.ViewPager>
- <Button android:id="@+id/new_fragment"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:text="@string/new_fragment">
- <requestFocus />
- </Button>
+ <LinearLayout android:orientation="horizontal"
+ android:gravity="center" android:measureWithLargestChild="true"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0">
+ <Button android:id="@+id/goto_first"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@string/first">
+ </Button>
+ <Button android:id="@+id/goto_last"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@string/last">
+ </Button>
+ </LinearLayout>
</LinearLayout>
diff --git a/samples/Support13Demos/res/values/strings.xml b/samples/Support13Demos/res/values/strings.xml
index af6ec4a75..818597c58 100644
--- a/samples/Support13Demos/res/values/strings.xml
+++ b/samples/Support13Demos/res/values/strings.xml
@@ -23,9 +23,9 @@
siwuf cakso dodtos anr koop.
</string>
- <string name="new_fragment">New fragment</string>
-
<string name="fragment_pager_support">Fragment/Pager</string>
+ <string name="first">First</string>
+ <string name="last">Last</string>
<string name="fragment_state_pager_support">Fragment/State Pager</string>
diff --git a/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentPagerSupport.java b/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentPagerSupport.java
index 46288b56e..fcb41cd9c 100644
--- a/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentPagerSupport.java
+++ b/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentPagerSupport.java
@@ -43,7 +43,6 @@ public class FragmentPagerSupport extends Activity {
MyAdapter mAdapter;
ViewPager mPager;
- int mCurPos;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -56,15 +55,16 @@ public class FragmentPagerSupport extends Activity {
mPager.setAdapter(mAdapter);
// Watch for button clicks.
- Button button = (Button)findViewById(R.id.new_fragment);
+ Button 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);
}
});
}
diff --git a/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentStatePagerSupport.java b/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentStatePagerSupport.java
index a65d8075b..e19bdf640 100644
--- a/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentStatePagerSupport.java
+++ b/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentStatePagerSupport.java
@@ -43,7 +43,6 @@ public class FragmentStatePagerSupport extends Activity {
MyAdapter mAdapter;
ViewPager mPager;
- int mCurPos;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -56,15 +55,16 @@ public class FragmentStatePagerSupport extends Activity {
mPager.setAdapter(mAdapter);
// Watch for button clicks.
- Button button = (Button)findViewById(R.id.new_fragment);
+ Button 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);
}
});
}
diff --git a/samples/Support4Demos/res/layout/fragment_pager.xml b/samples/Support4Demos/res/layout/fragment_pager.xml
index 3867f46f4..a082e2e54 100644
--- a/samples/Support4Demos/res/layout/fragment_pager.xml
+++ b/samples/Support4Demos/res/layout/fragment_pager.xml
@@ -28,10 +28,17 @@
android:layout_weight="1">
</android.support.v4.app.FragmentPager>
- <Button android:id="@+id/new_fragment"
- android:layout_width="wrap_content" android:layout_height="wrap_content"
- android:layout_weight="0"
- android:text="@string/new_fragment">
- <requestFocus />
- </Button>
+ <LinearLayout android:orientation="horizontal"
+ android:gravity="center" android:measureWithLargestChild="true"
+ android:layout_width="match_parent" android:layout_height="wrap_content"
+ android:layout_weight="0">
+ <Button android:id="@+id/goto_first"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@string/first">
+ </Button>
+ <Button android:id="@+id/goto_last"
+ android:layout_width="wrap_content" android:layout_height="wrap_content"
+ android:text="@string/last">
+ </Button>
+ </LinearLayout>
</LinearLayout>
diff --git a/samples/Support4Demos/res/values/strings.xml b/samples/Support4Demos/res/values/strings.xml
index 25fe88088..ba7a341b7 100644
--- a/samples/Support4Demos/res/values/strings.xml
+++ b/samples/Support4Demos/res/values/strings.xml
@@ -78,6 +78,8 @@
<string name="new_fragment">New fragment</string>
<string name="fragment_pager_support">Fragment/Pager</string>
+ <string name="first">First</string>
+ <string name="last">Last</string>
<string name="loader_cursor_support">Loader/Cursor</string>
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.java
index ca5e73f83..3329597b6 100644
--- a/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.java
@@ -39,7 +39,6 @@ public class FragmentPagerSupport extends FragmentActivity
static final int NUM_ITEMS = 10;
FragmentPager mPager;
- int mCurPos;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -50,15 +49,16 @@ public class FragmentPagerSupport extends FragmentActivity
mPager.setAdapter(this);
// Watch for button clicks.
- Button button = (Button)findViewById(R.id.new_fragment);
+ Button 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);
}
});
}