Java Code Examples for android.support.v7.widget.CardView#setRadius()

The following examples show how to use android.support.v7.widget.CardView#setRadius() . 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: HistoryActivity.java    From timecat with Apache License 2.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    CardView cardView = new CardView(this);
    cardView.setRadius(ViewUtil.dp2px(10));
    View view = LayoutInflater.from(this).inflate(R.layout.activity_history, null, false);
    cardView.addView(view);
    getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.trans));
    setContentView(cardView);

    //<功能归类分区方法,必须调用>-----------------------------------------------------------------
    initView();
    initData();
    initEvent();
    //</功能归类分区方法,必须调用>----------------------------------------------------------------
}
 
Example 2
Source File: TimeCatActivity.java    From timecat with Apache License 2.0 6 votes vote down vote up
private void initContentView(boolean fullScreen) {
    alpha = SPHelper.getInt(Constants.TIMECAT_ALPHA, 100);
    lastPickedColor = SPHelper.getInt(Constants.TIMECAT_DIY_BG_COLOR, Color.parseColor("#03A9F4"));
    int value = (int) ((alpha / 100.0f) * 255);

    RegexUtil.refreshSymbolSelection();
    if (fullScreen) {
        setTheme(R.style.PreSettingTheme);
        setContentView(R.layout.activity_time_cat);
        getWindow().setBackgroundDrawable(getResources().getDrawable(R.drawable.timecat_activity_window_full));
        getWindow().getDecorView().setBackgroundColor(Color.argb(value, Color.red(lastPickedColor), Color.green(lastPickedColor), Color.blue(lastPickedColor)));
        showAppList4OneStep();
    } else {
        CardView cardView = new CardView(this);
        cardView.setRadius(ViewUtil.dp2px(10));
        cardView.setCardBackgroundColor(Color.argb(value, Color.red(lastPickedColor), Color.green(lastPickedColor), Color.blue(lastPickedColor)));
        View view = LayoutInflater.from(this).inflate(R.layout.activity_time_cat, null, false);
        cardView.addView(view);

        getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.trans));
        setContentView(cardView);
    }
}
 
Example 3
Source File: ViewHelper.java    From FABRevealMenu-master with Apache License 2.0 5 votes vote down vote up
public CardView generateBaseView() {
    //Base view
    CardView mBaseView = new CardView(mContext);
    mBaseView.setLayoutParams(matchParams);
    mBaseView.setCardElevation(dpToPx(mContext, 5));
    mBaseView.setRadius(mContext.getResources().getDimension(R.dimen.card_radius));
    return mBaseView;
}
 
Example 4
Source File: LauncherAdapter.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
ViewHolder(View itemView, int viewType) {
    super(itemView);
    if (viewType == TYPE_HEADER) {
        name = itemView.findViewById(R.id.name);
        holderId = TYPE_HEADER;
    } else if (viewType == TYPE_CONTENT) {
        icon = itemView.findViewById(R.id.icon);
        name = itemView.findViewById(R.id.name);
        container = itemView.findViewById(R.id.container);

        CardView card = itemView.findViewById(R.id.card);
        if (CandyBarApplication.getConfiguration().getApplyGrid() == CandyBarApplication.GridStyle.FLAT) {
            if (card.getLayoutParams() instanceof GridLayoutManager.LayoutParams) {
                card.setRadius(0f);
                card.setUseCompatPadding(false);
                int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
                GridLayoutManager.LayoutParams params = (GridLayoutManager.LayoutParams) card.getLayoutParams();
                params.setMargins(0, 0, margin, margin);

                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                    params.setMarginEnd(margin);
                }
            }
        }
        if (!Preferences.get(mContext).isCardShadowEnabled()) {
            if (card != null) card.setCardElevation(0);
        }

        holderId = TYPE_CONTENT;

        container.setOnClickListener(this);
    }
}
 
Example 5
Source File: RequestAdapter.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
ContentViewHolder(View itemView) {
    super(itemView);
    title = itemView.findViewById(R.id.name);
    content = itemView.findViewById(R.id.requested);
    icon = itemView.findViewById(R.id.icon);
    checkbox = itemView.findViewById(R.id.checkbox);
    container = itemView.findViewById(R.id.container);
    divider = itemView.findViewById(R.id.divider);

    CardView card = itemView.findViewById(R.id.card);
    if (CandyBarApplication.getConfiguration().getRequestStyle() == CandyBarApplication.Style.PORTRAIT_FLAT_LANDSCAPE_FLAT &&
            card != null) {
        if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
            card.setRadius(0f);
            card.setUseCompatPadding(false);
            int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
            StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams();
            params.setMargins(0, 0, margin, margin);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                params.setMarginEnd(margin);
            }
        }
    }

    if (!Preferences.get(mContext).isCardShadowEnabled()) {
        if (card != null) card.setCardElevation(0);
    }

    container.setOnClickListener(this);
    container.setOnLongClickListener(this);
}
 
Example 6
Source File: HomeAdapter.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
GooglePlayDevViewHolder(View itemView) {
    super(itemView);
    container = itemView.findViewById(R.id.container);
    title = itemView.findViewById(R.id.title);

    CardView card = itemView.findViewById(R.id.card);
    if (CandyBarApplication.getConfiguration().getHomeGrid() == CandyBarApplication.GridStyle.FLAT) {
        if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
            card.setRadius(0f);
            card.setUseCompatPadding(false);
            int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
            StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams();
            params.setMargins(0, 0, margin, margin);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                params.setMarginEnd(margin);
            }
        }
    }

    if (!Preferences.get(mContext).isCardShadowEnabled()) {
        card.setCardElevation(0);
    }

    int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary);
    title.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable(
            mContext, R.drawable.ic_google_play_more_apps, color), null, null, null);

    container.setOnClickListener(this);
}
 
Example 7
Source File: HomeAdapter.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
WallpapersViewHolder(View itemView) {
    super(itemView);
    title = itemView.findViewById(R.id.title);
    TextView muzei = itemView.findViewById(R.id.muzei);

    CardView card = itemView.findViewById(R.id.card);
    if (CandyBarApplication.getConfiguration().getHomeGrid() == CandyBarApplication.GridStyle.FLAT) {
        if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
            card.setRadius(0f);
            card.setUseCompatPadding(false);
            int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
            StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams();
            params.setMargins(0, 0, margin, margin);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                params.setMarginEnd(margin);
            }
        }
    }

    if (!Preferences.get(mContext).isCardShadowEnabled()) {
        card.setCardElevation(0);
    }

    int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary);
    title.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable(
            mContext, R.drawable.ic_toolbar_wallpapers, color), null, null, null);

    muzei.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.get(
            mContext, R.drawable.ic_home_app_muzei), null, null, null);

    title.setOnClickListener(this);
    muzei.setOnClickListener(this);
}
 
Example 8
Source File: HomeAdapter.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
IconRequestViewHolder(View itemView) {
    super(itemView);
    title = itemView.findViewById(R.id.title);
    installedApps = itemView.findViewById(R.id.installed_apps);
    missedApps = itemView.findViewById(R.id.missed_apps);
    themedApps = itemView.findViewById(R.id.themed_apps);
    progress = itemView.findViewById(R.id.progress);
    container = itemView.findViewById(R.id.container);

    CardView card = itemView.findViewById(R.id.card);
    if (CandyBarApplication.getConfiguration().getHomeGrid() == CandyBarApplication.GridStyle.FLAT) {
        if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
            card.setRadius(0f);
            card.setUseCompatPadding(false);
            int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
            StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams();
            params.setMargins(0, 0, margin, margin);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                params.setMarginEnd(margin);
            }
        }
    }

    if (!Preferences.get(mContext).isCardShadowEnabled()) {
        card.setCardElevation(0);
    }

    int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary);
    title.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable(
            mContext, R.drawable.ic_toolbar_icon_request, color), null, null, null);

    int accent = ColorHelper.getAttributeColor(mContext, R.attr.colorAccent);
    progress.getProgressDrawable().setColorFilter(accent, PorterDuff.Mode.SRC_IN);

    container.setOnClickListener(this);
}
 
Example 9
Source File: HomeAdapter.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
ContentViewHolder(View itemView) {
    super(itemView);
    container = itemView.findViewById(R.id.container);
    autoFitTitle = itemView.findViewById(R.id.title);
    subtitle = itemView.findViewById(R.id.subtitle);

    CardView card = itemView.findViewById(R.id.card);
    if (CandyBarApplication.getConfiguration().getHomeGrid() == CandyBarApplication.GridStyle.FLAT) {
        if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
            card.setRadius(0f);
            card.setUseCompatPadding(false);
            int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
            StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams();
            params.setMargins(0, 0, margin, margin);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                params.setMarginEnd(margin);
            }
        }
    }

    if (!Preferences.get(mContext).isCardShadowEnabled()) {
        card.setCardElevation(0);
    }

    container.setOnClickListener(this);
}
 
Example 10
Source File: AboutAdapter.java    From candybar-library with Apache License 2.0 5 votes vote down vote up
ContributorsViewHolder(View itemView) {
    super(itemView);
    TextView title = itemView.findViewById(R.id.title);

    CardView card = itemView.findViewById(R.id.card);
    if (CandyBarApplication.getConfiguration().getAboutStyle() == CandyBarApplication.Style.PORTRAIT_FLAT_LANDSCAPE_FLAT &&
            card != null) {
        if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
            card.setRadius(0f);
            card.setUseCompatPadding(false);
            int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
            StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams();
            params.setMargins(0, 0, margin, margin);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                params.setMarginEnd(margin);
            }
        }
    }

    if (!Preferences.get(mContext).isCardShadowEnabled()) {
        if (card != null) card.setCardElevation(0);
    }

    int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary);
    title.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable(
            mContext, R.drawable.ic_toolbar_people, color), null, null, null);
    title.setText(mContext.getResources().getString(R.string.about_contributors_title));

    title.setOnClickListener(this);
}
 
Example 11
Source File: ToastUtils.java    From YCDialog with Apache License 2.0 5 votes vote down vote up
public Toast build() {
    if (!DialogUtils.checkNull(mToast)) {
        mToast.get().cancel();
    }
    Toast toast = new Toast(context);
    if (isFill) {
        toast.setGravity(gravity | Gravity.FILL_HORIZONTAL, 0, yOffset);
    } else {
        toast.setGravity(gravity, 0, yOffset);
    }
    toast.setDuration(duration);
    toast.setMargin(0, 0);
    if(layout==0){
        CardView rootView = (CardView) LayoutInflater.from(context).inflate(R.layout.view_toast_custom, null);
        TextView textView = rootView.findViewById(R.id.toastTextView);
        TextView descTv = rootView.findViewById(R.id.desc);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            //rootView.setElevation(elevation);
            rootView.setCardElevation(elevation);
        }
        rootView.setRadius(radius);
        rootView.setCardBackgroundColor(backgroundColor);
        //rootView.setBackgroundColor(backgroundColor);
        textView.setTextColor(textColor);
        textView.setText(title);
        if(TextUtils.isEmpty(desc)){
            descTv.setVisibility(View.GONE);
        }else{
            descTv.setText(desc);
            descTv.setVisibility(View.VISIBLE);
        }
        toast.setView(rootView);
    }else {
        View view = LayoutInflater.from(context).inflate(layout, null);
        toast.setView(view);
    }
    mToast = new SoftReference<>(toast);
    return toast;
}
 
Example 12
Source File: AlohaActivity.java    From YImagePicker with Apache License 2.0 5 votes vote down vote up
/**
 * 设置简单图片适配器
 *
 * @param imageItems 图片信息列表
 */
public void setImageViewList(@Nullable List<? extends ImageItem> imageItems) {
    if (imageItems == null) {
        return;
    }
    if (viewList == null) {
        viewList = new ArrayList<>();
    } else {
        viewList.clear();
    }
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    for (final ImageItem entity : imageItems) {
        CardView cardView = new CardView(this);
        cardView.setCardElevation(dp(2));
        cardView.setRadius(dp(5));
        cardView.setLayoutParams(params);

        CropImageView imageView = new CropImageView(this);
        imageView.setLayoutParams(params);
        imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
        if (entity.getCropUrl() != null && entity.getCropUrl().length() > 0) {
            Glide.with(this).load(entity.getCropUrl()).into(imageView);
        } else {
            Glide.with(this).load(entity.path).into(imageView);
        }
        cardView.addView(imageView);
        viewList.add(cardView);
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                intentCrop(entity);
            }
        });
    }
    setViewList(viewList);
}
 
Example 13
Source File: AboutAdapter.java    From candybar-library with Apache License 2.0 4 votes vote down vote up
FooterViewHolder(View itemView) {
    super(itemView);
    ImageView instagram = itemView.findViewById(R.id.about_dev_instagram);
    ImageView googlePlus = itemView.findViewById(R.id.about_dev_google_plus);
    ImageView github = itemView.findViewById(R.id.about_dev_github);
    TextView title = itemView.findViewById(R.id.about_dashboard_title);
    TextView licenses = itemView.findViewById(R.id.about_dashboard_licenses);
    TextView contributors = itemView.findViewById(R.id.about_dashboard_contributors);
    TextView translator = itemView.findViewById(R.id.about_dashboard_translator);

    CardView card = itemView.findViewById(R.id.card);
    if (CandyBarApplication.getConfiguration().getAboutStyle() == CandyBarApplication.Style.PORTRAIT_FLAT_LANDSCAPE_FLAT &&
            card != null) {
        if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
            card.setRadius(0f);
            card.setUseCompatPadding(false);
            int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
            StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams();
            params.setMargins(0, 0, margin, margin);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                params.setMarginEnd(margin);
            }
        }
    }

    if (!Preferences.get(mContext).isCardShadowEnabled()) {
        if (card != null) card.setCardElevation(0);
    }

    int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary);
    title.setCompoundDrawablesWithIntrinsicBounds(DrawableHelper.getTintedDrawable(
            mContext, R.drawable.ic_toolbar_dashboard, color), null, null, null);

    color = ConfigurationHelper.getSocialIconColor(mContext,
            CandyBarApplication.getConfiguration().getSocialIconColor());
    instagram.setImageDrawable(DrawableHelper.getTintedDrawable(mContext, R.drawable.ic_toolbar_instagram, color));
    googlePlus.setImageDrawable(DrawableHelper.getTintedDrawable(mContext, R.drawable.ic_toolbar_google_plus, color));
    github.setImageDrawable(DrawableHelper.getTintedDrawable(mContext, R.drawable.ic_toolbar_github, color));

    instagram.setOnClickListener(this);
    googlePlus.setOnClickListener(this);
    github.setOnClickListener(this);
    licenses.setOnClickListener(this);
    contributors.setOnClickListener(this);
    translator.setOnClickListener(this);
}
 
Example 14
Source File: CardsFragment.java    From iGap-Android with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addEmptyCard() {
    Context context = getContext();
    int dp8 = RaadCommonUtils.getPx(8, context);
    int dp16 = RaadCommonUtils.getPx(16, context);

    int cardHeight = BankCardView.getDefaultCardHeight(getContext());

    CardView cardView = new CardView(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, cardHeight);
    params.setMargins(dp16, 0, dp16, dp16);
    cardView.setLayoutParams(params);
    if (WalletActivity.isDarkTheme) {
        cardView.setCardBackgroundColor(Color.parseColor(WalletActivity.backgroundTheme_2));
    } else {
        cardView.setCardBackgroundColor(Color.parseColor(WalletActivity.backgroundTheme));
    }

    cardView.setPreventCornerOverlap(false);
    cardView.setCardElevation(RaadCommonUtils.getPx(6, context));
    cardView.setRadius(RaadCommonUtils.getPx(8, context));
    cardsLayout.addView(cardView);
    viewItems.add(cardView);

    TextView textView = new TextView(context);
    CardView.LayoutParams textViewParams = new CardView.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    textViewParams.gravity = Gravity.CENTER;
    textView.setLayoutParams(textViewParams);
    textView.setGravity(Gravity.CENTER);
    textView.setTextColor(Color.parseColor(WalletActivity.textTitleTheme));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    textView.setTypeface(Typefaces.get(context, Typefaces.IRAN_YEKAN_REGULAR));
    textView.setText(R.string.click_here_for_adding_card);
    cardView.addView(textView);

    cardView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ((NavigationBarActivity) getActivity()).pushFullFragment(
                    new AddCardFragment(), "AddCardFragment");
        }
    });
}
 
Example 15
Source File: RequestAdapter.java    From candybar-library with Apache License 2.0 4 votes vote down vote up
HeaderViewHolder(View itemView) {
    super(itemView);
    title = itemView.findViewById(R.id.title);
    content = itemView.findViewById(R.id.content);
    button = itemView.findViewById(R.id.buy);

    container = itemView.findViewById(R.id.premium_request);
    total = itemView.findViewById(R.id.premium_request_total);
    available = itemView.findViewById(R.id.premium_request_available);
    used = itemView.findViewById(R.id.premium_request_used);
    progress = itemView.findViewById(R.id.progress);

    CardView card = itemView.findViewById(R.id.card);
    if (CandyBarApplication.getConfiguration().getRequestStyle() == CandyBarApplication.Style.PORTRAIT_FLAT_LANDSCAPE_FLAT &&
            card != null) {
        if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
            card.setRadius(0f);
            card.setUseCompatPadding(false);
            int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
            StaggeredGridLayoutManager.LayoutParams params = (StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams();
            params.setMargins(0, 0, margin, margin);

            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
                params.setMarginEnd(margin);
            }
        }
    }

    if (!Preferences.get(mContext).isCardShadowEnabled() && card != null) {
        card.setCardElevation(0);
    }

    int padding = mContext.getResources().getDimensionPixelSize(R.dimen.content_margin) +
            mContext.getResources().getDimensionPixelSize(R.dimen.icon_size_small);
    content.setPadding(padding, 0, 0, 0);
    container.setPadding(padding, 0, padding, 0);

    int color = ColorHelper.getAttributeColor(mContext, android.R.attr.textColorPrimary);
    title.setCompoundDrawablesWithIntrinsicBounds(
            DrawableHelper.getTintedDrawable(mContext,
                    R.drawable.ic_toolbar_premium_request, color),
            null, null, null);

    int primary = ColorHelper.getAttributeColor(mContext, R.attr.colorPrimary);
    int accent = ColorHelper.getAttributeColor(mContext, R.attr.colorAccent);
    button.setTextColor(ColorHelper.getTitleTextColor(primary));

    progress.getProgressDrawable().setColorFilter(accent, PorterDuff.Mode.SRC_IN);

    button.setOnClickListener(this);
}
 
Example 16
Source File: PersonDetailActivity.java    From PopCorn with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_person_detail);
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);

    setTitle("");

    Intent receivedIntent = getIntent();
    mPersonId = receivedIntent.getIntExtra(Constants.PERSON_ID, -1);

    if (mPersonId == -1) finish();

    mCollapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
    mAppBarLayout = (AppBarLayout) findViewById(R.id.app_bar);

    mCastImageCardView = (CardView) findViewById(R.id.card_view_cast_detail);
    mCastImageSideSize = (int) (getResources().getDisplayMetrics().widthPixels * 0.33);
    mCastImageCardView.getLayoutParams().height = mCastImageSideSize;
    mCastImageCardView.getLayoutParams().width = mCastImageSideSize;
    mCastImageCardView.setRadius(mCastImageSideSize / 2);
    mCastImageView = (ImageView) findViewById(R.id.image_view_cast_detail);
    mProgressBar = (AVLoadingIndicatorView) findViewById(R.id.progress_bar_cast_detail);
    mProgressBar.setVisibility(View.GONE);
    mCastNameTextView = (TextView) findViewById(R.id.text_view_name_cast_detail);
    ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mCastNameTextView.getLayoutParams();
    params.setMargins(params.leftMargin, mCastImageSideSize / 2, params.rightMargin, params.bottomMargin);
    mCastAgeTextView = (TextView) findViewById(R.id.text_view_age_cast_detail);
    mCastBirthPlaceTextView = (TextView) findViewById(R.id.text_view_birthplace_cast_detail);

    mBackImageButton = (ImageButton) findViewById(R.id.image_button_back_cast_detail);
    mBackImageButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            onBackPressed();
        }
    });

    mCastBioHeaderTextView = (TextView) findViewById(R.id.text_view_bio_header_person_detail);
    mCastBioTextView = (TextView) findViewById(R.id.text_view_bio_person_detail);
    mCastReadMoreBioTextView = (TextView) findViewById(R.id.text_view_read_more_person_detail);

    mMovieCastTextView = (TextView) findViewById(R.id.text_view_movie_cast_person_detail);
    mMovieCastRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_movie_cast_person_detail);
    mMovieCastOfPersons = new ArrayList<>();
    mMovieCastsOfPersonAdapter = new MovieCastsOfPersonAdapter(PersonDetailActivity.this, mMovieCastOfPersons);
    mMovieCastRecyclerView.setAdapter(mMovieCastsOfPersonAdapter);
    mMovieCastRecyclerView.setLayoutManager(new LinearLayoutManager(PersonDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    mTVCastTextView = (TextView) findViewById(R.id.text_view_tv_cast_person_detail);
    mTVCastRecyclerView = (RecyclerView) findViewById(R.id.recycler_view_tv_cast_person_detail);
    mTVCastOfPersons = new ArrayList<>();
    mTVCastsOfPersonAdapter = new TVCastsOfPersonAdapter(PersonDetailActivity.this, mTVCastOfPersons);
    mTVCastRecyclerView.setAdapter(mTVCastsOfPersonAdapter);
    mTVCastRecyclerView.setLayoutManager(new LinearLayoutManager(PersonDetailActivity.this, LinearLayoutManager.HORIZONTAL, false));

    if (NetworkConnection.isConnected(PersonDetailActivity.this)) {
        isActivityLoaded = true;
        loadActivity();
    }

}
 
Example 17
Source File: CanDialog.java    From CanDialog with Apache License 2.0 3 votes vote down vote up
/**
 * 设置加载的dialog
 *
 * @param loadText String
 */
public void setProgress(String loadText) {

    setType(DIALOG_PROGRESS);

    View view = LayoutInflater.from(mContext).inflate(R.layout.dialog_progress, null);


    TextView tv_load = (TextView) view.findViewById(R.id.tv_load);

    tv_load.setText(loadText);
    showListOrEditView(view);


    hideButtons();
    hideTitle();


    CardView cardView = (CardView) findViewById(R.id.card);
    FrameLayout.LayoutParams params = (LayoutParams) cardView.getLayoutParams();
    params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
    params.height = ViewGroup.LayoutParams.WRAP_CONTENT;

    params.gravity = Gravity.CENTER;
    cardView.setRadius(InputUtils.dp2px(getContext(),3));
    cardView.setLayoutParams(params);

    setFullBackgroundColor(Color.TRANSPARENT);

}