本文整理汇总了Java中android.content.pm.ActivityInfo类的典型用法代码示例。如果您正苦于以下问题:Java ActivityInfo类的具体用法?Java ActivityInfo怎么用?Java ActivityInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActivityInfo类属于android.content.pm包,在下文中一共展示了ActivityInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleActivityStack
import android.content.pm.ActivityInfo; //导入依赖的package包/类
public static void handleActivityStack(ActivityInfo info, Intent intent) {
// Handle launchMode with singleTop, and flag with FLAG_ACTIVITY_SINGLE_TOP
int launchMode = info.launchMode;
int flag = intent.getFlags();
String launchActivityName = info.name;
String prevActivityName = null;
List<WeakReference<Activity>> activityList = ActivityTaskMgr.getInstance().getActivityList();
if (activityList.size() > 0) {
Activity lastActivity = activityList.get(activityList.size() - 1).get();
prevActivityName = lastActivity.getClass().getName();
}
if (StringUtils.equals(prevActivityName, launchActivityName)
&& (launchMode == ActivityInfo.LAUNCH_SINGLE_TOP || (flag & Intent.FLAG_ACTIVITY_SINGLE_TOP) == Intent.FLAG_ACTIVITY_SINGLE_TOP)) {
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
} else if (launchMode == ActivityInfo.LAUNCH_SINGLE_TASK || launchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE
|| (flag & Intent.FLAG_ACTIVITY_CLEAR_TOP) == Intent.FLAG_ACTIVITY_CLEAR_TOP) {
int i;
boolean isExist = false;
for (i = 0; i < activityList.size(); i++) {
WeakReference<Activity> ref = activityList.get(i);
if (ref!=null && ref.get()!=null && ref.get().getClass().getName().equals(launchActivityName)) {
isExist = true;
break;
}
}
if (isExist) {
for (WeakReference<Activity> act : activityList.subList(i + 1, activityList.size())) {
if(act!=null && act.get()!=null) {
act.get().finish();
}
}
activityList.subList(i + 1, activityList.size()).clear();
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
}
}
}
示例2: exitFullscreen
import android.content.pm.ActivityInfo; //导入依赖的package包/类
public void exitFullscreen(){
if(fullscreenPlayer!=null) {
this.showHeaderBar();
this.seekTo(fullscreenPlayer.getCurrentPosition());
if(this.isPlaying){
Log.d("xxxxxx","fullscreen played"+fullscreenPlayer.getCurrentPosition());
this.start();
}
maskLayout.removeView(fullscreenPlayer);
viewGroup.removeView(maskLayout.findViewById(R.id.maskLayer));
// maskLayout.setBackgroundColor(0xffffffff);
// LayoutInflater.from(mThemedReactContext).inflate(lastLayout,viewGroup);
fullscreenPlayer = null;
maskLayout = null;
mThemedReactContext.getCurrentActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
}
示例3: perform
import android.content.pm.ActivityInfo; //导入依赖的package包/类
@Override
public void perform(UiController uiController, View view) {
uiController.loopMainThreadUntilIdle();
int orientation = getActivityOrientation(view);
boolean checkOrientation = false;
switch (orientationType) {
case PORTRAIT:
checkOrientation = orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
|| orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
|| orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT
|| orientation == ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT;
break;
case LANDSCAPE:
checkOrientation = orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
|| orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
|| orientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE
|| orientation == ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE;
break;
}
if (checkOrientation) {
isOrientation[0] = true;
}
}
示例4: onConfigurationChanged
import android.content.pm.ActivityInfo; //导入依赖的package包/类
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
//如果旋转了就全屏
if (mIsPlay && !mIsPause) {
if (newConfig.orientation == ActivityInfo.SCREEN_ORIENTATION_USER) {
if (!mPlayer.isIfCurrentIsFullscreen()) {
mPlayer.startWindowFullscreen(MovieDetailActivity.this, true, true);
}
} else {
//新版本isIfCurrentIsFullscreen的标志位内部提前设置了,所以不会和手动点击冲突
if (mPlayer.isIfCurrentIsFullscreen()) {
StandardGSYVideoPlayer.backFromWindowFull(this);
}
if (mOrientationUtils != null) {
mOrientationUtils.setEnable(true);
}
}
}
}
示例5: processActivityIntentIfNeed
import android.content.pm.ActivityInfo; //导入依赖的package包/类
public static void processActivityIntentIfNeed(Object activityclientrecord) {
try {
Class ActivityClientRecord_Class = Class.forName("android.app.ActivityThread$ActivityClientRecord");
Field intent_Field = ActivityClientRecord_Class.getDeclaredField("intent");
intent_Field.setAccessible(true);
Intent intent = (Intent) intent_Field.get(activityclientrecord);
if (intent.getComponent() != null && intent.getComponent().getClassName().startsWith(String.format("%s%s",BridgeUtil.COMPONENT_PACKAGE,BridgeUtil.PROXY_PREFIX))){
Field activityInfo_Field = ActivityClientRecord_Class.getDeclaredField("activityInfo");
activityInfo_Field.setAccessible(true);
Intent originalIntent = unWrapperOriginalIntent(intent);
ActivityInfo info = AdditionalPackageManager.getInstance().getNewComponentInfo(originalIntent.getComponent(),ActivityInfo.class);
activityInfo_Field.set(activityclientrecord, info);
intent_Field.set(activityclientrecord,originalIntent);
}
} catch (Throwable e) {
e.printStackTrace();
}
}
示例6: onCreate
import android.content.pm.ActivityInfo; //导入依赖的package包/类
/**
* Initialize activity, set up layout and UI.
* @param savedInstanceState If activity is re-initialized then this contains data it supplied to onSaveInstanceState, otherwise null.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_result);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
ImageButton imageBtn = (ImageButton) findViewById(R.id.launchCameraButton);
imageBtn.setImageResource(R.drawable.camera_button);
// because of activity lifecycles...
if (savedInstanceState == null) {
// FIXME: Doesn't seem to be able to update UI in this state
sendRequestFromIntent(getIntent());
}
TextView view = (TextView) findViewById(R.id.resultTextView);
view.setText("Waiting for data...");
}
示例7: onCreate
import android.content.pm.ActivityInfo; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.view_login);
_logger = new Logger(TAG);
_logger.Debug("onCreate");
_context = this;
_bCrypter = new BCrypter();
_navigationController = new NavigationController(_context);
_sharedPrefController = new SharedPrefController(_context, SharedPref.NAME);
initializeViews();
if (!_sharedPrefController.LoadBooleanValueFromSharedPreferences(SharedPref.ENTERED_APPLICATION_PASSWORD)) {
new PasswordSafeDialogController(_context).ShowDialogFirstLogin(new SavePasswordRunnable(_sharedPrefController));
}
}
示例8: getParentActivityIntent
import android.content.pm.ActivityInfo; //导入依赖的package包/类
/**
* Obtain an {@link Intent} that will launch an explicit target activity specified by
* this activity's logical parent. The logical parent is named in the application's manifest
* by the {@link android.R.attr#parentActivityName parentActivityName} attribute.
* Activity subclasses may override this method to modify the Intent returned by
* super.getParentActivityIntent() or to implement a different mechanism of retrieving
* the parent intent entirely.
*
* @return a new Intent targeting the defined parent of this activity or null if
* there is no valid parent.
*/
@Nullable
public Intent getParentActivityIntent() {
final String parentName = mActivityInfo.parentActivityName;
if (TextUtils.isEmpty(parentName)) {
return null;
}
// If the parent itself has no parent, generate a main activity intent.
final ComponentName target = new ComponentName(this, parentName);
try {
final ActivityInfo parentInfo = getPackageManager().getActivityInfo(target, 0);
final String parentActivity = parentInfo.parentActivityName;
final Intent parentIntent = parentActivity == null
? Intent.makeMainActivity(target)
: new Intent().setComponent(target);
return parentIntent;
} catch (NameNotFoundException e) {
Log.e(TAG, "getParentActivityIntent: bad parentActivityName '" + parentName +
"' in manifest");
return null;
}
}
示例9: onVerticalClickFullScreen
import android.content.pm.ActivityInfo; //导入依赖的package包/类
@Override
public void onVerticalClickFullScreen() {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Display display = getWindow().getWindowManager().getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
display.getMetrics(metrics);
int heightPixels = metrics.heightPixels;
int widthPixels = metrics.widthPixels;
ViewGroup.LayoutParams params = mSurfaceView.getLayoutParams();
int height = params.height;
int width = params.width;
getWindow().getDecorView().setSystemUiVisibility(View.INVISIBLE);
mPortWidth = width;
mPortHeight = height;
params.width = widthPixels;
params.height = heightPixels;
mSurfaceView.setLayoutParams(params);
}
示例10: AppAdapter
import android.content.pm.ActivityInfo; //导入依赖的package包/类
public AppAdapter(Context context, ActivityInfo[] infoArray, ActivityInfo store) {
final List<App> apps = new ArrayList<>(infoArray.length);
for (ActivityInfo info : infoArray) {
apps.add(new App(context, info));
}
Collections.sort(apps, new Comparator<App>() {
@Override
public int compare(App app1, App app2) {
return app1.getLabel().compareTo(app2.getLabel());
}
});
this.apps = apps;
this.store = store != null ? new App(context, store) : null;
}
示例11: lockOrientation
import android.content.pm.ActivityInfo; //导入依赖的package包/类
public void lockOrientation(Activity activity, String orientation, ModuleResultListener listener){
if (activity == null || listener == null) return;
if (orientation.equals(ANY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
} else if (orientation.equals(LANDSCAPE_PRIMARY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else if (orientation.equals(PORTRAIT_PRIMARY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else if (orientation.equals(LANDSCAPE)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
} else if (orientation.equals(PORTRAIT)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
} else if (orientation.equals(LANDSCAPE_SECONDARY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
} else if (orientation.equals(PORTRAIT_SECONDARY)) {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
} else {
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
getOrientation(listener);
}
示例12: onHideCustomView
import android.content.pm.ActivityInfo; //导入依赖的package包/类
@Override
public void onHideCustomView() {
LogUtils.i("Info", "onHideCustomView:" + moiveView);
if (moiveView == null)
return;
if (mActivity!=null&&mActivity.getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
moiveView.setVisibility(View.GONE);
if (moiveParentView != null && moiveView != null) {
moiveParentView.removeView(moiveView);
}
if (moiveParentView != null)
moiveParentView.setVisibility(View.GONE);
if(this.mCallback!=null)
mCallback.onCustomViewHidden();
this.moiveView = null;
if (mWebView != null)
mWebView.setVisibility(View.VISIBLE);
}
示例13: resolveActivityInfo
import android.content.pm.ActivityInfo; //导入依赖的package包/类
public ActivityInfo resolveActivityInfo(Intent intent, int flags) throws RemoteException {
try {
if (this.mApkManager == null) {
return null;
}
if (intent.getComponent() != null) {
return this.mApkManager.getActivityInfo(intent.getComponent(), flags);
}
ResolveInfo resolveInfo = this.mApkManager.resolveIntent(intent, intent.resolveTypeIfNeeded(this.mHostContext.getContentResolver()), flags);
if (resolveInfo == null || resolveInfo.activityInfo == null) {
return null;
}
return resolveInfo.activityInfo;
} catch (RemoteException e) {
JLog.log("wuxinrong", "获取ActivityInfo 失败 e=" + e.getMessage());
throw e;
} catch (Exception e2) {
JLog.log("wuxinrong", "获取ActivityInfo 失败 e=" + e2.getMessage());
return null;
}
}
示例14: openGalleryByMatisse
import android.content.pm.ActivityInfo; //导入依赖的package包/类
/**
* 通过知乎Matisse类库 打开相册
*
* @param fragment
*/
public void openGalleryByMatisse(Fragment fragment) {
if (fragment == null) {
return;
}
int count = mPhotoLimitCount - mSelectPhotoAdapter.getBodyCount();
Matisse.from(fragment)
.choose(MimeType.allOf())
.theme(R.style.Matisse_Zhihu)
.capture(true)
.captureStrategy(new CaptureStrategy(true, AUTHORITY))
.countable(true)
.maxSelectable(count)
.gridExpectedSize(dip2px(120))
.restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
.thumbnailScale(0.85f)
.imageEngine(new PicassoEngine())
.forResult(mRequestCode);
}
示例15: fullscreen_disabledOnPortrait
import android.content.pm.ActivityInfo; //导入依赖的package包/类
@Test
public void fullscreen_disabledOnPortrait() throws Throwable {
rule.runOnUiThread(new Runnable() {
@Override
public void run() {
rule.getActivity()
.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
});
InstrumentationRegistry.getInstrumentation().waitForIdleSync();
rule.runOnUiThread(new Runnable() {
@Override
public void run() {
final View decorView = rule.getActivity().getWindow().getDecorView();
assertThat(decorView.getSystemUiVisibility(),
not(hasFlag(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)));
}
});
}
开发者ID:googlesamples,项目名称:android-PictureInPicture,代码行数:20,代码来源:MediaSessionPlaybackActivityTest.java