185833087b2288e0f002de6b4ebcbc0564839a217Dake Gu/*
285833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * Copyright (C) 2015 The Android Open Source Project
385833087b2288e0f002de6b4ebcbc0564839a217Dake Gu *
485833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
585833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * in compliance with the License. You may obtain a copy of the License at
685833087b2288e0f002de6b4ebcbc0564839a217Dake Gu *
785833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * http://www.apache.org/licenses/LICENSE-2.0
885833087b2288e0f002de6b4ebcbc0564839a217Dake Gu *
985833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * Unless required by applicable law or agreed to in writing, software distributed under the License
1085833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
1185833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * or implied. See the License for the specific language governing permissions and limitations under
1285833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * the License.
1385833087b2288e0f002de6b4ebcbc0564839a217Dake Gu */
1485833087b2288e0f002de6b4ebcbc0564839a217Dake Gupackage android.support.v17.leanback.widget;
1585833087b2288e0f002de6b4ebcbc0564839a217Dake Gu
1685833087b2288e0f002de6b4ebcbc0564839a217Dake Guimport android.content.Context;
1785833087b2288e0f002de6b4ebcbc0564839a217Dake Guimport android.view.View;
1885833087b2288e0f002de6b4ebcbc0564839a217Dake Gu
1985833087b2288e0f002de6b4ebcbc0564839a217Dake Gu/**
2085833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * A wrapper class working with {@link ItemBridgeAdapter} to wrap item view in a
2185833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * {@link ShadowOverlayContainer}.  The ShadowOverlayContainer is created from conditions
2285833087b2288e0f002de6b4ebcbc0564839a217Dake Gu * of {@link ShadowOverlayHelper}.
2385833087b2288e0f002de6b4ebcbc0564839a217Dake Gu */
2485833087b2288e0f002de6b4ebcbc0564839a217Dake Gupublic class ItemBridgeAdapterShadowOverlayWrapper extends ItemBridgeAdapter.Wrapper {
2585833087b2288e0f002de6b4ebcbc0564839a217Dake Gu
2685833087b2288e0f002de6b4ebcbc0564839a217Dake Gu    private final ShadowOverlayHelper mHelper;
2785833087b2288e0f002de6b4ebcbc0564839a217Dake Gu
2885833087b2288e0f002de6b4ebcbc0564839a217Dake Gu    public ItemBridgeAdapterShadowOverlayWrapper(ShadowOverlayHelper helper) {
2985833087b2288e0f002de6b4ebcbc0564839a217Dake Gu        mHelper = helper;
3085833087b2288e0f002de6b4ebcbc0564839a217Dake Gu    }
3185833087b2288e0f002de6b4ebcbc0564839a217Dake Gu
3285833087b2288e0f002de6b4ebcbc0564839a217Dake Gu    @Override
3385833087b2288e0f002de6b4ebcbc0564839a217Dake Gu    public View createWrapper(View root) {
3485833087b2288e0f002de6b4ebcbc0564839a217Dake Gu        Context context = root.getContext();
3585833087b2288e0f002de6b4ebcbc0564839a217Dake Gu        ShadowOverlayContainer wrapper = mHelper.createShadowOverlayContainer(context);
3685833087b2288e0f002de6b4ebcbc0564839a217Dake Gu        return wrapper;
3785833087b2288e0f002de6b4ebcbc0564839a217Dake Gu    }
3885833087b2288e0f002de6b4ebcbc0564839a217Dake Gu    @Override
3985833087b2288e0f002de6b4ebcbc0564839a217Dake Gu    public void wrap(View wrapper, View wrapped) {
4085833087b2288e0f002de6b4ebcbc0564839a217Dake Gu        ((ShadowOverlayContainer) wrapper).wrap(wrapped);
4185833087b2288e0f002de6b4ebcbc0564839a217Dake Gu    }
4285833087b2288e0f002de6b4ebcbc0564839a217Dake Gu
4385833087b2288e0f002de6b4ebcbc0564839a217Dake Gu}
44