Ejemplo n.º 1
1
  @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));
  }
  @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();
  }
Ejemplo n.º 3
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;
   }
 }
Ejemplo n.º 4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_touristic_point);

    // Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setSubtitleTextColor(Color.WHITE);
    setSupportActionBar(toolbar);

    // Create the adapter that will return a fragment for each of the sections of the activity.
    mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());

    // Set up the ViewPager with the sections adapter.
    mViewPager = (ViewPager) findViewById(R.id.container);
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mViewPager.addOnPageChangeListener(this);

    // Tabs
    TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(mViewPager);

    // Recebendo dados da outra activity
    Intent intent = getIntent();
    int id = intent.getExtras().getInt("id");
    touristicPoint = DatabaseDAO.getInstance().getTouristicPointByID(id);
  }
Ejemplo n.º 5
0
  private void createSaveButton() {
    mToolbar = ((MainActivity) getActivity()).getToolbar();
    mToolbar.inflateMenu(R.menu.menu_save);

    ImageButton saveButton =
        (ImageButton) mToolbar.getMenu().findItem(R.id.save_view).getActionView();
    saveButton.setImageDrawable(
        ContextCompat.getDrawable(getActivity(), R.drawable.ic_action_save));
    saveButton.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.ColorPrimaryDark));
    saveButton.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (isReadyToSave()) {
              saveUpdatedProfile();
              Toast.makeText(getActivity(), "Successfully saved", Toast.LENGTH_SHORT).show();
              InputMethodManager imm =
                  (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
              imm.hideSoftInputFromWindow(
                  view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
              ((MainActivity) getActivity()).setupProfileOnDrawer();
              ((MainActivity) getActivity()).openDrawer();
            }
          }
        });
  }
Ejemplo n.º 6
0
  @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.
  }
Ejemplo n.º 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);
         }
       });
 }
  /** Set up spinner navigation with swiped pages */
  private void setUpNavigation() {
    // Navigation spinner in toolbar for trainings selection
    LayoutInflater.from(mToolbar.getContext()).inflate(R.layout.navigation_spinner, mToolbar, true);
    mNavigationSpinner = (Spinner) mToolbar.findViewById(R.id.navigation_spinner);
    mNavigationSpinner.setOnItemSelectedListener(this);
    mNavigationSpinner.setSelection(mPosition);

    String[] from = new String[] {Trainings.EXERCISE};
    int[] to = new int[] {R.id.title};
    mNavigationAdapter =
        new NavigationAdapter(
            mToolbar.getContext(), R.layout.navigation_spinner_item, null, from, to, 0);
    mNavigationAdapter.setDropDownViewResource(R.layout.navigation_spinner_dropdown_item);
    mNavigationSpinner.setAdapter(mNavigationAdapter);

    // ViewPager for swipe navigation and animation on training select
    mViewPager.setOnPageChangeListener(this);
    mPagerAdapter = new TrainingPagerAdapter(getChildFragmentManager(), null);
    mViewPager.setAdapter(mPagerAdapter);

    Loader<Cursor> loader = getLoaderManager().getLoader(0);
    if (loader != null && !loader.isReset()) {
      getLoaderManager().restartLoader(0, null, this);
    } else {
      getLoaderManager().initLoader(0, null, this);
    }
  }
Ejemplo n.º 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);
  }
Ejemplo n.º 10
0
  @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();
          }
        });
  }
Ejemplo n.º 11
0
  private void setTheme() {
    toolbar.setBackgroundColor(getPrimaryColor());
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(
        new IconicsDrawable(this)
            .icon(GoogleMaterial.Icon.gmd_arrow_back)
            .color(Color.WHITE)
            .sizeDp(19));
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });

    setStatusBarColor();
    setNavBarColor();
    setRecentApp(getString(R.string.settings));

    txtGT.setTextColor(getAccentColor());
    txtTT.setTextColor(getAccentColor());
    txtPT.setTextColor(getAccentColor());
    txtVT.setTextColor(getAccentColor());

    setScrollViewColor(scr);
    setThemeOnChangeListener();
  }
Ejemplo n.º 12
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();
  }
Ejemplo n.º 13
0
  @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();
          }
        });
  }
Ejemplo n.º 14
0
 // 初始化toolbar
 private void initToolbar() {
   // 绑定toolbar
   Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
   // 找到toolbar标签
   TextView mToolBarTextView = (TextView) findViewById(R.id.text_view_toolbar_title);
   // 将toolbar放到页面顶部
   setSupportActionBar(mToolbar);
   // 设置左上角的图标可以点击
   getSupportActionBar().setHomeButtonEnabled(true);
   // 左上角返回图标
   getSupportActionBar().setDisplayHomeAsUpEnabled(true);
   // 使自定义的普通View能在title栏显示
   getSupportActionBar().setDisplayShowTitleEnabled(false);
   mToolBarTextView.setText("关于我的");
   mToolbar.setNavigationIcon(R.drawable.btn_back);
   // 给返回的按钮设置点击监听
   mToolbar.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           // 此函数系统原有  使用结束当前页面
           onBackPressed();
         }
       });
 }
Ejemplo n.º 15
0
  @Override
  protected void onPostCreate(Bundle savedInstanceState) {
    super.onPostCreate(savedInstanceState);
    if (mDetachedMode) {
      final Toolbar toolbar = getActionBarToolbar();
      toolbar.setNavigationIcon(R.drawable.ic_up);
      toolbar.setNavigationOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View view) {
              finish();
            }
          });
    }

    if (mMapFragment == null) {
      mMapFragment = MapFragment.newInstance();
      mMapFragment.setArguments(intentToFragmentArguments(getIntent()));
      getFragmentManager()
          .beginTransaction()
          .add(R.id.fragment_container_map, mMapFragment, "map")
          .commit();
    }

    mDetachedMode = getIntent().getBooleanExtra(EXTRA_DETACHED_MODE, false);

    ScrimInsetsFrameLayout scrimInsetsFrameLayout =
        (ScrimInsetsFrameLayout) findViewById(R.id.capture_insets_frame_layout);
    scrimInsetsFrameLayout.setOnInsetsCallback(this);
  }
Ejemplo n.º 16
0
  @Override
  public void onDetach() {
    super.onDetach();

    android.support.v7.widget.Toolbar toolbar =
        (android.support.v7.widget.Toolbar) getActivity().findViewById(R.id.toolbar);
    AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();

    // Ripristina gli scrollFlags originali
    params.setScrollFlags(scrollFlags);

    hideSoftKeyboard();

    /*
    //SE SI VUOLE MOSTRARE IL TABLAYOUT

    TabLayout tabLayout = (TabLayout) getActivity().findViewById(R.id.tabs);
    tabLayout.setVisibility(View.GONE);


    // SE SI VUOLE MODIFICARE IL app:layout_behavior del FrameLayout

    if(behavior == null)
        return;

    FrameLayout layout =(FrameLayout) getActivity().findViewById(R.id.dashboard_content);
    CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) layout.getLayoutParams();

    params.setBehavior(behavior);

    layout.setLayoutParams(params);

    behavior = null;
    */
  }
  /** Update toolbar content on fragment change. */
  private void updateToolbar() {
    getActivity().setTitle(null); // Disable regular title

    if (mToolbar.findViewById(R.id.navigation_spinner) == null) {
      mToolbar.addView(mNavigationSpinner);
    }
  }
Ejemplo n.º 18
0
  @Override
  public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);

    ActionBar mActionBar = getSupportActionBar();

    int color = getResources().getColor(R.color.toolbar_green);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      // Overview color
      MainActivity.this.setTaskDescription(
          new ActivityManager.TaskDescription(
              "Linode",
              AndroidHelper.drawableToBitmap(getResources().getDrawable(R.mipmap.ic_launcher)),
              color));
    }

    if (mActionBar != null) {
      toolbar.setBackgroundColor(color);
      drawer
          .getDrawerLayout()
          .setStatusBarBackgroundColor(
              AndroidHelper.darkenColor(getResources().getColor(R.color.toolbar_green), 0.8f));

      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        toolbar.setElevation(8);
      }
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_editor);
    ButterKnife.bind(this);

    setSupportActionBar(editorToolbar);
    editorToolbar.setNavigationIcon(R.mipmap.ic_back);
    editorToolbar.setTitleTextColor(getResources().getColor(R.color.white));
    editorToolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });

    Intent intent = getIntent();
    List<Editor> list = new ArrayList<Editor>();
    Bundle bundle = new Bundle();
    bundle = intent.getBundleExtra("EditorList");
    list = bundle.getParcelableArrayList("EditorList");
    EditorListFragment editorListFragment = new EditorListFragment();
    editorListFragment.setData(list);
    getSupportFragmentManager()
        .beginTransaction()
        .replace(R.id.editor_fragment_container, editorListFragment)
        .commit();
  }
Ejemplo n.º 20
0
  @Override
  public void initView(Bundle savedInstanceState) {

    SearchActivity.this.setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_icon);

    inputMethodManager =
        (InputMethodManager) SearchActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);

    /*创建Adapter*/
    SearchActivity.this.setupAdapter();

    if (savedInstanceState == null) {
      toolbar
          .getViewTreeObserver()
          .addOnPreDrawListener(
              new ViewTreeObserver.OnPreDrawListener() {
                @Override
                public boolean onPreDraw() {
                  toolbar.getViewTreeObserver().removeOnPreDrawListener(this);
                  SearchActivity.this.startEnterAnim();
                  return true;
                }
              });
    } else {
      SearchActivity.this.loadData();
    }
  }
  protected void setupToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar ab = getSupportActionBar();
    if (ab != null) {
      ab.setDisplayHomeAsUpEnabled(true);
    }

    // Status bar
    if (Build.VERSION.SDK_INT >= 21) {
      getWindow().setStatusBarColor(Color.parseColor(mColors[GridActivity.DARK_PRIMARY]));
    }

    // Entire bar layout
    int barColor = Color.parseColor(mColors[GridActivity.PRIMARY]);
    AppBarLayout barLayout = (AppBarLayout) this.findViewById(R.id.app_bar);
    if (barLayout != null) {
      barLayout.setBackgroundColor(barColor);
    }
    toolbar.setBackgroundColor(barColor);

    CollapsingToolbarLayout collapsingToolbarLayout =
        (CollapsingToolbarLayout) this.findViewById(R.id.toolbar_layout);
    if (collapsingToolbarLayout != null) {
      collapsingToolbarLayout.setBackgroundColor(barColor);
      collapsingToolbarLayout.setContentScrimColor(barColor);
    }
  }
  /**
   * 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);
    }
  }
Ejemplo n.º 23
0
  private void initToolBar() {
    toolbar.setTitleTextColor(Color.parseColor("#ffffff")); // 设置标题颜色
    toolbar.setLogo(R.mipmap.ic_launcher);
    setSupportActionBar(toolbar);

    //        getSupportActionBar().setDisplayHomeAsUpEnabled(true);//返回键是否显示
    //        getSupportActionBar().setHomeButtonEnabled(true);//应用图标是否可以点击,此api在toolbar中好像没有效果,待验证
    //        getSupportActionBar().setDisplayShowHomeEnabled(true);//应用图标是否显示
    mDrawerToggle =
        new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.open, R.string.close) {
          @Override
          public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            //                mAnimationDrawable.stop();
          }

          @Override
          public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
            //                mAnimationDrawable.start();
          }
        };

    mDrawerToggle.syncState();
    drawerLayout.setDrawerListener(mDrawerToggle);

    drawerLayout.setDrawerShadow(R.drawable.navigation_drawer_shadow, GravityCompat.START);
    //        drawerLayout.setDrawerListener(openDrawerListener);

  }
Ejemplo n.º 24
0
  // toolbar
  private void initToolbar() {
    toolbar.findViewById(R.id.toolbar);
    if (toolbar != null) {
      setSupportActionBar(toolbar);
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
      getSupportActionBar().setHomeButtonEnabled(true);
    }
    toolbar.setNavigationIcon(R.drawable.keyboard_backspace);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
            onclick(v);
          }
        });

    toolbar.setOnMenuItemClickListener(
        new Toolbar.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem menuItem) {
            return false;
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_phone_no_verification);
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      getWindow().setNavigationBarColor(getResources().getColor(R.color.navigationBarColor));
    }

    // setup Toolbar
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);
    mToolbar.setNavigationIcon(R.drawable.ic_back_arrow);
    mToolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });

    setupViews();
    name = getIntent().getStringExtra("etName");
    phoneno = getIntent().getStringExtra("etPhoneNumber");
    verifyCode = getIntent().getStringExtra("verifyCode");
  }
Ejemplo n.º 26
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.include_coordinator_recycler_view);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_up);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });

    final EmptyRecyclerView recyclerView = (EmptyRecyclerView) findViewById(R.id.recycler_view);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setHasFixedSize(true);
    recyclerView.setEmptyView(findViewById(R.id.empty_view));
    QueueAdapter adapter = new QueueAdapter();
    recyclerView.setAdapter(adapter);

    ServiceRecord serviceRecord = ServiceRecord.getInstance();
    if (serviceRecord != null) adapter.setTracks(serviceRecord.getTrackList());

    //        mAdapter = new ArtistAdapter();
    //        mAdapter.setOnArtistClickListener(this);
  }
  @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
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    preferences = getSharedPreferences(null, 0);
    queue = Volley.newRequestQueue(this);

    boolean loggedIn = true;
    for (String data : userData) {
      if (!preferences.contains(data) || !preferences.getBoolean("isOnTeam", false)) {
        loggedIn = false;
        break;
      }
    }

    if (loggedIn) {
      Intent intent = new Intent(this, MainActivity.class);
      startActivity(intent);
      finish();
      return;
    }

    // If not logged in, create login activity
    setContentView(R.layout.activity_login);

    // Set up action bar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    TextView toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
    Typeface typeface = Typeface.createFromAsset(getAssets(), "Exo2-Medium.ttf");
    toolbarTitle.setTypeface(typeface);

    toolbar.setVisibility(View.GONE);
  }
Ejemplo n.º 29
0
  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);
    }
  }
Ejemplo n.º 30
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.child_layout);
   init();
   setSupportActionBar(toolbar);
   JMessageClient.registerEventReceiver(this);
   JMessageClient.setNotificationMode(JMessageClient.NOTI_MODE_NO_NOTIFICATION);
   listener = new LocationListener();
   toolbar.setSubtitle("孩子");
   toolbar.setNavigationIcon(R.mipmap.ic_keyboard_backspace_white_24dp);
   toolbar.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           finish();
         }
       });
   location.setText("软件已开启,请按home键退出");
   client = new LocationClient(this);
   client.registerLocationListener(listener);
   LocationClientOption option = new LocationClientOption();
   option.setOpenGps(true); // 打开gps
   option.setCoorType("bd09ll"); // 设置坐标类型
   client.setLocOption(option);
   client.start();
 }