public void startMetrialView() { toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); dlDrawer = (DrawerLayout) findViewById(R.id.drawer_layout); dtToggle = new ActionBarDrawerToggle(this, dlDrawer, R.string.app_name, R.string.hello_world); dlDrawer.setDrawerListener(dtToggle); pager = (ViewPager) findViewById(R.id.pager); adapter = new ViewPagerAdapter_1(getSupportFragmentManager(), Titles); pager.setAdapter(adapter); tabs = (SlidingTabLayout) findViewById(R.id.tabs); tabs.setDistributeEvenly(true); tabs.setCustomTabColorizer( new SlidingTabLayout.TabColorizer() { @Override public int getIndicatorColor(int position) { return getResources().getColor(R.color.tabsScrollColor); } }); tabs.setViewPager(pager); ChoiceStartAlarmMenu choiceStartAlarmMenu = new ChoiceStartAlarmMenu(this); drawer = (FrameLayout) findViewById(R.id.drawer); drawer.addView(choiceStartAlarmMenu); // dlDrawer.closeDrawer(dtToggle); dlDrawer.closeDrawer(drawer); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_usertab); toolbar = (Toolbar) findViewById(R.id.app_bar); setSupportActionBar(toolbar); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Creating The ViewPagerAdapterUserTab and Passing Fragment ManagerDashBoard_MainActivity, // Titles fot the Tabs and Number Of Tabs. adapter = new ViewPagerAdapterLTab(getSupportFragmentManager(), Titles, Numboftabs); // Assigning ViewPager View and setting the adapter pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(adapter); // Assiging the Sliding Tab Layout View tabs = (SlidingTabLayout) findViewById(R.id.materialTabHost); tabs.setDistributeEvenly(true); // To make the Tabs Fixed set this true, This makes the tabs Space Evenly in Available width // Setting Custom Color for the Scroll bar indicator of the Tab View tabs.setCustomTabColorizer( new SlidingTabLayout.TabColorizer() { @Override public int getIndicatorColor(int position) { return getResources().getColor(R.color.accentcolor); } }); // Setting the ViewPager For the SlidingTabsLayout tabs.setViewPager(pager); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Creating The Toolbar and setting it as the Toolbar for the activity toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); // Creating The ViewPagerAdapter and Passing Fragment Manager, Titles fot the Tabs and Number Of // Tabs. adapter = new ViewPagerAdapter(getSupportFragmentManager(), Titles, Numboftabs); // Assigning ViewPager View and setting the adapter pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(adapter); // Assiging the Sliding Tab Layout View tabs = (SlidingTabLayout) findViewById(R.id.tabs); tabs.setDistributeEvenly( true); // To make the Tabs Fixed set this true, This makes the tabs Space Evenly in // Available width // Setting Custom Color for the Scroll bar indicator of the Tab View tabs.setCustomTabColorizer( new SlidingTabLayout.TabColorizer() { @Override public int getIndicatorColor(int position) { return getResources().getColor(R.color.tabsScrollColor); } }); // Setting the ViewPager For the SlidingTabsLayout tabs.setViewPager(pager); }
/** * Defines what happens when the app is opened up, and the first view the user sees is created. * This is where the defining of what what is displayed on each tab is accomplished * * @param savedInstanceState */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); tpAdapter = new TabsPagerAdapter(getSupportFragmentManager(), tabs, tabsNum); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(tpAdapter); tabLayout = (SlidingTabLayout) findViewById(R.id.tabs); tabLayout.setDistributeEvenly( true); // To make the Tabs Fixed set this true, This makes the tabs Space Evenly in // Available width tabLayout.setViewPager(mViewPager); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); requestQueue = Volley.newRequestQueue(this); editEmailId(); Cache.INSTANCE.initialize(); adapter = new TestPagerAdapter(getSupportFragmentManager(), MainActivity.this); pager = (CustomPager) findViewById(R.id.pager); pager.setAdapter(adapter); toolbar = (Toolbar) findViewById(R.id.toolbar); // setSupportActionBar(toolbar); setSupportActionBar(toolbar); mTabs = (SlidingTabLayout) findViewById(R.id.tabs); mTabs.setDistributeEvenly(true); mTabs.setViewPager(pager); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); adapter = new ViewPagerAdapter(getSupportFragmentManager(), Titles, Numboftabs); pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(adapter); tabs = (SlidingTabLayout) findViewById(R.id.tabs); tabs.setDistributeEvenly(true); tabs.setCustomTabColorizer( new SlidingTabLayout.TabColorizer() { @Override public int getIndicatorColor(int position) { return getResources().getColor(R.color.DeepSkyBlue); } }); tabs.setViewPager(pager); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /* Assinging the toolbar object ot the view and setting the the Action bar to our toolbar */ toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); mRecyclerView = (RecyclerView) findViewById(R.id.RecyclerView); // Assigning the RecyclerView Object to the xml View mRecyclerView.setHasFixedSize( true); // Letting the system know that the list objects are of fixed size mAdapter = new MyAdapter( TITLES, ICONS, NAME, EMAIL, PROFILE); // Creating the Adapter of MyAdapter class(which we are going to see in a bit) // And passing the titles,icons,header view name, header view email, // and header view profile picture mRecyclerView.setAdapter(mAdapter); // Setting the adapter to RecyclerView mLayoutManager = new LinearLayoutManager(this); // Creating a layout Manager mRecyclerView.setLayoutManager(mLayoutManager); // Setting the layout Manager Drawer = (DrawerLayout) findViewById(R.id.DrawerLayout); // Drawer object Assigned to the view mDrawerToggle = new ActionBarDrawerToggle( this, Drawer, toolbar, R.string.openDrawer, R.string.closeDrawer) { @Override public void onDrawerOpened(View drawerView) { super.onDrawerOpened(drawerView); // code here will execute once the drawer is opened( As I dont want anything happened // whe drawer is // open I am not going to put anything here) } @Override public void onDrawerClosed(View drawerView) { super.onDrawerClosed(drawerView); // Code here will execute once drawer is closed } }; // Drawer Toggle Object Made Drawer.setDrawerListener(mDrawerToggle); // Drawer Listener set to the Drawer toggle mDrawerToggle.syncState(); // Finally we set the drawer toggle sync State // Creating The ViewPagerAdapter and Passing Fragment Manager, Titles fot the Tabs and Number Of // Tabs. adapter = new ViewPagerAdapter(getSupportFragmentManager(), Titles, Numboftabs); // Assigning ViewPager View and setting the adapter pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(adapter); // Assiging the Sliding Tab Layout View tabs = (SlidingTabLayout) findViewById(R.id.tabs); tabs.setDistributeEvenly( true); // To make the Tabs Fixed set this true, This makes the tabs Space Evenly in // Available width // Setting Custom Color for the Scroll bar indicator of the Tab View tabs.setCustomTabColorizer( new SlidingTabLayout.TabColorizer() { @Override public int getIndicatorColor(int position) { return getResources().getColor(R.color.tabsScrollColor); } }); // Setting the ViewPager For the SlidingTabsLayout tabs.setViewPager(pager); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Creating The Toolbar and setting it as the Toolbar for the activity toolbar = (Toolbar) findViewById(R.id.tool_bar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle( (Html.fromHtml("<font color=\"#ffffff\">" + getString(R.string.app_name) + "</font>"))); actionBar.setDisplayShowHomeEnabled(true); // Creating The ViewPagerAdapter and Passing Fragment Manager, Titles fot the Tabs and Number Of // Tabs. adapter = new ViewPagerAdapter(getSupportFragmentManager(), Titles, Numboftabs); // Assigning ViewPager View and setting the adapter pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(adapter); // Assiging the Sliding Tab Layout View tabs = (SlidingTabLayout) findViewById(R.id.tabs); tabs.setDistributeEvenly( true); // To make the Tabs Fixed set this true, This makes the tabs Space Evenly in // Available width // Setting Custom Color for the Scroll bar indicator of the Tab View tabs.setCustomTabColorizer( new SlidingTabLayout.TabColorizer() { @Override public int getIndicatorColor(int position) { return getResources().getColor(R.color.ColorAccent); } }); // Setting the ViewPager For the SlidingTabsLayout tabs.setViewPager(pager); // 급식 및 학사 일정 Download 등 처리 Calendar cal = Calendar.getInstance(); int month = cal.get(cal.MONTH) + 1; SharedPreferences data = getSharedPreferences("month", MODE_MULTI_PROCESS); int dmonth = data.getInt("month", 0); SharedPreferences mdata = getSharedPreferences("meal", Context.MODE_MULTI_PROCESS); String mealdata = mdata.getString("meal", ""); SharedPreferences mnmdata = getSharedPreferences("mealnm", Context.MODE_MULTI_PROCESS); String mealnmdata = mnmdata.getString("mealnm", ""); SharedPreferences sdata = getSharedPreferences("sch", Context.MODE_MULTI_PROCESS); String schdata = sdata.getString("sch", ""); SharedPreferences snmdata = getSharedPreferences("schnm", Context.MODE_MULTI_PROCESS); String schnmdata = snmdata.getString("schnm", ""); // 데이터를 다운받은 달이 다른지, 급식 및 학사일정의 데이터가 비어있는지 확인하고 다운로드 if (dmonth != month | mealdata.equals("") | mealnmdata.equals("") | schdata.equals("") | schnmdata.equals("")) { Log.d("MainActivity", "Data Downloading..."); if (isNetworkAvailable() == true) { DataThread t = new DataThread(MainActivity.this); t.start(); Toast.makeText(MainActivity.this, getString(R.string.download_start), Toast.LENGTH_SHORT) .show(); } else { Log.d("MainActivity", "Internet Connect Failed"); Toast.makeText(MainActivity.this, getString(R.string.internet_error), Toast.LENGTH_SHORT) .show(); } } pager.setOffscreenPageLimit(3); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main_feed); gps = new GPSTracker(this); toolbar = (Toolbar) findViewById(R.id.toolBarFeed); setSupportActionBar(toolbar); Display mdisp = getWindowManager().getDefaultDisplay(); Point mdispSize = new Point(); mdisp.getSize(mdispSize); int maxX = mdispSize.x; int maxY = mdispSize.y; float dpPadding = convertDpToPixel(20, MainFeedActivity.this); pivotX = maxX - (int) dpPadding; pivotY = maxY - (int) dpPadding; mPager = (ViewPager) findViewById(R.id.loginPagerMain); mPager.setAdapter(new MainPagerAdapter(getFragmentManager())); mPager.addOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { // TODO: scale Floating Action Button size Log.d("POSITION_OFFSET", positionOffset + ""); Log.d("POS_OFFSET_VIEW", whichView + ""); Log.d("JUST_POS", position + ""); if (positionOffset < 0.5) { if (whichView) { // // fabMainFeed.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.primaryColorDark))); } else { // // fabMainFeed.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.accentColor))); } // fabMainFeed.setScaleX((1 - 2 * positionOffset)); // fabMainFeed.setScaleY((1 - 2 * positionOffset)); } else { // // fabMainFeed.setBackgroundTintList(ColorStateList.valueOf(getResources().getColor(R.color.primaryColorDark))); // fabMainFeed.setScaleX((2 * positionOffset - 1)); // fabMainFeed.setScaleY((2 * positionOffset - 1)); } } @Override public void onPageSelected(int position) { whichView = !whichView; } @Override public void onPageScrollStateChanged(int state) { if (state == ViewPager.SCROLL_STATE_IDLE) { // Hide the keyboard. ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(mPager.getWindowToken(), 0); } } }); mTabs = (SlidingTabLayout) findViewById(R.id.loginTabsMain); mTabs.setCustomTabView(R.layout.custom_tab_view_main, R.id.mainTabsText); mTabs.setDistributeEvenly(true); mTabs.setCustomTabColorizer( new SlidingTabLayout.TabColorizer() { @Override public int getIndicatorColor(int position) { return getResources().getColor(R.color.primaryColorLight); } }); mTabs.setViewPager(mPager); navigationView = (NavigationView) findViewById(R.id.navigationView); navigationView.setNavigationItemSelectedListener( new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { menuItem.setChecked(false); mNavItemId = menuItem.getItemId(); drawerLayout.closeDrawers(); switch (mNavItemId) { case R.id.navProfile: Intent profIntent = new Intent(MainFeedActivity.this, ProfileActivity.class); startActivity(profIntent); return true; case R.id.navSettings: Intent settingsIntent = new Intent(MainFeedActivity.this, SettingsActivity.class); startActivity(settingsIntent); return true; } return false; } }); fabMenu = (FloatingActionMenu) findViewById(R.id.fabMenu); fabCurrentLocation = (com.github.clans.fab.FloatingActionButton) findViewById(R.id.fabCurrentLocation); fabPickLocation = (com.github.clans.fab.FloatingActionButton) findViewById(R.id.fabPickLocation); fabAirport = (com.github.clans.fab.FloatingActionButton) findViewById(R.id.fabAirport); fabCurrentLocation.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) {} }); fabPickLocation.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainFeedActivity.this, FSPickLocActivity.class); startActivity(intent); } }); fabAirport.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) {} }); // fabMainFeed = (FloatingActionButton) findViewById(R.id.fabMainFeed); // fabMainFeed.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // // // TODO: expand the FAB to give three options, each launching a different // intent // // Can use whichView boolean value to launch the right intent by assigning // // OnClickListener to the 3 options and check the whichView boolean in each // // if (whichView) { // Toast.makeText(MainFeedActivity.this, "SECOND INTENT", // Toast.LENGTH_LONG).show(); // Intent intent = new Intent(MainFeedActivity.this, // AddForSalePostActivity.class); // startActivity(intent); // // } else { // Toast.makeText(MainFeedActivity.this, "FIRST INTENT", // Toast.LENGTH_LONG).show(); // Intent intent = new Intent(MainFeedActivity.this, // AddForSalePostActivity.class); // startActivity(intent); // } // } // }); drawerLayout = (DrawerLayout) findViewById(R.id.drawer); mDrawerToggle = new ActionBarDrawerToggle( this, drawerLayout, toolbar, R.string.openDrawer, R.string.closeDrawer); drawerLayout.setDrawerListener(mDrawerToggle); toolbar.setTitle("Browse"); toolbar.setTitleTextColor(getResources().getColor(R.color.whiteColor)); mPager.setCurrentItem(0); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTitle("Epic Music"); // Generate the ActionBar on top of the Activity // Note to Self Remove the Navigation bar until find a better way to Navigate multiple decisions toolbar = (Toolbar) findViewById(R.id.app_bar); setSupportActionBar(toolbar); // ViewPager to allow User to swipe to go to next section mPager = (ViewPager) findViewById(R.id.MainViewPager); FragmentManager fragmentManager = getSupportFragmentManager(); mPager.setAdapter(new MyPagerAdapter(fragmentManager)); mTabs = (SlidingTabLayout) findViewById(R.id.slidingTab); mTabs.setDistributeEvenly(true); mTabs.setBackgroundColor(getResources().getColor(R.color.primaryColor)); mTabs.setSelectedIndicatorColors(getResources().getColor(R.color.accentColor)); mTabs.setViewPager(mPager); mTabs.setOnPageChangeListener( new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled( int position, float positionOffset, int positionOffsetPixels) {} @Override public void onPageSelected(int position) { // Change Title When for selected Page switch (position) { case 0: { setTitle("Epic Music"); break; } case 1: { setTitle("Major League Gaming"); break; } case 2: { setTitle("Phoenix Wright"); break; } case 3: { setTitle("Dota sounds"); break; } case 4: { setTitle("Random"); break; } case 5: { setTitle("Random 2"); break; } } } @Override public void onPageScrollStateChanged(int state) {} }); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); MainActivity.mContext = getApplicationContext(); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { OpenKeyBoard(getApplicationContext()); } }); TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); // register PhoneStateListener PhoneStateListener callStateListener = new PhoneStateListener() { public void onCallStateChanged(int state, String incomingNumber) { if (state == TelephonyManager.CALL_STATE_RINGING) { // Toast.makeText(getApplicationContext(),"Phone Is Riging", // Toast.LENGTH_LONG).show(); Intent dialogIntent = new Intent(MainActivity.this, PhoneCall.class); dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(dialogIntent); } // If incoming call received if (state == TelephonyManager.CALL_STATE_OFFHOOK) { // Toast.makeText(getApplicationContext(),"Phone is Currently in A call", // Toast.LENGTH_LONG).show(); } if (state == TelephonyManager.CALL_STATE_IDLE) { // Toast.makeText(getApplicationContext(),"phone is neither ringing nor in a call", // Toast.LENGTH_LONG).show(); } } }; telephonyManager.listen(callStateListener, PhoneStateListener.LISTEN_CALL_STATE); // Creating The Toolbar and setting it as the Toolbar for the activity toolbar = (Toolbar) findViewById(R.id.tool_bar); // setSupportActionBar(toolbar); // Creating The ViewPagerAdapter and Passing Fragment Manager, Titles fot the Tabs and Number Of // Tabs. adapter = new ViewPagerAdapter(getSupportFragmentManager(), Titles, Numboftabs); // Assigning ViewPager View and setting the adapter pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(adapter); // Assiging the Sliding Tab Layout View tabs = (SlidingTabLayout) findViewById(R.id.tabs); tabs.setDistributeEvenly( true); // To make the Tabs Fixed set this true, This makes the tabs Space Evenly in // Available width // Setting Custom Color for the Scroll bar indicator of the Tab View tabs.setCustomTabColorizer( new SlidingTabLayout.TabColorizer() { @Override public int getIndicatorColor(int position) { return getResources().getColor(R.color.tabsScrollColor); } }); tabs.setPadding(0, 85, 0, 0); // Setting the ViewPager For the SlidingTabsLayout tabs.setViewPager(pager); }