diff --git a/build/sdk.atree b/build/sdk.atree
index 062817385..269f4f9d5 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -280,9 +280,7 @@ developers/build/prebuilts/gradle/CardReader sam
developers/build/prebuilts/gradle/BatchStepSensor samples/${PLATFORM_NAME}/sensors/BatchStepSensor
developers/build/prebuilts/gradle/DisplayingBitmaps samples/${PLATFORM_NAME}/ui/DisplayingBitmaps
developers/build/prebuilts/gradle/BasicTransition samples/${PLATFORM_NAME}/ui/BasicTransition
-developers/build/prebuilts/gradle/AdapterTransition samples/${PLATFORM_NAME}/ui/AdapterTransition
developers/build/prebuilts/gradle/CustomTransition samples/${PLATFORM_NAME}/ui/CustomTransition
-developers/build/prebuilts/gradle/FragmentTransition samples/${PLATFORM_NAME}/ui/FragmentTransition
developers/build/prebuilts/gradle/SwipeRefreshLayoutBasic samples/${PLATFORM_NAME}/ui/SwipeRefreshLayoutBasic
developers/build/prebuilts/gradle/SwipeRefreshListFragment samples/${PLATFORM_NAME}/ui/SwipeRefreshListFragment
developers/build/prebuilts/gradle/SwipeRefreshMultipleViews samples/${PLATFORM_NAME}/ui/SwipeRefreshMultipleViews
@@ -314,6 +312,8 @@ developers/build/prebuilts/gradle/PermissionRequest sam
developers/build/prebuilts/gradle/DirectorySelection samples/${PLATFORM_NAME}/content/documentsUi/DirectorySelection
developers/build/prebuilts/gradle/AppUsageStatistics samples/${PLATFORM_NAME}/system/AppUsageStatistics
developers/build/prebuilts/gradle/ScreenCapture samples/${PLATFORM_NAME}/media/ScreenCapture
+developers/build/prebuilts/gradle/NfcProvisioning samples/${PLATFORM_NAME}/nfc/NfcProvisioning
+developers/build/prebuilts/gradle/DeviceOwner samples/${PLATFORM_NAME}/admin/DeviceOwner
developers/build/prebuilts/androidtv samples/${PLATFORM_NAME}/androidtv
@@ -322,7 +322,6 @@ developers/build/prebuilts/gradle/AgendaData samples/${PLATFO
developers/build/prebuilts/gradle/DataLayer samples/${PLATFORM_NAME}/wearable/DataLayer
developers/build/prebuilts/gradle/DelayedConfirmation samples/${PLATFORM_NAME}/wearable/DelayedConfirmation
developers/build/prebuilts/gradle/ElizaChat samples/${PLATFORM_NAME}/wearable/ElizaChat
-developers/build/prebuilts/gradle/EmbeddedApp samples/${PLATFORM_NAME}/wearable/EmbeddedApp
developers/build/prebuilts/gradle/FindMyPhone samples/${PLATFORM_NAME}/wearable/FindMyPhone
developers/build/prebuilts/gradle/Flashlight samples/${PLATFORM_NAME}/wearable/Flashlight
developers/build/prebuilts/gradle/Geofencing samples/${PLATFORM_NAME}/wearable/Geofencing
@@ -337,6 +336,7 @@ developers/build/prebuilts/gradle/SynchronizedNotifications samples/${PLATFO
developers/build/prebuilts/gradle/Timer samples/${PLATFORM_NAME}/wearable/Timer
developers/build/prebuilts/gradle/WatchFace samples/${PLATFORM_NAME}/wearable/WatchFace
developers/build/prebuilts/gradle/WatchViewStub samples/${PLATFORM_NAME}/wearable/WatchViewStub
+developers/build/prebuilts/gradle/XYZTouristAttractions samples/${PLATFORM_NAME}/wearable/XYZTouristAttractions
# Old sample tree
development/samples/AccelerometerPlay samples/${PLATFORM_NAME}/legacy/AccelerometerPlay
@@ -503,4 +503,3 @@ ${OUT_DIR}/target/common/obj/PACKAGING/android-support-design_intermediates/andr
##############################################################################
framework/layoutlib-tests.jar tests/libtests/layoutlib-tests.jar
system/app/EmulatorSmokeTests/EmulatorSmokeTests.apk tests/emulator-test-apps/EmulatorSmokeTests.apk
-
diff --git a/samples/browseable/ActionBarCompat-Basic/res/layout/activity_main.xml b/samples/browseable/ActionBarCompat-Basic/res/layout/activity_main.xml
deleted file mode 100755
index be1aa49d9..000000000
--- a/samples/browseable/ActionBarCompat-Basic/res/layout/activity_main.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
- - Transition cannot be directly applied to AdapterViews. In this sample, we demonstrate how to create an overlay layout and run a Transition on it. Press the action bar button to toggle between ListView and GridView. - -
diff --git a/samples/browseable/AdapterTransition/res/drawable-hdpi/ic_action_grid.png b/samples/browseable/AdapterTransition/res/drawable-hdpi/ic_action_grid.png deleted file mode 100644 index e04f4a7f5..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-hdpi/ic_action_grid.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-hdpi/ic_action_list.png b/samples/browseable/AdapterTransition/res/drawable-hdpi/ic_action_list.png deleted file mode 100644 index 4131dba4e..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-hdpi/ic_action_list.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-hdpi/ic_launcher.png b/samples/browseable/AdapterTransition/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index b7a67c0cf..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-mdpi/ic_action_grid.png b/samples/browseable/AdapterTransition/res/drawable-mdpi/ic_action_grid.png deleted file mode 100644 index f2a83e38c..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-mdpi/ic_action_grid.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-mdpi/ic_action_list.png b/samples/browseable/AdapterTransition/res/drawable-mdpi/ic_action_list.png deleted file mode 100644 index e248a488e..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-mdpi/ic_action_list.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-mdpi/ic_launcher.png b/samples/browseable/AdapterTransition/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 1c9fc097d..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p1.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p1.jpg deleted file mode 100644 index 10f07acf1..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p1.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p10.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p10.jpg deleted file mode 100644 index 4272f4cc0..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p10.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p11.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p11.jpg deleted file mode 100644 index c5722b229..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p11.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p2.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p2.jpg deleted file mode 100644 index ca380ae4e..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p2.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p3.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p3.jpg deleted file mode 100644 index 6fc71e765..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p3.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p4.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p4.jpg deleted file mode 100644 index 153c1ffe8..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p4.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p5.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p5.jpg deleted file mode 100644 index 46d6a13df..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p5.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p6.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p6.jpg deleted file mode 100644 index 89ccb8329..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p6.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p7.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p7.jpg deleted file mode 100644 index 7e9546dde..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p7.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p8.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p8.jpg deleted file mode 100644 index 21e25ba17..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p8.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-nodpi/p9.jpg b/samples/browseable/AdapterTransition/res/drawable-nodpi/p9.jpg deleted file mode 100644 index 79854cb64..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-nodpi/p9.jpg and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-xhdpi/ic_action_grid.png b/samples/browseable/AdapterTransition/res/drawable-xhdpi/ic_action_grid.png deleted file mode 100644 index ecd39b530..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-xhdpi/ic_action_grid.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-xhdpi/ic_action_list.png b/samples/browseable/AdapterTransition/res/drawable-xhdpi/ic_action_list.png deleted file mode 100644 index e7e510d07..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-xhdpi/ic_action_list.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/AdapterTransition/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 11b992810..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-xxhdpi/ic_action_grid.png b/samples/browseable/AdapterTransition/res/drawable-xxhdpi/ic_action_grid.png deleted file mode 100644 index 3ba98fc15..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-xxhdpi/ic_action_grid.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-xxhdpi/ic_action_list.png b/samples/browseable/AdapterTransition/res/drawable-xxhdpi/ic_action_list.png deleted file mode 100644 index d18773288..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-xxhdpi/ic_action_list.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/AdapterTransition/res/drawable-xxhdpi/ic_launcher.png deleted file mode 100644 index f136c9f14..000000000 Binary files a/samples/browseable/AdapterTransition/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/samples/browseable/AdapterTransition/res/layout/item_meat_grid.xml b/samples/browseable/AdapterTransition/res/layout/item_meat_grid.xml deleted file mode 100644 index d7fb77a76..000000000 --- a/samples/browseable/AdapterTransition/res/layout/item_meat_grid.xml +++ /dev/null @@ -1,50 +0,0 @@ - - -- * To use the component, simply add it to your view hierarchy. Then in your - * {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call - * {@link #setViewPager(ViewPager)} providing it the ViewPager this layout is being used for. - *
- * The colors can be customized in two ways. The first and simplest is to provide an array of colors - * via {@link #setSelectedIndicatorColors(int...)} and {@link #setDividerColors(int...)}. The - * alternative is via the {@link TabColorizer} interface which provides you complete control over - * which color is used for any individual position. - *
- * The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)},
- * providing the layout ID of your custom layout.
- */
-public class SlidingTabLayout extends HorizontalScrollView {
-
- /**
- * Allows complete control over the colors drawn in the tab layout. Set with
- * {@link #setCustomTabColorizer(TabColorizer)}.
- */
- public interface TabColorizer {
-
- /**
- * @return return the color of the indicator used when {@code position} is selected.
- */
- int getIndicatorColor(int position);
-
- /**
- * @return return the color of the divider drawn to the right of {@code position}.
- */
- int getDividerColor(int position);
-
- }
-
- private static final int TITLE_OFFSET_DIPS = 24;
- private static final int TAB_VIEW_PADDING_DIPS = 16;
- private static final int TAB_VIEW_TEXT_SIZE_SP = 12;
-
- private int mTitleOffset;
-
- private int mTabViewLayoutId;
- private int mTabViewTextViewId;
-
- private ViewPager mViewPager;
- private ViewPager.OnPageChangeListener mViewPagerPageChangeListener;
-
- private final SlidingTabStrip mTabStrip;
-
- public SlidingTabLayout(Context context) {
- this(context, null);
- }
-
- public SlidingTabLayout(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- // Disable the Scroll Bar
- setHorizontalScrollBarEnabled(false);
- // Make sure that the Tab Strips fills this View
- setFillViewport(true);
-
- mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density);
-
- mTabStrip = new SlidingTabStrip(context);
- addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
- }
-
- /**
- * Set the custom {@link TabColorizer} to be used.
- *
- * If you only require simple custmisation then you can use
- * {@link #setSelectedIndicatorColors(int...)} and {@link #setDividerColors(int...)} to achieve
- * similar effects.
- */
- public void setCustomTabColorizer(TabColorizer tabColorizer) {
- mTabStrip.setCustomTabColorizer(tabColorizer);
- }
-
- /**
- * Sets the colors to be used for indicating the selected tab. These colors are treated as a
- * circular array. Providing one color will mean that all tabs are indicated with the same color.
- */
- public void setSelectedIndicatorColors(int... colors) {
- mTabStrip.setSelectedIndicatorColors(colors);
- }
-
- /**
- * Sets the colors to be used for tab dividers. These colors are treated as a circular array.
- * Providing one color will mean that all tabs are indicated with the same color.
- */
- public void setDividerColors(int... colors) {
- mTabStrip.setDividerColors(colors);
- }
-
- /**
- * Set the {@link ViewPager.OnPageChangeListener}. When using {@link SlidingTabLayout} you are
- * required to set any {@link ViewPager.OnPageChangeListener} through this method. This is so
- * that the layout can update it's scroll position correctly.
- *
- * @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener)
- */
- public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
- mViewPagerPageChangeListener = listener;
- }
-
- /**
- * Set the custom layout to be inflated for the tab views.
- *
- * @param layoutResId Layout id to be inflated
- * @param textViewId id of the {@link TextView} in the inflated view
- */
- public void setCustomTabView(int layoutResId, int textViewId) {
- mTabViewLayoutId = layoutResId;
- mTabViewTextViewId = textViewId;
- }
-
- /**
- * Sets the associated view pager. Note that the assumption here is that the pager content
- * (number of tabs and tab titles) does not change after this call has been made.
- */
- public void setViewPager(ViewPager viewPager) {
- mTabStrip.removeAllViews();
-
- mViewPager = viewPager;
- if (viewPager != null) {
- viewPager.setOnPageChangeListener(new InternalViewPagerListener());
- populateTabStrip();
- }
- }
-
- /**
- * Create a default view to be used for tabs. This is called if a custom tab view is not set via
- * {@link #setCustomTabView(int, int)}.
- */
- protected TextView createDefaultTabView(Context context) {
- TextView textView = new TextView(context);
- textView.setGravity(Gravity.CENTER);
- textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
- textView.setTypeface(Typeface.DEFAULT_BOLD);
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- // If we're running on Honeycomb or newer, then we can use the Theme's
- // selectableItemBackground to ensure that the View has a pressed state
- TypedValue outValue = new TypedValue();
- getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
- outValue, true);
- textView.setBackgroundResource(outValue.resourceId);
- }
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
- textView.setAllCaps(true);
- }
-
- int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
- textView.setPadding(padding, padding, padding, padding);
-
- return textView;
- }
-
- private void populateTabStrip() {
- final PagerAdapter adapter = mViewPager.getAdapter();
- final View.OnClickListener tabClickListener = new TabClickListener();
-
- for (int i = 0; i < adapter.getCount(); i++) {
- View tabView = null;
- TextView tabTitleView = null;
-
- if (mTabViewLayoutId != 0) {
- // If there is a custom tab view layout id set, try and inflate it
- tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip,
- false);
- tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
- }
-
- if (tabView == null) {
- tabView = createDefaultTabView(getContext());
- }
-
- if (tabTitleView == null && TextView.class.isInstance(tabView)) {
- tabTitleView = (TextView) tabView;
- }
-
- tabTitleView.setText(adapter.getPageTitle(i));
- tabView.setOnClickListener(tabClickListener);
-
- mTabStrip.addView(tabView);
- }
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
-
- if (mViewPager != null) {
- scrollToTab(mViewPager.getCurrentItem(), 0);
- }
- }
-
- private void scrollToTab(int tabIndex, int positionOffset) {
- final int tabStripChildCount = mTabStrip.getChildCount();
- if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
- return;
- }
-
- View selectedChild = mTabStrip.getChildAt(tabIndex);
- if (selectedChild != null) {
- int targetScrollX = selectedChild.getLeft() + positionOffset;
-
- if (tabIndex > 0 || positionOffset > 0) {
- // If we're not at the first child and are mid-scroll, make sure we obey the offset
- targetScrollX -= mTitleOffset;
- }
-
- scrollTo(targetScrollX, 0);
- }
- }
-
- private class InternalViewPagerListener implements ViewPager.OnPageChangeListener {
- private int mScrollState;
-
- @Override
- public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
- int tabStripChildCount = mTabStrip.getChildCount();
- if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) {
- return;
- }
-
- mTabStrip.onViewPagerPageChanged(position, positionOffset);
-
- View selectedTitle = mTabStrip.getChildAt(position);
- int extraOffset = (selectedTitle != null)
- ? (int) (positionOffset * selectedTitle.getWidth())
- : 0;
- scrollToTab(position, extraOffset);
-
- if (mViewPagerPageChangeListener != null) {
- mViewPagerPageChangeListener.onPageScrolled(position, positionOffset,
- positionOffsetPixels);
- }
- }
-
- @Override
- public void onPageScrollStateChanged(int state) {
- mScrollState = state;
-
- if (mViewPagerPageChangeListener != null) {
- mViewPagerPageChangeListener.onPageScrollStateChanged(state);
- }
- }
-
- @Override
- public void onPageSelected(int position) {
- if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
- mTabStrip.onViewPagerPageChanged(position, 0f);
- scrollToTab(position, 0);
- }
-
- if (mViewPagerPageChangeListener != null) {
- mViewPagerPageChangeListener.onPageSelected(position);
- }
- }
-
- }
-
- private class TabClickListener implements View.OnClickListener {
- @Override
- public void onClick(View v) {
- for (int i = 0; i < mTabStrip.getChildCount(); i++) {
- if (v == mTabStrip.getChildAt(i)) {
- mViewPager.setCurrentItem(i);
- return;
- }
- }
- }
- }
-
-}
diff --git a/samples/browseable/AdapterTransition/src/com.example.android.common/view/SlidingTabStrip.java b/samples/browseable/AdapterTransition/src/com.example.android.common/view/SlidingTabStrip.java
deleted file mode 100644
index d5bbbae59..000000000
--- a/samples/browseable/AdapterTransition/src/com.example.android.common/view/SlidingTabStrip.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.common.view;
-
-import android.R;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.util.AttributeSet;
-import android.util.TypedValue;
-import android.view.View;
-import android.widget.LinearLayout;
-
-class SlidingTabStrip extends LinearLayout {
-
- private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 2;
- private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26;
- private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 8;
- private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5;
-
- private static final int DEFAULT_DIVIDER_THICKNESS_DIPS = 1;
- private static final byte DEFAULT_DIVIDER_COLOR_ALPHA = 0x20;
- private static final float DEFAULT_DIVIDER_HEIGHT = 0.5f;
-
- private final int mBottomBorderThickness;
- private final Paint mBottomBorderPaint;
-
- private final int mSelectedIndicatorThickness;
- private final Paint mSelectedIndicatorPaint;
-
- private final int mDefaultBottomBorderColor;
-
- private final Paint mDividerPaint;
- private final float mDividerHeight;
-
- private int mSelectedPosition;
- private float mSelectionOffset;
-
- private SlidingTabLayout.TabColorizer mCustomTabColorizer;
- private final SimpleTabColorizer mDefaultTabColorizer;
-
- SlidingTabStrip(Context context) {
- this(context, null);
- }
-
- SlidingTabStrip(Context context, AttributeSet attrs) {
- super(context, attrs);
- setWillNotDraw(false);
-
- final float density = getResources().getDisplayMetrics().density;
-
- TypedValue outValue = new TypedValue();
- context.getTheme().resolveAttribute(R.attr.colorForeground, outValue, true);
- final int themeForegroundColor = outValue.data;
-
- mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor,
- DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);
-
- mDefaultTabColorizer = new SimpleTabColorizer();
- mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR);
- mDefaultTabColorizer.setDividerColors(setColorAlpha(themeForegroundColor,
- DEFAULT_DIVIDER_COLOR_ALPHA));
-
- mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
- mBottomBorderPaint = new Paint();
- mBottomBorderPaint.setColor(mDefaultBottomBorderColor);
-
- mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density);
- mSelectedIndicatorPaint = new Paint();
-
- mDividerHeight = DEFAULT_DIVIDER_HEIGHT;
- mDividerPaint = new Paint();
- mDividerPaint.setStrokeWidth((int) (DEFAULT_DIVIDER_THICKNESS_DIPS * density));
- }
-
- void setCustomTabColorizer(SlidingTabLayout.TabColorizer customTabColorizer) {
- mCustomTabColorizer = customTabColorizer;
- invalidate();
- }
-
- void setSelectedIndicatorColors(int... colors) {
- // Make sure that the custom colorizer is removed
- mCustomTabColorizer = null;
- mDefaultTabColorizer.setIndicatorColors(colors);
- invalidate();
- }
-
- void setDividerColors(int... colors) {
- // Make sure that the custom colorizer is removed
- mCustomTabColorizer = null;
- mDefaultTabColorizer.setDividerColors(colors);
- invalidate();
- }
-
- void onViewPagerPageChanged(int position, float positionOffset) {
- mSelectedPosition = position;
- mSelectionOffset = positionOffset;
- invalidate();
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- final int height = getHeight();
- final int childCount = getChildCount();
- final int dividerHeightPx = (int) (Math.min(Math.max(0f, mDividerHeight), 1f) * height);
- final SlidingTabLayout.TabColorizer tabColorizer = mCustomTabColorizer != null
- ? mCustomTabColorizer
- : mDefaultTabColorizer;
-
- // Thick colored underline below the current selection
- if (childCount > 0) {
- View selectedTitle = getChildAt(mSelectedPosition);
- int left = selectedTitle.getLeft();
- int right = selectedTitle.getRight();
- int color = tabColorizer.getIndicatorColor(mSelectedPosition);
-
- if (mSelectionOffset > 0f && mSelectedPosition < (getChildCount() - 1)) {
- int nextColor = tabColorizer.getIndicatorColor(mSelectedPosition + 1);
- if (color != nextColor) {
- color = blendColors(nextColor, color, mSelectionOffset);
- }
-
- // Draw the selection partway between the tabs
- View nextTitle = getChildAt(mSelectedPosition + 1);
- left = (int) (mSelectionOffset * nextTitle.getLeft() +
- (1.0f - mSelectionOffset) * left);
- right = (int) (mSelectionOffset * nextTitle.getRight() +
- (1.0f - mSelectionOffset) * right);
- }
-
- mSelectedIndicatorPaint.setColor(color);
-
- canvas.drawRect(left, height - mSelectedIndicatorThickness, right,
- height, mSelectedIndicatorPaint);
- }
-
- // Thin underline along the entire bottom edge
- canvas.drawRect(0, height - mBottomBorderThickness, getWidth(), height, mBottomBorderPaint);
-
- // Vertical separators between the titles
- int separatorTop = (height - dividerHeightPx) / 2;
- for (int i = 0; i < childCount - 1; i++) {
- View child = getChildAt(i);
- mDividerPaint.setColor(tabColorizer.getDividerColor(i));
- canvas.drawLine(child.getRight(), separatorTop, child.getRight(),
- separatorTop + dividerHeightPx, mDividerPaint);
- }
- }
-
- /**
- * Set the alpha value of the {@code color} to be the given {@code alpha} value.
- */
- private static int setColorAlpha(int color, byte alpha) {
- return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
- }
-
- /**
- * Blend {@code color1} and {@code color2} using the given ratio.
- *
- * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend,
- * 0.0 will return {@code color2}.
- */
- private static int blendColors(int color1, int color2, float ratio) {
- final float inverseRation = 1f - ratio;
- float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation);
- float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation);
- float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation);
- return Color.rgb((int) r, (int) g, (int) b);
- }
-
- private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer {
- private int[] mIndicatorColors;
- private int[] mDividerColors;
-
- @Override
- public final int getIndicatorColor(int position) {
- return mIndicatorColors[position % mIndicatorColors.length];
- }
-
- @Override
- public final int getDividerColor(int position) {
- return mDividerColors[position % mDividerColors.length];
- }
-
- void setIndicatorColors(int... colors) {
- mIndicatorColors = colors;
- }
-
- void setDividerColors(int... colors) {
- mDividerColors = colors;
- }
- }
-}
\ No newline at end of file
diff --git a/samples/browseable/AgendaData/Application/res/layout/activity_main.xml b/samples/browseable/AgendaData/Application/res/layout/activity_main.xml
deleted file mode 100755
index be1aa49d9..000000000
--- a/samples/browseable/AgendaData/Application/res/layout/activity_main.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
+ + This sample explains how to use App usage statistics API, which was introduced + in Android 5.0. + +
diff --git a/samples/browseable/AppUsageStatistics/res/drawable-hdpi/ic_default_app_launcher.png b/samples/browseable/AppUsageStatistics/res/drawable-hdpi/ic_default_app_launcher.png new file mode 100644 index 000000000..96a442e5b Binary files /dev/null and b/samples/browseable/AppUsageStatistics/res/drawable-hdpi/ic_default_app_launcher.png differ diff --git a/samples/browseable/AppUsageStatistics/res/drawable-hdpi/ic_launcher.png b/samples/browseable/AppUsageStatistics/res/drawable-hdpi/ic_launcher.png new file mode 100755 index 000000000..3cf5e8b4d Binary files /dev/null and b/samples/browseable/AppUsageStatistics/res/drawable-hdpi/ic_launcher.png differ diff --git a/samples/browseable/AdapterTransition/res/drawable-hdpi/tile.9.png b/samples/browseable/AppUsageStatistics/res/drawable-hdpi/tile.9.png similarity index 100% rename from samples/browseable/AdapterTransition/res/drawable-hdpi/tile.9.png rename to samples/browseable/AppUsageStatistics/res/drawable-hdpi/tile.9.png diff --git a/samples/browseable/AppUsageStatistics/res/drawable-mdpi/ic_default_app_launcher.png b/samples/browseable/AppUsageStatistics/res/drawable-mdpi/ic_default_app_launcher.png new file mode 100644 index 000000000..359047dfa Binary files /dev/null and b/samples/browseable/AppUsageStatistics/res/drawable-mdpi/ic_default_app_launcher.png differ diff --git a/samples/browseable/AppUsageStatistics/res/drawable-mdpi/ic_launcher.png b/samples/browseable/AppUsageStatistics/res/drawable-mdpi/ic_launcher.png new file mode 100755 index 000000000..51553c5dc Binary files /dev/null and b/samples/browseable/AppUsageStatistics/res/drawable-mdpi/ic_launcher.png differ diff --git a/samples/browseable/AppUsageStatistics/res/drawable-xhdpi/ic_default_app_launcher.png b/samples/browseable/AppUsageStatistics/res/drawable-xhdpi/ic_default_app_launcher.png new file mode 100644 index 000000000..71c6d760f Binary files /dev/null and b/samples/browseable/AppUsageStatistics/res/drawable-xhdpi/ic_default_app_launcher.png differ diff --git a/samples/browseable/AppUsageStatistics/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/AppUsageStatistics/res/drawable-xhdpi/ic_launcher.png new file mode 100755 index 000000000..52480002b Binary files /dev/null and b/samples/browseable/AppUsageStatistics/res/drawable-xhdpi/ic_launcher.png differ diff --git a/samples/browseable/AppUsageStatistics/res/drawable-xxhdpi/ic_default_app_launcher.png b/samples/browseable/AppUsageStatistics/res/drawable-xxhdpi/ic_default_app_launcher.png new file mode 100644 index 000000000..4df189464 Binary files /dev/null and b/samples/browseable/AppUsageStatistics/res/drawable-xxhdpi/ic_default_app_launcher.png differ diff --git a/samples/browseable/AppUsageStatistics/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/AppUsageStatistics/res/drawable-xxhdpi/ic_launcher.png new file mode 100755 index 000000000..7f1620096 Binary files /dev/null and b/samples/browseable/AppUsageStatistics/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/samples/browseable/AppUsageStatistics/res/layout/activity_app_usage_statistics.xml b/samples/browseable/AppUsageStatistics/res/layout/activity_app_usage_statistics.xml new file mode 100644 index 000000000..2627c8b7e --- /dev/null +++ b/samples/browseable/AppUsageStatistics/res/layout/activity_app_usage_statistics.xml @@ -0,0 +1,23 @@ + + +-This samples demonstrates the use of MotionEvent properties to keep track of individual touches +This sample demonstrates the use of MotionEvent properties to keep track of individual touches across multiple touch events. \n\nTouch the screen with multiple fingers to show that the pointer id -(also represented by a colour) does not change as new touch events are received.
- BasicRenderScript sample demonstrates basic steps how to use renderScript. - In the sample, it performs graphical filter operation on a image with renderScript. + This sample demonstrates using RenderScript to perform basic image manipulation. Specifically, it allows users + to dynamically adjust the saturation for an image using a slider. A custom RenderScript kernel performs the saturation + adjustment, running the computation on the device\'s GPU or other compute hardware as deemed appropriate by the system.
diff --git a/samples/browseable/BasicRenderScript/res/layout/activity_main.xml b/samples/browseable/BasicRenderScript/res/layout/activity_main.xml deleted file mode 100755 index be1aa49d9..000000000 --- a/samples/browseable/BasicRenderScript/res/layout/activity_main.xml +++ /dev/null @@ -1,36 +0,0 @@ - - -+ + This sample demonstrates how to transfer large files via Android Beam. After the initial + handshake over NFC, file transfer will take place over a secondary high-speed + communication channel such as Bluetooth or WiFi Direct. + + \n\nThis feature requires Android 4.1 (Jelly Bean) or above. Unlike traditional Beam, + your application will not receive an Intent on the receiving device. Instead, the system + will save the file to disk and display a notification that the user can select to open + the file using a standard ACTION_VIEW Intent. + +
diff --git a/samples/browseable/BeamLargeFiles/res/drawable-hdpi/ic_launcher.png b/samples/browseable/BeamLargeFiles/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..b1efaf4b2 Binary files /dev/null and b/samples/browseable/BeamLargeFiles/res/drawable-hdpi/ic_launcher.png differ diff --git a/samples/browseable/ElizaChat/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/BeamLargeFiles/res/drawable-hdpi/tile.9.png similarity index 100% rename from samples/browseable/ElizaChat/Application/res/drawable-hdpi/tile.9.png rename to samples/browseable/BeamLargeFiles/res/drawable-hdpi/tile.9.png diff --git a/samples/browseable/BeamLargeFiles/res/drawable-mdpi/ic_launcher.png b/samples/browseable/BeamLargeFiles/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..f5f9244f2 Binary files /dev/null and b/samples/browseable/BeamLargeFiles/res/drawable-mdpi/ic_launcher.png differ diff --git a/samples/browseable/BeamLargeFiles/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/BeamLargeFiles/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..5d07b3f06 Binary files /dev/null and b/samples/browseable/BeamLargeFiles/res/drawable-xhdpi/ic_launcher.png differ diff --git a/samples/browseable/BeamLargeFiles/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/BeamLargeFiles/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..6ef21e1f4 Binary files /dev/null and b/samples/browseable/BeamLargeFiles/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/samples/browseable/BeamLargeFiles/res/layout-sw600dp-land/activity_main.xml b/samples/browseable/BeamLargeFiles/res/layout-sw600dp-land/activity_main.xml new file mode 100644 index 000000000..8fed5f746 --- /dev/null +++ b/samples/browseable/BeamLargeFiles/res/layout-sw600dp-land/activity_main.xml @@ -0,0 +1,42 @@ + +While any type of data can be placed into a normal NDEF messages, NFC is not considered + * "high-speed" communication channel. Large images can easily take > 30 seconds to transfer. + * Because NFC requires devices to be in extremely close proximity, this is not ideal. + * + *
Instead, Android 4.2+ devices can use NFC to perform an initial handshake, before handing + * off to a faster communication channel, such as Bluetooth, for file transfer. + * + *
The tradeoff is that this application will not be invoked on the receiving device. Instead, + * the transfer will be handled by the OS. The user will be shown a notification when the transfer + * is complete. Selecting the notification will open the file in the default viewer for its MIME- + * type. (If it's important that your application be used to open the file, you'll need to register + * an intent-filter to watch for the appropriate MIME-type.) + */ +public class BeamLargeFilesFragment extends Fragment implements NfcAdapter.CreateBeamUrisCallback { + + private static final String TAG = "BeamLargeFilesFragment"; + /** Filename that is to be sent for this activity. Relative to /assets. */ + private static final String FILENAME = "stargazer_droid.jpg"; + /** Content provider URI. */ + private static final String CONTENT_BASE_URI = + "content://com.example.android.beamlargefiles.files/"; + + /** + * Standard lifecycle event. Registers a callback for large-file transfer, by calling + * NfcAdapter.setBeamPushUrisCallback(). + * + * Note: Like sending NDEF messages over standard Android Beam, there is also a non-callback + * API available. See: NfcAdapter.setBeamPushUris(). + * + * @param savedInstanceState Saved instance state. + */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setHasOptionsMenu(true); + Activity a = getActivity(); + + // Setup Beam to transfer a large file. Note the call to setBeamPushUrisCallback(). + // BEGIN_INCLUDE(setBeamPushUrisCallback) + NfcAdapter nfc = NfcAdapter.getDefaultAdapter(a); + if (nfc != null) { + Log.w(TAG, "NFC available. Setting Beam Push URI callback"); + nfc.setBeamPushUrisCallback(this, a); + } else { + Log.w(TAG, "NFC is not available"); + } + // END_INCLUDE(setBeamPushUrisCallback) + } + + /** + * Callback for Beam events (large file version). The return value here should be an array of + * content:// or file:// URIs to send. + * + * Note that the system must have read access to whatever URIs are provided here. + * + * @param nfcEvent NFC event which triggered callback + * @return URIs to be sent to remote device + */ + // BEGIN_INCLUDE(createBeamUris) + @Override + public Uri[] createBeamUris(NfcEvent nfcEvent) { + Log.i(TAG, "Beam event in progress; createBeamUris() called."); + // Images are served using a content:// URI. See AssetProvider for implementation. + Uri photoUri = Uri.parse(CONTENT_BASE_URI + FILENAME); + Log.i(TAG, "Sending URI: " + photoUri); + return new Uri[] {photoUri}; + } + // END_INCLUDE(createBeamUris) +} diff --git a/samples/browseable/BeamLargeFiles/src/com.example.android.beamlargefiles/MainActivity.java b/samples/browseable/BeamLargeFiles/src/com.example.android.beamlargefiles/MainActivity.java new file mode 100644 index 000000000..50d504c47 --- /dev/null +++ b/samples/browseable/BeamLargeFiles/src/com.example.android.beamlargefiles/MainActivity.java @@ -0,0 +1,82 @@ +/* +* Copyright 2013 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package com.example.android.beamlargefiles; + +import android.graphics.Color; +import android.os.Bundle; +import android.support.v4.app.FragmentTransaction; +import android.text.Html; +import android.widget.TextView; +import android.view.Menu; + +import com.example.android.common.activities.SampleActivityBase; +import com.example.android.common.logger.Log; +import com.example.android.common.logger.LogFragment; +import com.example.android.common.logger.LogWrapper; +import com.example.android.common.logger.MessageOnlyLogFilter; + +/** + * A simple launcher activity containing a summary sample description + * and a few action bar buttons. + */ +public class MainActivity extends SampleActivityBase { + + public static final String TAG = "MainActivity"; + + public static final String FRAGTAG = "BeamLargeFilesFragment"; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + TextView sampleOutput = (TextView) findViewById(R.id.sample_output); + sampleOutput.setText(Html.fromHtml(getString(R.string.intro_message))); + + FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); + BeamLargeFilesFragment fragment = new BeamLargeFilesFragment(); + transaction.add(fragment, FRAGTAG); + transaction.commit(); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + getMenuInflater().inflate(R.menu.main, menu); + return true; + } + + /** Create a chain of targets that will receive log data */ + @Override + public void initializeLogging() { + // Wraps Android's native log framework. + LogWrapper logWrapper = new LogWrapper(); + // Using Log, front-end to the logging chain, emulates android.util.log method signatures. + Log.setLogNode(logWrapper); + + // Filter strips out everything except the message text. + MessageOnlyLogFilter msgFilter = new MessageOnlyLogFilter(); + logWrapper.setNext(msgFilter); + + // On screen logging via a fragment with a TextView. + LogFragment logFragment = (LogFragment) getSupportFragmentManager() + .findFragmentById(R.id.log_fragment); + msgFilter.setNext(logFragment.getLogView()); + logFragment.getLogView().setTextAppearance(this, R.style.Log); + logFragment.getLogView().setBackgroundColor(Color.WHITE); + + Log.i(TAG, "Ready"); + } +} diff --git a/samples/browseable/AdapterTransition/src/com.example.android.common/activities/SampleActivityBase.java b/samples/browseable/BeamLargeFiles/src/com.example.android.common/activities/SampleActivityBase.java similarity index 100% rename from samples/browseable/AdapterTransition/src/com.example.android.common/activities/SampleActivityBase.java rename to samples/browseable/BeamLargeFiles/src/com.example.android.common/activities/SampleActivityBase.java diff --git a/samples/browseable/BeamLargeFiles/src/com.example.android.common/assetprovider/AssetProvider.java b/samples/browseable/BeamLargeFiles/src/com.example.android.common/assetprovider/AssetProvider.java new file mode 100644 index 000000000..f6c0f6139 --- /dev/null +++ b/samples/browseable/BeamLargeFiles/src/com.example.android.common/assetprovider/AssetProvider.java @@ -0,0 +1,140 @@ +/* +* Copyright (C) 2013 The Android Open Source Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package com.example.android.common.assetprovider; + +import android.content.ContentProvider; +import android.content.ContentValues; +import android.content.Context; +import android.content.res.AssetFileDescriptor; +import android.content.res.AssetManager; +import android.database.Cursor; +import android.net.Uri; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import static java.net.URLConnection.guessContentTypeFromName; + +/** + * Generic content provider, which makes any files available in this app's "assets" directory + * available publicly. + * + *
To use, add the following to your AndroidManifest.xml:
+ *
+ *
+ */
+public class AssetProvider extends ContentProvider {
+ AssetManager mAssets;
+
+ @Override
+ public boolean onCreate() {
+ Context ctx = getContext();
+ if (ctx == null) {
+ // Context not available. Give up.
+ return false;
+ }
+ mAssets = ctx.getAssets();
+ return true;
+ }
+
+ @Override
+ public String getType(Uri uri){
+ // Returns the MIME type for the selected URI, in conformance with the ContentProvider
+ // interface. Looks up the file indicated by /res/assets/{uri.path}, and returns the MIME
+ // type for that file as guessed by the URLConnection class.
+
+ // Setup
+ String path = uri.getPath();
+
+ // Check if file exists
+ if (!fileExists(path)) {
+ return null;
+ }
+
+ // Determine MIME-type based on filename
+ return guessContentTypeFromName(uri.toString());
+ }
+
+
+ @Override
+ public AssetFileDescriptor openAssetFile (Uri uri, String mode)
+ throws FileNotFoundException, SecurityException {
+ // ContentProvider interface for opening a file descriptor by URI. This content provider
+ // maps all URIs to the contents of the APK's assets folder, so a file handle to
+ // /res/assets/{uri.path} will be returned.
+
+ // Security check. This content provider only supports read-only access. (Also, the contents
+ // of an APKs assets folder are immutable, so read-write access doesn't make sense here.)
+ if (!"r".equals(mode)) {
+ throw new SecurityException("Only read-only access is supported, mode must be [r]");
+ }
+
+ // Open asset from within APK and return file descriptor
+ String path = uri.getPath();
+ try {
+ return mAssets.openFd(path);
+ } catch (IOException e) {
+ throw new FileNotFoundException();
+ }
+ }
+
+ /**
+ * Check if file exists inside APK assets.
+ *
+ * @param path Fully qualified path to file.
+ * @return true if exists, false otherwise.
+ */
+ private boolean fileExists(String path) {
+ try {
+ // Check to see if file can be opened. If so, file exists.
+ mAssets.openFd(path).close();
+ return true;
+ } catch (IOException e) {
+ // Unable to open file descriptor for specified path; file doesn't exist.
+ return false;
+ }
+ }
+
+ // Required/unused ContentProvider methods below.
+ @Override
+ public Cursor query(Uri uri, String[] projection, String selection,
+ String[] selectionArgs, String sortOrder) {
+ // Note: It might be worth implementing support for querying
+ // android.provider.OpenableColumns here in the future.
+ throw new RuntimeException("Operation not supported");
+ }
+
+ @Override
+ public Uri insert(Uri uri, ContentValues contentValues) {
+ throw new RuntimeException("Operation not supported");
+ }
+
+ @Override
+ public int delete(Uri uri, String selection, String[] selectionArgs) {
+ throw new RuntimeException("Operation not supported");
+ }
+
+ @Override
+ public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+ throw new RuntimeException("Operation not supported");
+ }
+}
diff --git a/samples/browseable/AdapterTransition/src/com.example.android.common/logger/Log.java b/samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/Log.java
similarity index 100%
rename from samples/browseable/AdapterTransition/src/com.example.android.common/logger/Log.java
rename to samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/Log.java
diff --git a/samples/browseable/AdapterTransition/src/com.example.android.common/logger/LogFragment.java b/samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/LogFragment.java
similarity index 100%
rename from samples/browseable/AdapterTransition/src/com.example.android.common/logger/LogFragment.java
rename to samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/LogFragment.java
diff --git a/samples/browseable/AdapterTransition/src/com.example.android.common/logger/LogNode.java b/samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/LogNode.java
similarity index 100%
rename from samples/browseable/AdapterTransition/src/com.example.android.common/logger/LogNode.java
rename to samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/LogNode.java
diff --git a/samples/browseable/AdapterTransition/src/com.example.android.common/logger/LogView.java b/samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/LogView.java
similarity index 100%
rename from samples/browseable/AdapterTransition/src/com.example.android.common/logger/LogView.java
rename to samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/LogView.java
diff --git a/samples/browseable/AdapterTransition/src/com.example.android.common/logger/LogWrapper.java b/samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/LogWrapper.java
similarity index 100%
rename from samples/browseable/AdapterTransition/src/com.example.android.common/logger/LogWrapper.java
rename to samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/LogWrapper.java
diff --git a/samples/browseable/AdapterTransition/src/com.example.android.common/logger/MessageOnlyLogFilter.java b/samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/MessageOnlyLogFilter.java
similarity index 100%
rename from samples/browseable/AdapterTransition/src/com.example.android.common/logger/MessageOnlyLogFilter.java
rename to samples/browseable/BeamLargeFiles/src/com.example.android.common/logger/MessageOnlyLogFilter.java
diff --git a/samples/browseable/BluetoothLeGatt/res/layout/activity_main.xml b/samples/browseable/BluetoothLeGatt/res/layout/activity_main.xml
deleted file mode 100755
index be1aa49d9..000000000
--- a/samples/browseable/BluetoothLeGatt/res/layout/activity_main.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
+ *
+ +This app demonstrates how to use device owner features. Use the NfcProvisioning sample to set up +this app as the device owner of your test device (This requires wiping out the device and resseting +it as an unprovisioned device). As a device owner, this app can configure global settings, and +enforce use of a specific launcher. + +
diff --git a/samples/browseable/DeviceOwner/res/drawable-hdpi/ic_launcher.png b/samples/browseable/DeviceOwner/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..282e54008 Binary files /dev/null and b/samples/browseable/DeviceOwner/res/drawable-hdpi/ic_launcher.png differ diff --git a/samples/browseable/EmbeddedApp/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/DeviceOwner/res/drawable-hdpi/tile.9.png similarity index 100% rename from samples/browseable/EmbeddedApp/Application/res/drawable-hdpi/tile.9.png rename to samples/browseable/DeviceOwner/res/drawable-hdpi/tile.9.png diff --git a/samples/browseable/DeviceOwner/res/drawable-mdpi/ic_launcher.png b/samples/browseable/DeviceOwner/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..4ecfdf619 Binary files /dev/null and b/samples/browseable/DeviceOwner/res/drawable-mdpi/ic_launcher.png differ diff --git a/samples/browseable/DeviceOwner/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/DeviceOwner/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..dfb6cabe3 Binary files /dev/null and b/samples/browseable/DeviceOwner/res/drawable-xhdpi/ic_launcher.png differ diff --git a/samples/browseable/DeviceOwner/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/DeviceOwner/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..650302edb Binary files /dev/null and b/samples/browseable/DeviceOwner/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/samples/browseable/DeviceOwner/res/layout/activity_main_real.xml b/samples/browseable/DeviceOwner/res/layout/activity_main_real.xml new file mode 100644 index 000000000..384e9f988 --- /dev/null +++ b/samples/browseable/DeviceOwner/res/layout/activity_main_real.xml @@ -0,0 +1,24 @@ + + ++ + This sample explains how to use Directory selection API, which was introduced + in Android 5.0. + +
diff --git a/samples/browseable/DirectorySelection/res/drawable-hdpi/ic_description_grey600_36dp.png b/samples/browseable/DirectorySelection/res/drawable-hdpi/ic_description_grey600_36dp.png new file mode 100755 index 000000000..dd7d0734d Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-hdpi/ic_description_grey600_36dp.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-hdpi/ic_folder_grey600_36dp.png b/samples/browseable/DirectorySelection/res/drawable-hdpi/ic_folder_grey600_36dp.png new file mode 100755 index 000000000..6c022d461 Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-hdpi/ic_folder_grey600_36dp.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-hdpi/ic_launcher.png b/samples/browseable/DirectorySelection/res/drawable-hdpi/ic_launcher.png new file mode 100755 index 000000000..49ee8546e Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-hdpi/ic_launcher.png differ diff --git a/samples/browseable/Flashlight/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/DirectorySelection/res/drawable-hdpi/tile.9.png similarity index 100% rename from samples/browseable/Flashlight/Application/res/drawable-hdpi/tile.9.png rename to samples/browseable/DirectorySelection/res/drawable-hdpi/tile.9.png diff --git a/samples/browseable/DirectorySelection/res/drawable-mdpi/ic_description_grey600_36dp.png b/samples/browseable/DirectorySelection/res/drawable-mdpi/ic_description_grey600_36dp.png new file mode 100755 index 000000000..ac18b5750 Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-mdpi/ic_description_grey600_36dp.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-mdpi/ic_folder_grey600_36dp.png b/samples/browseable/DirectorySelection/res/drawable-mdpi/ic_folder_grey600_36dp.png new file mode 100755 index 000000000..e3dccd298 Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-mdpi/ic_folder_grey600_36dp.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-mdpi/ic_launcher.png b/samples/browseable/DirectorySelection/res/drawable-mdpi/ic_launcher.png new file mode 100755 index 000000000..282a00c77 Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-mdpi/ic_launcher.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-xhdpi/ic_description_grey600_36dp.png b/samples/browseable/DirectorySelection/res/drawable-xhdpi/ic_description_grey600_36dp.png new file mode 100755 index 000000000..50f854ea5 Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-xhdpi/ic_description_grey600_36dp.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-xhdpi/ic_folder_grey600_36dp.png b/samples/browseable/DirectorySelection/res/drawable-xhdpi/ic_folder_grey600_36dp.png new file mode 100755 index 000000000..6fbc40459 Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-xhdpi/ic_folder_grey600_36dp.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/DirectorySelection/res/drawable-xhdpi/ic_launcher.png new file mode 100755 index 000000000..7293ad6ee Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-xhdpi/ic_launcher.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-xxhdpi/ic_description_grey600_36dp.png b/samples/browseable/DirectorySelection/res/drawable-xxhdpi/ic_description_grey600_36dp.png new file mode 100755 index 000000000..33df5d9d2 Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-xxhdpi/ic_description_grey600_36dp.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-xxhdpi/ic_folder_grey600_36dp.png b/samples/browseable/DirectorySelection/res/drawable-xxhdpi/ic_folder_grey600_36dp.png new file mode 100755 index 000000000..ed2f08e4e Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-xxhdpi/ic_folder_grey600_36dp.png differ diff --git a/samples/browseable/DirectorySelection/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/DirectorySelection/res/drawable-xxhdpi/ic_launcher.png new file mode 100755 index 000000000..7b618d405 Binary files /dev/null and b/samples/browseable/DirectorySelection/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/samples/browseable/DirectorySelection/res/layout/activity_directory_selection.xml b/samples/browseable/DirectorySelection/res/layout/activity_directory_selection.xml new file mode 100644 index 000000000..db655838b --- /dev/null +++ b/samples/browseable/DirectorySelection/res/layout/activity_directory_selection.xml @@ -0,0 +1,23 @@ + + +- - This simple app demonstrates how to embed a wearable app into a phone app. - -
diff --git a/samples/browseable/FindMyPhone/Application/res/layout/activity_main.xml b/samples/browseable/FindMyPhone/Application/res/layout/activity_main.xml deleted file mode 100755 index be1aa49d9..000000000 --- a/samples/browseable/FindMyPhone/Application/res/layout/activity_main.xml +++ /dev/null @@ -1,36 +0,0 @@ - - -- - This sample demonstrates how to start a transition right after a fragment transaction. - -
diff --git a/samples/browseable/FragmentTransition/res/drawable-hdpi/ic_launcher.png b/samples/browseable/FragmentTransition/res/drawable-hdpi/ic_launcher.png deleted file mode 100644 index dfa1b4580..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-mdpi/ic_launcher.png b/samples/browseable/FragmentTransition/res/drawable-mdpi/ic_launcher.png deleted file mode 100644 index 5f4ae7b56..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p1.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p1.jpg deleted file mode 100644 index 10f07acf1..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p1.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p10.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p10.jpg deleted file mode 100644 index 4272f4cc0..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p10.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p11.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p11.jpg deleted file mode 100644 index c5722b229..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p11.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p2.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p2.jpg deleted file mode 100644 index ca380ae4e..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p2.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p3.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p3.jpg deleted file mode 100644 index 6fc71e765..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p3.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p4.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p4.jpg deleted file mode 100644 index 153c1ffe8..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p4.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p5.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p5.jpg deleted file mode 100644 index 46d6a13df..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p5.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p6.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p6.jpg deleted file mode 100644 index 89ccb8329..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p6.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p7.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p7.jpg deleted file mode 100644 index 7e9546dde..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p7.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p8.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p8.jpg deleted file mode 100644 index 21e25ba17..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p8.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-nodpi/p9.jpg b/samples/browseable/FragmentTransition/res/drawable-nodpi/p9.jpg deleted file mode 100644 index 79854cb64..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-nodpi/p9.jpg and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/FragmentTransition/res/drawable-xhdpi/ic_launcher.png deleted file mode 100644 index 5e00f33f8..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/FragmentTransition/res/drawable-xxhdpi/ic_launcher.png deleted file mode 100644 index e061498e0..000000000 Binary files a/samples/browseable/FragmentTransition/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/samples/browseable/FragmentTransition/res/layout/fragment_detail_content.xml b/samples/browseable/FragmentTransition/res/layout/fragment_detail_content.xml deleted file mode 100644 index 206846005..000000000 --- a/samples/browseable/FragmentTransition/res/layout/fragment_detail_content.xml +++ /dev/null @@ -1,66 +0,0 @@ - - -- * To use the component, simply add it to your view hierarchy. Then in your - * {@link android.app.Activity} or {@link android.support.v4.app.Fragment} call - * {@link #setViewPager(ViewPager)} providing it the ViewPager this layout is being used for. - *
- * The colors can be customized in two ways. The first and simplest is to provide an array of colors - * via {@link #setSelectedIndicatorColors(int...)} and {@link #setDividerColors(int...)}. The - * alternative is via the {@link TabColorizer} interface which provides you complete control over - * which color is used for any individual position. - *
- * The views used as tabs can be customized by calling {@link #setCustomTabView(int, int)},
- * providing the layout ID of your custom layout.
- */
-public class SlidingTabLayout extends HorizontalScrollView {
-
- /**
- * Allows complete control over the colors drawn in the tab layout. Set with
- * {@link #setCustomTabColorizer(TabColorizer)}.
- */
- public interface TabColorizer {
-
- /**
- * @return return the color of the indicator used when {@code position} is selected.
- */
- int getIndicatorColor(int position);
-
- /**
- * @return return the color of the divider drawn to the right of {@code position}.
- */
- int getDividerColor(int position);
-
- }
-
- private static final int TITLE_OFFSET_DIPS = 24;
- private static final int TAB_VIEW_PADDING_DIPS = 16;
- private static final int TAB_VIEW_TEXT_SIZE_SP = 12;
-
- private int mTitleOffset;
-
- private int mTabViewLayoutId;
- private int mTabViewTextViewId;
-
- private ViewPager mViewPager;
- private ViewPager.OnPageChangeListener mViewPagerPageChangeListener;
-
- private final SlidingTabStrip mTabStrip;
-
- public SlidingTabLayout(Context context) {
- this(context, null);
- }
-
- public SlidingTabLayout(Context context, AttributeSet attrs) {
- this(context, attrs, 0);
- }
-
- public SlidingTabLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
-
- // Disable the Scroll Bar
- setHorizontalScrollBarEnabled(false);
- // Make sure that the Tab Strips fills this View
- setFillViewport(true);
-
- mTitleOffset = (int) (TITLE_OFFSET_DIPS * getResources().getDisplayMetrics().density);
-
- mTabStrip = new SlidingTabStrip(context);
- addView(mTabStrip, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
- }
-
- /**
- * Set the custom {@link TabColorizer} to be used.
- *
- * If you only require simple custmisation then you can use
- * {@link #setSelectedIndicatorColors(int...)} and {@link #setDividerColors(int...)} to achieve
- * similar effects.
- */
- public void setCustomTabColorizer(TabColorizer tabColorizer) {
- mTabStrip.setCustomTabColorizer(tabColorizer);
- }
-
- /**
- * Sets the colors to be used for indicating the selected tab. These colors are treated as a
- * circular array. Providing one color will mean that all tabs are indicated with the same color.
- */
- public void setSelectedIndicatorColors(int... colors) {
- mTabStrip.setSelectedIndicatorColors(colors);
- }
-
- /**
- * Sets the colors to be used for tab dividers. These colors are treated as a circular array.
- * Providing one color will mean that all tabs are indicated with the same color.
- */
- public void setDividerColors(int... colors) {
- mTabStrip.setDividerColors(colors);
- }
-
- /**
- * Set the {@link ViewPager.OnPageChangeListener}. When using {@link SlidingTabLayout} you are
- * required to set any {@link ViewPager.OnPageChangeListener} through this method. This is so
- * that the layout can update it's scroll position correctly.
- *
- * @see ViewPager#setOnPageChangeListener(ViewPager.OnPageChangeListener)
- */
- public void setOnPageChangeListener(ViewPager.OnPageChangeListener listener) {
- mViewPagerPageChangeListener = listener;
- }
-
- /**
- * Set the custom layout to be inflated for the tab views.
- *
- * @param layoutResId Layout id to be inflated
- * @param textViewId id of the {@link TextView} in the inflated view
- */
- public void setCustomTabView(int layoutResId, int textViewId) {
- mTabViewLayoutId = layoutResId;
- mTabViewTextViewId = textViewId;
- }
-
- /**
- * Sets the associated view pager. Note that the assumption here is that the pager content
- * (number of tabs and tab titles) does not change after this call has been made.
- */
- public void setViewPager(ViewPager viewPager) {
- mTabStrip.removeAllViews();
-
- mViewPager = viewPager;
- if (viewPager != null) {
- viewPager.setOnPageChangeListener(new InternalViewPagerListener());
- populateTabStrip();
- }
- }
-
- /**
- * Create a default view to be used for tabs. This is called if a custom tab view is not set via
- * {@link #setCustomTabView(int, int)}.
- */
- protected TextView createDefaultTabView(Context context) {
- TextView textView = new TextView(context);
- textView.setGravity(Gravity.CENTER);
- textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
- textView.setTypeface(Typeface.DEFAULT_BOLD);
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- // If we're running on Honeycomb or newer, then we can use the Theme's
- // selectableItemBackground to ensure that the View has a pressed state
- TypedValue outValue = new TypedValue();
- getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
- outValue, true);
- textView.setBackgroundResource(outValue.resourceId);
- }
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
- textView.setAllCaps(true);
- }
-
- int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
- textView.setPadding(padding, padding, padding, padding);
-
- return textView;
- }
-
- private void populateTabStrip() {
- final PagerAdapter adapter = mViewPager.getAdapter();
- final View.OnClickListener tabClickListener = new TabClickListener();
-
- for (int i = 0; i < adapter.getCount(); i++) {
- View tabView = null;
- TextView tabTitleView = null;
-
- if (mTabViewLayoutId != 0) {
- // If there is a custom tab view layout id set, try and inflate it
- tabView = LayoutInflater.from(getContext()).inflate(mTabViewLayoutId, mTabStrip,
- false);
- tabTitleView = (TextView) tabView.findViewById(mTabViewTextViewId);
- }
-
- if (tabView == null) {
- tabView = createDefaultTabView(getContext());
- }
-
- if (tabTitleView == null && TextView.class.isInstance(tabView)) {
- tabTitleView = (TextView) tabView;
- }
-
- tabTitleView.setText(adapter.getPageTitle(i));
- tabView.setOnClickListener(tabClickListener);
-
- mTabStrip.addView(tabView);
- }
- }
-
- @Override
- protected void onAttachedToWindow() {
- super.onAttachedToWindow();
-
- if (mViewPager != null) {
- scrollToTab(mViewPager.getCurrentItem(), 0);
- }
- }
-
- private void scrollToTab(int tabIndex, int positionOffset) {
- final int tabStripChildCount = mTabStrip.getChildCount();
- if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
- return;
- }
-
- View selectedChild = mTabStrip.getChildAt(tabIndex);
- if (selectedChild != null) {
- int targetScrollX = selectedChild.getLeft() + positionOffset;
-
- if (tabIndex > 0 || positionOffset > 0) {
- // If we're not at the first child and are mid-scroll, make sure we obey the offset
- targetScrollX -= mTitleOffset;
- }
-
- scrollTo(targetScrollX, 0);
- }
- }
-
- private class InternalViewPagerListener implements ViewPager.OnPageChangeListener {
- private int mScrollState;
-
- @Override
- public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
- int tabStripChildCount = mTabStrip.getChildCount();
- if ((tabStripChildCount == 0) || (position < 0) || (position >= tabStripChildCount)) {
- return;
- }
-
- mTabStrip.onViewPagerPageChanged(position, positionOffset);
-
- View selectedTitle = mTabStrip.getChildAt(position);
- int extraOffset = (selectedTitle != null)
- ? (int) (positionOffset * selectedTitle.getWidth())
- : 0;
- scrollToTab(position, extraOffset);
-
- if (mViewPagerPageChangeListener != null) {
- mViewPagerPageChangeListener.onPageScrolled(position, positionOffset,
- positionOffsetPixels);
- }
- }
-
- @Override
- public void onPageScrollStateChanged(int state) {
- mScrollState = state;
-
- if (mViewPagerPageChangeListener != null) {
- mViewPagerPageChangeListener.onPageScrollStateChanged(state);
- }
- }
-
- @Override
- public void onPageSelected(int position) {
- if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
- mTabStrip.onViewPagerPageChanged(position, 0f);
- scrollToTab(position, 0);
- }
-
- if (mViewPagerPageChangeListener != null) {
- mViewPagerPageChangeListener.onPageSelected(position);
- }
- }
-
- }
-
- private class TabClickListener implements View.OnClickListener {
- @Override
- public void onClick(View v) {
- for (int i = 0; i < mTabStrip.getChildCount(); i++) {
- if (v == mTabStrip.getChildAt(i)) {
- mViewPager.setCurrentItem(i);
- return;
- }
- }
- }
- }
-
-}
diff --git a/samples/browseable/FragmentTransition/src/com.example.android.common/view/SlidingTabStrip.java b/samples/browseable/FragmentTransition/src/com.example.android.common/view/SlidingTabStrip.java
deleted file mode 100644
index d5bbbae59..000000000
--- a/samples/browseable/FragmentTransition/src/com.example.android.common/view/SlidingTabStrip.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.common.view;
-
-import android.R;
-import android.content.Context;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.util.AttributeSet;
-import android.util.TypedValue;
-import android.view.View;
-import android.widget.LinearLayout;
-
-class SlidingTabStrip extends LinearLayout {
-
- private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 2;
- private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26;
- private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 8;
- private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5;
-
- private static final int DEFAULT_DIVIDER_THICKNESS_DIPS = 1;
- private static final byte DEFAULT_DIVIDER_COLOR_ALPHA = 0x20;
- private static final float DEFAULT_DIVIDER_HEIGHT = 0.5f;
-
- private final int mBottomBorderThickness;
- private final Paint mBottomBorderPaint;
-
- private final int mSelectedIndicatorThickness;
- private final Paint mSelectedIndicatorPaint;
-
- private final int mDefaultBottomBorderColor;
-
- private final Paint mDividerPaint;
- private final float mDividerHeight;
-
- private int mSelectedPosition;
- private float mSelectionOffset;
-
- private SlidingTabLayout.TabColorizer mCustomTabColorizer;
- private final SimpleTabColorizer mDefaultTabColorizer;
-
- SlidingTabStrip(Context context) {
- this(context, null);
- }
-
- SlidingTabStrip(Context context, AttributeSet attrs) {
- super(context, attrs);
- setWillNotDraw(false);
-
- final float density = getResources().getDisplayMetrics().density;
-
- TypedValue outValue = new TypedValue();
- context.getTheme().resolveAttribute(R.attr.colorForeground, outValue, true);
- final int themeForegroundColor = outValue.data;
-
- mDefaultBottomBorderColor = setColorAlpha(themeForegroundColor,
- DEFAULT_BOTTOM_BORDER_COLOR_ALPHA);
-
- mDefaultTabColorizer = new SimpleTabColorizer();
- mDefaultTabColorizer.setIndicatorColors(DEFAULT_SELECTED_INDICATOR_COLOR);
- mDefaultTabColorizer.setDividerColors(setColorAlpha(themeForegroundColor,
- DEFAULT_DIVIDER_COLOR_ALPHA));
-
- mBottomBorderThickness = (int) (DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS * density);
- mBottomBorderPaint = new Paint();
- mBottomBorderPaint.setColor(mDefaultBottomBorderColor);
-
- mSelectedIndicatorThickness = (int) (SELECTED_INDICATOR_THICKNESS_DIPS * density);
- mSelectedIndicatorPaint = new Paint();
-
- mDividerHeight = DEFAULT_DIVIDER_HEIGHT;
- mDividerPaint = new Paint();
- mDividerPaint.setStrokeWidth((int) (DEFAULT_DIVIDER_THICKNESS_DIPS * density));
- }
-
- void setCustomTabColorizer(SlidingTabLayout.TabColorizer customTabColorizer) {
- mCustomTabColorizer = customTabColorizer;
- invalidate();
- }
-
- void setSelectedIndicatorColors(int... colors) {
- // Make sure that the custom colorizer is removed
- mCustomTabColorizer = null;
- mDefaultTabColorizer.setIndicatorColors(colors);
- invalidate();
- }
-
- void setDividerColors(int... colors) {
- // Make sure that the custom colorizer is removed
- mCustomTabColorizer = null;
- mDefaultTabColorizer.setDividerColors(colors);
- invalidate();
- }
-
- void onViewPagerPageChanged(int position, float positionOffset) {
- mSelectedPosition = position;
- mSelectionOffset = positionOffset;
- invalidate();
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- final int height = getHeight();
- final int childCount = getChildCount();
- final int dividerHeightPx = (int) (Math.min(Math.max(0f, mDividerHeight), 1f) * height);
- final SlidingTabLayout.TabColorizer tabColorizer = mCustomTabColorizer != null
- ? mCustomTabColorizer
- : mDefaultTabColorizer;
-
- // Thick colored underline below the current selection
- if (childCount > 0) {
- View selectedTitle = getChildAt(mSelectedPosition);
- int left = selectedTitle.getLeft();
- int right = selectedTitle.getRight();
- int color = tabColorizer.getIndicatorColor(mSelectedPosition);
-
- if (mSelectionOffset > 0f && mSelectedPosition < (getChildCount() - 1)) {
- int nextColor = tabColorizer.getIndicatorColor(mSelectedPosition + 1);
- if (color != nextColor) {
- color = blendColors(nextColor, color, mSelectionOffset);
- }
-
- // Draw the selection partway between the tabs
- View nextTitle = getChildAt(mSelectedPosition + 1);
- left = (int) (mSelectionOffset * nextTitle.getLeft() +
- (1.0f - mSelectionOffset) * left);
- right = (int) (mSelectionOffset * nextTitle.getRight() +
- (1.0f - mSelectionOffset) * right);
- }
-
- mSelectedIndicatorPaint.setColor(color);
-
- canvas.drawRect(left, height - mSelectedIndicatorThickness, right,
- height, mSelectedIndicatorPaint);
- }
-
- // Thin underline along the entire bottom edge
- canvas.drawRect(0, height - mBottomBorderThickness, getWidth(), height, mBottomBorderPaint);
-
- // Vertical separators between the titles
- int separatorTop = (height - dividerHeightPx) / 2;
- for (int i = 0; i < childCount - 1; i++) {
- View child = getChildAt(i);
- mDividerPaint.setColor(tabColorizer.getDividerColor(i));
- canvas.drawLine(child.getRight(), separatorTop, child.getRight(),
- separatorTop + dividerHeightPx, mDividerPaint);
- }
- }
-
- /**
- * Set the alpha value of the {@code color} to be the given {@code alpha} value.
- */
- private static int setColorAlpha(int color, byte alpha) {
- return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color));
- }
-
- /**
- * Blend {@code color1} and {@code color2} using the given ratio.
- *
- * @param ratio of which to blend. 1.0 will return {@code color1}, 0.5 will give an even blend,
- * 0.0 will return {@code color2}.
- */
- private static int blendColors(int color1, int color2, float ratio) {
- final float inverseRation = 1f - ratio;
- float r = (Color.red(color1) * ratio) + (Color.red(color2) * inverseRation);
- float g = (Color.green(color1) * ratio) + (Color.green(color2) * inverseRation);
- float b = (Color.blue(color1) * ratio) + (Color.blue(color2) * inverseRation);
- return Color.rgb((int) r, (int) g, (int) b);
- }
-
- private static class SimpleTabColorizer implements SlidingTabLayout.TabColorizer {
- private int[] mIndicatorColors;
- private int[] mDividerColors;
-
- @Override
- public final int getIndicatorColor(int position) {
- return mIndicatorColors[position % mIndicatorColors.length];
- }
-
- @Override
- public final int getDividerColor(int position) {
- return mDividerColors[position % mDividerColors.length];
- }
-
- void setIndicatorColors(int... colors) {
- mIndicatorColors = colors;
- }
-
- void setDividerColors(int... colors) {
- mDividerColors = colors;
- }
- }
-}
\ No newline at end of file
diff --git a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/DetailFragment.java b/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/DetailFragment.java
deleted file mode 100644
index 81e7b46d3..000000000
--- a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/DetailFragment.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.fragmenttransition;
-
-import com.example.android.common.logger.Log;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.transition.Scene;
-import android.transition.TransitionManager;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-public class DetailFragment extends Fragment implements Animation.AnimationListener {
-
- private static final String TAG = "DetailFragment";
-
- private static final String ARG_RESOURCE_ID = "resource_id";
- private static final String ARG_TITLE = "title";
- private static final String ARG_X = "x";
- private static final String ARG_Y = "y";
- private static final String ARG_WIDTH = "width";
- private static final String ARG_HEIGHT = "height";
-
- /**
- * Create a new instance of DetailFragment.
- *
- * @param resourceId The resource ID of the Drawable image to show
- * @param title The title of the image
- * @param x The horizontal position of the grid item in pixel
- * @param y The vertical position of the grid item in pixel
- * @param width The width of the grid item in pixel
- * @param height The height of the grid item in pixel
- * @return a new instance of DetailFragment
- */
- public static DetailFragment newInstance(int resourceId, String title,
- int x, int y, int width, int height) {
- DetailFragment fragment = new DetailFragment();
- Bundle args = new Bundle();
- args.putInt(ARG_RESOURCE_ID, resourceId);
- args.putString(ARG_TITLE, title);
- args.putInt(ARG_X, x);
- args.putInt(ARG_Y, y);
- args.putInt(ARG_WIDTH, width);
- args.putInt(ARG_HEIGHT, height);
- fragment.setArguments(args);
- return fragment;
- }
-
- public DetailFragment() {
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- return inflater.inflate(R.layout.fragment_detail, container, false);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- FrameLayout root = (FrameLayout) view;
- Context context = view.getContext();
- assert context != null;
- // This is how the fragment looks at first. Since the transition is one-way, we don't need to make
- // this a Scene.
- View item = LayoutInflater.from(context).inflate(R.layout.item_meat_grid, root, false);
- assert item != null;
- bind(item);
- // We adjust the position of the initial image with LayoutParams using the values supplied
- // as the fragment arguments.
- Bundle args = getArguments();
- FrameLayout.LayoutParams params = null;
- if (args != null) {
- params = new FrameLayout.LayoutParams(
- args.getInt(ARG_WIDTH), args.getInt(ARG_HEIGHT));
- params.topMargin = args.getInt(ARG_Y);
- params.leftMargin = args.getInt(ARG_X);
- }
- root.addView(item, params);
- }
-
- @Override
- public void onResume() {
- super.onResume();
- }
-
- /**
- * Bind the views inside of parent with the fragment arguments.
- *
- * @param parent The parent of views to bind.
- */
- private void bind(View parent) {
- Bundle args = getArguments();
- if (args == null) {
- return;
- }
- ImageView image = (ImageView) parent.findViewById(R.id.image);
- image.setImageResource(args.getInt(ARG_RESOURCE_ID));
- TextView title = (TextView) parent.findViewById(R.id.title);
- title.setText(args.getString(ARG_TITLE));
- }
-
- @Override
- public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
- Animation animation = AnimationUtils.loadAnimation(getActivity(),
- enter ? android.R.anim.fade_in : android.R.anim.fade_out);
- // We bind a listener for the fragment transaction. We only bind it when
- // this fragment is entering.
- if (animation != null && enter) {
- animation.setAnimationListener(this);
- }
- return animation;
- }
-
- @Override
- public void onAnimationStart(Animation animation) {
- // This method is called at the end of the animation for the fragment transaction.
- // There is nothing we need to do in this sample.
- }
-
- @Override
- public void onAnimationEnd(Animation animation) {
- // This method is called at the end of the animation for the fragment transaction,
- // which is perfect time to start our Transition.
- Log.i(TAG, "Fragment animation ended. Starting a Transition.");
- final Scene scene = Scene.getSceneForLayout((ViewGroup) getView(),
- R.layout.fragment_detail_content, getActivity());
- TransitionManager.go(scene);
- // Note that we need to bind views with data after we call TransitionManager.go().
- bind(scene.getSceneRoot());
- }
-
- @Override
- public void onAnimationRepeat(Animation animation) {
- // This method is never called in this sample because the animation doesn't repeat.
- }
-
-}
diff --git a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/FragmentTransitionFragment.java b/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/FragmentTransitionFragment.java
deleted file mode 100644
index c072eb997..000000000
--- a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/FragmentTransitionFragment.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.fragmenttransition;
-
-import com.example.android.common.logger.Log;
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.animation.Animation;
-import android.view.animation.AnimationUtils;
-import android.widget.AdapterView;
-import android.widget.GridView;
-
-public class FragmentTransitionFragment extends Fragment implements AdapterView.OnItemClickListener {
-
- private static final String TAG = "FragmentTransitionFragment";
-
- private MeatAdapter mAdapter;
-
- public static FragmentTransitionFragment newInstance() {
- return new FragmentTransitionFragment();
- }
-
- public FragmentTransitionFragment() {
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- // This is the adapter we use to populate the grid.
- mAdapter = new MeatAdapter(inflater, R.layout.item_meat_grid);
- // Inflate the layout with a GridView in it.
- return inflater.inflate(R.layout.fragment_fragment_transition, container, false);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- GridView grid = (GridView) view.findViewById(R.id.grid);
- grid.setAdapter(mAdapter);
- grid.setOnItemClickListener(this);
- }
-
- @Override
- public void onItemClick(AdapterView> parent, View view, int position, long id) {
- Meat meat = mAdapter.getItem(position);
- Log.i(TAG, meat.title + " clicked. Replacing fragment.");
- // We start the fragment transaction here. It is just an ordinary fragment transaction.
- getActivity().getSupportFragmentManager()
- .beginTransaction()
- .replace(R.id.sample_content_fragment,
- DetailFragment.newInstance(meat.resourceId, meat.title,
- (int) view.getX(), (int) view.getY(),
- view.getWidth(), view.getHeight())
- )
- // We push the fragment transaction to back stack. User can go back to the
- // previous fragment by pressing back button.
- .addToBackStack("detail")
- .commit();
- }
-
- @Override
- public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
- return AnimationUtils.loadAnimation(getActivity(),
- enter ? android.R.anim.fade_in : android.R.anim.fade_out);
- }
-
-}
diff --git a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/Meat.java b/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/Meat.java
deleted file mode 100644
index 2f2fdfa44..000000000
--- a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/Meat.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.fragmenttransition;
-
-/**
- * This represents a sample data.
- */
-public class Meat {
-
- public int resourceId;
- public String title;
-
- public Meat(int resourceId, String title) {
- this.resourceId = resourceId;
- this.title = title;
- }
-
- public static final Meat[] MEATS = {
- new Meat(R.drawable.p1, "First"),
- new Meat(R.drawable.p2, "Second"),
- new Meat(R.drawable.p3, "Third"),
- new Meat(R.drawable.p4, "Fourth"),
- new Meat(R.drawable.p5, "Fifth"),
- new Meat(R.drawable.p6, "Sixth"),
- new Meat(R.drawable.p7, "Seventh"),
- new Meat(R.drawable.p8, "Eighth"),
- new Meat(R.drawable.p9, "Ninth"),
- new Meat(R.drawable.p10, "Tenth"),
- new Meat(R.drawable.p11, "Eleventh"),
- };
-
-}
diff --git a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/MeatAdapter.java b/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/MeatAdapter.java
deleted file mode 100644
index 307fd85fa..000000000
--- a/samples/browseable/FragmentTransition/src/com.example.android.fragmenttransition/MeatAdapter.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.fragmenttransition;
-
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-class MeatAdapter extends BaseAdapter {
-
- private final LayoutInflater mLayoutInflater;
- private final int mResourceId;
-
- public MeatAdapter(LayoutInflater inflater, int resourceId) {
- mLayoutInflater = inflater;
- mResourceId = resourceId;
- }
-
- @Override
- public int getCount() {
- return Meat.MEATS.length;
- }
-
- @Override
- public Meat getItem(int position) {
- return Meat.MEATS[position];
- }
-
- @Override
- public long getItemId(int position) {
- return Meat.MEATS[position].resourceId;
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- final View view;
- final ViewHolder holder;
- if (null == convertView) {
- view = mLayoutInflater.inflate(mResourceId, parent, false);
- holder = new ViewHolder();
- assert view != null;
- holder.image = (ImageView) view.findViewById(R.id.image);
- holder.title = (TextView) view.findViewById(R.id.title);
- view.setTag(holder);
- } else {
- view = convertView;
- holder = (ViewHolder) view.getTag();
- }
- bindView(holder, position);
- return view;
- }
-
- public void bindView(ViewHolder holder, int position) {
- Meat meat = getItem(position);
- holder.image.setImageResource(meat.resourceId);
- holder.title.setText(meat.title);
- }
-
- public static class ViewHolder {
- public ImageView image;
- public TextView title;
- }
-
-}
diff --git a/samples/browseable/Geofencing/Application/res/layout/activity_main.xml b/samples/browseable/Geofencing/Application/res/layout/activity_main.xml
deleted file mode 100755
index be1aa49d9..000000000
--- a/samples/browseable/Geofencing/Application/res/layout/activity_main.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
+ +This sample demonstrates how to provision other devices with a specified device owner using NFC. +Install the DeviceOwner sample to an unprovisioned device. Fill in the values below, and bump the +two devices, and tap this side to initiate the provisioning process. + +
diff --git a/samples/browseable/NfcProvisioning/res/drawable-hdpi/ic_launcher.png b/samples/browseable/NfcProvisioning/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..638a88dad Binary files /dev/null and b/samples/browseable/NfcProvisioning/res/drawable-hdpi/ic_launcher.png differ diff --git a/samples/browseable/GridViewPager/Application/res/drawable-hdpi/tile.9.png b/samples/browseable/NfcProvisioning/res/drawable-hdpi/tile.9.png similarity index 100% rename from samples/browseable/GridViewPager/Application/res/drawable-hdpi/tile.9.png rename to samples/browseable/NfcProvisioning/res/drawable-hdpi/tile.9.png diff --git a/samples/browseable/NfcProvisioning/res/drawable-mdpi/ic_launcher.png b/samples/browseable/NfcProvisioning/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..cd128c9c8 Binary files /dev/null and b/samples/browseable/NfcProvisioning/res/drawable-mdpi/ic_launcher.png differ diff --git a/samples/browseable/NfcProvisioning/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/NfcProvisioning/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..824541a59 Binary files /dev/null and b/samples/browseable/NfcProvisioning/res/drawable-xhdpi/ic_launcher.png differ diff --git a/samples/browseable/NfcProvisioning/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/NfcProvisioning/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..5fe9f2eda Binary files /dev/null and b/samples/browseable/NfcProvisioning/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/samples/browseable/AdapterTransition/res/layout-w720dp/activity_main.xml b/samples/browseable/NfcProvisioning/res/layout-w720dp/activity_main.xml similarity index 100% rename from samples/browseable/AdapterTransition/res/layout-w720dp/activity_main.xml rename to samples/browseable/NfcProvisioning/res/layout-w720dp/activity_main.xml diff --git a/samples/browseable/AdapterTransition/res/layout/activity_main.xml b/samples/browseable/NfcProvisioning/res/layout/activity_main.xml similarity index 100% rename from samples/browseable/AdapterTransition/res/layout/activity_main.xml rename to samples/browseable/NfcProvisioning/res/layout/activity_main.xml diff --git a/samples/browseable/NfcProvisioning/res/layout/fragment_nfc_provisioning.xml b/samples/browseable/NfcProvisioning/res/layout/fragment_nfc_provisioning.xml new file mode 100644 index 000000000..ee79e7a38 --- /dev/null +++ b/samples/browseable/NfcProvisioning/res/layout/fragment_nfc_provisioning.xml @@ -0,0 +1,77 @@ + + ++ * This fragment creates an intent, which sends parameters to a second device via an Nfc bump. If + * the second device is factory reset, this will start provisioning the second device to set it up + * as an owned device. + *
+ */ +public class NfcProvisioningFragment extends Fragment implements + NfcAdapter.CreateNdefMessageCallback, + TextWatcherWrapper.OnTextChangedListener, + LoaderManager.LoaderCallbacks