Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. package xyz.aungpyaephyo.joketeller.activities;
  2.  
  3. import android.content.Intent;
  4. import android.os.Bundle;
  5. import android.support.annotation.Nullable;
  6. import android.support.design.widget.FloatingActionButton;
  7. import android.support.design.widget.Snackbar;
  8. import android.support.v7.app.ActionBar;
  9. import android.support.v7.app.AppCompatActivity;
  10. import android.support.v7.widget.Toolbar;
  11. import android.view.View;
  12.  
  13. import xyz.aungpyaephyo.joketeller.JokeTellerApp;
  14. import xyz.aungpyaephyo.joketeller.R;
  15. import xyz.aungpyaephyo.joketeller.data.vos.EventVO;
  16. import xyz.aungpyaephyo.joketeller.fragments.EventFragment;
  17.  
  18. /**
  19. * Created by aung on 6/26/16.
  20. */
  21. public class EventActivity extends AppCompatActivity
  22. implements EventFragment.ControllerEventItem{
  23.  
  24. public static Intent newIntent() {
  25. Intent intent = new Intent(JokeTellerApp.getContext(), EventActivity.class);
  26. return intent;
  27. }
  28.  
  29. @Override
  30. protected void onCreate(@Nullable Bundle savedInstanceState) {
  31. super.onCreate(savedInstanceState);
  32. setContentView(R.layout.activity_event);
  33.  
  34. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
  35. setSupportActionBar(toolbar);
  36.  
  37. final ActionBar actionBar = getSupportActionBar();
  38. if (actionBar != null) {
  39. actionBar.setDisplayShowTitleEnabled(false);
  40. actionBar.setDisplayHomeAsUpEnabled(true);
  41. }
  42.  
  43. FloatingActionButton fabSearch = (FloatingActionButton) findViewById(R.id.fab_search);
  44. fabSearch.setOnClickListener(new View.OnClickListener() {
  45. @Override
  46. public void onClick(View view) {
  47. Snackbar.make(view, "Search on Phandeeyar Events", Snackbar.LENGTH_LONG)
  48. .setAction("Action", null).show();
  49. }
  50. });
  51.  
  52. if (savedInstanceState == null) {
  53. EventFragment fragment = EventFragment.newInstance();
  54. getSupportFragmentManager().beginTransaction()
  55. .replace(R.id.fl_container, fragment)
  56. .commit();
  57. }
  58. }
  59.  
  60. @Override
  61. public void onTapEvent(EventVO event) {
  62. Intent intent = EventDetailActivity.newIntent(event.getEventTitle());
  63. startActivity(intent);
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement