本文整理汇总了Java中android.app.ActivityGroup类的典型用法代码示例。如果您正苦于以下问题:Java ActivityGroup类的具体用法?Java ActivityGroup怎么用?Java ActivityGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActivityGroup类属于android.app包,在下文中一共展示了ActivityGroup类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import android.app.ActivityGroup; //导入依赖的package包/类
public void close(String[] args)
{
LocalActivityManager mgr = ((ActivityGroup) mContext)
.getLocalActivityManager();
ViewerActivity viewerActivity = (ViewerActivity) mgr.getActivity(TAG);
if(viewerActivity != null){
View view = viewerActivity.getWindow().getDecorView();
removeViewFromCurrentWindow(view);
viewerActivity.finish();
viewerActivity = null;
view = null;
}
if(isOpen){
isOpen=!isOpen;
}
}
示例2: getActionBarHeight
import android.app.ActivityGroup; //导入依赖的package包/类
/**
* 获取actionbar的像素高度,默认使用android官方兼容包做actionbar兼容
*
* @return
*/
public static int getActionBarHeight(Context context) {
int actionBarHeight = 0;
if (context instanceof AppCompatActivity && ((AppCompatActivity) context).getSupportActionBar() != null) {
Log.d("isAppCompatActivity", "==AppCompatActivity");
actionBarHeight = ((AppCompatActivity) context).getSupportActionBar().getHeight();
} else if (context instanceof Activity && ((Activity) context).getActionBar() != null) {
Log.d("isActivity", "==Activity");
actionBarHeight = ((Activity) context).getActionBar().getHeight();
} else if (context instanceof ActivityGroup) {
Log.d("ActivityGroup", "==ActivityGroup");
if (((ActivityGroup) context).getCurrentActivity() instanceof AppCompatActivity && ((AppCompatActivity) ((ActivityGroup) context).getCurrentActivity()).getSupportActionBar() != null) {
actionBarHeight = ((AppCompatActivity) ((ActivityGroup) context).getCurrentActivity()).getSupportActionBar().getHeight();
} else if (((ActivityGroup) context).getCurrentActivity() instanceof Activity && ((Activity) ((ActivityGroup) context).getCurrentActivity()).getActionBar() != null) {
actionBarHeight = ((Activity) ((ActivityGroup) context).getCurrentActivity()).getActionBar().getHeight();
}
}
if (actionBarHeight != 0)
return actionBarHeight;
final TypedValue tv = new TypedValue();
if (context.getTheme().resolveAttribute(android.support.v7.appcompat.R.attr.actionBarSize, tv, true)) {
if (context.getTheme().resolveAttribute(android.support.v7.appcompat.R.attr.actionBarSize, tv, true))
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
} else {
if (context.getTheme().resolveAttribute(android.support.v7.appcompat.R.attr.actionBarSize, tv, true))
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, context.getResources().getDisplayMetrics());
}
Log.d("actionBarHeight", "====" + actionBarHeight);
return actionBarHeight;
}
示例3: getCurrentActivity_shouldReturnTheProvidedCurrentActivity
import android.app.ActivityGroup; //导入依赖的package包/类
@Test
public void getCurrentActivity_shouldReturnTheProvidedCurrentActivity() throws Exception {
ActivityGroup activityGroup = new ActivityGroup();
Activity activity = new Activity();
shadowOf(activityGroup).setCurrentActivity(activity);
assertThat(activityGroup.getCurrentActivity()).isSameAs(activity);
}
示例4: getActionBarHeight
import android.app.ActivityGroup; //导入依赖的package包/类
/**
* 获取actionbar的像素高度,默认使用android官方兼容包做actionbar兼容
*
* @return
*/
public static int getActionBarHeight(Context context) {
int actionBarHeight = 0;
if (context instanceof AppCompatActivity && ((AppCompatActivity) context)
.getSupportActionBar() != null) {
Log.d("isAppCompatActivity", "==AppCompatActivity");
actionBarHeight = ((AppCompatActivity) context).getSupportActionBar().getHeight();
} else if (context instanceof Activity && ((Activity) context).getActionBar() != null) {
Log.d("isActivity", "==Activity");
actionBarHeight = ((Activity) context).getActionBar().getHeight();
} else if (context instanceof ActivityGroup) {
Log.d("ActivityGroup", "==ActivityGroup");
if (((ActivityGroup) context).getCurrentActivity() instanceof AppCompatActivity && (
(AppCompatActivity) ((ActivityGroup) context).getCurrentActivity())
.getSupportActionBar() != null) {
actionBarHeight = ((AppCompatActivity) ((ActivityGroup) context)
.getCurrentActivity()).getSupportActionBar().getHeight();
} else if (((ActivityGroup) context).getCurrentActivity() instanceof Activity && (
(Activity) ((ActivityGroup) context).getCurrentActivity()).getActionBar() !=
null) {
actionBarHeight = ((Activity) ((ActivityGroup) context).getCurrentActivity())
.getActionBar().getHeight();
}
}
if (actionBarHeight != 0)
return actionBarHeight;
final TypedValue tv = new TypedValue();
if (context.getTheme().resolveAttribute(android.support.v7.appcompat.R.attr
.actionBarSize, tv, true)) {
if (context.getTheme().resolveAttribute(android.support.v7.appcompat.R.attr
.actionBarSize, tv, true))
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, context
.getResources().getDisplayMetrics());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true))
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, context
.getResources().getDisplayMetrics());
} else {
if (context.getTheme().resolveAttribute(android.support.v7.appcompat.R.attr
.actionBarSize, tv, true))
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, context
.getResources().getDisplayMetrics());
}
Log.d("actionBarHeight", "====" + actionBarHeight);
return actionBarHeight;
}
示例5: shadowOf
import android.app.ActivityGroup; //导入依赖的package包/类
public static ShadowActivityGroup shadowOf(ActivityGroup instance) {
return (ShadowActivityGroup) shadowOf_(instance);
}