Search in sources :

Example 1 with MusicInfo

use of org.qii.weiciyuan.bean.android.MusicInfo in project weiciyuan by qii.

the class WriteWeiboActivity method onPrepareOptionsMenu.

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    String contentStr = content.getText().toString();
    if (!TextUtils.isEmpty(contentStr)) {
        menu.findItem(R.id.menu_clear).setVisible(true);
    } else {
        menu.findItem(R.id.menu_clear).setVisible(false);
    }
    MusicInfo musicInfo = GlobalContext.getInstance().getMusicInfo();
    if (!musicInfo.isEmpty()) {
        MenuItem musicMenu = menu.findItem(R.id.menu_add_now_playing);
        musicMenu.setVisible(true);
        musicMenu.setTitle(musicInfo.toString());
    }
    return super.onPrepareOptionsMenu(menu);
}
Also used : MenuItem(android.view.MenuItem) MusicInfo(org.qii.weiciyuan.bean.android.MusicInfo)

Example 2 with MusicInfo

use of org.qii.weiciyuan.bean.android.MusicInfo in project weiciyuan by qii.

the class MusicReceiver method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    String artist = intent.getStringExtra("artist");
    String album = intent.getStringExtra("album");
    String track = intent.getStringExtra("track");
    if (!TextUtils.isEmpty(track)) {
        MusicInfo musicInfo = new MusicInfo();
        musicInfo.setArtist(artist);
        musicInfo.setAlbum(album);
        musicInfo.setTrack(track);
        AppLogger.d("Music" + artist + ":" + album + ":" + track);
        GlobalContext.getInstance().updateMusicInfo(musicInfo);
    }
}
Also used : MusicInfo(org.qii.weiciyuan.bean.android.MusicInfo)

Example 3 with MusicInfo

use of org.qii.weiciyuan.bean.android.MusicInfo in project weiciyuan by qii.

the class WriteWeiboActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent;
    switch(item.getItemId()) {
        case android.R.id.home:
            saveToDraft();
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            if (imm.isActive()) {
                imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
            }
            intent = MainTimeLineActivity.newIntent(getAccount());
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
            break;
        case R.id.menu_topic:
            String ori = content.getText().toString();
            String topicTag = "##";
            content.setText(ori + topicTag);
            content.setSelection(content.getText().toString().length() - 1);
            break;
        case R.id.menu_at:
            intent = new Intent(WriteWeiboActivity.this, AtUserActivity.class);
            intent.putExtra("token", token);
            startActivityForResult(intent, AT_USER);
            break;
        case R.id.menu_txt_to_pic:
            convertStringToBitmap();
            break;
        case R.id.menu_clear:
            clearContentMenu();
            break;
        case R.id.menu_add_gps:
            addLocation();
            break;
        case R.id.menu_add_now_playing:
            MusicInfo musicInfo = GlobalContext.getInstance().getMusicInfo();
            if (!musicInfo.isEmpty()) {
                content.append(musicInfo.toString());
            }
            break;
    }
    return true;
}
Also used : Intent(android.content.Intent) InputMethodManager(android.view.inputmethod.InputMethodManager) AtUserActivity(org.qii.weiciyuan.ui.search.AtUserActivity) MusicInfo(org.qii.weiciyuan.bean.android.MusicInfo)

Aggregations

MusicInfo (org.qii.weiciyuan.bean.android.MusicInfo)3 Intent (android.content.Intent)1 MenuItem (android.view.MenuItem)1 InputMethodManager (android.view.inputmethod.InputMethodManager)1 AtUserActivity (org.qii.weiciyuan.ui.search.AtUserActivity)1