Java Code Examples for android.content.pm.ActivityInfo

The following examples show how to use android.content.pm.ActivityInfo. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: MxVideoPlayer   Source File: MxVideoPlayer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void autoFullscreen(float x) {
    Log.i(TAG, "autoFullscreen: [" + this.hashCode() + "] ");
    if (isCurrentMediaListener()
            && mCurrentState == CURRENT_STATE_PLAYING
            && mCurrentScreen != SCREEN_WINDOW_FULLSCREEN
            && mCurrentScreen != SCREEN_WINDOW_TINY) {
        if (x > 0) {
            MxUtils.getAppComptActivity(getContext()).setRequestedOrientation(
                    ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        } else {
            MxUtils.getAppComptActivity(getContext()).setRequestedOrientation(
                    ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
        }
        startWindowFullscreen();
    }
}
 
Example 2
Source Project: CSipSimple   Source File: Theme.java    License: GNU General Public License v3.0 6 votes vote down vote up
public static HashMap<String, String> getAvailableThemes(Context ctxt){
	HashMap<String, String> result = new HashMap<String, String>();
	result.put("", ctxt.getResources().getString(R.string.app_name));
	
	PackageManager packageManager = ctxt.getPackageManager();
	Intent it = new Intent(SipManager.ACTION_GET_DRAWABLES);
	
	List<ResolveInfo> availables = packageManager.queryBroadcastReceivers(it, 0);
	Log.d(THIS_FILE, "We found " + availables.size() + "themes");
	for(ResolveInfo resInfo : availables) {
		Log.d(THIS_FILE, "We have -- "+resInfo);
		ActivityInfo actInfos = resInfo.activityInfo;
		ComponentName cmp = new ComponentName(actInfos.packageName, actInfos.name);
		String label = (String) actInfos.loadLabel(packageManager);
		if(TextUtils.isEmpty(label)) {
		    label = (String) resInfo.loadLabel(packageManager);
		}
		result.put(cmp.flattenToString(), label);
	}
	
	return result;
}
 
Example 3
Source Project: media-samples   Source File: MainActivityTest.java    License: Apache License 2.0 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 4
Source Project: ExoPlayer-Wrapper   Source File: RecyclerViewAdapter.java    License: Apache License 2.0 6 votes vote down vote up
public void changeToNormalScreen() {
    ((Activity) mTextView.getContext()).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    mLayouManager.enableScroll();

    RecyclerView.LayoutParams layoutParamsItem = (RecyclerView.LayoutParams) mView.getLayoutParams();
    layoutParamsItem.height = mItemHeight;
    layoutParamsItem.width = mItemWidth;
    layoutParamsItem.topMargin = mItemTopMargin;
    layoutParamsItem.bottomMargin = mItemBottomMargin;
    layoutParamsItem.leftMargin = mItemLeftMargin;
    layoutParamsItem.rightMargin = mItemRightMargin;
    mView.setLayoutParams(layoutParamsItem);

    ConstraintLayout.LayoutParams videoParams = (ConstraintLayout.LayoutParams) mExoPlayerView.getLayoutParams();
    videoParams.height = mVideoHeight;
    videoParams.width = mVideoWidth;
    //videoParams.bottomToBottom = 0;
    mExoPlayerView.setLayoutParams(videoParams);

    mTextView.setVisibility(View.VISIBLE);
}
 
Example 5
Source Project: moviedb-android   Source File: GalleryPreviewDetail.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (activity.getSupportActionBar() != null && activity.getSupportActionBar().isShowing())
        activity.getSupportActionBar().hide();

    if (Build.VERSION.SDK_INT >= 19) {
        mUIFlag ^= View.SYSTEM_UI_FLAG_IMMERSIVE;
    }

    if (this.isVisible()) {
        // Check orientation and lock to portrait if we are on phone
        if (getResources().getBoolean(R.bool.portrait_only)) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
        }
    }
    imageLoader.displayImage(currImg, mImageView, options, imageLoadingListener);
}
 
Example 6
Source Project: FlowGeek   Source File: BaseActivity.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // 主题选择
    SharedPreferences preferences = SharePreferenceManager.getApplicationSetting(this);

    int theme = preferences.getInt(ApplicationSetting.KEY_THEME, ApplicationTheme.LIGHT.getKey());

    if (theme == ApplicationTheme.LIGHT.getKey()){
        setTheme(ApplicationTheme.LIGHT.getResId());
    }else if(theme == ApplicationTheme.DARK.getKey()){
        setTheme(ApplicationTheme.DARK.getResId());
    }

    // 方向锁定
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
 
Example 7
Source Project: Neptune   Source File: InstrActivityProxy1.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void setTheme(int resId) {
    if (VersionUtils.hasNougat()) {
        String[] temp = parsePkgAndClsFromIntent();
        if (mNeedUpdateConfiguration && (temp != null || mLoadedApk != null)) {
            if (null != temp && temp.length == 2) {
                tryToInitPluginLoadApk(temp[0]);
            }
            if (mLoadedApk != null && temp != null) {
                ActivityInfo actInfo = mLoadedApk.getActivityInfoByClassName(temp[1]);
                if (actInfo != null) {
                    int resTheme = actInfo.getThemeResource();
                    if (mNeedUpdateConfiguration) {
                        changeActivityInfo(InstrActivityProxy1.this, temp[0], actInfo);
                        super.setTheme(resTheme);
                        mNeedUpdateConfiguration = false;
                        return;
                    }
                }
            }
        }
        super.setTheme(resId);
    } else {
        getTheme().applyStyle(resId, true);
    }
}
 
Example 8
Source Project: science-journal   Source File: NoteTakingActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  permissions = new RxPermissions(this);
  setContentView(R.layout.activity_experiment_layout);

  Resources resources = getResources();
  boolean isTablet = resources.getBoolean(R.bool.is_tablet);
  if (!isTablet) {
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  }
  boolean isLandscape =
      resources.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
  isTwoPane = isTablet && isLandscape;

  appAccount = WhistlePunkApplication.getAccount(this, getIntent(), EXTRA_ACCOUNT_KEY);
  experimentId = getIntent().getStringExtra(EXTRA_EXPERIMENT_ID);
  exp = whenSelectedExperiment(experimentId, getDataController());

  AppSingleton.getInstance(this)
      .whenLabelsAdded(appAccount)
      .takeUntil(destroyed.happens())
      .subscribe(event -> onLabelAdded(event.getTrialId(), event.getLabel()));
}
 
Example 9
boolean isStubInfoUsed(ActivityInfo stubInfo, ActivityInfo targetInfo, String stubProcessName) {
    for (Integer pid : items.keySet()) {
        ProcessItem item = items.get(pid);
        if (TextUtils.equals(item.stubProcessName, stubProcessName)) {
            Set<ActivityInfo> infos = item.activityInfosMap.get(stubInfo.name);
            if (infos != null && infos.size() > 0) {
                for (ActivityInfo info : infos) {
                    if (TextUtils.equals(info.name, targetInfo.name) && TextUtils.equals(info.packageName, targetInfo.packageName)) {
                        return false;
                    }
                }
                return true;
            }
            return false;
        }
    }
    return false;
}
 
Example 10
Source Project: Ency   Source File: EyepetizerDetailActivity.java    License: Apache License 2.0 6 votes vote down vote up
private void initVideoPlayer() {
    LinkedHashMap map = new LinkedHashMap();
    if (videoBean.getContent().getData().getPlayInfo().size() == 3) {
        map.put("流畅", videoBean.getContent().getData().getPlayInfo().get(0).getUrl());
        map.put("标清", videoBean.getContent().getData().getPlayInfo().get(1).getUrl());
        map.put("高清", videoBean.getContent().getData().getPlayInfo().get(2).getUrl());
    } else if (videoBean.getContent().getData().getPlayInfo().size() == 2) {
        map.put("标清", videoBean.getContent().getData().getPlayInfo().get(0).getUrl());
        map.put("高清", videoBean.getContent().getData().getPlayInfo().get(1).getUrl());
    } else if (videoBean.getContent().getData().getPlayInfo().size() == 1) {
        map.put("高清", videoBean.getContent().getData().getPlayInfo().get(0).getUrl());
    }
    Object[] objects = new Object[3];
    objects[0] = map;
    objects[1] = false;//looping
    objects[2] = new HashMap<>();
    videoPlayerStandard.backButton.setVisibility(View.VISIBLE);
    videoPlayerStandard.titleTextView.setTextSize(16);
    videoPlayerStandard.setUp(objects, 0,
            JZVideoPlayerStandard.SCREEN_WINDOW_NORMAL, videoBean.getContent().getData().getTitle());
    ImageLoader.loadAllNoPlaceHolder(mContext, videoBean.getContent().getData().getCover().getFeed()
            ,videoPlayerStandard.thumbImageView);
    JZVideoPlayer.FULLSCREEN_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
    JZVideoPlayer.NORMAL_ORIENTATION = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
}
 
Example 11
private void addActivityInfo(String stubActivityName, ActivityInfo info) {
    if (!targetActivityInfos.containsKey(info.name)) {
        targetActivityInfos.put(info.name, info);
    }

    //pkgs
    if (!pkgs.contains(info.packageName)) {
        pkgs.add(info.packageName);
    }

    //stub map to activity info
    Set<ActivityInfo> list = activityInfosMap.get(stubActivityName);
    if (list == null) {
        list = new TreeSet<ActivityInfo>(sComponentInfoComparator);
        list.add(info);
        activityInfosMap.put(stubActivityName, list);
    } else {
        list.add(info);
    }
}
 
Example 12
/**
 * Gets the activity or application icon for an activity.
 *
 * @param component Name of an activity.
 * @return A drawable, or {@code null} if neither the acitivy or the application
 *         have an icon set.
 */
private Drawable getActivityIcon(ComponentName component) {
    PackageManager pm = mContext.getPackageManager();
    final ActivityInfo activityInfo;
    try {
        activityInfo = pm.getActivityInfo(component, PackageManager.GET_META_DATA);
    } catch (NameNotFoundException ex) {
        Log.w(LOG_TAG, ex.toString());
        return null;
    }
    int iconId = activityInfo.getIconResource();
    if (iconId == 0) return null;
    String pkg = component.getPackageName();
    Drawable drawable = pm.getDrawable(pkg, iconId, activityInfo.applicationInfo);
    if (drawable == null) {
        Log.w(LOG_TAG, "Invalid icon resource " + iconId + " for "
                + component.flattenToShortString());
        return null;
    }
    return drawable;
}
 
Example 13
Source Project: HeroVideo-master   Source File: MediaPlayer.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
    if (v.getId() == R.id.app_video_fullscreen) {
        toggleFullScreen();
    } else if (v.getId() == R.id.app_video_play) {
        doPauseResume();
        show(defaultTimeout);
    }else if (v.getId() == R.id.app_video_replay_icon) {
        videoView.seekTo(0);
        videoView.start();
        doPauseResume();
    } else if (v.getId() == R.id.app_video_finish) {
        if (!fullScreenOnly && !portrait) {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        } else {
            activity.finish();
        }
    }
}
 
Example 14
Source Project: android_9.0.0_r45   Source File: PreferredComponent.java    License: Apache License 2.0 6 votes vote down vote up
/** Returns components from mSetPackages that are present in query. */
public ComponentName[] discardObsoleteComponents(List<ResolveInfo> query) {
    if (mSetPackages == null || query == null) {
        return new ComponentName[0];
    }
    final int NQ = query.size();
    final int NS = mSetPackages.length;
    ArrayList<ComponentName> aliveComponents = new ArrayList<>();
    for (int i = 0; i < NQ; i++) {
        ResolveInfo ri = query.get(i);
        ActivityInfo ai = ri.activityInfo;
        for (int j = 0; j < NS; j++) {
            if (mSetPackages[j].equals(ai.packageName) && mSetClasses[j].equals(ai.name)) {
                aliveComponents.add(new ComponentName(mSetPackages[j], mSetClasses[j]));
                break;
            }
        }
    }
    return aliveComponents.toArray(new ComponentName[aliveComponents.size()]);
}
 
Example 15
Source Project: zhangshangwuda   Source File: SuggestionsAdapter.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Gets the activity or application icon for an activity.
 *
 * @param component Name of an activity.
 * @return A drawable, or {@code null} if neither the acitivy or the application
 *         have an icon set.
 */
private Drawable getActivityIcon(ComponentName component) {
    PackageManager pm = mContext.getPackageManager();
    final ActivityInfo activityInfo;
    try {
        activityInfo = pm.getActivityInfo(component, PackageManager.GET_META_DATA);
    } catch (NameNotFoundException ex) {
        Log.w(LOG_TAG, ex.toString());
        return null;
    }
    int iconId = activityInfo.getIconResource();
    if (iconId == 0) return null;
    String pkg = component.getPackageName();
    Drawable drawable = pm.getDrawable(pkg, iconId, activityInfo.applicationInfo);
    if (drawable == null) {
        Log.w(LOG_TAG, "Invalid icon resource " + iconId + " for "
                + component.flattenToShortString());
        return null;
    }
    return drawable;
}
 
Example 16
Source Project: GiraffePlayer2   Source File: PlayerActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.giraffe_player_activity);
    Intent intent = getIntent();
    if (intent == null) {
        finish();
        return;
    }
    VideoInfo videoInfo = intent.getParcelableExtra("__video_info__");
    if (videoInfo == null) {
        finish();
        return;
    }
    if(videoInfo.isFullScreenOnly()){
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    }
    PlayerManager.getInstance().releaseByFingerprint(videoInfo.getFingerprint());
    VideoView videoView = findViewById(R.id.video_view);
    videoView.videoInfo(videoInfo);
    PlayerManager.getInstance().getPlayer(videoView).start();
}
 
Example 17
Source Project: braintree_android   Source File: ManifestValidator.java    License: MIT License 6 votes vote down vote up
@Nullable
public static ActivityInfo getActivityInfo(Context context, Class klass) {
    try {
        PackageInfo packageInfo =
                context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES);
        ActivityInfo[] activities = packageInfo.activities;
        if (activities != null) {
            for (ActivityInfo activityInfo : activities) {
                if (activityInfo.name.equals(klass.getName())) {
                    return activityInfo;
                }
            }
        }
    } catch (NameNotFoundException ignored) {}

    return null;
}
 
Example 18
Source Project: FastLib   Source File: ActivityControlImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 设置屏幕方向--注意targetSDK设置27以上不能设置windowIsTranslucent=true属性不然应用直接崩溃-强烈建议手机应用锁定竖屏
 * 错误为 Only fullscreen activities can request orientation
 * 默认自动 ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
 * 竖屏 ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
 * 横屏 ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
 * {@link ActivityInfo#screenOrientation ActivityInfo.screenOrientation}
 *
 * @param activity
 */
public void setActivityOrientation(Activity activity) {
    //全局控制屏幕横竖屏
    //先判断xml没有设置屏幕模式避免将开发者本身想设置的覆盖掉
    if (activity.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
        try {
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        } catch (Exception e) {
            e.printStackTrace();
            LoggerManager.e(TAG, "setRequestedOrientation:" + e.getMessage());
        }
    }
}
 
Example 19
private void handleStaticBroadcastAsUser(int vuid, ActivityInfo info, Intent intent,
                                         PendingResultData result) {
    synchronized (this) {
        ProcessRecord r = findProcessLocked(info.processName, vuid);
        if (BROADCAST_NOT_STARTED_PKG && r == null) {
            r = startProcessIfNeedLocked(info.processName, getUserId(vuid), info.packageName);
        }
        if (r != null && r.appThread != null) {
            performScheduleReceiver(r.client, vuid, info, intent,
                    result);
        }
    }
}
 
Example 20
Source Project: Phantom   Source File: PluginContext.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 将宿主Activity的一些变量值赋值给插件Activity,使插件Activity与宿主占位Activity具有相同的状态
 */
private void attachStatus(PluginInterceptActivity pluginActivity) throws IllegalAccessException {
    for (Field field : ACTIVITY_FIELDS) {
        int modifiers = field.getModifiers();
        if (Modifier.isStatic(modifiers)
                || Modifier.isFinal(modifiers)
                || Modifier.isVolatile(modifiers)
                || Modifier.isTransient(modifiers)) {
            continue;
        }

        field.setAccessible(true);
        Object fieldsValue = field.get(mBaseContext);
        field.set(pluginActivity, fieldsValue);
    }

    pluginActivity.attachBaseContext(mBaseContext);

    //设置输入法模式
    if (!mTargetClass.getName().equals(PluginInterceptActivity.class.getName())) {
        ActivityInfo info = mPluginInfo.getActivityInfo(
                new ComponentName(mPluginInfo.packageName, mTargetClass.getName()));
        if (null != info && info.softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) {
            mBaseContext.getWindow().setSoftInputMode(info.softInputMode);
        }
    }
}
 
Example 21
Source Project: Roid-Library   Source File: RLSysUtil.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * @param context
 * @param receiverClass
 * @param key
 * @return
 */
public static String getReceiverMetaData(Context context, Class<?> receiverClass, String key) {
    String data = null;
    ActivityInfo info = null;
    try {
        info = context.getPackageManager().getReceiverInfo(new ComponentName(context, receiverClass),
                PackageManager.GET_META_DATA);
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }
    if (info != null && info.metaData != null && info.metaData.get(key) != null) {
        data = info.metaData.get(key).toString();
    }
    return data;
}
 
Example 22
Source Project: 365browser   Source File: VrShellDelegate.java    License: Apache License 2.0 5 votes vote down vote up
private void enterVrWithCorrectWindowMode(final boolean tentativeWebVrMode) {
    if (mInVr) return;
    if (mNativeVrShellDelegate == 0) {
        cancelPendingVrEntry();
        return;
    }
    if (!createVrShell()) {
        maybeSetPresentResult(false);
        mVrDaydreamApi.launchVrHomescreen();
        cancelPendingVrEntry();
        return;
    }
    mVrClassesWrapper.setVrModeEnabled(mActivity, true);
    mInVr = true;
    // Lock orientation to landscape after enter VR.
    mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

    addVrViews();
    boolean webVrMode = mRequestedWebVr || tentativeWebVrMode;
    mVrShell.initializeNative(
            mActivity.getActivityTab(), webVrMode, mActivity instanceof CustomTabActivity);
    mVrShell.setWebVrModeEnabled(webVrMode);

    // We're entering VR, but not in WebVr mode.
    mVrBrowserUsed = !webVrMode;

    // onResume needs to be called on GvrLayout after initialization to make sure DON flow works
    // properly.
    if (!mPaused) mVrShell.resume();

    maybeSetPresentResult(true);
    mVrShell.getContainer().setOnSystemUiVisibilityChangeListener(this);
    removeOverlayView();
}
 
Example 23
/**
 * Intent stores this info internally using {@link CompenentName}, so we're
 * using that as the method for setting it. It can also be set using
 * {@link Intent#setClassName(String, String) setClassName()}, and it is
 * then translated to a {@link ComponentName}.
 *
 * @param packageName
 * @return
 */
private Intent getLauncherIntent(String packageName) {
    Intent i = new Intent(Intent.ACTION_MAIN);
    i.setPackage(packageName);
    i.addCategory(Intent.CATEGORY_LAUNCHER);
    ResolveInfo resolveInfo = pm.resolveActivity(i, PackageManager.MATCH_DEFAULT_ONLY);
    if (TextUtils.isEmpty(packageName) || resolveInfo == null)
        return i;
    ActivityInfo activityInfo = resolveInfo.activityInfo;
    assertEquals(activityInfo.packageName, packageName);
    return new Intent(Intent.ACTION_MAIN)
            .setComponent(new ComponentName(packageName, activityInfo.name));
}
 
Example 24
Source Project: imsdk-android   Source File: VideoPlayActivity.java    License: MIT License 5 votes vote down vote up
@Override
    public void onConfigurationChanged(Configuration newConfig) {
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);  //设置横屏
//            Toast.makeText(VideoPlayActivity.this,"当前屏幕为横屏",Toast.LENGTH_SHORT).show();
        } else {
//            Toast.makeText(VideoPlayActivity.this, "当前屏幕为竖屏", Toast.LENGTH_SHORT).show();
            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//设置竖屏

        }
        super.onConfigurationChanged(newConfig);

    }
 
Example 25
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 26
Source Project: DKVideoPlayer   Source File: BaseVideoController.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 竖屏
 */
protected void onOrientationPortrait(Activity activity) {
    //屏幕锁定的情况
    if (mIsLocked) return;
    //没有开启设备方向监听的情况
    if (!mEnableOrientation) return;

    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    mControlWrapper.stopFullScreen();
}
 
Example 27
Source Project: YiBo   Source File: InitAppTask.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onPostExecute(Void result) {
	super.onPostExecute(result);

	context.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
	if (shejiaomao.isAutoScreenOrientation()) {
           context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);
	} else {
		context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
	}

	context.updateContentView(null);

	if (!NetUtil.isConnect(context)) {
		showNetSettingsDialog();
	}

	if (GlobalVars.IS_MOBILE_NET_UPDATE_VERSION) {
		UmengUpdateAgent.setUpdateOnlyWifi(false);
	}
	if (shejiaomao.isCheckNewVersionOnStartup()) {
		//检查更新
		UmengUpdateAgent.update(context);
	}

	//清除缓存
	StatusesCleanTask statusCleanTask = new StatusesCleanTask(context);
	statusCleanTask.execute();
	ImageCacheQuickCleanTask imageCacheTask = new ImageCacheQuickCleanTask(context);
	imageCacheTask.execute();
}
 
Example 28
Source Project: Viewer   Source File: PlayRtspVideoView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onResume()
{
	super.onResume();
	setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
	if (isPlaying)
	{
		if(null != aThread){
			aThread.resumeAudioPlayback();
		}
		media.resumeStream(vodStreamId);
	}
}
 
Example 29
Source Project: springreplugin   Source File: PmHostSvc.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public List<ActivityInfo> queryPluginsReceiverList(Intent intent) {
    List<ActivityInfo> infos = new ArrayList<>();

    if (intent == null) {
        return infos;
    }

    String action = intent.getAction();
    if (TextUtils.isEmpty(action)) {
        return infos;
    }

    Map<String, List<String>> pluginReceiverMap = mActionPluginComponents.get(action);
    if (pluginReceiverMap.isEmpty()) {
        return infos;
    }

    // 根据 action 找到插件的 Receivers
    for (Map.Entry<String, List<String>> entry : pluginReceiverMap.entrySet()) {
        String plugin = entry.getKey();

        // 根据插件名称,找到所有 Receiver
        ComponentList list = mPluginMgr.mLocal.queryPluginComponentList(plugin);
        if (list != null) {

            Map<String, ActivityInfo> receiversMap = list.getReceiverMap();
            if (receiversMap != null) {
                infos.addAll(receiversMap.values());
            }
        }
    }
    return infos;
}
 
Example 30
Source Project: motion   Source File: ParallaxActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    inflater.inflate(R.menu.parallax, menu);

    // Add parallax toggle
    final Switch mParallaxToggle = new Switch(getActivity());
    mParallaxToggle.setPadding(0, 0, (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, getResources().getDisplayMetrics()), 0);
    mParallaxToggle.setChecked(mParallaxSet);
    mParallaxToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (isChecked) {
                mBackground.registerSensorManager();
            } else {
                mBackground.unregisterSensorManager();
            }

            mParallaxSet = isChecked;
        }
    });
    MenuItem switchItem = menu.findItem(R.id.action_parallax);
    if (switchItem != null)
        switchItem.setActionView(mParallaxToggle);

    // Set lock/ unlock orientation text
    if (mPortraitLock) {
        getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        MenuItem orientationItem = menu.findItem(R.id.action_portrait);
        if (orientationItem != null)
            orientationItem.setTitle(R.string.action_unlock_portrait);
    }
}