Search in sources :

Example 71 with SuppressLint

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);
}
Also used : JsResult(android.webkit.JsResult) ConstantUtil(com.hotbitmapgg.bilibili.utils.ConstantUtil) Bundle(android.os.Bundle) JsResult(android.webkit.JsResult) Uri(android.net.Uri) Intent(android.content.Intent) RxBaseActivity(com.hotbitmapgg.bilibili.base.RxBaseActivity) MenuItem(android.view.MenuItem) BindView(butterknife.BindView) SuppressLint(android.annotation.SuppressLint) R(com.hotbitmapgg.ohmybilibili.R) WebSettings(android.webkit.WebSettings) WebResourceRequest(android.webkit.WebResourceRequest) Handler(android.os.Handler) Menu(android.view.Menu) WebViewClient(android.webkit.WebViewClient) View(android.view.View) WebView(android.webkit.WebView) ActionBar(android.support.v7.app.ActionBar) WebChromeClient(android.webkit.WebChromeClient) TextUtils(android.text.TextUtils) AlertDialog(android.app.AlertDialog) WebResourceError(android.webkit.WebResourceError) CircleProgressView(com.hotbitmapgg.bilibili.widget.CircleProgressView) Toolbar(android.support.v7.widget.Toolbar) Bitmap(android.graphics.Bitmap) ToastUtil(com.hotbitmapgg.bilibili.utils.ToastUtil) ClipboardUtil(com.hotbitmapgg.bilibili.utils.ClipboardUtil) Activity(android.app.Activity) WebSettings(android.webkit.WebSettings) WebChromeClient(android.webkit.WebChromeClient) WebView(android.webkit.WebView) SuppressLint(android.annotation.SuppressLint)

Example 72 with SuppressLint

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);
}
Also used : VideoCommentInfo(com.hotbitmapgg.bilibili.entity.video.VideoCommentInfo) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 73 with SuppressLint

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);
}
Also used : VideoCommentInfo(com.hotbitmapgg.bilibili.entity.video.VideoCommentInfo) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 74 with SuppressLint

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;
    }
}
Also used : ForegroundColorSpan(android.text.style.ForegroundColorSpan) Intent(android.content.Intent) SpannableStringBuilder(android.text.SpannableStringBuilder) SuppressLint(android.annotation.SuppressLint)

Example 75 with SuppressLint

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());
}
Also used : AppIntroduceActivity(com.hotbitmapgg.bilibili.module.common.AppIntroduceActivity) HotBitmapGGInfoActivity(com.hotbitmapgg.bilibili.module.common.HotBitmapGGInfoActivity) LoginActivity(com.hotbitmapgg.bilibili.module.common.LoginActivity) MainActivity(com.hotbitmapgg.bilibili.module.common.MainActivity) Activity(android.app.Activity) MainActivity(com.hotbitmapgg.bilibili.module.common.MainActivity) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1773 View (android.view.View)369 TextView (android.widget.TextView)243 Intent (android.content.Intent)232 ImageView (android.widget.ImageView)112 Paint (android.graphics.Paint)109 File (java.io.File)102 IOException (java.io.IOException)96 ArrayList (java.util.ArrayList)93 Context (android.content.Context)91 LayoutInflater (android.view.LayoutInflater)89 Uri (android.net.Uri)84 Bundle (android.os.Bundle)83 SharedPreferences (android.content.SharedPreferences)78 Bitmap (android.graphics.Bitmap)78 WebView (android.webkit.WebView)76 PendingIntent (android.app.PendingIntent)72 Method (java.lang.reflect.Method)72 SimpleDateFormat (java.text.SimpleDateFormat)69 ViewGroup (android.view.ViewGroup)66