diff --git a/build/Android.mk b/build/Android.mk index 5d36d14df..9a27edc9f 100644 --- a/build/Android.mk +++ b/build/Android.mk @@ -113,7 +113,8 @@ ANDROID_SUPPORT_LIBRARIES := \ android-support-v17-leanback \ android-support-multidex \ android-support-multidex-instrumentation \ - android-support-design + android-support-design \ + android-support-percent $(foreach lib, $(ANDROID_SUPPORT_LIBRARIES), $(eval $(call _package_sdk_library,$(lib)))) diff --git a/build/sdk.atree b/build/sdk.atree index 41094a870..c7cb28a89 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -498,6 +498,11 @@ frameworks/support/design/res frameworks/support/design/src/.readme extras/android/support/design/src/.readme ${OUT_DIR}/target/common/obj/PACKAGING/android-support-design_intermediates/android-support-design.jar extras/android/support/design/libs/android-support-design.jar +frameworks/support/percent/AndroidManifest.xml extras/android/support/percent/AndroidManifest.xml +frameworks/support/percent/res extras/android/support/percent/res +frameworks/support/percent/src/.readme extras/android/support/percent/src/.readme +${OUT_DIR}/target/common/obj/PACKAGING/android-support-percent_intermediates/android-support-percent.jar extras/android/support/percent/libs/android-support-percent.jar + ############################################################################## # Tests Component ############################################################################## diff --git a/samples/SupportPercentDemos/Android.mk b/samples/SupportPercentDemos/Android.mk new file mode 100644 index 000000000..6395a84b2 --- /dev/null +++ b/samples/SupportPercentDemos/Android.mk @@ -0,0 +1,35 @@ +# Copyright (C) 2015 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. + +LOCAL_PATH:= $(call my-dir) + +# Build the samples. +# We need to add some special AAPT flags to generate R classes +# for resources that are included from the libraries. +include $(CLEAR_VARS) +LOCAL_PACKAGE_NAME := SupportPercentDemos +LOCAL_MODULE_TAGS := samples +LOCAL_SDK_VERSION := current +LOCAL_SRC_FILES := $(call all-java-files-under, src) +LOCAL_STATIC_JAVA_LIBRARIES := \ + android-support-percent \ + android-support-v4 \ + android-support-v13 +LOCAL_RESOURCE_DIR = \ + $(LOCAL_PATH)/res \ + frameworks/support/percent/res +LOCAL_AAPT_FLAGS := \ + --auto-add-overlay \ + --extra-packages android.support.percent +include $(BUILD_PACKAGE) diff --git a/samples/SupportPercentDemos/AndroidManifest.xml b/samples/SupportPercentDemos/AndroidManifest.xml new file mode 100644 index 000000000..4a7b22b80 --- /dev/null +++ b/samples/SupportPercentDemos/AndroidManifest.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/samples/SupportPercentDemos/res/drawable-hdpi/app_sample_code.png b/samples/SupportPercentDemos/res/drawable-hdpi/app_sample_code.png new file mode 100755 index 000000000..66a198496 Binary files /dev/null and b/samples/SupportPercentDemos/res/drawable-hdpi/app_sample_code.png differ diff --git a/samples/SupportPercentDemos/res/drawable-mdpi/app_sample_code.png b/samples/SupportPercentDemos/res/drawable-mdpi/app_sample_code.png new file mode 100644 index 000000000..5ae7701a8 Binary files /dev/null and b/samples/SupportPercentDemos/res/drawable-mdpi/app_sample_code.png differ diff --git a/samples/SupportPercentDemos/res/layout/demo_1.xml b/samples/SupportPercentDemos/res/layout/demo_1.xml new file mode 100644 index 000000000..0502e0dc0 --- /dev/null +++ b/samples/SupportPercentDemos/res/layout/demo_1.xml @@ -0,0 +1,38 @@ + + + + + + diff --git a/samples/SupportPercentDemos/res/layout/demo_2.xml b/samples/SupportPercentDemos/res/layout/demo_2.xml new file mode 100644 index 000000000..9fae5ffdf --- /dev/null +++ b/samples/SupportPercentDemos/res/layout/demo_2.xml @@ -0,0 +1,38 @@ + + + + + + diff --git a/samples/SupportPercentDemos/res/layout/support_percent_demos.xml b/samples/SupportPercentDemos/res/layout/support_percent_demos.xml new file mode 100644 index 000000000..80e1bf31b --- /dev/null +++ b/samples/SupportPercentDemos/res/layout/support_percent_demos.xml @@ -0,0 +1,21 @@ + + + diff --git a/samples/SupportPercentDemos/res/values/strings.xml b/samples/SupportPercentDemos/res/values/strings.xml new file mode 100644 index 000000000..cd864c85c --- /dev/null +++ b/samples/SupportPercentDemos/res/values/strings.xml @@ -0,0 +1,19 @@ + + + + + Support Percent Demos + diff --git a/samples/SupportPercentDemos/src/com/example/android/support/percent/SupportPercentDemos.java b/samples/SupportPercentDemos/src/com/example/android/support/percent/SupportPercentDemos.java new file mode 100644 index 000000000..0290eb384 --- /dev/null +++ b/samples/SupportPercentDemos/src/com/example/android/support/percent/SupportPercentDemos.java @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2015 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.support.percent; + +import android.app.Activity; +import android.app.Fragment; +import android.os.Bundle; +import android.app.FragmentManager; +import android.support.v13.app.FragmentStatePagerAdapter; +import android.support.v4.view.ViewPager; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; + +public class SupportPercentDemos extends Activity { + private static final String LAYOUT_RESOURCE_ID = "layout_resource_id"; + + private ViewPager mPager; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.support_percent_demos); + mPager = (ViewPager) findViewById(R.id.pager); + mPager.setAdapter(new Adapter(getFragmentManager())); + } + + public static class Adapter extends FragmentStatePagerAdapter { + public Adapter(FragmentManager fm) { + super(fm); + } + + @Override + public Fragment getItem(int position) { + PercentFragment fragment = new PercentFragment(); + Bundle args = new Bundle(); + switch (position) { + case 0: + args.putInt(LAYOUT_RESOURCE_ID, R.layout.demo_1); + break; + case 1: + args.putInt(LAYOUT_RESOURCE_ID, R.layout.demo_2); + default: + break; + } + fragment.setArguments(args); + return fragment; + } + + @Override + public int getCount() { + return 2; + } + } + + public static class PercentFragment extends Fragment { + public PercentFragment() { + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + Bundle args = getArguments(); + int layout = args.getInt(LAYOUT_RESOURCE_ID); + return inflater.inflate(layout, container, false); + } + } +}