use of android.annotation.SuppressLint in project bilibili-android-client by HotBitmapGG.
the class BrowserActivity method setupWebView.
@SuppressLint("SetJavaScriptEnabled")
private void setupWebView() {
progressBar.spin();
final WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setJavaScriptCanOpenWindowsAutomatically(true);
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
webSettings.setDomStorageEnabled(true);
webSettings.setGeolocationEnabled(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
mWebView.getSettings().setBlockNetworkImage(true);
mWebView.setWebViewClient(webViewClient);
mWebView.requestFocus(View.FOCUS_DOWN);
mWebView.getSettings().setDefaultTextEncodingName("UTF-8");
mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView view, String url, String message, final JsResult result) {
AlertDialog.Builder b2 = new AlertDialog.Builder(BrowserActivity.this).setTitle(R.string.app_name).setMessage(message).setPositiveButton("确定", (dialog, which) -> result.confirm());
b2.setCancelable(false);
b2.create();
b2.show();
return true;
}
});
mWebView.loadUrl(url);
}
use of android.annotation.SuppressLint in project bilibili-android-client by HotBitmapGG.
the class VideoCommentAdapter method onBindViewHolder.
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(ClickableViewHolder holder, int position) {
if (holder instanceof ItemViewHolder) {
ItemViewHolder mHolder = (ItemViewHolder) holder;
VideoCommentInfo.List list = comments.get(position);
mHolder.mUserName.setText(list.nick);
Glide.with(getContext()).load(UrlHelper.getFaceUrlByUrl(list.face)).centerCrop().dontAnimate().placeholder(R.drawable.ico_user_default).diskCacheStrategy(DiskCacheStrategy.ALL).into(mHolder.mUserAvatar);
int currentLevel = list.level_info.current_level;
checkLevel(currentLevel, mHolder);
switch(list.sex) {
case "女":
mHolder.mUserSex.setImageResource(R.drawable.ic_user_female);
break;
case "男":
mHolder.mUserSex.setImageResource(R.drawable.ic_user_male);
break;
default:
mHolder.mUserSex.setImageResource(R.drawable.ic_user_gay_border);
break;
}
mHolder.mCommentNum.setText(String.valueOf(list.reply_count));
mHolder.mSpot.setText(String.valueOf(list.good));
long l = DateUtil.stringToLong(list.create_at, "yyyy-MM-dd HH:mm");
String time = DateUtil.getDescriptionTimeFromTimestamp(l);
mHolder.mCommentTime.setText(time);
mHolder.mContent.setText(list.msg);
mHolder.mFloor.setText("#" + list.lv);
}
super.onBindViewHolder(holder, position);
}
use of android.annotation.SuppressLint in project bilibili-android-client by HotBitmapGG.
the class VideoHotCommentAdapter method onBindViewHolder.
@SuppressLint("SetTextI18n")
@Override
public void onBindViewHolder(ClickableViewHolder holder, int position) {
if (holder instanceof ItemViewHolder) {
ItemViewHolder mHolder = (ItemViewHolder) holder;
VideoCommentInfo.HotList hotList = hotComments.get(position);
mHolder.mUserName.setText(hotList.nick);
Glide.with(getContext()).load(UrlHelper.getFaceUrlByUrl(hotList.face)).centerCrop().dontAnimate().placeholder(R.drawable.ico_user_default).diskCacheStrategy(DiskCacheStrategy.ALL).into(mHolder.mUserAvatar);
int currentLevel = hotList.level_info.current_level;
checkLevel(currentLevel, mHolder);
switch(hotList.sex) {
case "女":
mHolder.mUserSex.setImageResource(R.drawable.ic_user_female);
break;
case "男":
mHolder.mUserSex.setImageResource(R.drawable.ic_user_male);
break;
default:
mHolder.mUserSex.setImageResource(R.drawable.ic_user_gay_border);
break;
}
mHolder.mCommentNum.setText(String.valueOf(hotList.reply_count));
mHolder.mSpot.setText(String.valueOf(hotList.good));
long l = DateUtil.stringToLong(hotList.create_at, "yyyy-MM-dd HH:mm");
String time = DateUtil.getDescriptionTimeFromTimestamp(l);
mHolder.mCommentTime.setText(time);
mHolder.mContent.setText(hotList.msg);
mHolder.mFloor.setText("#" + hotList.lv);
if (position == hotComments.size() - 1) {
mHolder.mLine.setVisibility(View.GONE);
} else {
mHolder.mLine.setVisibility(View.VISIBLE);
}
}
super.onBindViewHolder(holder, position);
}
use of android.annotation.SuppressLint in project bilibili-android-client by HotBitmapGG.
the class HomeRecommendedSection method onBindHeaderViewHolder.
@SuppressLint("SetTextI18n")
@Override
public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder) {
HeaderViewHolder headerViewHolder = (HeaderViewHolder) holder;
setTypeIcon(headerViewHolder);
headerViewHolder.mTypeTv.setText(title);
headerViewHolder.mTypeRankBtn.setOnClickListener(v -> mContext.startActivity(new Intent(mContext, OriginalRankActivity.class)));
switch(type) {
case TYPE_RECOMMENDED:
headerViewHolder.mTypeMore.setVisibility(View.GONE);
headerViewHolder.mTypeRankBtn.setVisibility(View.VISIBLE);
headerViewHolder.mAllLiveNum.setVisibility(View.GONE);
break;
case TYPE_LIVE:
headerViewHolder.mTypeRankBtn.setVisibility(View.GONE);
headerViewHolder.mTypeMore.setVisibility(View.VISIBLE);
headerViewHolder.mAllLiveNum.setVisibility(View.VISIBLE);
SpannableStringBuilder stringBuilder = new SpannableStringBuilder("当前" + liveCount + "个直播");
ForegroundColorSpan foregroundColorSpan = new ForegroundColorSpan(mContext.getResources().getColor(R.color.pink_text_color));
stringBuilder.setSpan(foregroundColorSpan, 2, stringBuilder.length() - 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
headerViewHolder.mAllLiveNum.setText(stringBuilder);
break;
default:
headerViewHolder.mTypeRankBtn.setVisibility(View.GONE);
headerViewHolder.mTypeMore.setVisibility(View.VISIBLE);
headerViewHolder.mAllLiveNum.setVisibility(View.GONE);
break;
}
}
use of android.annotation.SuppressLint in project bilibili-android-client by HotBitmapGG.
the class SettingFragment method finishCreateView.
@SuppressLint("SetTextI18n")
@Override
public void finishCreateView(Bundle state) {
mToolbar.setTitle("设置与帮助");
mToolbar.setNavigationIcon(R.drawable.ic_navigation_drawer);
mToolbar.setNavigationOnClickListener(v -> {
Activity activity1 = getActivity();
if (activity1 instanceof MainActivity) {
((MainActivity) activity1).toggleDrawer();
}
});
mVersionCode.setText("v" + getVersionCode());
}
Aggregations