Exemplo n.º 1
0
 // TODO
 public void setNavigationButton(boolean isArrow) {
   if (isArrow) {
     mActivity.getSupportActionBar().setDisplayShowHomeEnabled(false);
     mToolbar.setNavigationIcon(R.mipmap.ic_arrow_back);
   } else {
     mActivity.getSupportActionBar().setDisplayShowHomeEnabled(true); // SHOW LOGO ICON
     mToolbar.setNavigationIcon(R.mipmap.ic_launcher);
   }
 }
Exemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_places);

    // Get and set the toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.places_toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_back_white_24dp);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
      getSupportActionBar().setDisplayShowHomeEnabled(true);
    }

    mProgress = (ProgressBar) findViewById(R.id.places_progress);
    mList = (ListView) findViewById(R.id.places_list);

    // Create the name dialog. This needs to be done only once
    mName = new EditText(this);
    mName.setLayoutParams(
        new ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mName.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
    mNameDialog =
        new AlertDialog.Builder(this)
            .setTitle(R.string.places_name_dialog_title)
            .setView(mName)
            .setNegativeButton(R.string.places_name_dialog_cancel, null)
            .setPositiveButton(R.string.places_name_dialog_accept, null)
            .create();
    mNameDialog.setOnShowListener(this);

    // Load the primary places
    HttpRequest.get(this, API.URL.getPrimaryPlaces());
  }
  @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");
  }
  @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();
  }
Exemplo n.º 5
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;
          }
        });
  }
Exemplo n.º 6
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();
          }
        });
  }
Exemplo n.º 7
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();
          }
        });
  }
Exemplo n.º 8
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);
  }
 /**
  * Change the drawer indicator
  *
  * @param resource - The icon
  * @return DrawerActivity
  */
 public DrawerActivity setCustomIconNavigationDrawer(int resource) {
   if (mDrawerToggle != null) {
     mDrawerToggle.setHomeAsUpIndicator(resource);
     mDefaultToolbar.setNavigationIcon(resource);
   }
   return this;
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_contenedor);

    navigation = (NavigationView) findViewById(R.id.navigation);
    dlaContenedor = (DrawerLayout) findViewById(R.id.dlaContenedor);
    toolbar = (Toolbar) findViewById(R.id.toolbar);

    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.mipmap.ic_launcher);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            dlaContenedor.openDrawer(GravityCompat.START);
          }
        });

    Fragment perfilFragment = PerfilFragment.newInstance();
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    ft.replace(R.id.flaContenido, perfilFragment);
    ft.commit();

    navigation.setNavigationItemSelectedListener(this);
  }
 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));
 }
Exemplo n.º 12
0
  /** {@inheritDoc} from Fragment */
  @Override
  public View onCreateView(
      final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.contact_picker_fragment, container, false);
    mRecipientTextView =
        (ContactRecipientAutoCompleteView) view.findViewById(R.id.recipient_text_view);
    mRecipientTextView.setThreshold(0);
    mRecipientTextView.setDropDownAnchor(R.id.compose_contact_divider);

    mRecipientTextView.setContactChipsListener(this);
    mRecipientTextView.setDropdownChipLayouter(
        new ContactDropdownLayouter(inflater, getActivity(), this));
    mRecipientTextView.setAdapter(new ContactRecipientAdapter(getActivity(), this));
    mRecipientTextView.addTextChangedListener(
        new TextWatcher() {
          @Override
          public void onTextChanged(
              final CharSequence s, final int start, final int before, final int count) {}

          @Override
          public void beforeTextChanged(
              final CharSequence s, final int start, final int count, final int after) {}

          @Override
          public void afterTextChanged(final Editable s) {
            updateTextInputButtonsVisibility();
          }
        });

    final CustomHeaderPagerViewHolder[] viewHolders = {
      mFrequentContactsListViewHolder, mAllContactsListViewHolder
    };

    mCustomHeaderViewPager = (CustomHeaderViewPager) view.findViewById(R.id.contact_pager);
    mCustomHeaderViewPager.setViewHolders(viewHolders);
    mCustomHeaderViewPager.setViewPagerTabHeight(CustomHeaderViewPager.DEFAULT_TAB_STRIP_SIZE);
    mCustomHeaderViewPager.setBackgroundColor(
        getResources().getColor(R.color.contact_picker_background));

    // The view pager defaults to the frequent contacts page.
    mCustomHeaderViewPager.setCurrentItem(0);

    mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
    mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_light);
    mToolbar.setNavigationContentDescription(R.string.back);
    mToolbar.setNavigationOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(final View v) {
            mHost.onBackButtonPressed();
          }
        });

    mToolbar.inflateMenu(R.menu.compose_menu);
    mToolbar.setOnMenuItemClickListener(this);

    mComposeDivider = view.findViewById(R.id.compose_contact_divider);
    mRootView = view;
    return view;
  }
Exemplo n.º 13
0
  private void configureToolbarView() {
    setSupportActionBar(mToolbarView);
    mToolbarView.setNavigationIcon(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
    mToolbarView.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            EventActivity.this.onBackPressed();
          }
        });

    // Remove toolbars title, as we have our own title implementation
    mToolbarView.post(
        new Runnable() {
          @Override
          public void run() {
            mToolbarView.setTitle("");
          }
        });

    mToolbarBackgroundColor = getResources().getColor(R.color.colorPrimary);
    TypedValue tv = new TypedValue();
    if (EventActivity.this.getTheme().resolveAttribute(R.attr.actionBarSize, tv, true)) {
      mToolbarHeight =
          TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
    }
    setBackgroundAlpha(mToolbarView, 0.0f, mToolbarBackgroundColor);
  }
Exemplo n.º 14
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    getDelegate().installViewFactory();
    getDelegate().onCreate(savedInstanceState);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.preferences_layout);

    // Pokreni toolbar u preferences aktivnosti
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_preferences);
    setSupportActionBar(toolbar);
    toolbar.setBackgroundColor(Color.parseColor("#F5F5F5"));
    toolbar.setTitleTextColor(Color.parseColor("#666666"));
    toolbar.setNavigationIcon(R.drawable.ic_keyboard_arrow_left_black_24dp);
    // Sta se dogadja kada korisnik klikne na back dugmic u toolbaru
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {

            // Ponovo pokreni glavnu aktivnost ovaj put sa novim postavkama
            Intent restartMainActivity = new Intent(Preferences.this, MainActivity.class);
            startActivity(restartMainActivity);
          }
        });

    // Dodaj Postavke fragment kao glavni sadrzaj u preferences aktivnosti
    getFragmentManager().beginTransaction().replace(R.id.prefsFragment, new Postavke()).commit();
  }
Exemplo n.º 15
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();
 }
 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);
 }
Exemplo n.º 17
0
  @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);

    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();
          }
        });
  }
Exemplo n.º 19
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();
         }
       });
 }
Exemplo n.º 20
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gridview);

    initGoogleAnalytics(this.getClass().getSimpleName());
    initAdMob();
    getExtra();
    initCheckbox();
    initGridLayout();

    _mContext = this;
    userToken = BrewSharedPrefs.getUserToken();

    Toolbar toolbar = (Toolbar) findViewById(R.id.standard_toolbar);
    setSupportActionBar(toolbar);
    if (toolbar != null) {
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        toolbar.setPadding(0, getStatusBarHeight(), 0, 0);
        ViewGroup.LayoutParams layoutParams = toolbar.getLayoutParams();
        layoutParams.height = layoutParams.height + getStatusBarHeight();
      }
      toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
      toolbar.setNavigationOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              onBackPressed();
            }
          });
      getSupportActionBar().setTitle(recipeTitle);
    }
  }
Exemplo n.º 21
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();
  }
  @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;
  }
Exemplo n.º 23
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();
    }
  }
Exemplo n.º 24
0
 public static void onSetSupportActionBar(Toolbar toolbar) {
   Drawable icon = toolbar.getNavigationIcon();
   ColorStateList tintList =
       ViewUtils.getColorStateListFromAttrRes(R.attr.colorControlNormal, toolbar.getContext());
   icon = tintDrawable(icon, tintList);
   toolbar.setNavigationIcon(icon);
 }
Exemplo n.º 25
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);
  }
Exemplo n.º 26
0
  @Override
  protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getLayoutResourceId() != 0) {
      setContentView(getLayoutResourceId());
    }

    ButterKnife.bind(this);

    ((LocativeApplication) getApplication()).inject(this);

    if (mToolbar != null) {
      setSupportActionBar(mToolbar);
      mToolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24px);
      mToolbar.setNavigationOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              onBackPressed();
            }
          });
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
      if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)
          != PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(
            this, new String[] {Manifest.permission.ACCESS_FINE_LOCATION}, REQUEST_FINE_LOCATION);
      }
    }
  }
Exemplo n.º 27
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);
         }
       });
 }
  private void setUpToolBar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    TextView title = (TextView) toolbar.findViewById(R.id.toolbar_title);
    title.setText("Select Friends");

    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Log.d(TAG, "finished");
            finish();
          }
        });
    TextView next = (TextView) toolbar.findViewById(R.id.action_done);
    next.setText("Next");
    next.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            goToNext();
            finish();
          }
        });
  }
Exemplo 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);
    }
  }
Exemplo n.º 30
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_articles, container, false);

    mRecyclerView = (RecyclerView) view.findViewById(R.id.articles);
    mLayoutManager = new LinearLayoutManager(getActivity());
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.addItemDecoration(new VerticalSpaceItemDecoration(15));
    adapter = new RecyclerArticleAdapter(getActivity(), articleList);
    mRecyclerView.setAdapter(adapter);

    Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
    AppCompatActivity activity = ((AppCompatActivity) getActivity());
    activity.setSupportActionBar(toolbar);

    toolbar.setNavigationIcon(R.drawable.ic_menu);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            listener.showNavDrawer();
          }
        });

    return view;
  }