Java 类android.support.v4.view.WindowCompat 实例源码

项目:PeSanKita-android    文件:ConversationActivity.java   
@Override
protected void onCreate(Bundle state, @NonNull MasterSecret masterSecret) {
  Log.w(TAG, "onCreate()");
  this.masterSecret = masterSecret;

  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(false, isDefaultSms).addListener(new AssertedSuccessListener<Boolean>() {
    @Override
    public void onSuccess(Boolean result) {
      initializeDraft();
    }
  });
}
项目:Cable-Android    文件:ConversationActivity.java   
@Override
protected void onCreate(Bundle state, @NonNull MasterSecret masterSecret) {
  Log.w(TAG, "onCreate()");
  this.masterSecret = masterSecret;

  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(false, isDefaultSms).addListener(new AssertedSuccessListener<Boolean>() {
    @Override
    public void onSuccess(Boolean result) {
      initializeProfiles();
      initializeDraft();
    }
  });
}
项目:Silence    文件:ConversationActivity.java   
@Override
protected void onCreate(Bundle state, @NonNull MasterSecret masterSecret) {
  Log.w(TAG, "onCreate()");
  this.masterSecret = masterSecret;

  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();
}
项目:gloomy-dungeons-2    文件:ActionBarActivityDelegateBase.java   
@Override
public boolean supportRequestWindowFeature(int featureId) {
    switch (featureId) {
        case WindowCompat.FEATURE_ACTION_BAR:
            mHasActionBar = true;
            return true;
        case WindowCompat.FEATURE_ACTION_BAR_OVERLAY:
            mOverlayActionBar = true;
            return true;
        case Window.FEATURE_PROGRESS:
            mFeatureProgress = true;
            return true;
        case Window.FEATURE_INDETERMINATE_PROGRESS:
            mFeatureIndeterminateProgress = true;
            return true;
        default:
            return mActivity.requestWindowFeature(featureId);
    }
}
项目:lastfm-for-android    文件:AlbumActivity.java   
protected void initHelper() {
    getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final FadingActionBarHelper helper = new FadingActionBarHelper();
    mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url,
            null);
    helper.contentLayout(R.layout.layout_artist);
    helper.actionBarBackground(R.drawable.ab_solid_lastfm);
    helper.headerView(mUrlImageView);

    final View v = helper.createView(this);
    mUrlImageView.getLayoutParams().height = (int) (160 * getResources()
            .getDisplayMetrics().density + 0.5f);
    setContentView(v);
    helper.initActionBar(this);
}
项目:Ramadan    文件:TopicsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        topicTitle = extras.getString(Constants.topic.EXTRA_TITLE);
        iconDrawableId = extras.getInt(Constants.topic.EXTRA_ICON_ID);
        topicResId = extras.getInt(Constants.topic.EXTRA_DATA_FILE);
    }

    actionBar = getSupportActionBar();
    actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.AB_White_Ramadan)));
    actionBar.setTitle(Utilities.getBanglaSpannableString(topicTitle, this));
    actionBar.setIcon(getResources().getDrawable(iconDrawableId));
    actionBar.setDisplayShowHomeEnabled(true);

    setContentView(R.layout.activity_topics);
}
项目:Ramadan    文件:SaomVongerKaronActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        topicTitle = extras.getString(Constants.topic.EXTRA_TITLE);
        iconDrawableId = extras.getInt(Constants.topic.EXTRA_ICON_ID);
        topicResId = extras.getInt(Constants.topic.EXTRA_DATA_FILE);
    }

    actionBar = getSupportActionBar();
    actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.AB_Green_Ramadan)));
    actionBar.setTitle(Utilities.getBanglaSpannableString(topicTitle, this));
    actionBar.setIcon(getResources().getDrawable(iconDrawableId));
    actionBar.setDisplayShowHomeEnabled(true);

    setContentView(R.layout.activity_saom_vonger_karon);
}
项目:AcFun-Area63    文件:CommentsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);
    aid = getIntent().getIntExtra("aid", 0);
    if (aid == 0)
        return;
    setContentView(R.layout.activity_comments);
    MobclickAgent.onEvent(this, "view_comment");
    ActionBar ab = getSupportActionBar();

    ab.setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_trans));
    mKeyboard = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    ActionBarUtil.setXiaomiFilterDisplayOptions(ab, false);
    ab.setTitle("ac" + aid + " / 评论");
    initCommentsBar();
    initList();
    requestData(1, true);
}
项目:lastfm-for-android    文件:AlbumActivity.java   
protected void initHelper() {
    getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final FadingActionBarHelper helper = new FadingActionBarHelper();
    mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url,
            null);
    helper.contentLayout(R.layout.layout_artist);
    helper.actionBarBackground(R.drawable.ab_solid_lastfm);
    helper.headerView(mUrlImageView);

    final View v = helper.createView(this);
    mUrlImageView.getLayoutParams().height = (int) (160 * getResources()
            .getDisplayMetrics().density + 0.5f);
    setContentView(v);
    helper.initActionBar(this);
}
项目:SupportLibraryV7AppCompatPatched    文件:ActionBarActivityDelegateBase.java   
@Override
public boolean supportRequestWindowFeature(int featureId) {
    switch (featureId) {
        case WindowCompat.FEATURE_ACTION_BAR:
            mHasActionBar = true;
            return true;
        case WindowCompat.FEATURE_ACTION_BAR_OVERLAY:
            mOverlayActionBar = true;
            return true;
        case Window.FEATURE_PROGRESS:
            mFeatureProgress = true;
            return true;
        case Window.FEATURE_INDETERMINATE_PROGRESS:
            mFeatureIndeterminateProgress = true;
            return true;
        default:
            return mActivity.requestWindowFeature(featureId);
    }
}
项目:SupportLibraryV7AppCompatPatched    文件:ActionBarActivityDelegateBase.java   
@Override
public boolean supportRequestWindowFeature(int featureId) {
    switch (featureId) {
        case WindowCompat.FEATURE_ACTION_BAR:
            mHasActionBar = true;
            return true;
        case WindowCompat.FEATURE_ACTION_BAR_OVERLAY:
            mOverlayActionBar = true;
            return true;
        case Window.FEATURE_PROGRESS:
            mFeatureProgress = true;
            return true;
        case Window.FEATURE_INDETERMINATE_PROGRESS:
            mFeatureIndeterminateProgress = true;
            return true;
        default:
            return mActivity.requestWindowFeature(featureId);
    }
}
项目:android-project-gallery    文件:ImageAutoPlayImageSwitcherActivity.java   
@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);
}
项目:android-support-learn    文件:ActionBarMechanics.java   
@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);
}
项目:android-support-learn    文件:ActionBarHideOnScroll.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Hide on content scroll requires an overlay action bar, so request one
    supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);

    setContentView(R.layout.action_bar_hide_scroll);

    // Enable hide on scroll
    getSupportActionBar().setHideOnContentScrollEnabled(true);
}
项目:informant-droid    文件:ActionBarMechanics.java   
@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);
}
项目:gloomy-dungeons-2    文件:ActionBarActivityDelegateICS.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    // Set framework uiOptions from the support metadata value
    if (UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata())) {
        mActivity.getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW,
                ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
    }

    super.onCreate(savedInstanceState);

    if (mHasActionBar) {
        // If action bar is requested by inheriting from the appcompat theme,
        // the system will not know about that. So explicitly request for an action bar.
        mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
    }
    if (mOverlayActionBar) {
        mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    }

    /*
     * This goofy move needs some explanation.
     *
     * The verifier on older platform versions has some interesting side effects if
     * a class defines a method that takes a parameter of a type that doesn't exist.
     * In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity
     * cannot override the onActionModeStarted/Finished methods without causing nastiness
     * when it is loaded on older platform versions.
     *
     * Since these methods are actually part of the window callback and not intrinsic to
     * Activity itself, we can install a little shim with the window instead that knows
     * about the ActionMode class. Note that this means that any new methods added to
     * Window.Callback in the future won't get proxied without updating the support lib,
     * but we shouldn't be adding new methods to public interfaces that way anyway...right? ;)
     */
    final Window w = mActivity.getWindow();
    w.setCallback(createWindowCallbackWrapper(w.getCallback()));
}
项目:V.FlyoutTest    文件:ActionBarMechanics.java   
@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);
}
项目:lastfm-for-android    文件:TrackActivity.java   
protected void initHelper() {
    getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final FadingActionBarHelper helper = new FadingActionBarHelper();
    mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url, null);
    helper.contentLayout(R.layout.layout_artist);
    helper.actionBarBackground(R.drawable.ab_solid_lastfm);
    helper.headerView(mUrlImageView);

    final View v = helper.createView(this);
    mUrlImageView.getLayoutParams().height = (int) (160 * getResources().getDisplayMetrics().density + 0.5f);
    setContentView(v);
    helper.initActionBar(this);
}
项目:lastfm-for-android    文件:ArtistActivity.java   
protected void initHelper() {
    getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final FadingActionBarHelper helper = new FadingActionBarHelper();
    mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url, null);
    helper.contentLayout(R.layout.layout_artist);
    helper.actionBarBackground(R.drawable.ab_solid_lastfm);
    helper.headerView(mUrlImageView);

    final View v = helper.createView(this);
    mUrlImageView.getLayoutParams().height = (int) (160 * getResources().getDisplayMetrics().density + 0.5f);
    setContentView(v);
    helper.initActionBar(this);
}
项目:lastfm-for-android    文件:EventActivity.java   
protected void initHelper() {
    getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final FadingActionBarHelper helper = new FadingActionBarHelper();
    mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url, null);
    helper.contentLayout(R.layout.layout_artist);
    helper.actionBarBackground(R.drawable.ab_solid_lastfm);
    helper.headerView(mUrlImageView);

    final View v = helper.createView(this);
    mUrlImageView.getLayoutParams().height = (int) (160 * getResources().getDisplayMetrics().density + 0.5f);
    setContentView(v);
    helper.initActionBar(this);
}
项目:Ramadan    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    DbManager.init(this);
    supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    setContentView(R.layout.activity_main);

    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        mAppWidgetId = extras.getInt(AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
    }

    preferenceHelper = new PreferenceHelper(this);
    if (!preferenceHelper.getBoolean(Constants.IS_DB_CREATED)) {
        CSVToDbHelper.readCSVAndInserIntoDb(this, R.raw.region, DbTableName.Region);
        CSVToDbHelper.readCSVAndInserIntoDb(this, R.raw.timetable, DbTableName.TimeTable);
        preferenceHelper.setBoolean(Constants.IS_DB_CREATED, true);
    }

    actionBar = getSupportActionBar();
    actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.AB_White_Ramadan)));
    actionBar.setDisplayShowTitleEnabled(false);

    findViewById(R.id.tab_iftar_time).setOnClickListener(this);
    findViewById(R.id.tab_saom).setOnClickListener(this);
    findViewById(R.id.tab_nioat).setOnClickListener(this);
    findViewById(R.id.tab_ramadan).setOnClickListener(this);
    findViewById(R.id.tab_saom_vonger_karon).setOnClickListener(this);
    findViewById(R.id.tab_tarabih).setOnClickListener(this);

    iftarTime = (BanglaTextView) findViewById(R.id.tv_ifter_time);
    seheriTime = (BanglaTextView) findViewById(R.id.tv_seheri_time);

    timeTables = DbManager.getInstance().getAllTimeTables();
    regions = DbManager.getInstance().getAllRegions();
}
项目:AcFun-Area63    文件:ImagePagerActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    ActionBarUtil.compatibleDeviceWithSB(this);
    requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    super.onCreate(savedInstanceState);
    ActionBarUtil.setXiaomiFilterDisplayOptions(getSupportActionBar(), false);
    getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_trans));
    Bundle extras = getIntent().getExtras();
    title = extras.getString("title");
    getSupportActionBar().setTitle(title);
    aid = extras.getInt("aid");
    mList = extras.getStringArrayList(EXTRA_IMAGES);
    int index = extras.getInt(EXTRA_INDEX,0);
    if(index < 0) index = 0;
    MobclickAgent.onEvent(this, "view_big_pic");
    setContentView(R.layout.activity_images);

    indexText = (TextView) findViewById(R.id.index);
    if(ActionBarUtil.hasSB() && getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE){
        setInfoBottomMargin(getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height));
    }
    pager = (MyViewPager) findViewById(R.id.pager);
    pager.setAdapter(new ImageAdapter(getSupportFragmentManager(),mList));
    pager.setOffscreenPageLimit(1);
    pager.setOnPageChangeListener(this);
    pager.setCurrentItem(index);
    onPageSelected(index);
}
项目:lastfm-for-android    文件:TrackActivity.java   
protected void initHelper() {
    getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final FadingActionBarHelper helper = new FadingActionBarHelper();
    mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url, null);
    helper.contentLayout(R.layout.layout_artist);
    helper.actionBarBackground(R.drawable.ab_solid_lastfm);
    helper.headerView(mUrlImageView);

    final View v = helper.createView(this);
    mUrlImageView.getLayoutParams().height = (int) (160 * getResources().getDisplayMetrics().density + 0.5f);
    setContentView(v);
    helper.initActionBar(this);
}
项目:lastfm-for-android    文件:ArtistActivity.java   
protected void initHelper() {
    getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final FadingActionBarHelper helper = new FadingActionBarHelper();
    mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url, null);
    helper.contentLayout(R.layout.layout_artist);
    helper.actionBarBackground(R.drawable.ab_solid_lastfm);
    helper.headerView(mUrlImageView);

    final View v = helper.createView(this);
    mUrlImageView.getLayoutParams().height = (int) (160 * getResources().getDisplayMetrics().density + 0.5f);
    setContentView(v);
    helper.initActionBar(this);
}
项目:lastfm-for-android    文件:EventActivity.java   
protected void initHelper() {
    getWindow().requestFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    final FadingActionBarHelper helper = new FadingActionBarHelper();
    mUrlImageView = (UrlImageView) View.inflate(this, R.layout.header_url, null);
    helper.contentLayout(R.layout.layout_artist);
    helper.actionBarBackground(R.drawable.ab_solid_lastfm);
    helper.headerView(mUrlImageView);

    final View v = helper.createView(this);
    mUrlImageView.getLayoutParams().height = (int) (160 * getResources().getDisplayMetrics().density + 0.5f);
    setContentView(v);
    helper.initActionBar(this);
}
项目:SupportLibraryV7AppCompatPatched    文件:ActionBarActivityDelegateICS.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    // Set framework uiOptions from the support metadata value
    if (UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata())) {
        mActivity.getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW,
                ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
    }

    super.onCreate(savedInstanceState);

    if (mHasActionBar) {
        // If action bar is requested by inheriting from the appcompat theme,
        // the system will not know about that. So explicitly request for an action bar.
        mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
    }
    if (mOverlayActionBar) {
        mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    }

    /*
     * This goofy move needs some explanation.
     *
     * The verifier on older platform versions has some interesting side effects if
     * a class defines a method that takes a parameter of a type that doesn't exist.
     * In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity
     * cannot override the onActionModeStarted/Finished methods without causing nastiness
     * when it is loaded on older platform versions.
     *
     * Since these methods are actually part of the window callback and not intrinsic to
     * Activity itself, we can install a little shim with the window instead that knows
     * about the ActionMode class. Note that this means that any new methods added to
     * Window.Callback in the future won't get proxied without updating the support lib,
     * but we shouldn't be adding new methods to public interfaces that way anyway...right? ;)
     */
    final Window w = mActivity.getWindow();
    w.setCallback(createWindowCallbackWrapper(w.getCallback()));
}
项目:SupportLibraryV7AppCompatPatched    文件:ActionBarActivityDelegateICS.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    // Set framework uiOptions from the support metadata value
    if (UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW.equals(getUiOptionsFromMetadata())) {
        mActivity.getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW,
                ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
    }

    super.onCreate(savedInstanceState);

    if (mHasActionBar) {
        // If action bar is requested by inheriting from the appcompat theme,
        // the system will not know about that. So explicitly request for an action bar.
        mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR);
    }
    if (mOverlayActionBar) {
        mActivity.requestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    }

    /*
     * This goofy move needs some explanation.
     *
     * The verifier on older platform versions has some interesting side effects if
     * a class defines a method that takes a parameter of a type that doesn't exist.
     * In this case, that type is android.view.ActionMode. Therefore, ActionBarActivity
     * cannot override the onActionModeStarted/Finished methods without causing nastiness
     * when it is loaded on older platform versions.
     *
     * Since these methods are actually part of the window callback and not intrinsic to
     * Activity itself, we can install a little shim with the window instead that knows
     * about the ActionMode class. Note that this means that any new methods added to
     * Window.Callback in the future won't get proxied without updating the support lib,
     * but we shouldn't be adding new methods to public interfaces that way anyway...right? ;)
     */
    final Window w = mActivity.getWindow();
    w.setCallback(createWindowCallbackWrapper(w.getCallback()));
}
项目:android-project-gallery    文件:BrowserFragmentActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState)
{
    Intent intent = getIntent();
    mLoadUrl = intent.getStringExtra(EXTRA_LOAD_URL);
    boolean mHasTitleBar = intent.getBooleanExtra(EXTRA_TITLE_BAR_FLAG, true);
    boolean mHasBottomBar = intent.getBooleanExtra(EXTRA_BOTTOM_BAR_FLAG, false);
    mLayerType = intent.getIntExtra(EXTRA_LAYER_TYPE, DEFAULT_LAYER_TYPE);

    if (mHasTitleBar)
    {
        mFeatures |= (1 << FEATURE_NO_TITLE);
    }
    else
    {
        supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);
    }
    if (mHasBottomBar)
    {
        mFeatures |= (1 << FEATURE_NO_BOTTOM);
    }





    super.onCreate(savedInstanceState);
    super.setContentView(R.layout.wrapper_webview);





    setUpViews();
    setUpEvents();

    if (!TextUtils.isEmpty(mLoadUrl))
    {
        mWebView.loadUrl(mLoadUrl);
    }
}
项目:android-project-gallery    文件:ImageViewerActivity.java   
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(GIntent.EXTRA_IMAGE_SET);
    int pagerPosition = bundle.getInt(GIntent.EXTRA_POSITION, 0);
    mExtraDirectory = bundle.getString(GIntent.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);
    mViewPager = (AutoScrollViewPager) findViewById(R.id.pull_refresh_viewpager);
    mViewPager.setAdapter(new ImagePagerAdapter(mPhotoList));
    mViewPager.setCurrentItem(pagerPosition);

    initView();
}
项目:android-project-wo2b    文件:ImageAutoPlayImageSwitcherActivity.java   
@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);
}
项目:android-project-wo2b    文件:ImageViewerActivity.java   
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();
}
项目:AntennaPodSP    文件:MainActivity.java   
@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);
}
项目:EinschlafenPodcastAndroidApp    文件:MainActivity.java   
@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);
}
项目:Ramadan    文件:DetailsActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR_OVERLAY);

    topics = getIntent().getParcelableArrayListExtra(Constants.topic.EXTRA_PARCELABLE_LIST);
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        topicPosition = extras.getInt(Constants.topic.EXTRA_VIEWING_NOW);
        iconDrawableId = extras.getInt(Constants.topic.EXTRA_ICON_ID);
        fileResId = extras.getInt(Constants.topic.EXTRA_DATA_FILE);
    }
    topicInView = topics.get(topicPosition);

    actionBar = getSupportActionBar();
    actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.AB_Green_Ramadan)));
    actionBar.setTitle(Utilities.getBanglaSpannableString(topicInView.getHeader(), this));
    actionBar.setIcon(getResources().getDrawable(iconDrawableId));
    actionBar.setDisplayShowHomeEnabled(true);

    setContentView(R.layout.activity_details);

    drawerLayout = (DrawerLayout) findViewById(R.id.layout_drawer);
    listViewDrawer = (ListView) findViewById(R.id.listView_drawer);

    drawerListAdapter = new ArrayAdapter<Topic>(this, R.layout.drawer_layout,
            topics) {
        @Override
        public int getViewTypeCount() {
            if (getCount() != 0)
                return getCount();
            return 1;
        }

        @Override
        public int getItemViewType(int position) {
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            BanglaTextView btv;
            if (convertView == null) {
                convertView = getLayoutInflater().inflate(R.layout.drawer_layout, parent, false);
            }
            btv = (BanglaTextView) convertView.findViewById(R.id.btv_nav);
            btv.setBanglaText(getItem(position).getHeader());
            if (position == topics.indexOf(topicInView))
                convertView.setBackgroundColor(getResources().getColor(R.color.ActionBar_Navigation));
            return convertView;
        }
    };
    listViewDrawer.setAdapter(drawerListAdapter);

    listViewDrawer.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View item, int position, long id) {
            topicInView = topics.get(position);
            if (TextUtils.isEmpty(topicInView.getDetailUri().toString())) {
                actionBar.setTitle(Utilities.getBanglaSpannableString(topicInView.getHeader(), DetailsActivity.this));
                DetailsFragment detailsFragment = (DetailsFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_details);
                detailsFragment.changeTopic(topicInView);
                listViewDrawer.setAdapter(drawerListAdapter);
                drawerLayout.closeDrawer(listViewDrawer);
            } else {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                intent.setData(topicInView.getDetailUri());
                startActivity(intent);
            }
        }
    });
}