/*
* 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 android.support.v7.internal.view.menu;
import android.content.Context;
import android.os.Build;
import android.support.v4.internal.view.SupportMenu;
import android.support.v4.internal.view.SupportMenuItem;
import android.support.v4.internal.view.SupportSubMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
/**
* @hide
*/
public final class MenuWrapperFactory {
private MenuWrapperFactory() {
}
public static Menu wrapSupportMenu(Context context, SupportMenu supportMenu) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return new MenuWrapperICS(context, supportMenu);
}
throw new UnsupportedOperationException();
}
public static MenuItem wrapSupportMenuItem(Context context, SupportMenuItem supportMenuItem) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
return new MenuItemWrapperJB(context, supportMenuItem);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return new MenuItemWrapperICS(context, supportMenuItem);
}
throw new UnsupportedOperationException();
}
public static SubMenu wrapSupportSubMenu(Context context, SupportSubMenu supportSubMenu) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
return new SubMenuWrapperICS(context, supportSubMenu);
}
throw new UnsupportedOperationException();
}
}