Java Code Examples for android.support.design.widget.FloatingActionButton#setImageResource()
The following examples show how to use
android.support.design.widget.FloatingActionButton#setImageResource() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataBindingAdapter.java From Android-App-Architecture-MVVM-Databinding with Apache License 2.0 | 6 votes |
/** * Binding FAB's icon to the "state". * * @param fab the FAB * @param state state */ @BindingAdapter({"state"}) public static void setFavoriteState(final FloatingActionButton fab, final MovieDetailsViewModel.State state) { if (state == null) { return; } switch (state) { case LOADING: changeToLoadingState(fab); break; case NON_FAVORITE: fab.clearAnimation(); fab.setImageResource(R.drawable.ic_favorite_border); break; case FAVORITE: fab.clearAnimation(); fab.setImageResource(R.drawable.ic_favorite); break; default: break; } }
Example 2
Source File: AddNoteFragment.java From androidtestdebug with MIT License | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mActionListener = new AddNotePresenter(Injection.provideNotesRepository(), this, Injection.provideImageFile()); FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab_add_notes); fab.setImageResource(R.drawable.ic_done); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mActionListener.saveNote(mTitle.getText().toString(), mDescription.getText().toString()); } }); }
Example 3
Source File: AddEditTaskFragment.java From android-espresso-revealed with Apache License 2.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab_edit_task_done); fab.setImageResource(R.drawable.ic_done); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { byte[] imageViewBytes = null; if (imageView != null) { imageViewBytes = bitmapToByte(((BitmapDrawable)imageView.getDrawable()).getBitmap()); } mPresenter.saveTask(mTitle.getText().toString(), mDescription.getText().toString(),imageViewBytes); } }); }
Example 4
Source File: MainActivity.java From music_player with Open Software License 3.0 | 6 votes |
@Subscribe(threadMode = ThreadMode.MAIN) public void onMessageEvent(UIChangeEvent event) { FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.play_or_pause); switch (event.event) { case MyConstant.initialize: mLayout.setPanelHeight((int) (60 * getResources().getDisplayMetrics().density + 0.5f)+ImmersionBar.getNavigationBarHeight(MainActivity.this)); random_play.hide(); return; case MyConstant.pauseAction: floatingActionButton.setImageResource(R.drawable.ic_play_arrow_black_24dp); play_pause_button.setImageResource(R.drawable.ic_play_arrow_black_24dp); return; case MyConstant.playAction: floatingActionButton.setImageResource(R.drawable.ic_pause_black_24dp); play_pause_button.setImageResource(R.drawable.ic_pause_black_24dp); return; case MyConstant.mediaChangeAction: ChangeScrollingUpPanel(MyApplication.getPositionNow()); return; //??? case MyConstant.DestoryAction: this.finish(); // MainActivity.this.onDestroy(); // finish(); } }
Example 5
Source File: AddNoteFragment.java From androidtestdebug with MIT License | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mActionListener = new AddNotePresenter(Injection.provideNotesRepository(), this, Injection.provideImageFile()); FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab_add_notes); fab.setImageResource(R.drawable.ic_done); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mActionListener.saveNote(mTitle.getText().toString(), mDescription.getText().toString()); } }); }
Example 6
Source File: QuizActivity.java From android-topeka with Apache License 2.0 | 6 votes |
private void initLayout(String categoryId) { setContentView(R.layout.activity_quiz); //noinspection PrivateResource mIcon = (ImageView) findViewById(R.id.icon); int resId = getResources().getIdentifier(IMAGE_CATEGORY + categoryId, DRAWABLE, getApplicationContext().getPackageName()); mIcon.setImageResource(resId); mIcon.setImageResource(resId); ViewCompat.animate(mIcon) .scaleX(1) .scaleY(1) .alpha(1) .setInterpolator(mInterpolator) .setStartDelay(300) .start(); mQuizFab = (FloatingActionButton) findViewById(R.id.fab_quiz); mQuizFab.setImageResource(R.drawable.ic_play); if (mSavedStateIsPlaying) { mQuizFab.hide(); } else { mQuizFab.show(); } mQuizFab.setOnClickListener(mOnClickListener); }
Example 7
Source File: ConnectionPrefsFragment.java From xpra-client with GNU General Public License v3.0 | 6 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FloatingActionButton button = activityAccessor.getFloatingActionButton(); button.setImageResource(R.drawable.ic_play_arrow_white_48dp); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (save()) { Intent intent = new Intent(getActivity(), XpraActivity.class); intent.putExtra(XpraActivity.EXTRA_CONNECTION_ID, connection.getId()); startActivity(intent); } } }); }
Example 8
Source File: ComposeFabFragment.java From actor-platform with GNU Affero General Public License v3.0 | 6 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View res = inflater.inflate(R.layout.fragment_fab, container, false); FloatingActionButton fabRoot = (FloatingActionButton) res.findViewById(R.id.fab); fabRoot.setImageResource(R.drawable.ic_edit_white_24dp); fabRoot.setBackgroundTintList(new ColorStateList(new int[][]{ new int[]{android.R.attr.state_pressed}, StateSet.WILD_CARD, }, new int[]{ ActorSDK.sharedActor().style.getFabPressedColor(), ActorSDK.sharedActor().style.getFabColor(), })); fabRoot.setRippleColor(ActorSDK.sharedActor().style.getFabPressedColor()); fabRoot.setOnClickListener(v -> startActivity(new Intent(getActivity(), ComposeActivity.class))); return res; }
Example 9
Source File: AnagramsActivity.java From jterm-cswithandroid with Apache License 2.0 | 5 votes |
public boolean defaultAction(View view) { TextView gameStatus = (TextView) findViewById(R.id.gameStatusView); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); EditText editText = (EditText) findViewById(R.id.editText); TextView resultView = (TextView) findViewById(R.id.resultView); if (currentWord == null) { currentWord = dictionary.pickGoodStarterWord(); anagrams = dictionary.getAnagramsWithOneMoreLetter(currentWord); gameStatus.setText(Html.fromHtml(String.format(START_MESSAGE, currentWord.toUpperCase(), currentWord))); fab.setImageResource(android.R.drawable.ic_menu_help); fab.hide(); resultView.setText(""); editText.setText(""); editText.setEnabled(true); editText.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); } else { editText.setText(currentWord); editText.setEnabled(false); fab.setImageResource(android.R.drawable.ic_media_play); currentWord = null; resultView.append(TextUtils.join("\n", anagrams)); gameStatus.append(" Hit 'Play' to start again"); } return true; }
Example 10
Source File: NotesFragment.java From androidtestdebug with MIT License | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_notes, container, false); RecyclerView recyclerView = (RecyclerView) root.findViewById(R.id.notes_list); recyclerView.setAdapter(mListAdapter); int numColumns = getContext().getResources().getInteger(R.integer.num_notes_columns); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new GridLayoutManager(getContext(), numColumns)); // Set up floating action button FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab_add_notes); fab.setImageResource(R.drawable.ic_add); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mActionsListener.addNewNote(); } }); // Pull-to-refresh SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.refresh_layout); swipeRefreshLayout.setColorSchemeColors( ContextCompat.getColor(getActivity(), R.color.colorPrimary), ContextCompat.getColor(getActivity(), R.color.colorAccent), ContextCompat.getColor(getActivity(), R.color.colorPrimaryDark)); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mActionsListener.loadNotes(true); } }); return root; }
Example 11
Source File: NotesFragment.java From androidtestdebug with MIT License | 5 votes |
@Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_notes, container, false); RecyclerView recyclerView = (RecyclerView) root.findViewById(R.id.notes_list); recyclerView.setAdapter(mListAdapter); int numColumns = getContext().getResources().getInteger(R.integer.num_notes_columns); recyclerView.setHasFixedSize(true); recyclerView.setLayoutManager(new GridLayoutManager(getContext(), numColumns)); // Set up floating action button FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab_add_notes); fab.setImageResource(R.drawable.ic_add); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mActionsListener.addNewNote(); } }); // Pull-to-refresh SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.refresh_layout); swipeRefreshLayout.setColorSchemeColors( ContextCompat.getColor(getActivity(), R.color.colorPrimary), ContextCompat.getColor(getActivity(), R.color.colorAccent), ContextCompat.getColor(getActivity(), R.color.colorPrimaryDark)); swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { mActionsListener.loadNotes(true); } }); return root; }
Example 12
Source File: ServersListFragment.java From xpra-client with GNU General Public License v3.0 | 5 votes |
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); FloatingActionButton floatingButton = activityAccessor.getFloatingActionButton(); floatingButton.setImageResource(R.drawable.ic_add_white_36dp); floatingButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { newConnection(); } }); }
Example 13
Source File: QuizActivity.java From CoolSignIn with Apache License 2.0 | 5 votes |
private void initLayout(String categoryId) { setContentView(R.layout.activity_quiz); progressBar = (ProgressBar) findViewById(R.id.progress); mQuizFab = (FloatingActionButton) findViewById(R.id.fab_quiz); mQuizFab.setImageResource(R.drawable.ic_play); if (mSavedStateIsPlaying) { mQuizFab.hide(); } else { mQuizFab.show(); } mQuizFab.setOnClickListener(mOnClickListener); }
Example 14
Source File: AnagramsActivity.java From jterm-cswithandroid with Apache License 2.0 | 5 votes |
public boolean defaultAction(View view) { TextView gameStatus = (TextView) findViewById(R.id.gameStatusView); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); EditText editText = (EditText) findViewById(R.id.editText); TextView resultView = (TextView) findViewById(R.id.resultView); if (currentWord == null) { currentWord = dictionary.pickGoodStarterWord(); anagrams = dictionary.getAnagramsWithOneMoreLetter(currentWord); gameStatus.setText(Html.fromHtml(String.format(START_MESSAGE, currentWord.toUpperCase(), currentWord))); fab.setImageResource(android.R.drawable.ic_menu_help); fab.hide(); resultView.setText(""); editText.setText(""); editText.setEnabled(true); editText.requestFocus(); InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT); } else { editText.setText(currentWord); editText.setEnabled(false); fab.setImageResource(android.R.drawable.ic_media_play); currentWord = null; resultView.append(TextUtils.join("\n", anagrams)); gameStatus.append(" Hit 'Play' to start again"); } return true; }
Example 15
Source File: TasksViews.java From mobius-android-sample with Apache License 2.0 | 5 votes |
public TasksViews( LayoutInflater inflater, ViewGroup parent, FloatingActionButton fab, Observable<TasksListEvent> menuEvents) { this.menuEvents = menuEvents; mRoot = inflater.inflate(R.layout.tasks_frag, parent, false); mListAdapter = new TasksAdapter(); // Set up allTasks view ListView listView = mRoot.findViewById(R.id.tasks_list); listView.setAdapter(mListAdapter); mFilteringLabelView = mRoot.findViewById(R.id.filteringLabel); mTasksView = mRoot.findViewById(R.id.tasksLL); // Set up no allTasks view mNoTasksView = mRoot.findViewById(R.id.noTasks); mNoTaskIcon = mRoot.findViewById(R.id.noTasksIcon); mNoTaskMainView = mRoot.findViewById(R.id.noTasksMain); mNoTaskAddView = mRoot.findViewById(R.id.noTasksAdd); fab.setImageResource(R.drawable.ic_add); mFab = fab; // Set up progress indicator mSwipeRefreshLayout = mRoot.findViewById(R.id.refresh_layout); mSwipeRefreshLayout.setColorSchemeColors( ContextCompat.getColor(mRoot.getContext(), R.color.colorPrimary), ContextCompat.getColor(mRoot.getContext(), R.color.colorAccent), ContextCompat.getColor(mRoot.getContext(), R.color.colorPrimaryDark)); // Set the scrolling view in the custom SwipeRefreshLayout. mSwipeRefreshLayout.setScrollUpChild(listView); }
Example 16
Source File: DataBindingAdapter.java From Android-App-Architecture-MVVM-Databinding with Apache License 2.0 | 5 votes |
private static void changeToLoadingState(final FloatingActionButton fab) { fab.setImageResource(R.drawable.ic_progress); final Animation rotateAnimation = AnimationUtils.loadAnimation(fab.getContext(), R.anim.rotate); rotateAnimation.setRepeatMode(Animation.RESTART); rotateAnimation.setRepeatCount(Animation.INFINITE); fab.startAnimation(rotateAnimation); }
Example 17
Source File: AddEditTaskViews.java From mobius-android-sample with Apache License 2.0 | 5 votes |
public AddEditTaskViews(LayoutInflater inflater, ViewGroup parent, FloatingActionButton fab) { mRoot = inflater.inflate(R.layout.addtask_frag, parent, false); mTitle = mRoot.findViewById(R.id.add_task_title); mDescription = mRoot.findViewById(R.id.add_task_description); fab.setImageResource(R.drawable.ic_done); mFab = fab; }
Example 18
Source File: ChallengeActivity.java From BrainPhaser with GNU General Public License v3.0 | 4 votes |
/** * Setup the activity. Instantiates the views with its listeners. Loads the challenge * afterwards. If no challenges are due the function loads the finish screen. * * @param savedInstanceState Current state of the due challenges, the current challenge and if * the challenge is done */ @Override @SuppressWarnings("unchecked") public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Content View setContentView(R.layout.activity_challenge); // Set up actionbar Toolbar myChildToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(myChildToolbar); ActionBar ab = getSupportActionBar(); if (ab != null) { ab.setDisplayHomeAsUpEnabled(true); } //get the views mFloatingActionButton = (FloatingActionButton) findViewById(R.id.btnNextChallenge); mQuestionText = (TextView) findViewById(R.id.challengeQuestion); mProgress = (ProgressBar) findViewById(R.id.progress_bar); mCategoryText = (TextView) findViewById(R.id.challenge_category); mTypeText = (TextView) findViewById(R.id.challenge_type); mClassText = (TextView) findViewById(R.id.challenge_class); //Get the CategoryID from the intent. If no Category is given the id will be -1 (for all categories) Intent i = getIntent(); long categoryId = i.getLongExtra(EXTRA_CATEGORY_ID, -1); //Load the user's due challenges for the selected category if (savedInstanceState != null) { mAllDueChallenges = (ArrayList<Long>) savedInstanceState.getSerializable(KEY_ALL_DUE_CHALLENGES); mLoadNextChallengeOnFabClick = savedInstanceState.getBoolean(KEY_NEXT_ON_FAB); mChallengeNo = savedInstanceState.getInt(KEY_CHALLENGE_ID, 0); } else { final User currentUser = mUserManager.getCurrentUser(); DueChallengeLogic dueChallengeLogic = mUserLogicFactory.createDueChallengeLogic(currentUser); mAllDueChallenges = new ArrayList<>(dueChallengeLogic.getDueChallenges(categoryId)); Collections.shuffle(mAllDueChallenges); } //Load the empty state screen if no challenges are due if (mAllDueChallenges == null || mAllDueChallenges.size() < 1) { loadFinishScreen(); return; } //load the challenge if no saved instance state, else subviews are responsible for loading state mCurrentChallenge = mChallengeDataSource.getById(mAllDueChallenges.get(mChallengeNo)); if (savedInstanceState == null) { loadChallenge(); } else { initializeMetaData(); mQuestionText.setText(mCurrentChallenge.getQuestion()); } //setup progressbar mProgress.setMax(mAllDueChallenges.size() * 100); mProgress.setProgress(mChallengeNo * 100); // Setup Floating Action Button if (mLoadNextChallengeOnFabClick) { mFloatingActionButton.setImageResource(R.drawable.ic_navigate_next_white_24dp); } else { mFloatingActionButton.setImageResource(R.drawable.ic_check_white_24dp); } mFloatingActionButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { floatingActionButtonClicked(); } }); }
Example 19
Source File: UserDetailActivity.java From TestChat with Apache License 2.0 | 4 votes |
@Override public void initView() { // toolbar = (Toolbar) findViewById(R.id.tb_toolbar); // collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.ctl_layout); // floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_avatar); floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_activity_user_detail_button); floatingActionButton.setImageResource(R.drawable.ic_mode_edit_blue_grey_900_24dp); // display = (RecyclerView) findViewById(R.id.rcl_content); display = (RecyclerView) findViewById(R.id.rcv_activity_user_detail_display); refresh = (SwipeRefreshLayout) findViewById(R.id.refresh_activity_user_detail_refresh); // bgCover = (ImageView) findViewById(R.id.iv_background_cover); // appBarLayout = (AppBarLayout) findViewById(R.id.al_appbar_layout); bottomInput = (LinearLayout) findViewById(R.id.ll_user_detail_bottom); input = (EditText) findViewById(R.id.et_user_detail_input); send = (ImageView) findViewById(R.id.iv_user_detail_send); rootContainer = (RelativeLayout) findViewById(R.id.rl_activity_user_detail_container); rootContainer.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { Rect rect = new Rect(); rootContainer.getWindowVisibleDisplayFrame(rect); screenHeight = rootContainer.getRootView().getHeight(); int keyBoardHeight = screenHeight - rect.bottom; int status = getStatusHeight(); if (keyBoardHeight != mKeyBoardHeight) { if (keyBoardHeight > mKeyBoardHeight) { bottomInput.setVisibility(View.VISIBLE); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) bottomInput.getLayoutParams(); int realHeight = screenHeight - status - bottomInput.getHeight() - keyBoardHeight; layoutParams.setMargins(0, realHeight, 0, 0); bottomInput.setLayoutParams(layoutParams); mKeyBoardHeight = keyBoardHeight; floatingActionButton.setVisibility(View.GONE); mLinearLayoutManager.scrollToPositionWithOffset(currentPosition, getListOffset()); } else { floatingActionButton.setVisibility(View.VISIBLE); mKeyBoardHeight = keyBoardHeight; bottomInput.setVisibility(View.GONE); } } } }); // appBarLayout.addOnOffsetChangedListener(this); send.setOnClickListener(this); refresh.setOnRefreshListener(this); floatingActionButton.setOnClickListener(this); rootContainer.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if (mCommentPopupWindow != null && mCommentPopupWindow.isShowing()) { mCommentPopupWindow.dismiss(); } // 这里进行点击关闭编辑框 if (bottomInput.getVisibility() == View.VISIBLE) { LogUtil.e("触摸界面点击关闭输入法"); dealBottomView(false); return true; } return false; } }); }
Example 20
Source File: MainActivity.java From music_player with Open Software License 3.0 | 4 votes |
public void ChangeScrollingUpPanel(int position) { seekBar.setProgress(0); seekBar.setMax(MyApplication.getMediaDuration()); final TextView duration = (TextView) findViewById(R.id.duration); duration.setText(toTime(MyApplication.getMediaDuration())); //设置歌曲名,歌手 musicInfo nowMusic = MyApplication.getMusicListNow().get(position); String title = nowMusic.getMusicTitle(); String artist = nowMusic.getMusicArtist(); TextView play_now_song = (TextView) findViewById(R.id.play_now_song); TextView play_now_singer = (TextView) findViewById(R.id.play_now_singer); play_now_song.setText(title); play_now_singer.setText(artist); //小控制栏 TextView main_song_title = (TextView) findViewById(R.id.main_song_title); main_song_title.setText(title); final ImageView repeat_button = (ImageView) findViewById(R.id.repeat_button); ImageView shuffle_button = (ImageView) findViewById(R.id.shuffle_button); FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.play_or_pause); //判断是否更改List if (previousList != MyApplication.getMusicListNow()) { playNowCoverPagerAdapter coverPagerAdapter = new playNowCoverPagerAdapter(MainActivity.this); coverPagerAdapter.notifyDataSetChanged(); play_now_cover_viewPager.setAdapter(coverPagerAdapter); previousList = MyApplication.getMusicListNow(); } play_now_cover_viewPager.setCurrentItem(MyApplication.getPositionNow()); if (otherLyricView.getVisibility() == VISIBLE) { changeVisibility(); } //animationChangeColor if (!nowMusic.getMusicLink().equals("")) {//网络 Glide.with(this).load(nowMusic.getMusicLargeAlbum()).asBitmap().diskCacheStrategy(DiskCacheStrategy.SOURCE).listener(listener).into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL); } else {//本地 if (nowMusic.getAlbumLink() != null) {//本地下载 Glide.with(this).load(nowMusic.getAlbumLink()).asBitmap().diskCacheStrategy(DiskCacheStrategy.SOURCE).listener(listener).into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL); } else {//本地原有 Glide.with(this).load(ContentUris.withAppendedId(Uri.parse("content://media/external/audio/albumart"), nowMusic.getMusicAlbumId())).asBitmap().listener(listener).diskCacheStrategy(DiskCacheStrategy.SOURCE).into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL); } } TextView now_on_play_text = (TextView) findViewById(R.id.now_on_play_text); now_on_play_text.setText("正在播放"); otherLyricView.loadLrc(""); //设置播放模式按钮 int playMode = MyApplication.getPlayMode(); if (playMode == MyConstant.list_repeat) { repeat_button.setImageResource(R.drawable.repeat); shuffle_button.setImageResource(R.drawable.shuffle_grey); } else if (playMode == MyConstant.random) { shuffle_button.setImageResource(R.drawable.shuffle); repeat_button.setImageResource(R.drawable.repeat_grey); } else if (playMode == MyConstant.one_repeat) { repeat_button.setImageResource(R.drawable.repeat_one); shuffle_button.setImageResource(R.drawable.shuffle_grey); } else { repeat_button.setImageResource(R.drawable.repeat_grey); shuffle_button.setImageResource(R.drawable.shuffle_grey); } //设置播放按钮 if (MyApplication.getState() == MyConstant.playing) { floatingActionButton.setImageResource(R.drawable.ic_pause_black_24dp); play_pause_button.setImageResource(R.drawable.ic_pause_black_24dp); } else { floatingActionButton.setImageResource(R.drawable.ic_play_arrow_black_24dp); play_pause_button.setImageResource(R.drawable.ic_play_arrow_black_24dp); } }