Example usage for android.view Window setFeatureInt

List of usage examples for android.view Window setFeatureInt

Introduction

In this page you can find the example usage for android.view Window setFeatureInt.

Prototype

public abstract void setFeatureInt(int featureId, int value);

Source Link

Document

Set the integer value for a feature.

Usage

From source file:com.leo.runningman.ui.ImageGridFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Window window = getActivity().getWindow();
    window.setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.layout_title);

    final View v = inflater.inflate(R.layout.image_grid_fragment, container, false);

    TextView txt_title = (TextView) this.getActivity().findViewById(R.id.txt_title);
    txt_title.setText(getActivity().getResources().getString(R.string.app_name));
    Button btn_delete = (Button) this.getActivity().findViewById(R.id.btn_delete);
    TextView txt_delete_confirm = (TextView) this.getActivity().findViewById(R.id.txt_delete_confirm);
    btn_delete.setVisibility(View.GONE);
    txt_delete_confirm.setVisibility(View.GONE);

    layout_bottom = (RelativeLayout) v.findViewById(R.id.layout_bottom);
    autoHideview(4000);//ww  w. j av a 2  s . c  o  m

    final GridView mGridView = (GridView) v.findViewById(R.id.gridView);
    mGridView.setAdapter(mAdapter);
    mGridView.setOnItemClickListener(this);

    // This listener is used to get the final width of the GridView and then calculate the
    // number of columns and the width of each column. The width of each column is variable
    // as the GridView has stretchMode=columnWidth. The column width is used to set the height
    // of each view so we get nice square thumbnails.
    mGridView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            if (mAdapter.getNumColumns() == 0) {
                final int numColumns = (int) Math
                        .floor(mGridView.getWidth() / (mImageThumbSize + mImageThumbSpacing));
                if (numColumns > 0) {
                    final int columnWidth = (mGridView.getWidth() / numColumns) - mImageThumbSpacing;
                    mAdapter.setNumColumns(numColumns);
                    mAdapter.setItemHeight(columnWidth);
                    if (BuildConfig.DEBUG) {
                        Log.d(TAG, "onCreateView - numColumns set to " + numColumns);
                    }
                }
            }
        }
    });
    mGridView.setOnScrollListener(new OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view, int scrollState) {
            switch (scrollState) {
            case OnScrollListener.SCROLL_STATE_IDLE:
                if (loadMore) {
                    new HttpGetTask(1000L).execute();
                }
                break;
            case OnScrollListener.SCROLL_STATE_FLING:
                break;
            case OnScrollListener.SCROLL_STATE_TOUCH_SCROLL:
                break;
            }
            hideBottomLayout();
            cancelAutoHideview();
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
            Log.i(TAG, "firstVisibleItem:--->" + firstVisibleItem + "visibleItemCount:----->" + visibleItemCount
                    + "totalItemCount:" + totalItemCount);
            loadMore = firstVisibleItem + visibleItemCount >= totalItemCount;
            start = totalItemCount;
            autoShowview(2000);
        }
    });

    adview_first = (AdView) v.findViewById(R.id.adview_first); //TODO
    return v;
}

From source file:study.tdcc.act.MainCalendar.java

/**
 * onCreate/*from ww  w . ja v  a  2s.  c  om*/
 * @param savedInstanceState ?
 */
@Override
public void onCreate(Bundle savedInstanceState) {
    Log.d("DEBUG", "MainCalendar onCreate Start");
    super.onCreate(savedInstanceState);
    //
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    //???
    setContentView(R.layout.calendar);
    //???
    Window window = getWindow();
    window.setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.customtitle);
    //????
    getScreenTransitionData();
    //???
    getScreenRestoreData(savedInstanceState);
    //?????
    getViewElement();
    //?
    setCustomTitle();
    //???
    setViewListener();
    //????
    setViewElement();
    //
    blFlick = true;
    Log.d("DEBUG", "MainCalendar onCreate End");
}