Java Code Examples for android.content.pm.ActivityInfo

The following are top voted examples for showing how to use android.content.pm.ActivityInfo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: atlas   File: ActivityBridge.java   Source Code and License 7 votes vote down vote up
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);
        }
    }
}
 
Example 2
Project: react-native-videoplayer   File: ReactVideoView.java   Source Code and License 6 votes vote down vote up
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);
        }

    }
 
Example 3
Project: fullscreen-video-view   File: CustomChecks.java   Source Code and License 6 votes vote down vote up
@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;
    }
}
 
Example 4
Project: MyEyepetizer   File: MovieDetailActivity.java   Source Code and License 6 votes vote down vote up
@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);
            }
        }
    }
}
 
Example 5
Project: atlas   File: ActivityBridge.java   Source Code and License 6 votes vote down vote up
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();
    }

}
 
Example 6
Project: Graphrec   File: ResultActivity.java   Source Code and License 6 votes vote down vote up
/**
 * 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...");

}
 
Example 7
Project: PasswordSafe-AndroidClient   File: LoginView.java   Source Code and License 6 votes vote down vote up
@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));
    }
}
 
Example 8
Project: ProgressManager   File: a.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 9
Project: GitHub   File: TvShowActivity.java   Source Code and License 6 votes vote down vote up
@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);
}
 
Example 10
Project: ProgressManager   File: a.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
    }
}
 
Example 11
Project: firefox-tv   File: AppAdapter.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 12
Project: nat-device-screen   File: ScreenModule.java   Source Code and License 6 votes vote down vote up
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);
}
 
Example 13
Project: AgentWebX5   File: VideoImpl.java   Source Code and License 6 votes vote down vote up
@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);



}
 
Example 14
Project: letv   File: ApkManager.java   Source Code and License 6 votes vote down vote up
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;
    }
}
 
Example 15
Project: SugarPhotoPicker   File: SelectPhotoRecyclerView.java   Source Code and License 6 votes vote down vote up
/**
 * 通过知乎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);
}
 
Example 16
Project: android-PictureInPicture   File: MediaSessionPlaybackActivityTest.java   Source Code and License 6 votes vote down vote up
@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)));
        }
    });
}
 
Example 17
Project: android-banklink   File: RequestTest.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("WrongConstant")
private void installApp(@NonNull String packageName,
                        int versionCode,
                        @NonNull Signature signature) {
  final ResolveInfo resolveInfo = new ResolveInfo();
  resolveInfo.activityInfo = new ActivityInfo();
  resolveInfo.activityInfo.packageName = packageName;
  banklinkActivities.add(resolveInfo);
  final PackageInfo packageInfo = new PackageInfo();
  packageInfo.versionCode = versionCode;
  packageInfo.packageName = packageName;
  packageInfo.signatures = new Signature[1];
  packageInfo.signatures[0] = signature;
  try {
    when(context.getPackageManager().getPackageInfo(eq(packageName), anyInt()))
        .thenReturn(packageInfo);
  } catch (PackageManager.NameNotFoundException e) {
    throw new RuntimeException(e);
  }
}
 
Example 18
Project: FTC2016   File: ImageRotationExtension.java   Source Code and License 6 votes vote down vote up
/**
 * Set a fixed orientation for the app
 *
 * @param orientation Fixed screen orientation
 */
public void setActivityOrientationFixed(ScreenOrientation orientation) {
    switch (orientation) {
        case LANDSCAPE:
        default:
            setActivityOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
            break;
        case PORTRAIT:
            setActivityOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
            break;
        case LANDSCAPE_REVERSE:
            setActivityOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
            break;
        case PORTRAIT_REVERSE:
            setActivityOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
            break;
    }
}
 
Example 19
Project: flowr   File: Flowr.java   Source Code and License 6 votes vote down vote up
/**
 * Called by the {@link android.app.Activity#onPostCreate(Bundle)} to update
 * the state of the container screen.
 */
public void syncScreenState() {
    int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
    int navigationBarColor = -1;

    if (currentFragment instanceof FlowrFragment) {
        screenOrientation = ((FlowrFragment) currentFragment).getScreenOrientation();
        navigationBarColor = ((FlowrFragment) currentFragment).getNavigationBarColor();
    }

    if (screen != null) {
        screen.onCurrentFragmentChanged(getCurrentFragment());
        screen.setScreenOrientation(screenOrientation);
        screen.setNavigationBarColor(navigationBarColor);
    }

    syncToolbarState();
    syncDrawerState();
}
 
Example 20
Project: letv   File: ApkManager.java   Source Code and License 5 votes vote down vote up
public void onActivityCreated(ActivityInfo stubInfo, ActivityInfo targetInfo) throws RemoteException {
    try {
        if (this.mApkManager != null) {
            this.mApkManager.onActivityCreated(stubInfo, targetInfo);
        }
    } catch (RemoteException e) {
        JLog.log("wuxinrong", "activity启动回调ActivityManagerService.onActivityCreated 失败 e=" + e.getMessage());
        throw e;
    } catch (Exception e2) {
        JLog.log("wuxinrong", "activity启动回调ActivityManagerService.onActivityCreated 失败 e=" + e2.getMessage());
    }
}
 
Example 21
Project: ProgressManager   File: a.java   Source Code and License 5 votes vote down vote up
/**
 * Change the desired orientation of this activity.  If the activity
 * is currently in the foreground or otherwise impacting the screen
 * orientation, the screen will immediately be changed (possibly causing
 * the activity to be restarted). Otherwise, this will be used the next
 * time the activity is visible.
 *
 * @param requestedOrientation An orientation constant as used in
 * {@link ActivityInfo#screenOrientation ActivityInfo.screenOrientation}.
 */
public void setRequestedOrientation(@ActivityInfo.ScreenOrientation int requestedOrientation) {
    if (mParent == null) {
        try {
            ActivityManagerNative.getDefault().setRequestedOrientation(
                    mToken, requestedOrientation);
        } catch (RemoteException e) {
            // Empty
        }
    } else {
        mParent.setRequestedOrientation(requestedOrientation);
    }
}
 
Example 22
Project: HeroVideo-master   File: MediaPlayer.java   Source Code and License 5 votes vote down vote up
private void updateFullScreenButton() {
    if (getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
        $.id(R.id.app_video_fullscreen).image(R.drawable.ic_fullscreen_exit_white_36dp);
    } else {
        $.id(R.id.app_video_fullscreen).image(R.drawable.ic_fullscreen_white_24dp);
    }
}
 
Example 23
Project: TPlayer   File: VActivityManagerService.java   Source Code and License 5 votes vote down vote up
private void performScheduleReceiver(IVClient client, int vuid, ActivityInfo info, Intent intent,
                                     PendingResultData result) {

    ComponentName componentName = ComponentUtils.toComponentName(info);
    BroadcastSystem.get().broadcastSent(vuid, info, result);
    try {
        client.scheduleReceiver(info.processName, componentName, intent, result);
    } catch (Throwable e) {
        if (result != null) {
            result.finish();
        }
    }
}
 
Example 24
Project: letv   File: IActivityManagerHookHandle.java   Source Code and License 5 votes vote down vote up
private static ComponentName selectProxyActivity(Intent intent) {
    if (intent != null) {
        try {
            ActivityInfo proxyInfo = ApkManager.getInstance().selectStubActivityInfo(intent);
            if (proxyInfo != null) {
                return new ComponentName(proxyInfo.packageName, proxyInfo.name);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    return null;
}
 
Example 25
Project: FlickLauncher   File: Launcher.java   Source Code and License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public void lockScreenOrientation() {
    if (mRotationEnabled) {
        if (Utilities.ATLEAST_JB_MR2) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
        } else {
            setRequestedOrientation(mapConfigurationOriActivityInfoOri(getResources()
                    .getConfiguration().orientation));
        }
    }
}
 
Example 26
Project: Pocket-Plays-for-Twitch   File: StreamActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onResume() {
	super.onResume();
	if (getResources().getConfiguration().orientation == ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT) {
		Log.d(LOG_TAG, "Orientations is reverse portrait");
	}

	Log.d(LOG_TAG, "Current orientation: " + getResources().getConfiguration().orientation);
}
 
Example 27
Project: NeuTV   File: Video.java   Source Code and License 5 votes vote down vote up
@Override
protected void onResume() {
    if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }
    super.onResume();
}
 
Example 28
Project: FlickLauncher   File: LauncherAppsCompatV16.java   Source Code and License 5 votes vote down vote up
public boolean isActivityEnabledForProfile(ComponentName component, UserHandleCompat user) {
    try {
        ActivityInfo info = mPm.getActivityInfo(component, 0);
        return info != null && info.isEnabled();
    } catch (NameNotFoundException e) {
        return false;
    }
}
 
Example 29
Project: MiPushFramework   File: CheckAppSupportActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected Boolean doInBackground(Void... voids) {
    ActivityInfo info = getReceiverName(mPackageName, getActivity().getPackageManager());
    if (info == null)
        return false;
    return ShellUtils.exec("pm enable " + info.packageName + "/" +
    info.name);
}
 
Example 30
Project: dkplayer   File: BaseIjkVideoView.java   Source Code and License 5 votes vote down vote up
/**
 * 竖屏
 */
protected void onOrientationPortrait(Activity activity) {
    if (isLockFullScreen || !mAutoRotate || currentOrientation == PORTRAIT) return;
    if ((currentOrientation == LANDSCAPE || currentOrientation == REVERSE_LANDSCAPE) && !isFullScreen()) {
        currentOrientation = PORTRAIT;
        return;
    }
    currentOrientation = PORTRAIT;
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    stopFullScreen();
}
 
Example 31
Project: EasyReader   File: WebViewActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();
    webView.onResume();
    // 支付宝网页版在打开文章详情之后,无法点击按钮下一步
    webView.resumeTimers();
    // 设置为横屏
    if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
}
 
Example 32
Project: live_master   File: GiraffePlayer.java   Source Code and License 5 votes vote down vote up
private void fullSreeen(){
    isFull = true;
    fullListener.setFull();
    log.i("lock4", isFull + "," + isShowing);
    $.id(R.id.app_video_box).heightandwidth(mWidthPixels, mHeightPixels, false);
    if (mIsLock){
        orientationEventListener.disable();
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    }
    if (isShowing) {
        handler.sendEmptyMessage(MESSAGE_SHOW_BOX);
    }
}
 
Example 33
Project: GitHub   File: MyWebChromeClient.java   Source Code and License 5 votes vote down vote up
@Override
public void onHideCustomView() {
    if (mXCustomView == null)// 不是全屏播放状态
        return;
    mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    mXCustomView.setVisibility(View.GONE);
    if (mActivity.getVideoFullView() != null) {
        mActivity.getVideoFullView().removeView(mXCustomView);
    }
    mXCustomView = null;
    mIWebPageView.hindVideoFullView();
    mXCustomViewCallback.onCustomViewHidden();
    mIWebPageView.showWebView();
}
 
Example 34
Project: ProgressManager   File: a.java   Source Code and License 5 votes vote down vote up
/**
 * Puts the activity in picture-in-picture mode if the activity supports.
 * @see android.R.attr#supportsPictureInPicture
 * @hide
 */
@Override
public void enterPictureInPictureModeIfPossible() {
    if (mActivityInfo.resizeMode == ActivityInfo.RESIZE_MODE_RESIZEABLE_AND_PIPABLE) {
        enterPictureInPictureMode();
    }
}
 
Example 35
Project: android-apkbox   File: ApkActivityModifier.java   Source Code and License 5 votes vote down vote up
private static void modifyActivityInfo(Activity target, ApkLoaded loaded) {
    ActivityInfo activityInfo = loaded.getActivityInfo(target.getClass().getName());
    if (activityInfo != null) {
        applyActivityInfo(target, activityInfo);
        applyTheme(target, activityInfo);
        applyRequestedOrientation(target, activityInfo);
        applyTaskDescription(target, loaded);
    } else {
        ApkLogger.get().debug("getActivityInfo fail : " + target.getClass().getName(), null);
    }
}
 
Example 36
Project: anyRTC-Meeting-Android   File: RTCVideoView.java   Source Code and License 5 votes vote down vote up
public RTCVideoView(RelativeLayout videoView, Context ctx, EglBase eglBase) {
    mAutoLayout = false;
    mContext = ctx;
    mVideoView = videoView;
    mRootEglBase = eglBase;
    mLocalRender = null;
    mRemoteRenders = new HashMap<>();
    mRTCVideoLayout = AnyRTCMeetEngine.Inst().getAnyRTCMeetOption().getmVideoLayout();
    if (mRTCVideoLayout == AnyRTCVideoLayout.AnyRTC_V_3X3_auto) {
        ((Activity) mContext).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }
    mScreenWidth = ScreenUtils.getScreenWidth(mContext);
    mScreenHeight = ScreenUtils.getScreenHeight(mContext) - ScreenUtils.getStatusHeight(mContext);
}
 
Example 37
Project: VirtualHook   File: VActivityManagerService.java   Source Code and License 5 votes vote down vote up
private boolean handleUserBroadcast(int vuid, ActivityInfo info, ComponentName component, Intent realIntent, PendingResultData result) {
    if (component != null && !ComponentUtils.toComponentName(info).equals(component)) {
        // Verify the component.
        return false;
    }
    String originAction = SpecialComponentList.unprotectAction(realIntent.getAction());
    if (originAction != null) {
        // restore to origin action.
        realIntent.setAction(originAction);
    }
    handleStaticBroadcastAsUser(vuid, info, realIntent, result);
    return true;
}
 
Example 38
Project: Idea-ijkplayer   File: Activity_BaseControllerView.java   Source Code and License 5 votes vote down vote up
@Override
protected void onResume() {
    super.onResume();
    if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    }
}
 
Example 39
Project: container   File: VPackageManagerService.java   Source Code and License 5 votes vote down vote up
@Override
public ActivityInfo getActivityInfo(ComponentName component, int flags, int userId) {
	checkUserId(userId);
	synchronized (mPackages) {
		PackageParser.Activity a = mActivities.mActivities.get(component);
		if (a != null) {
			ActivityInfo activityInfo = PackageParserCompat.generateActivityInfo(a, flags);
			PackageParser.Package p = mPackages.get(activityInfo.packageName);
			AppSetting settings = (AppSetting) p.mExtras;
			ComponentFixer.fixComponentInfo(settings, activityInfo, userId);
			return activityInfo;
		}
	}
	return null;
}
 
Example 40
Project: AOSP-Kayboard-7.1.2   File: ApplicationUtils.java   Source Code and License 5 votes vote down vote up
public static int getActivityTitleResId(final Context context,
        final Class<? extends Activity> cls) {
    final ComponentName cn = new ComponentName(context, cls);
    try {
        final ActivityInfo ai = context.getPackageManager().getActivityInfo(cn, 0);
        if (ai != null) {
            return ai.labelRes;
        }
    } catch (final NameNotFoundException e) {
        Log.e(TAG, "Failed to get settings activity title res id.", e);
    }
    return 0;
}
 
Example 41
Project: TPlayer   File: PackageParserCompat.java   Source Code and License 5 votes vote down vote up
public static ActivityInfo generateActivityInfo(Activity activity, int flags) {
    if (API_LEVEL >= M) {
        return PackageParserMarshmallow.generateActivityInfo.call(activity, flags, sUserState, myUserId);
    } else if (API_LEVEL >= LOLLIPOP_MR1) {
        return PackageParserLollipop22.generateActivityInfo.call(activity, flags, sUserState, myUserId);
    } else if (API_LEVEL >= LOLLIPOP) {
        return PackageParserLollipop.generateActivityInfo.call(activity, flags, sUserState, myUserId);
    } else if (API_LEVEL >= JELLY_BEAN_MR1) {
        return PackageParserJellyBean17.generateActivityInfo.call(activity, flags, sUserState, myUserId);
    } else if (API_LEVEL >= JELLY_BEAN) {
        return PackageParserJellyBean.generateActivityInfo.call(activity, flags, false, 1, myUserId);
    } else {
        return mirror.android.content.pm.PackageParser.generateActivityInfo.call(activity, flags);
    }
}
 
Example 42
Project: Idea-ijkplayer   File: PlayerManager.java   Source Code and License 5 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.FROYO)
public boolean onBackPressed() {
    if (!fullScreenOnly && getScreenOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
        activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        return true;
    }
    return false;
}
 
Example 43
Project: Graphrec   File: CameraActivity.java   Source Code and License 5 votes vote down vote up
/**
 * 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_camera);

    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    // get the camera and relay it to the preview service
    cam = getCameraInstance();

    camPreview = new CameraPreview(this, cam);
    FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
    preview.addView(camPreview);

    final SurfaceOverlay overlay = (SurfaceOverlay) findViewById(R.id.overlay);
    overlay.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (overlay.didButtonClick(event)) {
                invokeTakePicture();
            }
            return true;
        }
    });

}
 
Example 44
Project: Pocket-Plays-for-Twitch   File: StreamFragment.java   Source Code and License 5 votes vote down vote up
/**
 * If the device isn't currently in fullscreen a request is sent to turn the device into landscape.
 * Otherwise if the device is in fullscreen then is releases the lock by requesting for an unspecified orientation
 * After and update to the VideoView layout is requested.
 */
public void toggleFullscreen() {
	isFullscreen = !isFullscreen;
	if(isFullscreen) {
		getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
	} else {
		getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
	}
	updateFullscreenButtonState();
	setVideoViewLayout();
}
 
Example 45
Project: android-robocar   File: GameControllerActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    setContentView(R.layout.activity_controller);
    ButterKnife.bind(this);
    initNavigationDrawer();
}
 
Example 46
Project: dkplayer   File: AdController.java   Source Code and License 5 votes vote down vote up
@Override
public boolean onBackPressed() {
    if (mediaPlayer.isFullScreen()) {
        WindowUtil.scanForActivity(getContext()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        mediaPlayer.stopFullScreen();
        setPlayerState(IjkVideoView.PLAYER_NORMAL);
        return true;
    }
    return super.onBackPressed();
}
 
Example 47
Project: GitHub   File: BaseActivity.java   Source Code and License 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            //透明状态栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            //透明导航栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        }
        statusBarHeight = getStatusBarHeight();
        titleHeight=dp2px(this,50);
    }
 
Example 48
Project: TPlayer   File: VActivityManagerService.java   Source Code and License 5 votes vote down vote up
@Override
public int startActivities(Intent[] intents, String[] resolvedTypes, IBinder token, Bundle options, int userId) {
    synchronized (this) {
        ActivityInfo[] infos = new ActivityInfo[intents.length];
        for (int i = 0; i < intents.length; i++) {
            ActivityInfo ai = VirtualCore.get().resolveActivityInfo(intents[i], userId);
            if (ai == null) {
                return ActivityManagerCompat.START_INTENT_NOT_RESOLVED;
            }
            infos[i] = ai;

        }
        return mMainStack.startActivitiesLocked(userId, intents, infos, resolvedTypes, token, options);
    }
}
 
Example 49
Project: EZFilter   File: VideoOffscreenActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_video_offscreen);
    mRenderView = $(R.id.render_view);

    $(R.id.choose).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Matisse.from(VideoOffscreenActivity.this)
                    .choose(MimeType.of(MimeType.MP4), false)
                    .showSingleMediaType(true)
                    .maxSelectable(1)
                    .countable(false)
                    .gridExpectedSize(getResources().getDimensionPixelSize(R.dimen.grid_expected_size))
                    .restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
                    .thumbnailScale(0.85f)
                    .imageEngine(new PicassoEngine())
                    .forResult(REQUEST_CODE_CHOOSE);
        }
    });

    $(R.id.rotate).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mRenderView.setRotate90Degrees(mRenderView.getRotation90Degrees() + 1);
            mRenderView.requestLayout();
        }
    });
}
 
Example 50
Project: Edu   File: JCVideoPlayer.java   Source Code and License 5 votes vote down vote up
public void autoFullscreen(float x) {
    if (isCurrentJcvd()
            && currentState == CURRENT_STATE_PLAYING
            && currentScreen != SCREEN_WINDOW_FULLSCREEN
            && currentScreen != SCREEN_WINDOW_TINY) {
        if (x > 0) {
            JCUtils.getAppCompActivity(getContext()).setRequestedOrientation(
                    ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        } else {
            JCUtils.getAppCompActivity(getContext()).setRequestedOrientation(
                    ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
        }
        startWindowFullscreen();
    }
}
 
Example 51
Project: VirtualHook   File: PackageParserEx.java   Source Code and License 5 votes vote down vote up
public static ActivityInfo generateActivityInfo(VPackage.ActivityComponent a, int flags,
                                                PackageUserState state, int userId) {
    if (a == null) return null;
    if (!checkUseInstalledOrHidden(state, flags)) {
        return null;
    }
    // Make shallow copies so we can store the metadata safely
    ActivityInfo ai = new ActivityInfo(a.info);
    if ((flags & PackageManager.GET_META_DATA) != 0
            && (a.metaData != null)) {
        ai.metaData = a.metaData;
    }
    ai.applicationInfo = generateApplicationInfo(a.owner, flags, state, userId);
    return ai;
}
 
Example 52
Project: dkplayer   File: FullScreenIjkVideoView.java   Source Code and License 5 votes vote down vote up
/**
 * 直接开始全屏播放
 */
public void startFullScreenDirectly() {
    Activity activity = WindowUtil.scanForActivity(getContext());
    if (activity == null) return;
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    startFullScreen();
}
 
Example 53
Project: EmotionApp   File: EditEmotionActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    setContentView(R.layout.activity_edit_emotion);
    initView();
    initData();
}
 
Example 54
Project: buildAPKsApps   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);   
    requestWindowFeature(Window.FEATURE_NO_TITLE);
   
    mView = new GLSurfaceView(this);
    mView.setEGLContextClientVersion(2);
    mView.setRenderer(new GLLayer(this));
    
    setContentView(mView);
}
 
Example 55
Project: DroidPlugin   File: PluginPackageParser.java   Source Code and License 5 votes vote down vote up
public ActivityInfo getActivityInfo(ComponentName className, int flags) throws Exception {
    Object data;
    synchronized (mActivityObjCache) {
        data = mActivityObjCache.get(className);
    }
    if (data != null) {
        ActivityInfo activityInfo = mParser.generateActivityInfo(data, flags);
        fixApplicationInfo(activityInfo.applicationInfo);
        if (TextUtils.isEmpty(activityInfo.processName)) {
            activityInfo.processName = activityInfo.packageName;
        }
        return activityInfo;
    }
    return null;
}
 
Example 56
Project: SuperVideoPlayer   File: SuperPlayer.java   Source Code and License 5 votes vote down vote up
public SuperPlayer playInFullScreen(boolean fullScreenOnly) {
	this.fullScreenOnly = fullScreenOnly;
	if (fullScreenOnly) {
		activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
	} else {
		activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
	}
	updateFullScreenButton();
	return this;
}
 
Example 57
Project: letv   File: IApkManagerImpl.java   Source Code and License 5 votes vote down vote up
public ActivityInfo getReceiverInfo(ComponentName className, int flags) throws RemoteException {
    waitForReadyInner();
    try {
        if (getAndCheckCallingPkg(className.getPackageName()) != null) {
            enforcePluginFileExists();
            PluginPackageParser parser = (PluginPackageParser) this.mPluginCache.get(className.getPackageName());
            if (parser != null) {
                return parser.getReceiverInfo(className, flags);
            }
        }
    } catch (Exception e) {
        handleException(e);
    }
    return null;
}
 
Example 58
Project: springreplugin   File: ActivityInjector.java   Source Code and License 5 votes vote down vote up
/**
 * 填充一些必要的东西到Activity中
 *
 * @param activity     Activity对象
 * @param plugin       插件名
 * @param realActivity 真实的(非坑位的)Activity名字
 * @return 是否Inject成功
 */
public static boolean inject(Activity activity, String plugin, String realActivity) {
    // 根据传进的参数来获取ActivityInfo
    PluginInfo pi = RePluginOS.getPlugin(plugin, false);
    if (pi == null) {
        return false;
    }
    ComponentList cl = RePlugin.fetchComponentList(plugin);
    if (cl == null) {
        return false;
    }

    ActivityInfo ai = cl.getActivity(realActivity);
    return ai != null && inject(activity, ai, pi.getFrameworkVersion());
}
 
Example 59
Project: apps_small   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    SharedPreferences myPrefs = this.getSharedPreferences("com.alaskalinuxuser.sharedpref", Context.MODE_PRIVATE);
    myPrefs.edit().putString("myName", "AKLU").apply();

    String userName = myPrefs.getString("myName", "");

    Log.i("WJH", userName);

}
 
Example 60
Project: android-robocar   File: TiltControllerActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    setContentView(R.layout.activity_tilt_controller);
    ButterKnife.bind(this);

    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED);

    mToggleButton.setOnCheckedChangeListener(this);

    initNavigationDrawer();
}