@TargetApi(Build.VERSION_CODES.HONEYCOMB)
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_sketch_properties);

    // StackOverflow: http://stackoverflow.com/a/27455330/1628609
    LinearLayout root =
        (LinearLayout) findViewById(android.R.id.list).getParent().getParent().getParent();
    toolbar = (Toolbar) LayoutInflater.from(this).inflate(R.layout.settings_toolbar, root, false);
    root.addView(toolbar, 0);

    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });

    initOptionsMenu(toolbar.getMenu());
    toolbar.setOnMenuItemClickListener(this);

    toolbar.setTitle(getGlobalState().getSketchName());

    getGlobalState().setProperties(this);

    getWindow()
        .getDecorView()
        .setBackgroundColor(getResources().getColor(R.color.activity_background));
  }
Example #2
0
 private void loadSelection(int i) {
   switch (i) {
     case 0:
       CostOverviewFragment overviewFragment = new CostOverviewFragment();
       toolbar.setTitle("Cost Overview");
       FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
       Bundle bundle = new Bundle();
       bundle.putParcelable("house", house);
       bundle.putParcelable("account", current);
       bundle.putInt("cost", getIntent().getBundleExtra("extra").getInt("cost"));
       getIntent().putExtra("extra", bundle);
       fragmentTransaction.replace(R.id.detailsFragmentHolder, overviewFragment);
       fragmentTransaction.addToBackStack(overviewFragment.getTag());
       fragmentTransaction.commit();
       break;
     case 1:
       PersonalCostOverview personalCostOverview = new PersonalCostOverview();
       toolbar.setTitle(cost.getSplit().get(selectedUser).getName() + "'s payments");
       fragmentTransaction = fragmentManager.beginTransaction();
       bundle = new Bundle();
       bundle.putParcelable("house", house);
       bundle.putParcelable("account", current);
       bundle.putInt("cost", getIntent().getBundleExtra("extra").getInt("cost"));
       bundle.putInt("selected", selectedUser);
       getIntent().putExtra("extra", bundle);
       fragmentTransaction.replace(R.id.detailsFragmentHolder, personalCostOverview);
       fragmentTransaction.addToBackStack(personalCostOverview.getTag());
       fragmentTransaction.commit();
       break;
   }
 }
  public void initData() {
    canSee = false;
    initCodeBook();
    isUpdate = getIntent().getBooleanExtra(EditPassWordActivity.intent_is_update, false);
    if (isUpdate) {
      deleteButton.setVisibility(View.VISIBLE);
      codeBookId = getIntent().getStringExtra(EditPassWordActivity.intent_codeBook_id);
      // mCodeBook = MyApplication.daoMaster.newSession().getCodeBookDao().
      Query query =
          MyApplication.daoMaster
              .newSession()
              .getCodeBookDao()
              .queryBuilder()
              .where(CodeBookDao.Properties.Id.eq(codeBookId))
              .build();
      mCodeBook = (CodeBook) query.list().get(0);
      canSee = mCodeBook.getCanSee();
      mToolbar.setTitle(getString(R.string.common_look));
    } else {
      mToolbar.setTitle(getString(R.string.common_new));
    }

    setChangeButton();

    etTitle.setText(mCodeBook.getTitle());
    etUserName.setText(mCodeBook.getUsername());
    etPassWord.setText(mCodeBook.getPassword());
    etDescribe.setText(mCodeBook.getDescribe());

    if (isUpdate) {
      txtUpdateTime.setText("上次修改时间:" + DateUtils.TimeMills2Date(mCodeBook.getUpdateTime()));
    } else {
      txtUpdateTime.setText("当前创建时间:" + DateUtils.TimeMills2Date(DateUtils.currentTime2String()));
    }
  }
 private void atualizarTitulo(boolean drawerIsOpen) {
   if (drawerIsOpen) {
     mToolbar.setTitle(R.string.app_name);
   } else {
     int posicaoAtual = mDrawerList.getCheckedItemPosition();
     String opcaoAtual = mDrawerList.getItemAtPosition(posicaoAtual).toString();
     mToolbar.setTitle(opcaoAtual);
   }
 }
 private void initToolbar(String title) {
   mToolbar.setTitle(getString(R.string.post_title));
   setSupportActionBar(mToolbar);
   mToolbar.setTitle(title);
   mToolbar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
   mToolbar.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           finish();
         }
       });
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_settings);
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_settings);
    toolbar.setTitle("");
    setSupportActionBar(toolbar);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            exit();
          }
        });

    TextView main_title = (TextView) findViewById(R.id.settings_toolbar_title);
    main_title.setText("Settings");

    init();
  }
Example #7
0
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.vietchu);
   toolbar = (Toolbar) findViewById(R.id.toolbar);
   toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_left_arrow));
   toolbar.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Intent i = new Intent(vietchu.this, GameS.class);
           startActivity(i);
           finish();
         }
       });
   toolbar.setTitle("Bé tập viết chữ");
   Gallery gallery = (Gallery) findViewById(R.id.gallery1);
   gallery.setAdapter(new ImageAdapter(getApplicationContext()));
   //	gallery.setAdapter(new ImageAdapter(getApplicationContext();
   gesture = (GestureOverlayView) findViewById(R.id.gestureOverlayView1);
   vietlai = (Button) findViewById(R.id.btn_vietlai);
   vietlai.setOnClickListener(
       new OnClickListener() {
         public void onClick(View v) {
           gesture.cancelClearAnimation();
           gesture.clear(true);
         }
       });
 }
 @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;
 }
Example #9
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sleep);
    Realm realm = Realm.getDefaultInstance();

    Toolbar tb = (Toolbar) findViewById(R.id.toolbar);
    tb.setTitle("Sleep Summaries");
    setSupportActionBar(tb);

    if (getSupportActionBar() != null) {
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      getSupportActionBar().setDisplayShowHomeEnabled(true);
      final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
      upArrow.setColorFilter(Color.parseColor("#FFFFFF"), PorterDuff.Mode.SRC_ATOP);
      getSupportActionBar().setHomeAsUpIndicator(upArrow);
      tb.setTitleTextColor(Color.WHITE);
    }

    tb.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });

    // Get all sleep data recorded and send this to adapter to populate the list

    RealmResults<Sleep> sleeps = realm.where(Sleep.class).findAll();
    sleeps.sort("startTime", Sort.DESCENDING);
    SleepAdapter sleepAdapter = new SleepAdapter(this, R.id.listView, sleeps, true);
    ListView listView = (ListView) findViewById(R.id.listView);
    listView.setAdapter(sleepAdapter);
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Log.d("DEBUG", "onCreateView");

    // view
    View v = inflater.inflate(R.layout.detail_contact, container, false);

    // set back icon in toolbar
    Toolbar tl = MainActivity.getToolbar();
    tl.setTitle(contact.getName());
    tl.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    tl.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            getActivity().onBackPressed();
          }
        });

    // find views and put data on it
    ImageView icon = (ImageView) v.findViewById(R.id.detail_icon);
    TextView status = (TextView) v.findViewById(R.id.detail_status);
    TextView name = (TextView) v.findViewById(R.id.detail_name);

    status.setText(contact.getStatus());
    icon.setImageResource(contact.getIcon());
    name.setText(contact.getName());

    return v;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setTheme(mThemeId);

    ViewGroup root = (ViewGroup) findViewById(android.R.id.content);
    View content = root.getChildAt(0);
    LinearLayout toolbarContainer = (LinearLayout) View.inflate(this, R.layout.activity_pref, null);

    root.removeAllViews();
    toolbarContainer.addView(content);
    root.addView(toolbarContainer);

    mToolBar = (Toolbar) toolbarContainer.findViewById(R.id.toolbar);

    mToolBar = (Toolbar) toolbarContainer.findViewById(R.id.toolbar);
    mToolBar.setTitle(getTitle());
    mToolBar.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    mToolBar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });
  }
 private void initToolBar() {
   toolbar = (Toolbar) findViewById(R.id.toolbar);
   setSupportActionBar(toolbar);
   toolbar.setTitle("关于驱动器");
   toolbar.setTitleTextColor(getResources().getColor(R.color.white));
   if (typeNum == AboutQudongActivity.PRODUCT_NOTEBOOK) {
     toolbar.setSubtitle("产品手册");
   } else if (typeNum == AboutQudongActivity.ORDER_NOTEBOOK) {
     toolbar.setSubtitle("指令手册");
   } else if (typeNum == AboutQudongActivity.TEST_NOTEBOOK) {
     toolbar.setSubtitle("调试软件手册");
   } else if (typeNum == AboutQudongActivity.QAA_NOTEBOOK) {
     toolbar.setSubtitle("常见问题");
   }
   toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_48dp);
   toolbar.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           Intent intent = new Intent(NoteBookActivity.this, AboutQudongActivity.class); // 方法1
           startActivity(intent);
           finish();
         }
       });
   toolbar.setOnMenuItemClickListener(onMenuItemClick);
 }
 private void initToolBarUI() {
   Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
   toolbar.setTitle(getResources().getString(R.string.edit_category));
   setSupportActionBar(toolbar);
   toolbar.setNavigationIcon(R.drawable.ic_check_white_24dp);
   LollipopCompat.setElevation(toolbar, getResources().getDimension(R.dimen.ui_elevation));
 }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    View view = inflater.inflate(R.layout.soft_tags_wall_view, container, false);
    ButterKnife.bind(this, view);

    ((AppCompatActivity) mActivity).setSupportActionBar(mToolbar);
    ((AppCompatActivity) mActivity).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    ((AppCompatActivity) mActivity)
        .getSupportActionBar()
        .setHomeAsUpIndicator(R.drawable.back_arrow);
    mToolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            // hack to get click working
            mActivity.onBackPressed();
          }
        });
    // tag name
    String tag = getArguments().getString(K.KEY_TAG.name());
    mToolbar.setTitle(tag);

    // recyclers
    mLayoutManager = new LinearLayoutManager(mActivity);
    setupRecyclerView();

    return view;
  }
Example #15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    /*getSupportActionBar().setTitle("Event Details");
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);*/
    setContentView(R.layout.event_detail_view);

    ButterKnife.bind(this);

    Bundle b = this.getIntent().getExtras();
    Event event = (Event) b.getSerializable("curItem");

    lblTitle.setText(event.getTitle());
    lblEventDetail.setText(
        "From " + event.getStartdate() + " till " + event.getEnddate() + " at " + event.getCity());
    U.LoadImage(this, iv, event.getImgName());

    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    viewPager.setAdapter(new SampleFragmentPagerAdapter(getSupportFragmentManager(), event));

    PagerSlidingTabStrip tabsStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
    tabsStrip.setShouldExpand(true);
    tabsStrip.setViewPager(viewPager);
    tabsStrip.setShouldExpand(false);

    final Toolbar advToolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
    advToolbar.setTitle("Event Detail");
    advToolbar.setTitleTextColor(R.color.colorPrimaryDark);
    advToolbar.inflateMenu(R.menu.advance_search);
  }
Example #16
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_list);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("List of Trails");
    setSupportActionBar(toolbar);

    map = TrailData.trailHashMap;
    trailList = new ArrayList<Trail>(TrailData.trailHashMap.values());
    Collections.sort(trailList, Trail.TrailComparatorName);

    // set listview to trailadapter using trailList
    trailAdapter = new TrailAdapter(this, R.layout.list_item, trailList);
    listView = (ListView) findViewById(R.id.listView);
    listView.setAdapter(trailAdapter);

    // ListView Item Click Listener
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Trail trail = (Trail) (listView.getItemAtPosition(position));
            Intent intent = new Intent(ListActivity.this, TrailActivity.class);
            intent.putExtra("trailKey", trail.getTrailName());
            startActivity(intent);
          }
        });

    setUpSearchField();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.airbnb_logo);
    toolbar.setTitle("");
    getSupportActionBar().setDisplayShowTitleEnabled(false);

    TextView txtFont = (TextView) findViewById(R.id.custom_font);
    Typeface font = Typeface.createFromAsset(getAssets(), "bello.ttf");
    txtFont.setTypeface(font);

    fab.setOnClickListener(this);

    CustomList adapter = new CustomList(MainActivity.this, places, imageId, imageId2, imageId3);
    mContentListView.setAdapter(adapter);
    mContentListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Log.d(TAG, "it worksLIst");
            Toast.makeText(
                    MainActivity.this, "You Clicked on " + places[+position], Toast.LENGTH_SHORT)
                .show();
          }
        });
  }
Example #18
0
  private void setupUIData() {
    //        digitalAsset = (DigitalAsset) appSession.getData("asset_data");
    String digitalAssetPublicKey =
        ((DigitalAsset) appSession.getData("asset_data")).getAssetPublicKey();
    try {
      digitalAsset = Data.getDigitalAsset(moduleManager, digitalAssetPublicKey);
    } catch (CantLoadWalletException e) {
      e.printStackTrace();
    }

    toolbar.setTitle(digitalAsset.getName());

    //        if (digitalAsset.getImage() != null) {
    //            assetRedeemImage.setImageBitmap(BitmapFactory.decodeStream(new
    // ByteArrayInputStream(digitalAsset.getImage())));
    //        } else {
    //
    // assetRedeemImage.setImageDrawable(rootView.getResources().getDrawable(R.drawable.img_asset_without_image));
    //        }
    byte[] img = (digitalAsset.getImage() == null) ? new byte[0] : digitalAsset.getImage();
    BitmapWorkerTask bitmapWorkerTask =
        new BitmapWorkerTask(assetRedeemImage, res, R.drawable.img_asset_without_image, false);
    bitmapWorkerTask.execute(img); // todo comment to be able to compile

    assetRedeemNameText.setText(digitalAsset.getName());
    //        assetsToRedeemEditText.setText(digitalAsset.getAvailableBalanceQuantity() + "");
    assetsToRedeemEditText.setText(selectedRPCount + "");
    long quantity = digitalAsset.getAvailableBalanceQuantity();
    assetRedeemRemainingText.setText(
        quantity + ((quantity == 1) ? " Asset" : " Assets") + " Remaining");
  }
  /**
   * Fills the list with the available recordings. Only the recordings that are scheduled are added
   * to the list.
   */
  private void populateList() {
    // Clear the list and add the recordings
    adapter.clear();
    TVHClientApplication app = (TVHClientApplication) activity.getApplication();
    for (SeriesRecording srec : app.getSeriesRecordings()) {
      adapter.add(srec);
    }
    // Show the newest scheduled recordings first
    adapter.sort(Constants.RECORDING_SORT_DESCENDING);
    adapter.notifyDataSetChanged();

    if (toolbar != null) {
      onPrepareToolbarMenu(toolbar.getMenu());
      toolbar.setTitle(getString(R.string.series_recordings));
      if (adapter.getCount() > 0) {
        toolbar.setSubtitle(adapter.getCount() + " " + getString(R.string.items_available));
      } else {
        toolbar.setSubtitle(R.string.no_recordings_scheduled);
      }
    }
    // Inform the listeners that the channel list is populated.
    // They could then define the preselected list item.
    if (fragmentStatusInterface != null) {
      fragmentStatusInterface.onListPopulated(TAG);
    }
  }
Example #20
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);

    Demo demo = getDemo();

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(demo.titleResId);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    ViewGroup tab = (ViewGroup) findViewById(R.id.tab);
    tab.addView(LayoutInflater.from(this).inflate(demo.layoutResId, tab, false));

    ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
    SmartTabLayout viewPagerTab = (SmartTabLayout) findViewById(R.id.viewpagertab);
    demo.setup(viewPagerTab);

    FragmentPagerItems pages = new FragmentPagerItems(this);
    for (int titleResId : demo.tabs()) {
      pages.add(FragmentPagerItem.of(getString(titleResId), DemoFragment.class));
    }

    FragmentPagerItemAdapter adapter =
        new FragmentPagerItemAdapter(getSupportFragmentManager(), pages);

    viewPager.setAdapter(adapter);
    viewPagerTab.setViewPager(viewPager);
  }
 /** 设置标题 */
 protected void setTitle(String title) {
   if (!useToolbar) {
     ((TextView) top_bar.findViewById(R.id.tv_title)).setText(title);
   } else {
     ((Toolbar) top_bar).setTitle(title);
   }
 }
  private void updateDialog() {
    Exercise chosenExercise = mExercise.getSection().getExercises().get(mChosenLevel);

    mToolbar.setTitle(chosenExercise.getTitle());
    mToolbar.setSubtitle(chosenExercise.getDescription());

    if (mExercise.getSection().getSectionMode() == SectionMode.LEVELS) {
      mLevelTextView.setText(chosenExercise.getLevel());
    } else {
      mLevelTextView.setText("Pick One");
    }

    if (mChosenLevel == 0) {
      mLevelPreviousButton.setVisibility(View.INVISIBLE);
    } else {
      mLevelPreviousButton.setVisibility(View.VISIBLE);
    }

    if (mChosenLevel >= (mAvailableLevels - 1)) {
      mLevelNextButton.setVisibility(View.INVISIBLE);
    } else {
      mLevelNextButton.setVisibility(View.VISIBLE);
    }

    updateProgressBar();
  }
Example #23
0
 // In Activity#onCreateOptionsMenu
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   // Get the menu item.
   getMenuInflater().inflate(R.menu.share_menu, menu);
   mToolbar.setTitle(mTitle);
   return (super.onCreateOptionsMenu(menu));
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_success_package);
    ButterKnife.bind(this);

    toolbar.setNavigationIcon(R.drawable.nav_icon_back);
    new ToolBarHelper(toolbar)
        .buildNavigationOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                onBackPressed();
              }
            })
        .buildMenu(
            R.menu.menu_back_font,
            new Toolbar.OnMenuItemClickListener() {
              @Override
              public boolean onMenuItemClick(MenuItem item) {
                if (item.getItemId() == R.id.action_back) {
                  startActivity(new Intent(getApplicationContext(), HomeActivity.class));
                }

                return false;
              }
            })
        .setUp();
    toolbar.setTitle("成功生成礼包");

    addRuleItem();
    addRuleItem();
    addRuleItem();
    addRuleItem();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_item_app_bar);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setTitle(getTitle());

    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                .setAction("Action", null)
                .show();
          }
        });

    if (findViewById(R.id.item_detail_container) != null) {
      // The detail container view will be present only in the
      // large-screen layouts (res/values-large and
      // res/values-sw600dp). If this view is present, then the
      // activity should be in two-pane mode.
      tumbado = true;

      // In two-pane mode, list items should be given the
      // 'activated' state when touched.
      ((ItemListFragment) getSupportFragmentManager().findFragmentById(R.id.item_list))
          .setActivateOnItemClick(true);
    }

    // TODO: If exposing deep links into your app, handle intents here.
  }
Example #26
0
 public void onSectionAttached(int number) {
   switch (number) {
     case 0:
       mTitle = getString(R.string.title_section1);
       break;
     case 1:
       mTitle = getString(R.string.title_section2);
       break;
     case 2:
       mTitle = getString(R.string.title_section3);
       break;
     case 3:
       mTitle = getString(R.string.title_section4);
       break;
     case 4:
       mTitle = getString(R.string.title_section5);
       break;
     case 5:
       mTitle = getString(R.string.title_section6);
       break;
     case 6:
       mTitle = getString(R.string.title_section7);
     case 7:
       mTitle = getString(R.string.title_section8);
       break;
   }
   if (toolbar != null) {
     toolbar.setTitle(mTitle);
   }
   // getSupportActionBar().setTitle(mTitle);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // Set up the toolbar.
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("Welcome");
    setSupportActionBar(toolbar);
    toolbar.setOnMenuItemClickListener(onToolbarMenuItemClickListener);
    ActionBar ab = getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);

    // Set up the navigation drawer.
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark);
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    if (navigationView != null) {
      setupDrawerContent(navigationView);
    }

    fragContainerId = R.id.main_content;

    if (savedInstanceState == null) {
      transitionTo(DemoHomePageFragment.newInstance());
    }

    // Uncomment me for iovation suppoort
    // start(getApplicationContext());
  }
  @Override
  protected void initView(@Nullable Bundle savedInstanceState) {
    setContentView(R.layout.activity_comment_list);
    ButterKnife.bind(this);

    mToolbar.setTitleTextColor(Color.WHITE);
    setSupportActionBar(mToolbar);
    mToolbar.setTitle("评论");
    mToolbar.setNavigationIcon(R.drawable.ic_actionbar_back);

    mRecyclerView.setHasFixedSize(false);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));

    mSwipeRefreshLayout.setColorSchemeResources(
        android.R.color.holo_blue_bright,
        android.R.color.holo_green_light,
        android.R.color.holo_orange_light,
        android.R.color.holo_red_light);

    mSwipeRefreshLayout.setOnRefreshListener(
        () -> {
          if (isFromFreshNews) {
            mAdapter.loadData4FreshNews();
          } else {
            mAdapter.loadData();
          }
        });
  }
  void InitToolBarView() throws Exception {
    mSettingToolbar = (Toolbar) findViewById(R.id.setting_toolbar);
    mSettingToolbar.setTitle("");
    mSettingToolbar.setNavigationIcon(R.drawable.settingtoolbar_return);
    mSettingToolbarTextViewInfo = (TextView) findViewById(R.id.settingtoolbar_info);
    // 设置字体加粗
    TextPaint tp = mSettingToolbarTextViewInfo.getPaint();
    tp.setFakeBoldText(true);
    setSupportActionBar(mSettingToolbar);

    mViewNetset = (Switch) findViewById(R.id.setting_netsetting);
    mViewTempClear = (TextView) findViewById(R.id.setting_tempclear);
    String strTempSize = DataCleanManager.getTotalCacheSize(getApplicationContext());
    mViewTempClear.setText("清除缓存\n缓存大小为:" + strTempSize);
    mViewSetDefaultUrl = (TextView) findViewById(R.id.setting_setdefaulturl);
    mViewSetDefaultUrl.setText("设置默认网址\n默认网址为:" + GetDafaultUrl());
    mViewCheckUpdate = (TextView) findViewById(R.id.setting_checkupdate);
    mViewAbout = (TextView) findViewById(R.id.setting_about);
    mViewClose = (TextView) findViewById(R.id.setting_close);
    // 设置网络选项初始值
    mIsOnlyWifi = GetNetConfig();
    if (mIsOnlyWifi == 0) {
      SettingInfo.SetmIsOnlyWifi(false);
      mViewNetset.setChecked(false);
    } else {
      SettingInfo.SetmIsOnlyWifi(true);
      mViewNetset.setChecked(true);
    }
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.fragment_mealplan, container, false);
    loadingProgress = (ProgressBar) view.findViewById(R.id.loading_mealplan);
    backButton = (ImageButton) view.findViewById(R.id.toolbarButton);
    Toolbar toolbar = (Toolbar) view.findViewById(R.id.meal_plan_toolbar);
    toolbar.setTitle("");
    toolbar.inflateMenu(R.menu.drawer_view);
    toolbar.showOverflowMenu();

    TextView toolbarName = (TextView) view.findViewById(R.id.toolbarName);
    toolbarName.setText("Awesome Mealplan");

    mainActivity = (MainActivity) getActivity();
    mainActivity.setSupportActionBar(toolbar);
    viewPager = (ViewPager) view.findViewById(R.id.meal_plan_viewpager);
    tabLayout = (TabLayout) view.findViewById(R.id.meal_plan_tablayout);

    hideToolbar();
    sendJSONRequest();

    backButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            getActivity().onBackPressed();
          }
        });

    return view;
  }