예제 #1
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(setLayout());
   ButterKnife.bind(this);
   init();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_episodes);

    apiAdapter = ApiAdapter.build();

    final Category category = (Category) getIntent().getSerializableExtra(ARG_CATEGORY);

    initUI(category);
    loadAndShowEpisodes(category);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_nfc);

    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    deviceOptions.put(getString(R.string.device_cat), UnityActivity.MARKER_CAT);
    deviceOptions.put(getString(R.string.device_dog), UnityActivity.MARKER_DOG);
    deviceOptions.put(getString(R.string.device_snail), UnityActivity.MARKER_SNAIL);

    optionsDialogFragment =
        OptionsDialogFragment.newInstance(deviceOptions.keySet().toArray(new String[] {}));

    txtUsername = (TextView) findViewById(R.id.txt_username);

    user = (User) getIntent().getExtras().getSerializable(EXTRA_USER);
    presentation = (Presentation) getIntent().getExtras().getSerializable(EXTRA_PRESENTATION);

    txtUsername.setText(getString(R.string.welcome) + "\n" + user.getName());

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(user.getName());

    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });
    toolbar.inflateMenu(R.menu.nfc);
    toolbar.setOnMenuItemClickListener(
        new Toolbar.OnMenuItemClickListener() {
          @Override
          public boolean onMenuItemClick(MenuItem item) {
            switch (item.getItemId()) {
              case R.id.action_log_out:
                RestClient.getInstance().setUser(null, null);
                finish();
                break;
              case R.id.action_join:
                optionsDialogFragment.show(getSupportFragmentManager(), DIALOG_TAG_OPTIONS_DIALOG);
                break;
            }
            return false;
          }
        });

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

    // Init UI components
    ButterKnife.inject(this);
    setSupportActionBar(mToolbar);
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);
    mRecyclerView.addOnScrollListener(mOnScrollListener);
    mSwipeRefreshLayout.setOnRefreshListener(this);
    mSwipeRefreshLayout.setColorSchemeColors(
        getResources().getColor(R.color.accent), getResources().getColor(R.color.flipagram_red));

    initServices();
    initData();
  }