private void transformMaterial( int origWidth, int targetWidth, int origHeight, int targetHeight, int origRadius, int targetRadius, ValueAnimator animation) { float fraction = (float) animation.getAnimatedValue(); // update the cardView rounded corners mCardView.setRadius(interpolate(origRadius, targetRadius, fraction)); // update cardview size if (origWidth != targetWidth) { mCardView.getLayoutParams().width = (int) ((targetWidth - origWidth) * (1 - fraction) + origWidth); } if (origHeight != targetHeight) { mCardView.getLayoutParams().height = (int) ((targetHeight - origHeight) * (1 - fraction) + origWidth); } // request the cardview to redraw mCardView.requestLayout(); }
/** * 创建消息回忆的ViewHolder. * * @param view each_message_view */ public MessageViewHolder(CardView view) { super(view); cardView = view; icon = (ImageView) cardView.findViewById(R.id.personIVMessageView); name = (TextView) cardView.findViewById(R.id.nameTVMessageView); time = (TextView) cardView.findViewById(R.id.timeTVMessageView); message = (TextView) cardView.findViewById(R.id.messageTVMessageView); }
@Override public void setOnViewClickListener() { super.setOnViewClickListener(); box1View.setOnClickListener(this); box2View.setOnClickListener(this); box3View.setOnClickListener(this); box4View.setOnClickListener(this); }
private void setUpCardView() { LayoutParams params = new LayoutParams(mCardView.getLayoutParams()); params.topMargin = mMarginTop; params.bottomMargin = mMarginBottom; params.leftMargin = mMarginLeft; params.rightMargin = mMarginRight; mCardView.setLayoutParams(params); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_home, container, false); ButterKnife.bind(this, view); setTypeFace(); alarm = new AlarmManagerBroadcastReceiver(); alarm.SetAlarm(getActivity()); try { new CountDownTimer(MixUtils.calculateTimeLeftToVote(), 1000) { @Override public void onTick(long millisUntilFinished) { HashMap<String, String> values = MixUtils.formatTime(millisUntilFinished); String monthDay = MixUtils.convertToBurmese(values.get("month_day")); String hourMinute = MixUtils.convertToBurmese(values.get("hour_minute")); monthDayLeft.setText(monthDay); hourMinuteLeft.setText(hourMinute); if (monthDay.isEmpty()) { monthDayLeft.setVisibility(View.GONE); } } @Override public void onFinish() { // toVote.setText("ပြောင်းလဲရန်"); monthDayLeft.setText("အခ\u103Bိန\u103Aရောက\u103Aပ\u103Cီ"); monthDayLeft.setVisibility(View.VISIBLE); hourMinuteLeft.setVisibility(View.GONE); } }.start(); } catch (ParseException e) { e.printStackTrace(); } faqImg.setColorFilter(getResources().getColor(R.color.white)); faqImg.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View view) { Intent faqIntent = new Intent(getActivity(), FaqListActivity.class); startActivity(faqIntent); } }); UserPrefUtils userPrefUtils = new UserPrefUtils(getActivity()); if (userPrefUtils.isValid()) { backdrop.setCardBackgroundColor(getResources().getColor(R.color.accent_color)); txt_cardview_vote_check.setTextColor(Color.WHITE); valid_sign.setImageDrawable(getResources().getDrawable(R.drawable.ic_mark)); } else { backdrop.setCardBackgroundColor(Color.parseColor("#FFC107")); valid_sign.setImageDrawable(getResources().getDrawable(R.drawable.ic_exclamation_mark)); txt_cardview_vote_check.setTextColor(Color.WHITE); } return view; }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View ui = inflater.inflate(R.layout.fragment_profile, container, false); // get UI views points = (TextView) ui.findViewById(R.id.rank_card_points); userName = (TextView) ui.findViewById(R.id.profile_card_name); profilePicture = (ImageView) ui.findViewById(R.id.profile_card_picture); contentPicture = (ImageView) ui.findViewById(R.id.content_card_picture); profileCard = (CardView) ui.findViewById(R.id.profile_card); contentCard = (CardView) ui.findViewById(R.id.content_card); profileCard.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { /*Code from: http://bit.ly/1UmSnOi*/ startActivityForResult( new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), Constants.SELECT_IMAGE); } }); contentCard.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(getContext(), ContentDisplay.class); i.putExtra(Constants.PUT_EXTRA_UID, MainActivity.getUser().getUid()); ArrayList<Course> courses = MainActivity.getCourses(); String[] courseIDs = new String[courses.size()]; for (int p = 0; p < courses.size(); ++p) { courseIDs[p] = Integer.toString(courses.get(p).getId()); } i.putExtra(Constants.PUT_EXTRA_COURSE_IDS, courseIDs); startActivity(i); } }); level = (TextView) ui.findViewById(R.id.rank_card_level); updateUI(); return ui; }
private void accentColorPiker() { final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle()); final View dialogLayout = getLayoutInflater().inflate(R.layout.color_piker_accent, null); final LineColorPicker colorPicker = (LineColorPicker) dialogLayout.findViewById(R.id.color_picker_accent); final TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.cp_accent_title); CardView cv = (CardView) dialogLayout.findViewById(R.id.cp_accent_card); cv.setCardBackgroundColor(getCardBackgroundColor()); colorPicker.setColors(ColorPalette.getAccentColors(getApplicationContext())); colorPicker.setSelectedColor(getAccentColor()); dialogTitle.setBackgroundColor(getAccentColor()); colorPicker.setOnColorChangedListener( new OnColorChangedListener() { @Override public void onColorChanged(int c) { dialogTitle.setBackgroundColor(c); updateAccentViewsColor(colorPicker.getColor()); } }); dialogBuilder.setView(dialogLayout); dialogBuilder.setNeutralButton( getString(R.string.cancel), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); updateAccentViewsColor(getAccentColor()); } }); dialogBuilder.setPositiveButton( getString(R.string.ok_action), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { SharedPreferences.Editor editor = SP.edit(); editor.putInt(getString(R.string.preference_accent_color), colorPicker.getColor()); editor.apply(); updateTheme(); updateAccentViewsColor(getAccentColor()); } }); dialogBuilder.setOnDismissListener( new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { updateAccentViewsColor(getAccentColor()); } }); dialogBuilder.show(); }
/** * Override the Dialog Box's OK Button Click Event from VoterCheckDialog. * * @param view Click View * @param isValid Voter Check Result */ @Override public void onClickOkFromDialog(View view, boolean isValid) { if (isValid) { backdrop.setCardBackgroundColor(getResources().getColor(R.color.accent_color)); valid_sign.setImageDrawable(getResources().getDrawable(R.drawable.ic_mark)); } else { backdrop.setCardBackgroundColor(getResources().getColor(R.color.orange)); valid_sign.setImageDrawable(getResources().getDrawable(R.drawable.ic_exclamation_mark)); } txt_cardview_vote_check.setTextColor(Color.WHITE); }
@Override public CardAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { CardView v = (CardView) LayoutInflater.from(parent.getContext()) .inflate(R.layout.meal_item_layout, parent, false); // set view size margins padding and layout params v.setCardElevation(10); ViewHolder vh = new ViewHolder((View) v); return vh; }
@Override public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; if (rowView == null) { LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.card_list_item, null); } CardView tv = (CardView) rowView.findViewById(R.id.card); LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) tv.getLayoutParams(); Resources r = context.getResources(); int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, r.getDisplayMetrics()); if (position == 0) { params.setMargins(px, px, px, px); // substitute parameters for left, top, right, bottom tv.setLayoutParams(params); } else { params.setMargins(px, 0, px, px); tv.setLayoutParams(params); } ImageView image = (ImageView) rowView.findViewById(R.id.line_img); TextView line = (TextView) rowView.findViewById(R.id.line_name); if (position == 0) { image.setColorFilter(Color.argb(89, 198, 12, 48)); } else if (position == 1) { image.setColorFilter(Color.argb(89, 0, 161, 222)); } else if (position == 2) { image.setColorFilter(Color.argb(170, 98, 54, 27)); } else if (position == 3) { image.setColorFilter(Color.argb(89, 0, 155, 58)); } else if (position == 4) { image.setColorFilter(Color.argb(117, 249, 70, 28)); } else if (position == 5) { image.setColorFilter(Color.argb(137, 82, 35, 152)); } else if (position == 6) { image.setColorFilter(Color.argb(150, 226, 126, 166)); } else if (position == 7) { image.setColorFilter(Color.argb(89, 249, 227, 0)); } else { image.setColorFilter(Color.argb(0, 255, 255, 255)); } image.setImageResource(images[position]); line.setText(lines[position]); line.setTextColor(Color.BLACK); return rowView; }
private void createLayout() { Intent intent = getIntent(); totalPlayers = intent.getIntExtra("LOG_GAME_TOTAL_PLAYERS", 0); firstLine = (LinearLayout) findViewById(R.id.firstLine); firstLine.setOnDragListener(new MyDragListener()); CardView firstCard = (CardView) findViewById(R.id.firstCard); if (firstCard != null) { firstCard.setOnTouchListener(new MyTouchListener()); } avatarFirstLogGame = (ImageView) findViewById(R.id.avatarFirstLogGame); playerFirstNameLogGame = (TextView) findViewById(R.id.playerFirstNameLogGame); playerFirstDeckLogGame = (TextView) findViewById(R.id.playerFirstDeckLogGame); secondLine = (LinearLayout) findViewById(R.id.secondLine); secondLine.setOnDragListener(new MyDragListener()); CardView secondCard = (CardView) findViewById(R.id.secondCard); if (secondCard != null) { secondCard.setOnTouchListener(new MyTouchListener()); } avatarSecondLogGame = (ImageView) findViewById(R.id.avatarSecondLogGame); playerSecondNameLogGame = (TextView) findViewById(R.id.playerSecondNameLogGame); playerSecondDeckLogGame = (TextView) findViewById(R.id.playerSecondDeckLogGame); LinearLayout thirdLineParent = (LinearLayout) findViewById(R.id.thirdLineParent); if (totalPlayers >= 3) { thirdLine = (LinearLayout) findViewById(R.id.thirdLine); thirdLine.setOnDragListener(new MyDragListener()); CardView thirdCard = (CardView) findViewById(R.id.thirdCard); if (thirdCard != null) { thirdCard.setOnTouchListener(new MyTouchListener()); } avatarThirdLogGame = (ImageView) findViewById(R.id.avatarThirdLogGame); playerThirdNameLogGame = (TextView) findViewById(R.id.playerThirdNameLogGame); playerThirdDeckLogGame = (TextView) findViewById(R.id.playerThirdDeckLogGame); } else { if (thirdLineParent != null) { thirdLineParent.setVisibility(View.GONE); } } LinearLayout fourthLineParent = (LinearLayout) findViewById(R.id.fourthLineParent); if (totalPlayers >= 4) { fourthLine = (LinearLayout) findViewById(R.id.fourthLine); fourthLine.setOnDragListener(new MyDragListener()); CardView fourthCard = (CardView) findViewById(R.id.fourthCard); if (fourthCard != null) { fourthCard.setOnTouchListener(new MyTouchListener()); } avatarFourthLogGame = (ImageView) findViewById(R.id.avatarFourthLogGame); playerFourthNameLogGame = (TextView) findViewById(R.id.playerFourthNameLogGame); playerFourthDeckLogGame = (TextView) findViewById(R.id.playerFourthDeckLogGame); } else { if (fourthLineParent != null) { fourthLineParent.setVisibility(View.GONE); } } scrollView = (ScrollView) findViewById(R.id.scrollLogGame); }
@Override public void setData(RecommendContent data) { super.setData(data); recommendContent = data; simpleDraweeView1.setImageURI(Uri.parse(recommendContent.getImgUrl1())); simpleDraweeView2.setImageURI(Uri.parse(recommendContent.getImgUrl2())); title1.setText(recommendContent.getTitle1()); title2.setText(recommendContent.getTitle2()); content1.setText(recommendContent.getContent1()); content2.setText(recommendContent.getContent2()); cardView1.setOnClickListener(this); cardView2.setOnClickListener(this); }
public void bind(@NonNull final Movie movie) { mFavoriteButton.setSelected(movie.isFavorited()); mMovieItemTitle.setText(movie.getTitle()); mMovieItemContainer.setOnClickListener( v -> BusProvider.getInstance().post(new OnMovieClickedEvent(movie, itemView))); mFavoriteButton.setOnClickListener( v -> { BusProvider.getInstance() .post(new FavoriteClickedEvent(movie, MovieViewHolder.this.getAdapterPosition())); mFavoriteButton.setSelected(movie.isFavorited()); }); // stop that blinking ish if (mMovieId != movie.getId()) { resetColors(); mMovieId = movie.getId(); } Glide.with(itemView.getContext()) .load("http://image.tmdb.org/t/p/w185/" + movie.getPosterPath()) .crossFade() .placeholder(R.color.movie_poster_placeholder) .listener( GlidePalette.with(movie.getPosterPath()) .intoCallBack(palette -> applyColors(palette.getVibrantSwatch()))) .into(mMovieItemImage); }
private void setListeners(final String recipeId) { fab.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (isFavorite) { favRecipesIds.remove(recipeId); fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_favorite_outline)); isFavorite = false; } else { fab.setImageDrawable(getResources().getDrawable(R.drawable.ic_like)); favRecipesIds.add(recipeId); isFavorite = true; } SharedPreferences.Editor editor = settings.edit(); editor.putStringSet(FAVORITE_RECIPE_KEY, favRecipesIds); editor.commit(); Log.d(TAG, "favRecipesIds: " + favRecipesIds.toString()); } }); btnClearIngredients.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { ingredientsAdapter.uncheckAllChildrenCascade(lvIngredients); } }); btnAddIngredients.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Set<String> shoppingList = settings.getStringSet(SHOPPING_LIST_KEY, new HashSet<String>()); shoppingList.addAll(ingredientsAdapter.getAllChecked()); Log.d(TAG, "getAllChecked: " + ingredientsAdapter.getAllChecked()); SharedPreferences.Editor editor = settings.edit(); editor.putStringSet(SHOPPING_LIST_KEY, shoppingList); editor.commit(); Log.d(TAG, "shoppingList: " + shoppingList.toString()); Snackbar.make( findViewById(R.id.main_content), ingredientsAdapter.getAllChecked().size() + " items added to shopping list.", Snackbar.LENGTH_LONG) .show(); } }); cvDirections.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlRecipeDirections)); startActivity(intent); } }); }
public ViewHolder(View view) { super(view); mTextViewDietplanName = (TextView) view.findViewById(R.id.fragment_diet_dietplanlist_cardview_textview_dietplanname); mTextViewDescription = (TextView) view.findViewById(R.id.fragment_diet_dietplanlist_cardview_textview_description); mTextViewAmountDays = (TextView) view.findViewById(R.id.fragment_diet_dietplanlist_cardview_textview_amountdays); mTextViewAmountMeals = (TextView) view.findViewById(R.id.fragment_diet_dietplanlist_cardview_textview_amountmeals); mTextViewEnergyKcal = (TextView) view.findViewById(R.id.fragment_diet_dietplanlist_cardview_textview_energykcal); mImageViewPinAsCurrent = (ImageView) view.findViewById(R.id.fragment_diet_dietplanlist_cardview_imagebutton_pinascurrent); mImageViewPinAsCurrent.setOnClickListener(this); mImageViewSettings = (ImageView) view.findViewById(R.id.fragment_diet_dietplanlist_cardview_imageview_settings); mImageViewSettings.setOnClickListener(this); mCardView = (CardView) view.findViewById(R.id.fragment_diet_dietplanlist_cardview); mCardView.setOnClickListener(this); context = view.getContext(); }
/** Fade in/out the view. */ public void toggleFade() { if (context.getSharedPreferences(FADE_KEY, 0).getBoolean(FADE_KEY, false)) { context.getSharedPreferences(FADE_KEY, 0).edit().putBoolean(FADE_KEY, false).apply(); cardView.animate().alpha(1).setDuration(300).start(); cardView.setVisibility(View.VISIBLE); } else { context.getSharedPreferences(FADE_KEY, 0).edit().putBoolean(FADE_KEY, true).apply(); cardView.animate().alpha(0).setDuration(300).start(); cardView.setVisibility(View.GONE); } }
private void showSoundController() { okButton.setEnabled(true); okButton.setClickable(true); mIsPlaying = STOP; mPlayPause.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (mIsPlaying == PLAYING) { // pause mPlayPause.setImageResource(R.drawable.ic_play); onPlay(PAUSE_PLAYING); } else { // play mPlayPause.setImageResource(R.drawable.ic_pause); onPlay(START_PLAYING); } } }); mRlSoundControler.setVisibility(View.VISIBLE); }
@Override public void successOperation(Object object, boolean isCalledFirstTime) { List<Product> productList = null; if (!isCalledFirstTime) productList = new ArrayList<>(data.getProductList()); data = (Data) object; if (!isCalledFirstTime) for (int i = 0; i < productList.size(); i++) data.getProductList().add(i, productList.get(i)); if (isCalledFirstTime) { customListAdapter = new CustomListAdapter(data.getProductList(), this); listView.setAdapter(customListAdapter); listView.setVisibility(View.VISIBLE); filterScrollView.setVisibility(View.VISIBLE); listView.setOnScrollListener(this); filterRG.removeAllViews(); showFilterOptions(); } else { customListAdapter.productList = data.getProductList(); customListAdapter.notifyDataSetChanged(); } isApiCalledOnScrollToEnd = false; progressView.setVisibility(View.GONE); }
SponsorViewHolder(View itemView) { super(itemView); cv = (CardView) itemView.findViewById(R.id.card_view_sponsor); name = (TextView) itemView.findViewById(R.id.sponsorDescription); icon = (ImageView) itemView.findViewById(R.id.sponsorImage); cv.setOnClickListener(this); }
public ExtraGroupInfoListHolder(View itemView) { super(itemView); g_name_joined = (TextView) itemView.findViewById(R.id.tv_group_joined_name); cv_group_attributes = (CardView) itemView.findViewById(R.id.group_attributes_card); cv_group_attributes.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (getPosition() == 1) { Intent intent_temp = new Intent(v.getContext(), AboutGroupActivity.class); v.getContext().startActivity(intent_temp); } else if (getPosition() == 2) { Intent intent_temp = new Intent(v.getContext(), GroupMembersByGroupActivity.class); v.getContext().startActivity(intent_temp); } else if (getPosition() == 3) { Intent intent_temp = new Intent(v.getContext(), UpcomingEventsActivity.class); v.getContext().startActivity(intent_temp); } else if (getPosition() == 4) { Intent intent_temp = new Intent(v.getContext(), NewsPostsByGroupActivity.class); v.getContext().startActivity(intent_temp); } else if (getPosition() == 5) { Intent intent_temp = new Intent(v.getContext(), PreviousEventsActivity.class); v.getContext().startActivity(intent_temp); } else { } } }); }
private void initialization() { DashBoardTitle = (TextView) ((Activity) mContext).findViewById(R.id.DashBoardTitle); DashBoardTitle = (TextView) ((Activity) mContext).findViewById(R.id.DashBoardTitle); logolayout = (LinearLayout) ((Activity) mContext).findViewById(R.id.logolayout); DashboardOrgDetailsLayout = (LinearLayout) ((Activity) mContext).findViewById(R.id.DashboardOrgDetailsLayout); DashboardOrgEin = (TextView) ((Activity) mContext).findViewById(R.id.DashboardOrgEin); DashboardOrgName = (TextView) ((Activity) mContext).findViewById(R.id.DashboardOrgName); DashBoardTitle.setText("REVIEW"); if (EIN != null && BN != null) { DashboardOrgEin.setText(EIN); DashboardOrgName.setText(BN); DashboardOrgDetailsLayout.setVisibility(View.VISIBLE); } else DashboardOrgDetailsLayout.setVisibility(View.GONE); WholeLayout = (LinearLayout) CommonTaxView.findViewById(R.id.WholeLayout); ReviewCancelbutton = (android.support.v7.widget.CardView) CommonTaxView.findViewById(R.id.ReviewCancelbutton); ReviewNext = (android.support.v7.widget.CardView) CommonTaxView.findViewById(R.id.ReviewNext); ReviewNext.setEnabled(false); ReviewCancelbuttonText = (TextView) CommonTaxView.findViewById(R.id.ReviewCancelbuttonText); ReviewNextText = (TextView) CommonTaxView.findViewById(R.id.ReviewNextText); text1 = (TextView) CommonTaxView.findViewById(R.id.text1); text2 = (TextView) CommonTaxView.findViewById(R.id.text2); text3 = (TextView) CommonTaxView.findViewById(R.id.text3); wholeNoErrorLayout = (LinearLayout) CommonTaxView.findViewById(R.id.wholeNoErrorLayout); wholeErrorLayout = (LinearLayout) CommonTaxView.findViewById(R.id.wholeErrorLayout); wholeNoErrorLayout.setVisibility(View.GONE); wholeErrorLayout.setVisibility(View.GONE); Error_layout = (LinearLayout) CommonTaxView.findViewById(R.id.Error_layout); Error_layout.setVisibility(View.GONE); NoError_layout = (LinearLayout) CommonTaxView.findViewById(R.id.NoError_layout); NoError_layout.setVisibility(View.GONE); caution_layout = (LinearLayout) CommonTaxView.findViewById(R.id.caution_layout); caution_layout.setVisibility(View.GONE); NoCaution_layout = (LinearLayout) CommonTaxView.findViewById(R.id.NoCaution_layout); NoCaution_layout.setVisibility(View.GONE); errorlist = (com.span.expressextension8868.utils.utility.ExpandableHeightListView) CommonTaxView.findViewById(R.id.errorlist); cautionList = (com.span.expressextension8868.utils.utility.ExpandableHeightListView) CommonTaxView.findViewById(R.id.cautionList); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle("Impostazioni"); getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); LinearLayout container = new LinearLayout(this); container.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); container.setOrientation(LinearLayout.VERTICAL); NestedScrollView scrollView = new NestedScrollView(this); scrollView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); scrollView.addView(container); headers = new ArrayList(); onInit(); // Start parsing and creating the layout for (SettingHeader header : headers) { CardView headerCard = (CardView) LayoutInflater.from(this).inflate(R.layout.settings_header, null); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); params.setMargins(0, 0, 0, 10); headerCard.setLayoutParams(params); TextView headerTitle = (TextView) headerCard.findViewById(R.id.headerTitle); StaticHeightListView inputsContainer = (StaticHeightListView) headerCard.findViewById(R.id.inputContainer); headerTitle.setText(header.title); inputsContainer.setAdapter(new SettingInputAdapter(this, header.inputs)); container.addView(headerCard); } setContentView(scrollView); }
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { mCursorAdapter.getCursor().moveToPosition(position); mCursorAdapter.bindView(holder.itemView, getContext(), mCursorAdapter.getCursor()); CardView cardView = (CardView) holder.itemView.findViewById(R.id.card_view); TextView text = (TextView) holder.itemView.findViewById(android.R.id.text2); int color; if (text.getText().toString().contains(getString(R.string.free))) { color = Color.rgb(200, 230, 201); } else { color = Color.rgb(255, 205, 210); } cardView.setCardBackgroundColor(color); }
public ViewHolder(View v) { super(v); name = (TextView) v.findViewById(R.id.name); placeimage = (ImageView) v.findViewById(R.id.placeimage); cv = (CardView) v.findViewById(R.id.card_view); cv.setOnClickListener(this); name.setOnClickListener(this); }
ComicViewHolder(View itemView) { super(itemView); cv = (CardView) itemView.findViewById(R.id.cv); if (prefHelper.nightThemeEnabled()) cv.setCardBackgroundColor( ContextCompat.getColor(getActivity(), R.color.background_material_dark)); articleTitle = (TextView) itemView.findViewById(R.id.article_title); thumbnail = (ImageView) itemView.findViewById(R.id.thumbnail); }
@Override public void initView() { imgCard = (CardView) findViewById(R.id.img_card); imgPic = (ImageView) findViewById(R.id.img_pic); tvUpage = (TextView) findViewById(R.id.tv_update); imgUpage = (ImageView) findViewById(R.id.img_update); update = (TextView) findViewById(R.id.creategroup); update.setOnClickListener(updateCardListener); imgCard.setOnClickListener(updateImageListener); }
private View CreateACard(MenuCard currCard) { CardView card = new CardView(this); View child = this.getLayoutInflater().inflate(R.layout.custom_card, null); ((ImageView) child.findViewById(R.id.crd_imag)).setBackgroundResource(currCard.imgRes); ((TextView) (child.findViewById(R.id.crd_txt))) .setText( currCard.name + Character.LINE_SEPARATOR + currCard.type + Character.LINE_SEPARATOR + "" + Character.LINE_SEPARATOR + currCard.desc); card.addView(child); return card; }
private void animateCards() { ivBackdrop.animate().alpha(1f).setDuration(500).setInterpolator(INTERPOLATOR); cvIntro .animate() .scaleY(1) .scaleX(1) .setDuration(300) .setStartDelay(300) .setInterpolator(INTERPOLATOR) .start(); cvIngredients .animate() .scaleY(1) .scaleX(1) .setDuration(300) .setStartDelay(400) .setInterpolator(INTERPOLATOR) .setListener( new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { setListViewHeightBasedOnItems(lvIngredients); } }) .start(); cvFlavors .animate() .scaleY(1) .scaleX(1) .setDuration(300) .setStartDelay(400) .setInterpolator(INTERPOLATOR) .start(); cvDirections .animate() .scaleY(1) .scaleX(1) .setDuration(300) .setStartDelay(500) .setInterpolator(INTERPOLATOR) .start(); }
/** * 创建图片回忆的ViewHolder. * * @param view each_picture_view */ public PictureViewHolder(CardView view) { super(view); view.setOnClickListener(new PictureClickListener()); placeTv = (TextView) view.findViewById(R.id.titleTVArticleView); timeTv = (TextView) view.findViewById(R.id.timeTVArticleView); imageView = (ImageView) view.findViewById(R.id.imageView); nine = new ImageView[9]; nine[0] = (ImageView) view.findViewById(R.id.small_1); nine[1] = (ImageView) view.findViewById(R.id.small_2); nine[2] = (ImageView) view.findViewById(R.id.small_3); nine[3] = (ImageView) view.findViewById(R.id.small_4); nine[4] = (ImageView) view.findViewById(R.id.small_5); nine[5] = (ImageView) view.findViewById(R.id.small_6); nine[6] = (ImageView) view.findViewById(R.id.small_7); nine[7] = (ImageView) view.findViewById(R.id.small_8); nine[8] = (ImageView) view.findViewById(R.id.small_9); }
@Override public View getItemView(final Stamp stamp, View v, ViewGroup parent) { if (v == null) { v = View.inflate(getContext(), R.layout.image, null); } super.getItemView(stamp, v, parent); ParseImageView stampImage = (ParseImageView) v.findViewById(R.id.image_view); ParseFile photoFile = stamp.getPhotoFile(); if (photoFile != null) { stampImage.setParseFile(photoFile); stampImage.loadInBackground( new GetDataCallback() { @Override public void done(byte[] data, ParseException e) { // nothing to do } }); } CardView card = (CardView) v.findViewById(R.id.image_card); card.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(cont, PgStampInfoActivity.class); /* event.getObjectId(); stamp.getObjectId(); String stampId = item.getID(); ArrayList<String> stampIdList = getStampObjectIdArrayList(); int pos = stampIdList.indexOf(stampId); intent.putExtra("clicked_stamp_pos", pos); intent.putExtra("stamp_id_list", stampIdList);*/ cont.startActivity(intent); } }); return v; }