本文整理汇总了Java中android.graphics.drawable.LevelListDrawable.setLevel方法的典型用法代码示例。如果您正苦于以下问题:Java LevelListDrawable.setLevel方法的具体用法?Java LevelListDrawable.setLevel怎么用?Java LevelListDrawable.setLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.drawable.LevelListDrawable
的用法示例。
在下文中一共展示了LevelListDrawable.setLevel方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(ChooseSetAdapter.SetHolder holder, int position) {
int page = position + 1;
LevelListDrawable ld = (LevelListDrawable) holder.mTvSetCount.getBackground();
if (page == currentPage) {
ld.setLevel(1);
holder.mTvSetCount.setTextColor(mContext.getResources().getColor(R.color.white));
} else {
ld.setLevel(0);
holder.mTvSetCount.setTextColor(mContext.getResources().getColor(R.color.new_text_color_first));
}
setText(holder.mTvSetCount, page);
}
示例2: onClick
import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@OnClick({R.id.tv_subscribe, R.id.tv_choose_set, R.id.ll_play_track_box, R.id.iv_ting_switch})
public void onClick(View view) {
TingAlbumMsg albumMsg = (TingAlbumMsg) datas.get(getAdapterPosition());
Album album = albumMsg.getAlbums().get(0);
switch (view.getId()) {
case R.id.tv_subscribe:
LevelListDrawable ld = (LevelListDrawable) mTvSubscribe.getBackground();
if (ld.getLevel() == 0) { //订阅
ld.setLevel(1);
mTvSubscribe.setText("已订阅");
TingAlbumDao.getInstance().insertSubscribe(album);
} else {
ld.setLevel(0);
mTvSubscribe.setText("订阅");
TingAlbumDao.getInstance().delSubscribeById(album.getId());
}
break;
case R.id.tv_choose_set:
Intent intent = new Intent(mContext, TingAlbumDetailActivity.class);
intent.putExtra(TingAlbumDetailActivity.ALBUM_ID, album.getId());
int type = album.getCoverUrlMiddle().contains(TingPlayProcessor.KAOLA_FM) ? TingAlbumDetailActivity.KAOLA : TingAlbumDetailActivity.XIMALAYA;
intent.putExtra(TingAlbumDetailActivity.ALBUM_TYPE, type);
mContext.startActivity(intent);
((Activity) mContext).overridePendingTransition(R.anim.activity_start_in, R.anim.activity_start_out);
break;
case R.id.ll_play_track_box:
case R.id.iv_ting_switch:
boolean isPlaying = XmlyManager.get().isPlaying();
if (isPlaying) {
XmPlayerManager.getInstance(mContext).pause();
} else {
XmPlayerManager.getInstance(mContext).play();
}
break;
}
}
示例3: setDot
import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
public void setDot(int position) {
mBeginBt.setVisibility(View.GONE);
for (int i = 0; i < mllDot.getChildCount(); i++) {
View dotView = mllDot.getChildAt(i);
LevelListDrawable ld = (LevelListDrawable) dotView.getBackground();
ld.setLevel(position == i ? 1 : 0);
}
}
示例4: applyRowStyle
import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
public static void applyRowStyle(Markable markable, View row, int position) {
if (row.getBackground() instanceof LevelListDrawable) {
LevelListDrawable levelListDrawable = (LevelListDrawable) row.getBackground();
int level = position % 2;
if (markable.isFavorite())
level += 2;
else if (markable.isUnused())
level += 4;
levelListDrawable.setLevel(level);
}
}
示例5: switchAccountType
import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public void switchAccountType(int type) {
LevelListDrawable ld = (LevelListDrawable) mAibType1.getBackground();
ld.setLevel(type);
}
示例6: updatePlayBar
import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
private void updatePlayBar(boolean playing) {
LevelListDrawable drawable = (LevelListDrawable) mPlayBt.getDrawable();
drawable.setLevel(playing ? 0 : 1);
}
示例7: onBindViewHolder
import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (position == 0) {
HeaderHolder headerHolder = (HeaderHolder) holder;
//专辑详情
Glide.with(mContext).load(mAlbum.getCoverUrlMiddle()).into(headerHolder.mIvAlbum);
headerHolder.mTvAlbumTitle.setText(mAlbum.getAlbumTitle());
LastUpTrack lastUptrack = mAlbum.getLastUptrack();
StringBuilder sb = new StringBuilder();
headerHolder.mTvLastTrack.setText(sb.append("更新至").append(TimeUtils.formatDate(new Date(lastUptrack.getCreatedAt()))).append(" ").append(lastUptrack.getTrackTitle()).toString());
sb.setLength(0);
headerHolder.mTvPlayCount.setText(sb.append(StringUtils.formPlayCount(mAlbum.getPlayCount())).append("次播放").toString());
sb.setLength(0);
headerHolder.mTvTrackCount.setText(sb.append(mAlbum.getIncludeTrackCount()).append("集").toString());
//订阅状态
boolean isSubscribe = mAlbumDao.isSubscribe(mAlbumId);
headerHolder.mTvSubscribe.setText(isSubscribe ? "已订阅" : "订阅");
LevelListDrawable ld = (LevelListDrawable) headerHolder.mTvSubscribe.getBackground();
ld.setLevel(isSubscribe ? 1 : 0);
if (mHistory != null) {
headerHolder.mRlHistoryBox.setVisibility(View.VISIBLE);
sb.setLength(0);
headerHolder.mTvHistoryTitle.setText(sb.append("继续播放:").append(mHistory.getTrackTitle()).toString());
sb.setLength(0);
NumberFormat nf = NumberFormat.getPercentInstance();
//返回数的整数部分所允许的最大位数
nf.setMaximumIntegerDigits(3);
//返回数的小数部分所允许的最大位数
nf.setMaximumFractionDigits(0);
headerHolder.mTvProgress.setText(sb.append("已播 ").append(nf.format(mHistory.getBreakPos() / (double) mHistory.getDuration())).toString());
headerHolder.mIvTingSwitch.setImageLevel((XmlyManager.get().isPlaying() && playTrackId == mHistory.getTrackId()) ? 1 : 0);
} else {
headerHolder.mRlHistoryBox.setVisibility(View.GONE);
}
} else {
Track track = mTracks.get(position);
TrackDetailHolder detailHolder = (TrackDetailHolder) holder;
detailHolder.mTvTrackTitle.setText(track.getTrackTitle());
detailHolder.mTvTrackTitle.setTextColor(track.getDataId() == playTrackId
? mContext.getResources().getColor(R.color.second_base_color)
: mContext.getResources().getColor(R.color.new_text_color_first));
detailHolder.mIvTingSwitch.setImageLevel(0);
if (track.getDataId() == playTrackId)
detailHolder.mIvTingSwitch.setImageLevel(XmlyManager.get().isPlaying() ? 1 : 0);
detailHolder.mTvCreated.setText(TimeUtils.getInstance().getDateString(new Date(track.getCreatedAt())));
detailHolder.mTvDuration.setText(new SimpleDate().formDuration(track.getDuration()));
}
}
示例8: getLevelDrawable
import android.graphics.drawable.LevelListDrawable; //导入方法依赖的package包/类
private Drawable getLevelDrawable(Context context) {
LevelListDrawable drawable =
(LevelListDrawable) context.getResources().getDrawable(mLevelDrawableId);
drawable.setLevel(0);
return drawable;
}