コード例 #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));
  }
コード例 #2
0
  @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();
  }
コード例 #3
0
ファイル: vietchu.java プロジェクト: anhdtuet1995/behocchu
 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);
         }
       });
 }
コード例 #4
0
ファイル: SleepActivity.java プロジェクト: aoflynn/DynAlarm
  @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);
  }
コード例 #5
0
ファイル: MainActivity.java プロジェクト: XBICT/CourseWork
  // 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;
          }
        });
  }
コード例 #6
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);
  }
コード例 #7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_swipe_tabs);

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

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    viewPager = (ViewPager) findViewById(R.id.pager);
    setupViewPager(viewPager);

    tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(viewPager);

    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            // do something you want
            close();
          }
        });
  }
コード例 #8
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;
  }
コード例 #9
0
  @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);
  }
コード例 #10
0
  @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;
  }
コード例 #11
0
 private void initToolbar() {
   setSupportActionBar(toolbar);
   toolbar.setNavigationOnClickListener(v -> onBackPressed());
   ActionBar actionbar = getSupportActionBar();
   actionbar.setDisplayHomeAsUpEnabled(true);
   actionbar.setDisplayShowHomeEnabled(true);
 }
コード例 #12
0
 @Override
 public void afterCreate() {
   mCategory = getIntent().getStringExtra(EXTRA_CATEGORY);
   ActionBar actionBar = getSupportActionBar();
   if (actionBar != null) {
     actionBar.setDisplayHomeAsUpEnabled(true);
   }
   Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
   toolbar.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           finish();
         }
       });
   setHeader();
   EventBus.getDefault().register(this);
   // 初始化SwipeRefreshLayout
   mSwipeRefreshLayout.setColorSchemeResources(R.color.primary_color);
   initEvent();
   // 初始化recyclerview
   mRvInvitation.setLayoutManager(
       mLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
   // 加载数据并显示加载框
   InvitationCondition condition = new InvitationCondition();
   condition.setCategory(mCategory);
   mCondition = condition;
   showProgress();
   mController.loadData(condition);
 }
コード例 #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);
  }
コード例 #14
0
ファイル: MainActivity.java プロジェクト: makavelka/CheckAuto
 private void init() {
   Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
   setSupportActionBar(toolbar);
   mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
   getSupportActionBar().setDisplayShowTitleEnabled(false);
   mDrawerToggle =
       new ActionBarDrawerToggle(
           this,
           mDrawerLayout,
           toolbar,
           R.string.abc_action_bar_home_description,
           R.string.abc_action_bar_home_description);
   mDrawerLayout.setDrawerListener(mDrawerToggle);
   mDrawerToggle.syncState();
   toolbar.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           if (mPager.getCurrentItem() == 0) {
             mPager.setCurrentItem(1);
           } else {
             mPager.setCurrentItem(0);
           }
           //                }
         }
       });
 }
コード例 #15
0
  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();
          }
        });
  }
コード例 #16
0
 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);
 }
コード例 #17
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();
 }
コード例 #18
0
  @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();
          }
        });
  }
コード例 #19
0
ファイル: InfoActivity.java プロジェクト: yangjiu/android2048
 // 初始化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();
         }
       });
 }
コード例 #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);
    }
  }
コード例 #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();
  }
コード例 #22
0
  @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;
  }
コード例 #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_todo_list);

    app = ((BrainasApp) BrainasApp.getAppContext());
    setTitle("TODO List");

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });

    tasksGrid = (GridView) findViewById(R.id.tasks_grid);
    userNotSignedInMessage = (TextView) findViewById(R.id.user_not_signed_in_message);

    app.getSynchronizationManager().attach(this);
    app.getActivationManager().attach(this);
  }
コード例 #24
0
ファイル: AboutActivity.java プロジェクト: DSstar/Loliclub
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    // 初始化Toolbar
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    // 获取APP版本号(名)
    try {
      TextView versionView = (TextView) findViewById(R.id.about_version);
      PackageManager packageManager = getPackageManager();
      PackageInfo packageInfo = packageManager.getPackageInfo(getPackageName(), 0);
      versionView.setText("V" + packageInfo.versionName);
    } catch (PackageManager.NameNotFoundException e) {
      e.printStackTrace();
    }

    mToolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });
  }
コード例 #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);
  }
コード例 #26
0
  @Nullable
  @Override
  public View onCreateView(
      LayoutInflater inflater,
      @Nullable ViewGroup viewContainer,
      @Nullable Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_likes_list, viewContainer, false);
    toolbar = ViewUtils.getView(rootView, R.id.t__likes_list__toolbar);
    likersListView = ViewUtils.getView(rootView, R.id.rv__likes_list);

    likesAdapter = new LikesAdapter();
    likersListView.setLayoutManager(new LinearLayoutManager(getActivity()));
    likersListView.setAdapter(likesAdapter);

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

    Message likedMessage = getArguments().getParcelable(ARGUMENT_LIKED_MESSAGE);
    likesAdapter.setLikes(likedMessage.getLikes());

    return rootView;
  }
コード例 #27
0
  @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();
  }
コード例 #28
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);
      }
    }
  }
  @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");
  }
コード例 #30
0
ファイル: Preferences.java プロジェクト: SKaDiZZ/MytecApp
  @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();
  }