Пример #1
0
 @Override
 public void onClick(View v) {
   switch (v.getId()) {
     case R.id.titlebarRightImg:
       {
         if (FLog.isDebug()) {
           FLog.d("Lyrics", "onClick()..");
         }
         if (lyricsDrawerFragment.isDrawerOpen()) {
           lyricsDrawerFragment.closeDrawer();
         } else {
           PlayMode playMode = lyricsContentFragment.getPlayMode();
           int mode = playMode.getMode();
           long count = playMode.getRestSentenceCount();
           if (count > AppConstant.Player.LOOP_5) {
             count = Long.MAX_VALUE;
           } else {
             count = AppConstant.Player.LOOP_5;
           }
           if (FLog.isDebug()) {
             FLog.d("LyricsActivity", "onClick() openDrawer mode=" + mode + " count=" + count);
           }
           lyricsDrawerFragment.openDrawer(playMode.getMode(), count);
         }
       }
       break;
   }
 }
Пример #2
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_lyrics);

    Intent intent = getIntent();
    String audioName = intent.getStringExtra(AppConstant.NAME);
    if (audioName == null) {
      finish();
      return;
    }

    lyricsContentFragment = new LyricsContentFragment();
    FragmentManager fragmentManager = getSupportFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.container, lyricsContentFragment).commit();

    lyricsDrawerFragment =
        (LyricsDrawerFragment) getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
    // Set up the drawer.
    lyricsDrawerFragment.setUp();
    lyricsDrawerFragment.setPlayModeListener(lyricsContentFragment);

    txtTitlebarName.setText(audioName);
    imgTitlebarLeft.setImageResource(R.drawable.back);

    setTitlebarRightImage(R.drawable.control);
    imgTitlebarRight.setOnClickListener(this);

    if (FLog.isDebug()) {
      FLog.d("Lyrics", "onCreate() audioName=" + audioName);
    }
  }
Пример #3
0
 public boolean doOnBackPressed() {
   if (lyricsDrawerFragment.isDrawerOpen()) {
     lyricsDrawerFragment.closeDrawer();
     return true;
   } else if (lyricsContentFragment.doOnBackPressed()) {
     return true;
   } else {
     return super.doOnBackPressed();
   }
 }