@TargetApi(20) protected void onFinishInflate() { super.onFinishInflate(); this.mDrawerRoot = ((ViewGroup)findViewById(R.id.play_drawer_root)); this.mDrawerList = ((ListView)findViewById(R.id.play_drawer_list)); this.mDockedActionView = ((TextView)findViewById(R.id.play_drawer_docked_action)); this.mDockedActionView.setVisibility(8); if (Build.VERSION.SDK_INT >= 21) { this.mDrawerRoot.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @TargetApi(20) public final WindowInsets onApplyWindowInsets(View paramAnonymousView, WindowInsets paramAnonymousWindowInsets) { return paramAnonymousWindowInsets.consumeSystemWindowInsets(); } }); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setOnApplyWindowInsetsListener(new OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { final boolean round = insets.isRound(); int rowMargin = res.getDimensionPixelOffset(R.dimen.page_row_margin); int colMargin = res.getDimensionPixelOffset(round ? R.dimen.page_column_margin_round : R.dimen.page_column_margin); pager.setPageMargins(rowMargin, colMargin); return insets; } }); menu = new com.iblancasa.comedoresUGR.Menu(this,pager,getFragmentManager()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Resources res = getResources(); final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); pager.setOnApplyWindowInsetsListener(new OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // Adjust page margins: // A little extra horizontal spacing between pages looks a bit // less crowded on a round display. final boolean round = insets.isRound(); int rowMargin = res.getDimensionPixelOffset(R.dimen.page_row_margin); int colMargin = res.getDimensionPixelOffset(round ? R.dimen.page_column_margin_round : R.dimen.page_column_margin); pager.setPageMargins(rowMargin, colMargin); return insets; } }); pager.setAdapter(new SampleGridPagerAdapter(this, getFragmentManager())); }