android.support.v4.view.WindowCompat Java Examples

The following examples show how to use android.support.v4.view.WindowCompat. 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 check out the related API usage on the sidebar.
Example #1
Source File: ConversationActivity.java    From Silence with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle state, @NonNull MasterSecret masterSecret) {
  Log.w(TAG, "onCreate()");
  this.masterSecret = masterSecret;
  this.activeSubscriptions = SubscriptionManagerCompat.from(this).getActiveSubscriptionInfoList();

  supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
  setContentView(R.layout.conversation_activity);

  fragment = initFragment(R.id.fragment_content, new ConversationFragment(),
                          masterSecret, dynamicLanguage.getCurrentLocale());

  initializeReceivers();
  initializeActionBar();
  initializeViews();
  initializeResources();
  initializeSecurity();
  updateRecipientPreferences();
  initializeDraft();
}
 
Example #2
Source File: ActionBarMechanics.java    From V.FlyoutTest with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // The Action Bar is a window feature. The feature must be requested
    // before setting a content view. Normally this is set automatically
    // by your Activity's theme in your manifest. The provided system
    // theme Theme.WithActionBar enables this for you. Use it as you would
    // use Theme.NoTitleBar. You can add an Action Bar to your own themes
    // by adding the element <item name="android:windowActionBar">true</item>
    // to your style definition.
    supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
}
 
Example #3
Source File: ImageAutoPlayActivity.java    From android-project-wo2b with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
	supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
	super.onCreate(savedInstanceState);
	setContentView(R.layout.wrapper_cn_image_autoplay);
	
	Intent intent = getIntent();
	mImageList = intent.getStringArrayListExtra(EXTRA_IMAGE_LIST);
	mTitle = intent.getStringExtra(EXTRA_TITLE);
	mCacheDir = intent.getStringExtra(EXTRA_DIRECTORY);
	mPeriod = intent.getIntExtra(EXTRA_PERIOD, SCROLL_PERIOD_DEFAULT);
	mPosition = intent.getIntExtra(EXTRA_POSITION, 0);
	// 默认进行图片缓存
	mCacheOnDisc = intent.getBooleanExtra(EXTRA_CACHE_ON_DISC, true);
	if (mPeriod <= 0)
	{
		mPeriod = SCROLL_PERIOD_DEFAULT;
	}
	if (TextUtils.isEmpty(mCacheDir))
	{
		// 没有地址不进行缓存, 后续看看有没有需要考虑没有地址使用默认地址的情况
		// 原则上, 在设计时, 都提供存储地址应该比较合理
		mCacheOnDisc = false;
	}

	if (TextUtils.isEmpty(mTitle))
	{
		int titleId = getResources().getIdentifier("app_name", "string", this.getPackageName());
		mTitle = getString(titleId);
	}
	getSupportActionBar().show();
	getSupportActionBar().setTitle(mTitle);
	//getSupportActionBar().setSubtitle(title + "sub");
	getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg_translucent));
	
	getUiHandler().postDelayed(new Runnable()
	{
		
		@Override
		public void run()
		{
			getSupportActionBar().hide();
		}
	}, ACTIONBAR_HIDE_DELAYED);
	
	
	mSaveImageOptions = new SaveImageOptions.Builder()
		.medule("Image_AutoPlay")
		.extraDir(mCacheDir)
		.build();

	mDisplayImageOptions = new DisplayImageOptions.Builder()
		.showImageForEmptyUri(R.drawable.warn_image_empty)
		.showImageOnFail(R.drawable.warn_image_error)
		.cacheInMemory(true)
		.cacheOnDisc(mCacheOnDisc)
		.considerExifParams(true)
		.bitmapConfig(Bitmap.Config.RGB_565)
		.saveImageOptions(mSaveImageOptions)
		.build();

	mAutoScrollViewPager = (AutoScrollPoster) findViewById(R.id.rocky_viewpager);
	mAutoScrollViewPager.setDisplayImageOptions(mDisplayImageOptions);
	mAutoScrollViewPager.addItems(mImageList);
	mAutoScrollViewPager.startAutoScroll(mPeriod, mPosition);
	mAutoScrollViewPager.setOnItemViewClickListener(new OnItemViewClickListener()
	{
		
		@Override
		public void onItemViewClick(View view, Object item)
		{
			if (getSupportActionBar().isShowing())
			{
				getSupportActionBar().hide();
			}
			else
			{
				getSupportActionBar().show();
			}
		}
	});
}
 
Example #4
Source File: ImageAutoPlayImageSwitcherActivity.java    From android-project-wo2b with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
	supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
	super.onCreate(savedInstanceState);
	setContentView(R.layout.wrapper_cn_image_autoplay);

	Intent intent = getIntent();
	mImageList = intent.getStringArrayListExtra(EXTRA_IMAGE_LIST);
	mTitle = intent.getStringExtra(EXTRA_TITLE);
	mCacheDir = intent.getStringExtra(EXTRA_DIRECTORY);
	mPeriod = intent.getIntExtra(EXTRA_PERIOD, SCROLL_PERIOD_DEFAULT);
	mPosition = intent.getIntExtra(EXTRA_POSITION, 0);
	// 默认进行图片缓存
	mCacheOnDisc = intent.getBooleanExtra(EXTRA_CACHE_ON_DISC, true);
	if (mPeriod <= 0)
	{
		mPeriod = SCROLL_PERIOD_DEFAULT;
	}
	if (TextUtils.isEmpty(mCacheDir))
	{
		// 没有地址不进行缓存, 后续看看有没有需要考虑没有地址使用默认地址的情况
		// 原则上, 在设计时, 都提供存储地址应该比较合理
		mCacheOnDisc = false;
	}

	if (TextUtils.isEmpty(mTitle))
	{
		int titleId = getResources().getIdentifier("app_name", "string", this.getPackageName());
		mTitle = getString(titleId);
	}
	getSupportActionBar().show();
	getSupportActionBar().setTitle(mTitle);
	//getSupportActionBar().setSubtitle(title + "sub");
	getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg_translucent));
	
	getUiHandler().postDelayed(new Runnable()
	{

		@Override
		public void run()
		{
			getSupportActionBar().hide();
		}
	}, ACTIONBAR_HIDE_DELAYED);
	
	
	SaveImageOptions saveOptions = new SaveImageOptions.Builder()
		.medule("Image_AutoPlay")
		.extraDir(mCacheDir)
		.build();

	DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
		.showImageForEmptyUri(R.drawable.warn_image_empty)
		.showImageOnFail(R.drawable.warn_image_error)
		.cacheInMemory(true)
		.cacheOnDisc(mCacheOnDisc)
		.considerExifParams(true)
		.bitmapConfig(Bitmap.Config.RGB_565)
		.saveImageOptions(saveOptions)
		.build();

	imageSwitcher = (XImageSwitcher) findViewById(R.id.imageSwitcher);
	imageSwitcher.setFactory(this);
	imageSwitcher.setOnClickListener(this);
	imageSwitcher.addImagePath(mImageList);
	imageSwitcher.setDisplayImageOptions(displayImageOptions);
	imageSwitcher.startAutoScroll(mPeriod, mPosition);
}
 
Example #5
Source File: ImageViewerActivity.java    From android-project-wo2b with Apache License 2.0 4 votes vote down vote up
public void onCreate(Bundle savedInstanceState)
{
	//getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
	supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
	super.onCreate(savedInstanceState);
	setContentView(R.layout.image_viewer);
	
	getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg_translucent));
	

	final long useDayCount = XPreferenceManager.getUseDayCount();
	if (useDayCount <= NOTICE_MAX || useDayCount % NOTICE_CYCLE == 0)
	{
		if (!getSupportActionBar().isShowing())
		{
			getSupportActionBar().show();
		}
	}
	
	Bundle bundle = getIntent().getExtras();
	PhotoInfoSet photoInfoSet = (PhotoInfoSet) bundle.getSerializable(RockyIntent.EXTRA_IMAGE_SET);
	int pagerPosition = bundle.getInt(RockyIntent.EXTRA_POSITION, 0);
	mExtraDirectory = bundle.getString(RockyIntent.EXTRA_DIRECTORY);
	String title = photoInfoSet.getAlbumname();
	getSupportActionBar().setTitle(title);
	//getToolbar().setBackgroundResource(R.drawable.actionbar_bg_translucent);
	
	mPhotoList = photoInfoSet.getData();
	
	// boolean isCacheOnDisc = true;
	if (TextUtils.isEmpty(mExtraDirectory))
	{
		// 没有缓存路径, 不进行缓存.
		mCacheOnDisc = false;
	}

	if (savedInstanceState != null)
	{
		pagerPosition = savedInstanceState.getInt(STATE_POSITION);
	}

	SaveImageOptions saveOptions = new SaveImageOptions.Builder()
		.medule("IMAGE_VIEWER")
		.extraDir(mExtraDirectory)
		.build();

	mWallpaperBaseUri = Uri.parse("file://" + new AppCacheFactory().getWallpaper());
	mCacheDir = "file://" + mImageLoader.getDiscCache().getExtraDir().toString() + "/" + mExtraDirectory;
	
	mOptions = new DisplayImageOptions.Builder()
		.showImageForEmptyUri(R.drawable.warn_image_empty)
		.showImageOnFail(R.drawable.warn_image_error)
		.resetViewBeforeLoading(true)
		.cacheOnDisc(mCacheOnDisc)
		.imageScaleType(ImageScaleType.EXACTLY)
		.bitmapConfig(Bitmap.Config.RGB_565)
		.considerExifParams(true)
		.displayer(new FadeInBitmapDisplayer(300))
		.saveImageOptions(saveOptions)
		.build();
	
	mFavoriteView = (ImageView) findViewById(R.id.favorite_tips_iv);
	mFavoriteView.setVisibility(View.GONE);
	mPullToRefreshViewPager = (PullToRefreshViewPager) findViewById(R.id.pull_refresh_viewpager);
	mViewPager = mPullToRefreshViewPager.getRefreshableView();
	mViewPager.setAdapter(new ImagePagerAdapter(mPhotoList));
	mViewPager.setCurrentItem(pagerPosition);
	
	initView();
}
 
Example #6
Source File: MainActivity.java    From AntennaPodSP with MIT License 4 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    setTheme(UserPreferences.getTheme());
    super.onCreate(savedInstanceState);
    StorageUtils.checkStorageAvailability(this);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setCustomView(R.layout.abs_layout);
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
        getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.color.actionbar_gray));
    }

    setContentView(R.layout.main);
    slidingUpPanelLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
    slidingUpPanelLayout.setPanelSlideListener(panelSlideListener);
    slidingUpPanelLayout.setShadowDrawable(getResources().getDrawable(com.sothree.slidinguppanel.library.R.drawable.above_shadow));

    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    int playerInitialState = ExternalPlayerFragment.ARG_INIT_ANCHORED;
    if (savedInstanceState != null && savedInstanceState.getBoolean(SAVED_STATE_ACTION_BAR_HIDDEN)) {
        getSupportActionBar().hide();
        slidingUpPanelLayout.expandPane();
        playerInitialState = ExternalPlayerFragment.ARG_INIT_EPXANDED;
    }

    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fT = fragmentManager.beginTransaction();
    EpisodesFragment epf = (EpisodesFragment) fragmentManager.findFragmentById(R.id.main_view);
    if (epf == null) {
        long feedID = getIntent().getLongExtra(ARG_FEED_ID, 1L);
        epf = EpisodesFragment.newInstance(feedID);
    }
    fT.replace(R.id.main_view, epf);
    externalPlayerFragment = ExternalPlayerFragment.newInstance(playerInitialState);
    fT.replace(R.id.player_view, externalPlayerFragment);
    fT.commit();

    slidingUpPanelLayout.post(new Runnable() {
        @Override
        public void run() {
            slidingUpPanelLayout.hidePane();
        }
    });

    SPAUtil.askForPodcatcherInstallation(this);
}