diff --git a/samples/browseable/ActivitySceneTransitionBasic/AndroidManifest.xml b/samples/browseable/ActivitySceneTransitionBasic/AndroidManifest.xml new file mode 100644 index 000000000..ae64d6f4c --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/AndroidManifest.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/browseable/ActivitySceneTransitionBasic/_index.jd b/samples/browseable/ActivitySceneTransitionBasic/_index.jd new file mode 100644 index 000000000..1053a7d5b --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/_index.jd @@ -0,0 +1,12 @@ +page.tags="ActivitySceneTransitionBasic" +sample.group=UI +@jd:body + +

+ + Demonstrates how to the use Activity scene transitions when transitions + from one Activity to another. Uses a combination of moveImage and changeBounds + to nicely transition a grid of images to an Activity with a large image and detail + text. + +

diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/drawable-hdpi/ic_launcher.png b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..a598447aa Binary files /dev/null and b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-hdpi/ic_launcher.png differ diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/drawable-hdpi/tile.9.png b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-hdpi/tile.9.png new file mode 100644 index 000000000..135862883 Binary files /dev/null and b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-hdpi/tile.9.png differ diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/drawable-mdpi/ic_launcher.png b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..8aaa6c942 Binary files /dev/null and b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-mdpi/ic_launcher.png differ diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..3667baaa5 Binary files /dev/null and b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-xhdpi/ic_launcher.png differ diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..e3c4a3291 Binary files /dev/null and b/samples/browseable/ActivitySceneTransitionBasic/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/layout/activity_main.xml b/samples/browseable/ActivitySceneTransitionBasic/res/layout/activity_main.xml new file mode 100755 index 000000000..be1aa49d9 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/res/layout/activity_main.xml @@ -0,0 +1,36 @@ + + + + + + + + + diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/layout/details.xml b/samples/browseable/ActivitySceneTransitionBasic/res/layout/details.xml new file mode 100644 index 000000000..e61212ed2 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/res/layout/details.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid.xml b/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid.xml new file mode 100644 index 000000000..4dded953f --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid.xml @@ -0,0 +1,27 @@ + + + + diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid_item.xml b/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid_item.xml new file mode 100644 index 000000000..1d28dbada --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/res/layout/grid_item.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/transition/grid_detail_transition.xml b/samples/browseable/ActivitySceneTransitionBasic/res/transition/grid_detail_transition.xml new file mode 100644 index 000000000..40be3d468 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/res/transition/grid_detail_transition.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values-sw600dp/template-dimens.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values-sw600dp/template-dimens.xml new file mode 100644 index 000000000..22074a2bd --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/res/values-sw600dp/template-dimens.xml @@ -0,0 +1,24 @@ + + + + + + + @dimen/margin_huge + @dimen/margin_medium + + diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values-sw600dp/template-styles.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values-sw600dp/template-styles.xml new file mode 100644 index 000000000..03d197418 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/res/values-sw600dp/template-styles.xml @@ -0,0 +1,25 @@ + + + + + + + diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values-v11/template-styles.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values-v11/template-styles.xml new file mode 100644 index 000000000..8c1ea66f2 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/res/values-v11/template-styles.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/template-styles.xml b/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/template-styles.xml new file mode 100644 index 000000000..134fcd9d3 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/res/values-v21/template-styles.xml @@ -0,0 +1,22 @@ + + + + + + + + + + diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/DetailActivity.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/DetailActivity.java new file mode 100644 index 000000000..741cd26ea --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/DetailActivity.java @@ -0,0 +1,95 @@ +/* + * Copyright (C) 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.activityscenetransitionbasic; + +import com.android.volley.toolbox.ImageLoader; +import com.android.volley.toolbox.NetworkImageView; +import com.android.volley.toolbox.Volley; + +import android.app.Activity; +import android.graphics.Bitmap; +import android.os.Bundle; +import android.widget.TextView; + +/** + * Our secondary Activity which is launched from {@link MainActivity}. Has a simple detail UI + * which has a large banner image, title and body text. + */ +public class DetailActivity extends Activity { + + // Extra name for the ID parameter + public static final String EXTRA_PARAM_ID = "detail:_id"; + + // View name of the header image. Used for activity scene transitions + public static final String VIEW_NAME_HEADER_IMAGE = "detail:header:image"; + + // View name of the header title. Used for activity scene transitions + public static final String VIEW_NAME_HEADER_TITLE = "detail:header:title"; + + private NetworkImageView mHeaderImageView; + private TextView mHeaderTitle; + + private ImageLoader mImageLoader; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.details); + + // Construct an ImageLoader instance so that we can load images from the network + mImageLoader = new ImageLoader(Volley.newRequestQueue(this), ImageMemoryCache.INSTANCE); + + // Retrieve the correct Item instance, using the ID provided in the Intent + Item item = Item.getItem(getIntent().getIntExtra(EXTRA_PARAM_ID, 0)); + + mHeaderImageView = (NetworkImageView) findViewById(R.id.imageview_header); + mHeaderTitle = (TextView) findViewById(R.id.textview_title); + + // BEGIN_INCLUDE(detail_set_view_name) + /** + * Set the name of the view's which will be transition to, using the static values above. + * This could be done in the layout XML, but exposing it via static variables allows easy + * querying from other Activities + */ + mHeaderImageView.setViewName(VIEW_NAME_HEADER_IMAGE); + mHeaderTitle.setViewName(VIEW_NAME_HEADER_TITLE); + // END_INCLUDE(detail_set_view_name) + + loadItem(item); + } + + private void loadItem(Item item) { + // Set the title TextView to the item's name and author + mHeaderTitle.setText(getString(R.string.image_header, item.getName(), item.getAuthor())); + + final ImageMemoryCache cache = ImageMemoryCache.INSTANCE; + Bitmap thumbnailImage = cache.getBitmapFromUrl(item.getThumbnailUrl()); + + // Check to see if we already have the thumbnail sized image in the cache. If so, start + // loading the full size image and display the thumbnail as a placeholder. + if (thumbnailImage != null) { + mHeaderImageView.setImageUrl(item.getPhotoUrl(), mImageLoader); + mHeaderImageView.setImageBitmap(thumbnailImage); + return; + } + + // If we get here then we do not have either the full size or the thumbnail in the cache. + // Here we just load the full size and make do. + mHeaderImageView.setImageUrl(item.getPhotoUrl(), mImageLoader); + } + +} diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/ImageMemoryCache.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/ImageMemoryCache.java new file mode 100644 index 000000000..53d47bae1 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/ImageMemoryCache.java @@ -0,0 +1,96 @@ +/* + * Copyright (C) 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.activityscenetransitionbasic; + +import com.android.volley.toolbox.ImageLoader; + +import android.graphics.Bitmap; +import android.util.LruCache; + +import java.util.Map; + +/** + * An image memory cache implementation for Volley which allows the retrieval of entires via a URL. + * Volley internally inserts items with a key which is a combination of a the size of the image, + * and the url. + * + * This class provide the method {@link #getBitmapFromUrl(String)} which allows the retrieval of + * a bitmap solely on the URL. + */ +public class ImageMemoryCache extends LruCache implements ImageLoader.ImageCache { + + /** + * Singleton instance which has it's maximum size set to be 1/8th of the allowed memory size. + */ + public static final ImageMemoryCache INSTANCE = new ImageMemoryCache( + (int) (Runtime.getRuntime().maxMemory() / 8)); + + // Cache the last created snapshot + private Map mLastSnapshot; + + private ImageMemoryCache(int maxSize) { + super(maxSize); + } + + public Bitmap getBitmapFromUrl(String url) { + // If we do not have a snapshot to use, generate one + if (mLastSnapshot == null) { + mLastSnapshot = snapshot(); + } + + // Iterate through the snapshot to find any entries which match our url + for (Map.Entry entry : mLastSnapshot.entrySet()) { + if (url.equals(extractUrl(entry.getKey()))) { + // We've found an entry with the same url, return the bitmap + return entry.getValue(); + } + } + + // We didn't find an entry, so return null + return null; + } + + @Override + public Bitmap getBitmap(String key) { + return get(key); + } + + @Override + public void putBitmap(String key, Bitmap bitmap) { + put(key, bitmap); + + // An entry has been added, so invalidate the snapshot + mLastSnapshot = null; + } + + @Override + protected void entryRemoved(boolean evicted, String key, Bitmap oldValue, Bitmap newValue) { + super.entryRemoved(evicted, key, oldValue, newValue); + + // An entry has been removed, so invalidate the snapshot + mLastSnapshot = null; + } + + private static String extractUrl(String key) { + return key.substring(key.indexOf("http")); + } + + @Override + protected int sizeOf(String key, Bitmap value) { + return value.getAllocationByteCount(); + } +} diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/Item.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/Item.java new file mode 100644 index 000000000..e21188674 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/Item.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 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.activityscenetransitionbasic; + +/** + * Represents an Item in our application. Each item has a name, id, full size image url and + * thumbnail url. + */ +public class Item { + + private static final String LARGE_BASE_URL = "http://storage.googleapis.com/androiddevelopers/sample_data/activity_transition/large/"; + private static final String THUMB_BASE_URL = "http://storage.googleapis.com/androiddevelopers/sample_data/activity_transition/thumbs/"; + + public static Item[] ITEMS = new Item[] { + new Item("Flying in the Light", "Romain Guy", "flying_in_the_light.jpg"), + new Item("Caterpillar", "Romain Guy", "caterpillar.jpg"), + new Item("Look Me in the Eye", "Romain Guy", "look_me_in_the_eye.jpg"), + new Item("Flamingo", "Romain Guy", "flamingo.jpg"), + new Item("Rainbow", "Romain Guy", "rainbow.jpg"), + new Item("Over there", "Romain Guy", "over_there.jpg"), + new Item("Jelly Fish 2", "Romain Guy", "jelly_fish_2.jpg"), + new Item("Lone Pine Sunset", "Romain Guy", "lone_pine_sunset.jpg"), + }; + + public static Item getItem(int id) { + for (Item item : ITEMS) { + if (item.getId() == id) { + return item; + } + } + return null; + } + + private final String mName; + private final String mAuthor; + private final String mFileName; + + Item (String name, String author, String fileName) { + mName = name; + mAuthor = author; + mFileName = fileName; + } + + public int getId() { + return mName.hashCode() + mFileName.hashCode(); + } + + public String getAuthor() { + return mAuthor; + } + + public String getName() { + return mName; + } + + public String getPhotoUrl() { + return LARGE_BASE_URL + mFileName; + } + + public String getThumbnailUrl() { + return THUMB_BASE_URL + mFileName; + } + +} diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/MainActivity.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/MainActivity.java new file mode 100644 index 000000000..363099038 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/MainActivity.java @@ -0,0 +1,145 @@ +/* + * Copyright (C) 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.activityscenetransitionbasic; + +import com.android.volley.toolbox.ImageLoader; +import com.android.volley.toolbox.NetworkImageView; +import com.android.volley.toolbox.Volley; + +import android.app.Activity; +import android.app.ActivityOptions; +import android.content.Intent; +import android.os.Bundle; +import android.util.Pair; +import android.view.View; +import android.view.ViewGroup; +import android.widget.AdapterView; +import android.widget.BaseAdapter; +import android.widget.GridView; +import android.widget.TextView; + +/** + * Our main Activity in this sample. Displays a grid of items which an image and title. When the + * user clicks on an item, {@link DetailActivity} is launched, using the Activity Scene Transitions + * framework to animatedly do so. + */ +public class MainActivity extends Activity implements AdapterView.OnItemClickListener { + + private GridView mGridView; + private GridAdapter mAdapter; + + private ImageLoader mImageLoader; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.grid); + + // Retrieve the ImageLoader we are going to use for NetworkImageView + mImageLoader = new ImageLoader(Volley.newRequestQueue(this), ImageMemoryCache.INSTANCE); + + // Setup the GridView and set the adapter + mGridView = (GridView) findViewById(R.id.grid); + mGridView.setOnItemClickListener(this); + mAdapter = new GridAdapter(); + mGridView.setAdapter(mAdapter); + } + + /** + * Called when an item in the {@link android.widget.GridView} is clicked. Here will launch the + * {@link DetailActivity}, using the Scene Transition animation functionality. + */ + @Override + public void onItemClick(AdapterView adapterView, View view, int position, long id) { + Item item = (Item) adapterView.getItemAtPosition(position); + + // Construct an Intent as normal + Intent intent = new Intent(this, DetailActivity.class); + intent.putExtra(DetailActivity.EXTRA_PARAM_ID, item.getId()); + + // BEGIN_INCLUDE(start_activity) + /** + * Now create an {@link android.app.ActivityOptions} instance using the + * {@link android.app.ActivityOptions#makeSceneTransitionAnimation(android.app.Activity, android.util.Pair[])} factory method. + */ + ActivityOptions activityOptions = ActivityOptions.makeSceneTransitionAnimation( + this, + + // Now we provide a list of Pair items which contain the view we can transitioning + // from, and the name of the view it is transitioning to, in the launched activity + new Pair( + view.findViewById(R.id.imageview_item), + DetailActivity.VIEW_NAME_HEADER_IMAGE), + new Pair( + view.findViewById(R.id.textview_name), + DetailActivity.VIEW_NAME_HEADER_TITLE) + ); + + // Now we can start the Activity, providing the activity options as a bundle + startActivity(intent, activityOptions.toBundle()); + // END_INCLUDE(start_activity) + } + + /** + * {@link android.widget.BaseAdapter} which displays items. + */ + private class GridAdapter extends BaseAdapter { + + @Override + public int getCount() { + return Item.ITEMS.length; + } + + @Override + public Item getItem(int position) { + return Item.ITEMS[position]; + } + + @Override + public long getItemId(int position) { + return getItem(position).getId(); + } + + @Override + public View getView(int position, View view, ViewGroup viewGroup) { + if (view == null) { + view = getLayoutInflater().inflate(R.layout.grid_item, viewGroup, false); + } + + final Item item = getItem(position); + + // Load the thumbnail image + NetworkImageView image = (NetworkImageView) view.findViewById(R.id.imageview_item); + image.setImageUrl(item.getThumbnailUrl(), mImageLoader); + + // Set the TextView's contents + TextView name = (TextView) view.findViewById(R.id.textview_name); + name.setText(item.getName()); + + // BEGIN_INCLUDE(grid_set_view_name) + /** + * As we're in an adapter we need to set each view's name dynamically, using the + * item's ID so that the names are unique. + */ + image.setViewName("grid:image:" + item.getId()); + name.setViewName("grid:name:" + item.getId()); + // END_INCLUDE(grid_set_view_name) + + return view; + } + } +} diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/SquareFrameLayout.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/SquareFrameLayout.java new file mode 100644 index 000000000..eece73eb8 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.activityscenetransitionbasic/SquareFrameLayout.java @@ -0,0 +1,74 @@ +/* + * Copyright (C) 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.activityscenetransitionbasic; + +import android.content.Context; +import android.util.AttributeSet; +import android.widget.FrameLayout; + +/** + * {@link android.widget.FrameLayout} which forces itself to be laid out as square. + */ +public class SquareFrameLayout extends FrameLayout { + + public SquareFrameLayout(Context context) { + super(context); + } + + public SquareFrameLayout(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public SquareFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public SquareFrameLayout(Context context, AttributeSet attrs, + int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + final int widthSize = MeasureSpec.getSize(widthMeasureSpec); + final int heightSize = MeasureSpec.getSize(heightMeasureSpec); + + if (widthSize == 0 && heightSize == 0) { + // If there are no constraints on size, let FrameLayout measure + super.onMeasure(widthMeasureSpec, heightMeasureSpec); + + // Now use the smallest of the measured dimensions for both dimensions + final int minSize = Math.min(getMeasuredWidth(), getMeasuredHeight()); + setMeasuredDimension(minSize, minSize); + return; + } + + final int size; + if (widthSize == 0 || heightSize == 0) { + // If one of the dimensions has no restriction on size, set both dimensions to be the + // on that does + size = Math.max(widthSize, heightSize); + } else { + // Both dimensions have restrictions on size, set both dimensions to be the + // smallest of the two + size = Math.min(widthSize, heightSize); + } + + final int newMeasureSpec = MeasureSpec.makeMeasureSpec(size, MeasureSpec.EXACTLY); + super.onMeasure(newMeasureSpec, newMeasureSpec); + } +} diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/Log.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/Log.java new file mode 100644 index 000000000..17503c568 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/Log.java @@ -0,0 +1,236 @@ +/* + * 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.logger; + +/** + * Helper class for a list (or tree) of LoggerNodes. + * + *

When this is set as the head of the list, + * an instance of it can function as a drop-in replacement for {@link android.util.Log}. + * Most of the methods in this class server only to map a method call in Log to its equivalent + * in LogNode.

+ */ +public class Log { + // Grabbing the native values from Android's native logging facilities, + // to make for easy migration and interop. + public static final int NONE = -1; + public static final int VERBOSE = android.util.Log.VERBOSE; + public static final int DEBUG = android.util.Log.DEBUG; + public static final int INFO = android.util.Log.INFO; + public static final int WARN = android.util.Log.WARN; + public static final int ERROR = android.util.Log.ERROR; + public static final int ASSERT = android.util.Log.ASSERT; + + // Stores the beginning of the LogNode topology. + private static LogNode mLogNode; + + /** + * Returns the next LogNode in the linked list. + */ + public static LogNode getLogNode() { + return mLogNode; + } + + /** + * Sets the LogNode data will be sent to. + */ + public static void setLogNode(LogNode node) { + mLogNode = node; + } + + /** + * Instructs the LogNode to print the log data provided. Other LogNodes can + * be chained to the end of the LogNode as desired. + * + * @param priority Log level of the data being logged. Verbose, Error, etc. + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public static void println(int priority, String tag, String msg, Throwable tr) { + if (mLogNode != null) { + mLogNode.println(priority, tag, msg, tr); + } + } + + /** + * Instructs the LogNode to print the log data provided. Other LogNodes can + * be chained to the end of the LogNode as desired. + * + * @param priority Log level of the data being logged. Verbose, Error, etc. + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. The actual message to be logged. + */ + public static void println(int priority, String tag, String msg) { + println(priority, tag, msg, null); + } + + /** + * Prints a message at VERBOSE priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public static void v(String tag, String msg, Throwable tr) { + println(VERBOSE, tag, msg, tr); + } + + /** + * Prints a message at VERBOSE priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + */ + public static void v(String tag, String msg) { + v(tag, msg, null); + } + + + /** + * Prints a message at DEBUG priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public static void d(String tag, String msg, Throwable tr) { + println(DEBUG, tag, msg, tr); + } + + /** + * Prints a message at DEBUG priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + */ + public static void d(String tag, String msg) { + d(tag, msg, null); + } + + /** + * Prints a message at INFO priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public static void i(String tag, String msg, Throwable tr) { + println(INFO, tag, msg, tr); + } + + /** + * Prints a message at INFO priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + */ + public static void i(String tag, String msg) { + i(tag, msg, null); + } + + /** + * Prints a message at WARN priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public static void w(String tag, String msg, Throwable tr) { + println(WARN, tag, msg, tr); + } + + /** + * Prints a message at WARN priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + */ + public static void w(String tag, String msg) { + w(tag, msg, null); + } + + /** + * Prints a message at WARN priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public static void w(String tag, Throwable tr) { + w(tag, null, tr); + } + + /** + * Prints a message at ERROR priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public static void e(String tag, String msg, Throwable tr) { + println(ERROR, tag, msg, tr); + } + + /** + * Prints a message at ERROR priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + */ + public static void e(String tag, String msg) { + e(tag, msg, null); + } + + /** + * Prints a message at ASSERT priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public static void wtf(String tag, String msg, Throwable tr) { + println(ASSERT, tag, msg, tr); + } + + /** + * Prints a message at ASSERT priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. + */ + public static void wtf(String tag, String msg) { + wtf(tag, msg, null); + } + + /** + * Prints a message at ASSERT priority. + * + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public static void wtf(String tag, Throwable tr) { + wtf(tag, null, tr); + } +} diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogFragment.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogFragment.java new file mode 100644 index 000000000..b302acd4b --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogFragment.java @@ -0,0 +1,109 @@ +/* +* 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. +*/ +/* + * 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.common.logger; + +import android.graphics.Typeface; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.text.Editable; +import android.text.TextWatcher; +import android.view.Gravity; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ScrollView; + +/** + * Simple fraggment which contains a LogView and uses is to output log data it receives + * through the LogNode interface. + */ +public class LogFragment extends Fragment { + + private LogView mLogView; + private ScrollView mScrollView; + + public LogFragment() {} + + public View inflateViews() { + mScrollView = new ScrollView(getActivity()); + ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT); + mScrollView.setLayoutParams(scrollParams); + + mLogView = new LogView(getActivity()); + ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams); + logParams.height = ViewGroup.LayoutParams.WRAP_CONTENT; + mLogView.setLayoutParams(logParams); + mLogView.setClickable(true); + mLogView.setFocusable(true); + mLogView.setTypeface(Typeface.MONOSPACE); + + // Want to set padding as 16 dips, setPadding takes pixels. Hooray math! + int paddingDips = 16; + double scale = getResources().getDisplayMetrics().density; + int paddingPixels = (int) ((paddingDips * (scale)) + .5); + mLogView.setPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels); + mLogView.setCompoundDrawablePadding(paddingPixels); + + mLogView.setGravity(Gravity.BOTTOM); + mLogView.setTextAppearance(getActivity(), android.R.style.TextAppearance_Holo_Medium); + + mScrollView.addView(mLogView); + return mScrollView; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, + Bundle savedInstanceState) { + + View result = inflateViews(); + + mLogView.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) {} + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) {} + + @Override + public void afterTextChanged(Editable s) { + mScrollView.fullScroll(ScrollView.FOCUS_DOWN); + } + }); + return result; + } + + public LogView getLogView() { + return mLogView; + } +} \ No newline at end of file diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogNode.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogNode.java new file mode 100644 index 000000000..bc37cabc0 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogNode.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2012 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.logger; + +/** + * Basic interface for a logging system that can output to one or more targets. + * Note that in addition to classes that will output these logs in some format, + * one can also implement this interface over a filter and insert that in the chain, + * such that no targets further down see certain data, or see manipulated forms of the data. + * You could, for instance, write a "ToHtmlLoggerNode" that just converted all the log data + * it received to HTML and sent it along to the next node in the chain, without printing it + * anywhere. + */ +public interface LogNode { + + /** + * Instructs first LogNode in the list to print the log data provided. + * @param priority Log level of the data being logged. Verbose, Error, etc. + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + public void println(int priority, String tag, String msg, Throwable tr); + +} diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogView.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogView.java new file mode 100644 index 000000000..c01542b91 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogView.java @@ -0,0 +1,145 @@ +/* + * 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.logger; + +import android.app.Activity; +import android.content.Context; +import android.util.*; +import android.widget.TextView; + +/** Simple TextView which is used to output log data received through the LogNode interface. +*/ +public class LogView extends TextView implements LogNode { + + public LogView(Context context) { + super(context); + } + + public LogView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public LogView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + /** + * Formats the log data and prints it out to the LogView. + * @param priority Log level of the data being logged. Verbose, Error, etc. + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + @Override + public void println(int priority, String tag, String msg, Throwable tr) { + + + String priorityStr = null; + + // For the purposes of this View, we want to print the priority as readable text. + switch(priority) { + case android.util.Log.VERBOSE: + priorityStr = "VERBOSE"; + break; + case android.util.Log.DEBUG: + priorityStr = "DEBUG"; + break; + case android.util.Log.INFO: + priorityStr = "INFO"; + break; + case android.util.Log.WARN: + priorityStr = "WARN"; + break; + case android.util.Log.ERROR: + priorityStr = "ERROR"; + break; + case android.util.Log.ASSERT: + priorityStr = "ASSERT"; + break; + default: + break; + } + + // Handily, the Log class has a facility for converting a stack trace into a usable string. + String exceptionStr = null; + if (tr != null) { + exceptionStr = android.util.Log.getStackTraceString(tr); + } + + // Take the priority, tag, message, and exception, and concatenate as necessary + // into one usable line of text. + final StringBuilder outputBuilder = new StringBuilder(); + + String delimiter = "\t"; + appendIfNotNull(outputBuilder, priorityStr, delimiter); + appendIfNotNull(outputBuilder, tag, delimiter); + appendIfNotNull(outputBuilder, msg, delimiter); + appendIfNotNull(outputBuilder, exceptionStr, delimiter); + + // In case this was originally called from an AsyncTask or some other off-UI thread, + // make sure the update occurs within the UI thread. + ((Activity) getContext()).runOnUiThread( (new Thread(new Runnable() { + @Override + public void run() { + // Display the text we just generated within the LogView. + appendToLog(outputBuilder.toString()); + } + }))); + + if (mNext != null) { + mNext.println(priority, tag, msg, tr); + } + } + + public LogNode getNext() { + return mNext; + } + + public void setNext(LogNode node) { + mNext = node; + } + + /** Takes a string and adds to it, with a separator, if the bit to be added isn't null. Since + * the logger takes so many arguments that might be null, this method helps cut out some of the + * agonizing tedium of writing the same 3 lines over and over. + * @param source StringBuilder containing the text to append to. + * @param addStr The String to append + * @param delimiter The String to separate the source and appended strings. A tab or comma, + * for instance. + * @return The fully concatenated String as a StringBuilder + */ + private StringBuilder appendIfNotNull(StringBuilder source, String addStr, String delimiter) { + if (addStr != null) { + if (addStr.length() == 0) { + delimiter = ""; + } + + return source.append(addStr).append(delimiter); + } + return source; + } + + // The next LogNode in the chain. + LogNode mNext; + + /** Outputs the string as a new line of log data in the LogView. */ + public void appendToLog(String s) { + append("\n" + s); + } + + +} diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogWrapper.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogWrapper.java new file mode 100644 index 000000000..16a9e7ba2 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/LogWrapper.java @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2012 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.logger; + +import android.util.Log; + +/** + * Helper class which wraps Android's native Log utility in the Logger interface. This way + * normal DDMS output can be one of the many targets receiving and outputting logs simultaneously. + */ +public class LogWrapper implements LogNode { + + // For piping: The next node to receive Log data after this one has done its work. + private LogNode mNext; + + /** + * Returns the next LogNode in the linked list. + */ + public LogNode getNext() { + return mNext; + } + + /** + * Sets the LogNode data will be sent to.. + */ + public void setNext(LogNode node) { + mNext = node; + } + + /** + * Prints data out to the console using Android's native log mechanism. + * @param priority Log level of the data being logged. Verbose, Error, etc. + * @param tag Tag for for the log data. Can be used to organize log statements. + * @param msg The actual message to be logged. The actual message to be logged. + * @param tr If an exception was thrown, this can be sent along for the logging facilities + * to extract and print useful information. + */ + @Override + public void println(int priority, String tag, String msg, Throwable tr) { + // There actually are log methods that don't take a msg parameter. For now, + // if that's the case, just convert null to the empty string and move on. + String useMsg = msg; + if (useMsg == null) { + useMsg = ""; + } + + // If an exeption was provided, convert that exception to a usable string and attach + // it to the end of the msg method. + if (tr != null) { + msg += "\n" + Log.getStackTraceString(tr); + } + + // This is functionally identical to Log.x(tag, useMsg); + // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg) + Log.println(priority, tag, useMsg); + + // If this isn't the last node in the chain, move things along. + if (mNext != null) { + mNext.println(priority, tag, msg, tr); + } + } +} diff --git a/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/MessageOnlyLogFilter.java b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/MessageOnlyLogFilter.java new file mode 100644 index 000000000..19967dcd4 --- /dev/null +++ b/samples/browseable/ActivitySceneTransitionBasic/src/com.example.android.common.logger/MessageOnlyLogFilter.java @@ -0,0 +1,60 @@ +/* + * 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.logger; + +/** + * Simple {@link LogNode} filter, removes everything except the message. + * Useful for situations like on-screen log output where you don't want a lot of metadata displayed, + * just easy-to-read message updates as they're happening. + */ +public class MessageOnlyLogFilter implements LogNode { + + LogNode mNext; + + /** + * Takes the "next" LogNode as a parameter, to simplify chaining. + * + * @param next The next LogNode in the pipeline. + */ + public MessageOnlyLogFilter(LogNode next) { + mNext = next; + } + + public MessageOnlyLogFilter() { + } + + @Override + public void println(int priority, String tag, String msg, Throwable tr) { + if (mNext != null) { + getNext().println(Log.NONE, null, msg, null); + } + } + + /** + * Returns the next LogNode in the chain. + */ + public LogNode getNext() { + return mNext; + } + + /** + * Sets the LogNode data will be sent to.. + */ + public void setNext(LogNode node) { + mNext = node; + } + +} diff --git a/samples/browseable/AppRestrictionEnforcer/AndroidManifest.xml b/samples/browseable/AppRestrictionEnforcer/AndroidManifest.xml new file mode 100644 index 000000000..c66b4b33e --- /dev/null +++ b/samples/browseable/AppRestrictionEnforcer/AndroidManifest.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/browseable/AppRestrictionEnforcer/_index.jd b/samples/browseable/AppRestrictionEnforcer/_index.jd new file mode 100644 index 000000000..f25084a06 --- /dev/null +++ b/samples/browseable/AppRestrictionEnforcer/_index.jd @@ -0,0 +1,10 @@ +page.tags="AppRestrictionEnforcer" +sample.group=Admin +@jd:body + +

+ + This sample demonstrates how to set restrictions to other apps as a profile owner. + Use AppRestrictionSchema sample as a app with available restrictions. + +

diff --git a/samples/browseable/AppRestrictionEnforcer/res/drawable-hdpi/ic_launcher.png b/samples/browseable/AppRestrictionEnforcer/res/drawable-hdpi/ic_launcher.png new file mode 100644 index 000000000..e7bd161ef Binary files /dev/null and b/samples/browseable/AppRestrictionEnforcer/res/drawable-hdpi/ic_launcher.png differ diff --git a/samples/browseable/AppRestrictionEnforcer/res/drawable-hdpi/tile.9.png b/samples/browseable/AppRestrictionEnforcer/res/drawable-hdpi/tile.9.png new file mode 100644 index 000000000..135862883 Binary files /dev/null and b/samples/browseable/AppRestrictionEnforcer/res/drawable-hdpi/tile.9.png differ diff --git a/samples/browseable/AppRestrictionEnforcer/res/drawable-mdpi/ic_launcher.png b/samples/browseable/AppRestrictionEnforcer/res/drawable-mdpi/ic_launcher.png new file mode 100644 index 000000000..4c42c9c45 Binary files /dev/null and b/samples/browseable/AppRestrictionEnforcer/res/drawable-mdpi/ic_launcher.png differ diff --git a/samples/browseable/AppRestrictionEnforcer/res/drawable-xhdpi/ic_launcher.png b/samples/browseable/AppRestrictionEnforcer/res/drawable-xhdpi/ic_launcher.png new file mode 100644 index 000000000..3ec336888 Binary files /dev/null and b/samples/browseable/AppRestrictionEnforcer/res/drawable-xhdpi/ic_launcher.png differ diff --git a/samples/browseable/AppRestrictionEnforcer/res/drawable-xxhdpi/ic_launcher.png b/samples/browseable/AppRestrictionEnforcer/res/drawable-xxhdpi/ic_launcher.png new file mode 100644 index 000000000..730f80cd2 Binary files /dev/null and b/samples/browseable/AppRestrictionEnforcer/res/drawable-xxhdpi/ic_launcher.png differ diff --git a/samples/browseable/AppRestrictionEnforcer/res/layout/activity_main.xml b/samples/browseable/AppRestrictionEnforcer/res/layout/activity_main.xml new file mode 100755 index 000000000..be1aa49d9 --- /dev/null +++ b/samples/browseable/AppRestrictionEnforcer/res/layout/activity_main.xml @@ -0,0 +1,36 @@ + + + + + + + + + diff --git a/samples/browseable/AppRestrictionEnforcer/res/layout/activity_main_real.xml b/samples/browseable/AppRestrictionEnforcer/res/layout/activity_main_real.xml new file mode 100644 index 000000000..d36c2b6ad --- /dev/null +++ b/samples/browseable/AppRestrictionEnforcer/res/layout/activity_main_real.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/browseable/AppRestrictionEnforcer/res/layout/fragment_app_restriction_enforcer.xml b/samples/browseable/AppRestrictionEnforcer/res/layout/fragment_app_restriction_enforcer.xml new file mode 100644 index 000000000..e6c50a245 --- /dev/null +++ b/samples/browseable/AppRestrictionEnforcer/res/layout/fragment_app_restriction_enforcer.xml @@ -0,0 +1,44 @@ + + + + + + +