コード例 #1
1
  private void selectItem(int position, int currentPosition) {

    String tag = "";
    switch (position) {
      case POSITION_DISCOVERY:
        mFragment = new MainFragment();
        currentPosition = POSITION_DISCOVERY;
        tag = "discovery";
        break;
    }

    if (mFragment != null) {
      mFragmentManager
          .beginTransaction()
          .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
          .replace(R.id.content_frame, mFragment, tag)
          .commit();
      FragmentTransaction ft = mFragmentManager.beginTransaction();
      ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
      ft.replace(R.id.content_frame, mFragment, tag);
      ft.commit();
      mFragmentManager.executePendingTransactions();
    }
    mDrawerList.setItemChecked(position, true);
    mActivity.setTitle(mDrawerOptions[position]);
    mDrawerLayout.closeDrawer(mDrawerList);
  }
コード例 #2
0
  private void selectItem(int position) {

    Activity activity = null;

    switch (position) {
        // Campus Select
      case 0:
        // startActivity(new Intent(this, CamSelTest.class));
        NavUtils.navigateUpFromSameTask(this);
        mDrawerLayout.closeDrawer(mDrawerList);

        break;
        // Help
      case 1:
        startActivity(new Intent(this, Help.class));
        mDrawerLayout.closeDrawer(mDrawerList);
        break;
        // About Us
      case 2:
        startActivity(new Intent(this, AboutUs.class));
        mDrawerLayout.closeDrawer(mDrawerList);
        break;

      default:
        break;
    }
  }
コード例 #3
0
  private void selectItem(int position) {

    switch (position) {
      case 0:
        loadAndPlayVideo();
        break;
      case 1:
        if (popUpViewText == null) {
          popUpViewText = layoutInflater.inflate(R.layout.fragment_text, null);
          TextView textView = (TextView) popUpViewText.findViewById(R.id.textView);
          textView.setText(getPopUpText());
          textPopUp = popupWindow(popUpViewText, false);
        }

        mDrawerLayout.closeDrawer(mDrawerList);
        break;
      case 2:
        takeScreenShot();
        mDrawerLayout.closeDrawer(mDrawerList);
        break;
      case 3:
        mDrawerLayout.closeDrawer(mDrawerList);
        showScreenShotSlideshow();
        break;
      default:
        break;
    }
  }
コード例 #4
0
  public void selectItem(int position, boolean child) {
    mCurrentSelectedPosition = position;
    mAdapter.setSelectedItem(position);
    mAdapter.setSelectedType(child);

    if (mDrawerListView != null) {
      mDrawerListView.setItemChecked(position, true);
    }

    if (position != 1 && !child) {
      if (mDrawerLayout != null) {
        mDrawerLayout.closeDrawer(mFragmentContainerView);
      }
      if (mCallbacks != null) {
        mCallbacks.onNavigationDrawerItemSelected(position);
      }
    } else if (child) {
      if (mDrawerLayout != null) {
        mDrawerLayout.closeDrawer(mFragmentContainerView);
      }
      if (mCallbacks != null) {
        mCallbacks.onNavigationDrawerItemSelected(position + 10);
      }
    }
  }
コード例 #5
0
  /**
   * Private method. Handles selection of primary navigation items
   *
   * <p>Order of items in the list:
   *
   * <p>0 = NavigationDrawer header view
   *
   * <p>1 = LibraryFragment 2 = PressCuttingsFragment 3 = ShopFragment
   *
   * <p>4 = Separator
   *
   * <p>5 = SettingsActivity 6 = AboutActivity
   */
  private void selectPrimaryItem(int position) {

    // Let's not load anything if the user selects the same screen they're on
    if (mCurrentSelectedPosition == position) {

      if (mDrawerLayout != null) {

        mDrawerLayout.closeDrawer(mNavigationDrawerContainer);
      }

      return;
    }

    this.mCurrentSelectedPosition = position;

    // Adjust the position for the header view
    final int listPosition = position - 1;

    // Change the title
    this.mTitle = getNavigationItems().get(listPosition).getTitle();
    this.getSupportActionBar().setTitle(mTitle);

    if (mDrawerLayout != null) {

      mDrawerLayout.closeDrawer(mNavigationDrawerContainer);
    }

    // The Fragment to be loaded
    Fragment fragment;

    /* Load the Fragment appropriate for the navigation selection.
    Note the case differentiation. This is because the header in the
    NavigationDrawer counts as item '0' so the first item in the list
    is actually item '1' */
    switch (position) {
      case 1:
        fragment = new LibraryFragment();

        break;

      case 2:
        fragment = new PressCuttingsFragment();

        break;

      case 3:
        fragment = new ShopFragment();

        break;

      default:
        fragment = new ErrorFragment();

        break;
    }

    getSupportFragmentManager().beginTransaction().replace(R.id.container, fragment).commit();
  }
コード例 #6
0
ファイル: Main_Nav.java プロジェクト: Pradeet/DAWebmail
  private void selectItem(int position) {

    Fragment fragment = null;

    switch (position) {
      case 0:
        showDialog();
        FragmentManager fragmentManager = getFragmentManager();
        fragmentManager
            .beginTransaction()
            .replace(R.id.content_frame, new InboxFragment(username, pwd))
            .commit();
        mDrawerList.setItemChecked(position, true);
        mDrawerList.setSelection(position);
        mDrawerLayout.closeDrawer(mDrawerList);
        break;
      case 1:
        fragment = new InboxFragment(username, pwd);
        break;
      case 2:
        fragment = new SmartBoxFragment();
        break;
      case 3:
        fragment = new SettingsFragment(username, pwd);
        break;
      case 4:
        fragment = new FeedbackFragment();
        break;

      default:
        break;
    }
    if (fragment != null) {
      // here fragment is being changed. So every time it is changed i
      // will update the user icon.
      // updateUserStatus(false);
      invalidateOptionsMenu();

      FragmentManager fragmentManager = getFragmentManager();
      fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
      fragmentManager.popBackStack();
      mDrawerList.setItemChecked(position, true);
      mDrawerList.setSelection(position);
      getActionBar().setTitle(drawerItem[position].name);
      mDrawerLayout.closeDrawer(mDrawerList);
      mDrawerTitle = drawerItem[position].name;
    } else {
      Log.e("MainActivity", "Error in creating fragment");
    }
  }
コード例 #7
0
 public void selectItem() {
   Fragment fragment = null;
   // FOR Diff color action bar
   /*Intent intent = new Intent();
   Bundle bundle = new Bundle();*/
   switch (label) {
     case "推薦":
       fragment = new Recommendation_frag();
       break;
     case "訂閱":
       // FOR FRAGMENT STRUCTURE(Same color action bar)
       fragment = new ChannelMain_frag();
       Bundle bundle = new Bundle();
       bundle.putString("channelid", "1"); // TODO:SET TO SUBSCRIPTED CHANNEL
       fragment.setArguments(bundle);
       // FOR Diff color action bar
       /*intent.setClass(MainActivity_mdsign.this, ChannelMain.class);
       bundle.putString("channelid", "1");//item.getID()
       intent.putExtras(bundle);
       startActivity(intent);*/
       break;
     case "收藏庫":
       fragment = new Collect_frag();
       // FOR Diff color action bar
       /*intent.setClass(MainActivity_mdsign.this, Collect.class);
       bundle.putString("channelid", "1");//TODO:SET TO COLLECT
       intent.putExtras(bundle);
       startActivity(intent);*/
       break;
       // TODO:FRAGMENT PLACE_REPLACE
     case "快選行程":
       Intent intent = new Intent(place_navi.this, Search.class);
       Drawer.closeDrawer(mRecyclerView);
       startActivity(intent);
       return;
       // break;
     default:
       Drawer.closeDrawer(mRecyclerView);
       return;
       // break;
   }
   getSupportActionBar().setTitle(label);
   android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
   FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
   fragmentTransaction.replace(R.id.content_frame, fragment);
   fragmentTransaction.addToBackStack(null);
   fragmentTransaction.commit();
   Drawer.closeDrawer(mRecyclerView);
 }
コード例 #8
0
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_home) {
      // Handle the camera action
      displayView(0);
    } else if (id == R.id.nav_profile) {
      displayView(1);
    } else if (id == R.id.nav_earn_pts) {
      displayView(2);
    } else if (id == R.id.nav_top_10_day) {
      displayView(3);
    } else if (id == R.id.nav_history) {
      displayView(4);
    } else if (id == R.id.nav_feedback) {
      displayView(5);
    } else if (id == R.id.nav_about) {
      displayView(6);
    } else if (id == R.id.nav_logout) {

    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }
コード例 #9
0
 @Override
 public boolean onNavigationItemSelected(MenuItem item) {
   int id = item.getItemId();
   switch (id) {
     case R.id.nav_new:
       break;
     case R.id.nav_xingan:
       break;
     case R.id.nav_mr:
       break;
     case R.id.nav_sw:
       break;
     case R.id.nav_xz:
       break;
     case R.id.nav_wallpaper:
       break;
     case R.id.nav_share:
       break;
     case R.id.nav_personal:
       break;
   }
   toolbar.setTitle(item.getTitle());
   DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
   drawer.closeDrawer(GravityCompat.START);
   return true;
 }
コード例 #10
0
 public void toggleDrawer() {
   if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT)) {
     mDrawerLayout.closeDrawer(Gravity.RIGHT);
   } else {
     mDrawerLayout.openDrawer(Gravity.RIGHT);
   }
 }
コード例 #11
0
  private void updateDisplay(int position) {
    Fragment fragment = null;
    switch (position) {
      case 0:
        fragment = new FragSearch();
        break;
      case 1:
        fragment = new FragFavorites();
        break;
      case 2:
        fragment = new FragMission();
        break;
      case 3:
        fragment = new FragRules();
        break;
      case 4:
        fragment = new FragAbout();
        break;
      default:
        break;
    }

    if (fragment != null) {
      FragmentManager fragmentManager = getFragmentManager();
      fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
      // update selected item and title, then close the drawer
      setTitle(menutitles[position]);
      mDrawerLayout.closeDrawer(mDrawerList);
    } else {
      // error in creating fragment
      Log.e("MainActivity", "Error in creating fragment");
    }
  }
コード例 #12
0
 private void selectItem(int position) {
   mCurrentSelectedPosition = position;
   if (mDrawerListView != null) {
     mDrawerListView.setItemChecked(position, true);
   }
   if (mDrawerLayout != null) {
     mDrawerLayout.closeDrawer(mFragmentContainerView);
   }
   if (mCallbacks != null) {
     if (mCurrentSelectedPosition == 0) {
       // mCallbacks.onNavigationDrawerItemSelected(getString(R.string.app_name));
       if (!AccountTemp.getUsername(getActivity()).toString().equals("")
           && !AccountTemp.getPwd(getActivity()).toString().equals("")) {
         if (getNetworkIsAvailable()) {
           Intent intent = new Intent(getActivity(), AccountSelf.class);
           intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
           startActivity(intent);
           getActivity().overridePendingTransition(R.anim.push_left_in, R.anim.push_left_in);
         } else {
           Toast.makeText(getActivity(), "亲~断网了哦~", Toast.LENGTH_LONG).show();
         }
       } else {
         Intent intent = new Intent(getActivity(), Login.class);
         intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
         startActivity(intent);
         getActivity().overridePendingTransition(R.anim.push_left_in, R.anim.push_left_in);
       }
       return;
     }
     mCallbacks.onNavigationDrawerItemSelected(mData.get(position - 1).getTitle());
   }
 }
コード例 #13
0
 @Override
 public boolean onNavigationItemSelected(MenuItem menuItem) {
   // Handle navigation view item clicks here.
   navigationView.setCheckedItem(menuItem.getItemId());
   navigationDrawer.closeDrawer(GravityCompat.START);
   return true;
 }
コード例 #14
0
ファイル: MainActivity.java プロジェクト: raoyuan/x-bionic
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   Intent intent = null;
   switch (position) {
     case 1:
       intent = new Intent(this, CollectionActivity.class);
       startActivity(intent);
       break;
     case 2:
       intent = new Intent(MainActivity.this, SetActivity.class);
       startActivity(intent);
       break;
     case 3:
       intent = new Intent(MainActivity.this, MasterActivity.class);
       startActivity(intent);
       break;
     case 4:
       intent = new Intent(MainActivity.this, MainActivity.class);
       startActivity(intent);
       break;
     case 5:
       intent = new Intent(MainActivity.this, ShoppingActivity.class);
       startActivity(intent);
       break;
     case 7:
       intent = new Intent(MainActivity.this, SharesetActivity.class);
       startActivity(intent);
       break;
     default:
       break;
   }
   drawer.closeDrawer(drawerList);
 }
コード例 #15
0
  @Override
  public void onBackPressed() {
    if (mDrawer.isDrawerOpen(GravityCompat.START)) {
      mDrawer.closeDrawer(GravityCompat.START);
      return;
    }

    // handle back button for all fragment
    Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.content_frame);
    if (fragment instanceof FavoriteBoardFragment) {
      if (!favoriteBoardFragment.atFavoriteRoot()) {
        favoriteBoardFragment.popFavoritePath();
        favoriteBoardFragment.RefreshFavoriteBoards();
        return;
      }
    }

    if (fragment != hotTopicFragment) {
      // return to hottopic if we are not there yet
      String title = "首页导读";
      FragmentManager fm = getSupportFragmentManager();
      fm.beginTransaction().replace(R.id.content_frame, hotTopicFragment).commit();
      setTitle(SMTHApplication.App_Title_Prefix + title);
      return;
    }

    // for other cases, double back to exit app
    DoubleBackToExit();
  }
コード例 #16
0
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.log_in) {
      Intent i = new Intent(MainActivity.this, login.class);
      startActivity(i);
      // Handle the camera action
    } else if (id == R.id.nav_gallery) {

    } else if (id == R.id.nav_manage) {

    } else if (id == R.id.nav_share) {

    } else if (id == R.id.devInfo) {
      Intent j = new Intent(MainActivity.this, DevInfo.class);
      startActivity(j);
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }
コード例 #17
0
ファイル: MainActivity.java プロジェクト: marcinmkot/PtestPro
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_camara) {
      // Handle the camera action
    } else if (id == R.id.nav_gallery) {

      Toast.makeText(getApplicationContext(), "Galeria", Toast.LENGTH_SHORT).show();

    } else if (id == R.id.nav_slideshow) {

      Toast.makeText(getApplicationContext(), "Slideshow", Toast.LENGTH_SHORT).show();

    } else if (id == R.id.nav_manage) {

      Toast.makeText(getApplicationContext(), "Manage", Toast.LENGTH_SHORT).show();

    } else if (id == R.id.nav_share) {

      Toast.makeText(getApplicationContext(), "Share", Toast.LENGTH_SHORT).show();

    } else if (id == R.id.nav_send) {

      Toast.makeText(getApplicationContext(), "Send", Toast.LENGTH_SHORT).show();
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }
コード例 #18
0
ファイル: Inicio.java プロジェクト: aranchafoz/Snack_a_TAP
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_search) {
      // Handle the camera action
      Intent i = new Intent(this, ListaProductos.class);
      startActivity(i);
    } else if (id == R.id.nav_categories) {
      // Desplegar las 4 categorias: cafes, frutas, refrescos, snacks
    } else if (id == R.id.nav_filter) {
      Intent i2 = new Intent(this, SelectFilters.class);
      startActivity(i2);
    } else if (id == R.id.nav_contact) {
      // Hacer cosas chungas con la app de correo
    } else if (id == R.id.nav_setting) {
      Intent i3 = new Intent(this, Settings.class);
      startActivity(i3);
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }
コード例 #19
0
 public void setOpen(boolean isOpen) {
   if (isOpen) {
     drawerLayout.openDrawer(GravityCompat.START);
   } else {
     drawerLayout.closeDrawer(GravityCompat.START);
   }
 }
コード例 #20
0
  @Override
  public void onClick(View view) {
    // Close the navigation drawer, currently all click listeners are drawer items
    mDrawerLayout.closeDrawer(GravityCompat.START);

    if (view == mNavAccountItemLayout) {
      EvercamPlayApplication.sendEventAnalytics(
          this, R.string.category_menu, R.string.action_manage_account, R.string.label_account);

      startActivityForResult(
          new Intent(CamerasActivity.this, ManageAccountsActivity.class),
          Constants.REQUEST_CODE_MANAGE_ACCOUNT);
    } else if (view == mNavSettingsItemLayout) {
      EvercamPlayApplication.sendEventAnalytics(
          this, R.string.category_menu, R.string.action_settings, R.string.label_settings);

      startActivity(new Intent(CamerasActivity.this, CameraPrefsActivity.class));
    } else if (view == mNavFeedbackItemLayout) {
      startActivity(new Intent(CamerasActivity.this, FeedbackActivity.class));
    } else if (view == mNavAboutItemLayout) {
      Intent aboutIntent = new Intent(CamerasActivity.this, SimpleWebActivity.class);
      aboutIntent.putExtra(Constants.BUNDLE_KEY_URL, getString(R.string.evercam_url));
      startActivity(aboutIntent);
    }
  }
コード例 #21
0
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_camera) {
      Intent intent = new Intent(this, GameActivity.class);
      startActivity(intent);
    } else if (id == R.id.nav_gallery) {
      Intent intent = new Intent(this, AlphabetActivity.class);
      startActivity(intent);
    } else if (id == R.id.nav_slideshow) {
      Intent intent = new Intent(this, PathRendererActivity.class);
      startActivity(intent);
    } else if (id == R.id.nav_manage) {
      Intent intent = new Intent(this, GestureActivity.class);
      startActivity(intent);
    } else if (id == R.id.nav_share) {

    } else if (id == R.id.nav_send) {

    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }
コード例 #22
0
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    int id = item.getItemId();

    Intent intent;
    switch (id) {
      case R.id.nav_test1:
        intent = new Intent(this, MovieActivity.class);
        startActivity(intent);
        break;
      case R.id.nav_test2:
        intent = new Intent(this, PalindromeActivity.class);
        startActivity(intent);
        break;
      case R.id.nav_test3:
        intent = new Intent(this, BluetoothActivity.class);
        startActivity(intent);
        break;
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);

    return true;
  }
コード例 #23
0
  private void navigateFragment(int fNum) {
    android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
    switch (fNum) {
      case 0:
        { // Home
          fragmentManager.beginTransaction().replace(R.id.container, mainFragment).commit();
          break;
        }
      case 1:
        { // Settings
          SettingsFragment fragment = new SettingsFragment();
          fragmentManager.beginTransaction().replace(R.id.container, fragment).commit();
          break;
        }
      case 2:
        { // About
          AboutFragment fragment = new AboutFragment();
          fragmentManager.beginTransaction().replace(R.id.container, fragment).commit();
          break;
        }
      default:
        Log.e(APP_TAG, "Cannot navigate to fragment number: " + fNum);
        throw new ArrayIndexOutOfBoundsException(
            "Invalid position passed to navigate to. This should never happen.");
    }

    // Close the drawer
    drawerLayout.closeDrawer(Gravity.LEFT);
  }
コード例 #24
0
  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);
  }
コード例 #25
0
  private void displayView(int position) {
    // update the main content by replacing fragments
    Fragment fragment = null;
    switch (position) {
      case 0:
        fragment = new HomeFragment();
        break;
      case 1:
        fragment = new MainFragment();
        break;
      case 2:
        fragment = new EndFragment();
        break;
      default:
        break;
    }

    if (fragment != null) {
      FragmentManager fragmentManager = getFragmentManager();
      fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();

      // update selected item and title, then close the drawer
      drawerList.setItemChecked(position, true);
      drawerList.setSelection(position);
      setTitle(itemList[position]);
      drawerLayout.closeDrawer(drawerList);
    } else {
      Log.e("MainActivity", "Error in creating fragment");
    }
  }
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_us) {
      // Handle the camera action
      mwebView.loadUrl("http://www.newsweek.com/us");
    } else if (id == R.id.nav_world) {
      mwebView.loadUrl("http://www.newsweek.com/world");
    } else if (id == R.id.nav_tech) {
      mwebView.loadUrl("http://www.newsweek.com/tech-science");
    } else if (id == R.id.nav_sports) {
      mwebView.loadUrl("http://www.newsweek.com/sports");
    } else if (id == R.id.nav_share) {
      mwebView.loadUrl("http://www.newsweek.com/about-newsweek");
    } else if (id == R.id.nav_send) {
      mwebView.loadUrl("http://www.newsweek.com/contact");
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }
コード例 #27
0
 private void selectItem(int position) {
   System.out.println(position);
   switch (position) {
     case 0:
       showProfile(profileL, true);
       break;
     case 1:
       showQuickPay(true);
       break;
     case 2:
       showTransactions(null, null, true);
       break;
     case 3:
       showWallets(true);
       break;
     case 4:
       showRelations(null, null, true);
       break;
     case 5:
       mDrawerList.setItemChecked(position, true);
       setTitle(mPlanetTitles[position]);
       startActivity(demoIntent);
       break;
     case 6:
       mDrawerList.setItemChecked(position, true);
       setTitle(mPlanetTitles[position]);
       logOutNow();
       break;
     default:
       break;
   }
   mDrawerLayout.closeDrawer(mDrawerList);
 }
コード例 #28
0
ファイル: MainActivity.java プロジェクト: katalonec/figures
        @Override
        public void onClick(View v) {
          if (mDrawerToggle != null) mDrawerLayout.closeDrawer(mDrawer);

          AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
          LayoutInflater inflater = getLayoutInflater();
          builder.setTitle(R.string.title_new_surface);
          builder
              .setView(inflater.inflate(R.layout.dialog_new_surface, null))
              .setPositiveButton(
                  R.string.ok,
                  new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                      EditText field = (EditText) ((AlertDialog) dialog).findViewById(R.id.name);
                      String name = field.getText().toString();
                      if (!TextUtils.isEmpty(name)) {
                        ContentValues values = new ContentValues();
                        values.put(DbHelper.SURFACE_NAME, name);
                        Uri uri =
                            getContentResolver()
                                .insert(SurfaceProvider.SURFACES_CONTENT_URI, values);
                        if (uri != null) showDetail(0, Long.parseLong(uri.getLastPathSegment()));
                      }
                    }
                  })
              .setNegativeButton(
                  R.string.cancel,
                  new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                      dialog.cancel();
                    }
                  });
          builder.show();
        }
コード例 #29
0
ファイル: MainActivity.java プロジェクト: IsaaCXY/NewMap
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_camara) {
      // Handle the camera action
      Intent intent = new Intent(MainActivity.this, DetailActivity.class);
      startActivity(intent);
      item.setChecked(false);
    } else if (id == R.id.nav_gallery) {
      Intent intent = new Intent(MainActivity.this, RoutinNaviActivity.class);
      startActivity(intent);
      item.setChecked(false);
    } else if (id == R.id.nav_share) {

    } else if (id == R.id.nav_send) {

    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }
コード例 #30
0
ファイル: MainActivity.java プロジェクト: kanke/DreamCar
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_camara) {
      // Handle the camera action
    } else if (id == R.id.nav_gallery) {

    } else if (id == R.id.nav_slideshow) {

    } else if (id == R.id.nav_manage1) {

    } else if (id == R.id.nav_manage2) {

    } else if (id == R.id.nav_manage3) {

    } else if (id == R.id.nav_manage4) {

    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
  }