List of usage examples for android.graphics Typeface BOLD
int BOLD
To view the source code for android.graphics Typeface BOLD.
Click Source Link
From source file:com.samsistemas.calendarview.widget.CalendarView.java
/** * Display calendar title with next previous month button *//*from w w w . j av a2 s. c o m*/ private void initTitleLayout() { View titleLayout = mView.findViewById(R.id.title_layout); titleLayout.setBackgroundColor(mCalendarTitleBackgroundColor); TextView dateTitle = (TextView) mView.findViewById(R.id.dateTitle); String dateText = CalendarUtility.getCurrentMonth(mCurrentMonthIndex).toUpperCase(Locale.getDefault()) + " " + getCurrentYear(); dateTitle.setText(dateText); dateTitle.setTextColor(mCalendarTitleTextColor); if (null != getTypeface()) { dateTitle.setTypeface(getTypeface(), Typeface.BOLD); } }
From source file:utils.widget.vpi_lib.TabPageIndicator_Custom.java
@Override public void setCurrentItem(final int item) { // final RippleView rippleView = (RippleView) mTabLayout // .findViewById(R.id.ripTabItem); // rippleView.setRippleColor(R.color.rippelColorOrange); // rippleView // .setOnRippleCompleteListener(new // RippleView.OnRippleCompleteListener() { ////w w w . jav a2 s .c om // @Override // public void onComplete(RippleView rippleView) { if (mViewPager == null) { throw new IllegalStateException("ViewPager has not been bound."); } mSelectedTabIndex = item; mViewPager.setCurrentItem(item); final int tabCount = mTabLayout.getChildCount(); for (int i = 0; i < tabCount; i++) { final View child = mTabLayout.getChildAt(i); final boolean isSelected = (i == item); child.setSelected(isSelected); // TODO - Trigger (Arrow) Setting // Toast.makeText(getContext(), // "Selected ID :"+item, // Toast.LENGTH_SHORT).show(); // ImageView img = (ImageView) // child.findViewById(R.id.img_trigger); TextView txtTitle = (TextView) child.findViewById(R.id.vpi_custom_txt_Title); TextView txtBottom = (TextView) child.findViewById(R.id.vpi_custom_txt_btm); if (isSelected) { animateToTab(item); txtBottom.setBackgroundColor(getResources().getColor(R.color.vpi_focus)); txtBottom.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 8)); txtTitle.setTextColor(getResources().getColor(R.color.vpi_focus)); txtTitle.setTypeface(null, Typeface.BOLD); // img.setVisibility(View.VISIBLE); } else { txtBottom.setBackgroundColor(getResources().getColor(R.color.vpi_non_focus)); txtBottom.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1)); txtTitle.setTextColor(getResources().getColor(R.color.vpi_non_focus)); txtTitle.setTypeface(null, Typeface.NORMAL); // img.setVisibility(View.INVISIBLE); } } // } // // }); }
From source file:com.codetroopers.betterpickers.calendardatepicker.MonthView.java
/** * Sets up the text and style properties for painting. Override this if you want to use a different paint. *//*from ww w . j av a 2s. c om*/ protected void initView() { mMonthTitlePaint = new Paint(); mMonthTitlePaint.setFakeBoldText(true); mMonthTitlePaint.setAntiAlias(true); mMonthTitlePaint.setTextSize(MONTH_LABEL_TEXT_SIZE); mMonthTitlePaint.setTypeface(Typeface.create(mMonthTitleTypeface, Typeface.BOLD)); mMonthTitlePaint.setColor(mDayTextColorEnabled); mMonthTitlePaint.setTextAlign(Align.CENTER); mMonthTitlePaint.setStyle(Style.FILL); mMonthTitleBGPaint = new Paint(); mMonthTitleBGPaint.setFakeBoldText(true); mMonthTitleBGPaint.setAntiAlias(true); mMonthTitleBGPaint.setTextAlign(Align.CENTER); mMonthTitleBGPaint.setStyle(Style.FILL); mSelectedCirclePaint = new Paint(); mSelectedCirclePaint.setFakeBoldText(true); mSelectedCirclePaint.setAntiAlias(true); mSelectedCirclePaint.setColor(mTodayNumberColor); mSelectedCirclePaint.setTextAlign(Align.CENTER); mSelectedCirclePaint.setStyle(Style.FILL); mSelectedCirclePaint.setAlpha(SELECTED_CIRCLE_ALPHA); mDisabledDaySquarePaint = new Paint(); mDisabledDaySquarePaint.setFakeBoldText(true); mDisabledDaySquarePaint.setAntiAlias(true); mDisabledDaySquarePaint.setColor(mDayBackgroundColorDisabled); mDisabledDaySquarePaint.setTextAlign(Align.CENTER); mDisabledDaySquarePaint.setStyle(Style.FILL); mDisabledDaySquarePaint.setAlpha(DISABLED_DAY_SQUARE_ALPHA); mMonthDayLabelPaint = new Paint(); mMonthDayLabelPaint.setAntiAlias(true); mMonthDayLabelPaint.setTextSize(MONTH_DAY_LABEL_TEXT_SIZE); mMonthDayLabelPaint.setColor(mDayTextColorEnabled); mMonthDayLabelPaint.setTypeface(Typeface.create(mDayOfWeekTypeface, Typeface.NORMAL)); mMonthDayLabelPaint.setStyle(Style.FILL); mMonthDayLabelPaint.setTextAlign(Align.CENTER); mMonthDayLabelPaint.setFakeBoldText(true); mMonthNumPaint = new Paint(); mMonthNumPaint.setAntiAlias(true); mMonthNumPaint.setTextSize(MINI_DAY_NUMBER_TEXT_SIZE); mMonthNumPaint.setStyle(Style.FILL); mMonthNumPaint.setTextAlign(Align.CENTER); mMonthNumPaint.setFakeBoldText(false); }
From source file:com.matthewmitchell.peercoin_android_wallet.ui.TransactionsListFragment.java
@Override public void onLoadFinished(final Loader<List<Transaction>> loader, final List<Transaction> transactions) { adapter.replace(transactions);/* w ww . j av a 2 s . c o m*/ final SpannableStringBuilder emptyText = new SpannableStringBuilder( getString(direction == Direction.SENT ? R.string.wallet_transactions_fragment_empty_text_sent : R.string.wallet_transactions_fragment_empty_text_received)); emptyText.setSpan(new StyleSpan(Typeface.BOLD), 0, emptyText.length(), SpannableStringBuilder.SPAN_POINT_MARK); if (direction != Direction.SENT) emptyText.append("\n\n").append(getString(R.string.wallet_transactions_fragment_empty_text_howto)); setEmptyText(emptyText); }
From source file:com.timothy.android.api.fragment.PageFragmentNew.java
public void setAllComponent(List<HtmlCleanAPI.HtmlContent> hcList) { Log.i(LOG_TAG, "setAllComponent()..."); for (HtmlCleanAPI.HtmlContent hc : hcList) { String tag = hc.getTag(); String content = hc.getContent(); if (StringUtil.isEmpty(content)) continue; String contentMBlank = StringUtil.mergeBlank(content); if (StringUtil.isEmpty(contentMBlank)) continue; String contentRBlank = StringUtil.rmvEnter(StringUtil.trim(contentMBlank)); if (StringUtil.isEmpty(contentRBlank)) continue; String contentRSpecial = StringUtil.rmvSpecial(contentRBlank); if (StringUtil.isEmpty(contentRSpecial)) continue; Log.i(LOG_TAG, "tag:" + tag); Log.i(LOG_TAG, "content:" + contentRSpecial); if (tag.equalsIgnoreCase("P")) { final TextView tagPTV = new TextView(mContext); tagPTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 3, 2, 3);/*from w ww . ja v a2 s . c om*/ tagPTV.setLayoutParams(lp); tagPTV.setPadding(3, 3, 3, 3); tagPTV.setPaddingRelative(3, 3, 3, 3); tagPTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagPTV.setTextColor(Color.BLACK); tagPTV.setText(contentRSpecial); tagPTV.setTextSize(TEXT_SIZE); tagPTV.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagPTV.getText().toString()); return false; } }); lineLayout.addView(tagPTV); } else if (tag.equalsIgnoreCase("pre")) { final TextView tagPre = new TextView(mContext); tagPre.setBackgroundColor(Color.parseColor("#D2EADE")); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagPre.setLayoutParams(lp); tagPre.setPadding(2, 2, 2, 2); tagPre.setPaddingRelative(2, 2, 2, 2); tagPre.setMovementMethod(ScrollingMovementMethod.getInstance()); tagPre.setTextColor(Color.BLACK); // String contentRSpecial = StringUtil.rmvSpecial(content); tagPre.setText(StringUtil.rmvSpecial(content)); tagPre.setTextSize(TEXT_SIZE); tagPre.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagPre.getText().toString()); return false; } }); lineLayout.addView(tagPre); } else if (tag.equalsIgnoreCase("dt") || tag.equalsIgnoreCase("H1") || tag.equalsIgnoreCase("H2") || tag.equalsIgnoreCase("H3")) {//title TextView tagDtHTV = new TextView(mContext); tagDtHTV.setBackgroundColor(Color.DKGRAY); tagDtHTV.setTypeface(null, Typeface.BOLD); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 0, 2, 0); tagDtHTV.setLayoutParams(lp); tagDtHTV.setPadding(2, 2, 2, 2); tagDtHTV.setPaddingRelative(2, 2, 2, 2); tagDtHTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagDtHTV.setTextColor(Color.WHITE); tagDtHTV.setText(contentRSpecial); tagDtHTV.setTextSize(TEXT_SIZE); lineLayout.addView(tagDtHTV); } else if (tag.equalsIgnoreCase("dd")) { final TextView tagDD = new TextView(mContext); tagDD.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagDD.setLayoutParams(lp); tagDD.setPadding(3, 3, 3, 3); tagDD.setPaddingRelative(3, 3, 3, 3); tagDD.setMovementMethod(ScrollingMovementMethod.getInstance()); tagDD.setTextColor(Color.BLACK); tagDD.setText(contentRSpecial); tagDD.setTextSize(TEXT_SIZE); tagDD.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagDD.getText().toString()); return false; } }); lineLayout.addView(tagDD); } else if (tag.equalsIgnoreCase("li")) { final TextView tagLigTV = new TextView(mContext); tagLigTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); tagLigTV.setLayoutParams(lp); tagLigTV.setPaddingRelative(2, 2, 2, 2); tagLigTV.setMovementMethod(ScrollingMovementMethod.getInstance()); tagLigTV.setTextColor(Color.BLACK); tagLigTV.setText(contentRSpecial); tagLigTV.setTextSize(TEXT_SIZE); tagLigTV.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { openDialog(tagLigTV.getText().toString()); return false; } }); lineLayout.addView(tagLigTV); } else if (tag.equalsIgnoreCase("img")) { final TextView imgTV = new TextView(mContext); imgTV.setBackgroundResource(R.drawable.tag_p_drawable); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); lp.setMargins(2, 2, 2, 2); imgTV.setLayoutParams(lp); imgTV.setPaddingRelative(2, 2, 2, 2); imgTV.setMovementMethod(ScrollingMovementMethod.getInstance()); imgTV.setTextColor(Color.BLACK); imgTV.setText(content); imgTV.setTextSize(TEXT_SIZE); lineLayout.addView(imgTV); ImageView imageView = new ImageView(mContext); LinearLayout.LayoutParams imgLP = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); imageView.setLayoutParams(imgLP); Bitmap localBt = getLoacalBitmap(baseFolder + File.separator + content); imageView.setImageBitmap(localBt); lineLayout.addView(imageView); } } }
From source file:org.mariotaku.twidere.view.holder.ActivityTitleSummaryViewHolder.java
public void displayActivity(ParcelableActivity activity, boolean byFriends) { final Context context = adapter.getContext(); final Resources resources = adapter.getContext().getResources(); switch (activity.action) { case Activity.ACTION_FOLLOW: { activityTypeView.setImageResource(R.drawable.ic_activity_action_follow); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_follow), Mode.SRC_ATOP);/*from ww w . j a v a 2 s.c om*/ if (byFriends) { titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_follow, R.string.activity_by_friends_follow_multi, activity.sources, activity.target_users)); } else { titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_follow, R.string.activity_about_me_follow_multi, activity.sources)); } displayUserProfileImages(activity.sources); summaryView.setVisibility(View.GONE); break; } case Activity.ACTION_FAVORITE: { if (adapter.shouldUseStarsForLikes()) { activityTypeView.setImageResource(R.drawable.ic_activity_action_favorite); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_favorite), Mode.SRC_ATOP); if (byFriends) { titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_favorite, R.string.activity_by_friends_favorite_multi, activity.sources, activity.target_statuses)); } else { titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_favorite, R.string.activity_about_me_favorite_multi, activity.sources)); } } else { activityTypeView.setImageResource(R.drawable.ic_activity_action_like); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_like), Mode.SRC_ATOP); if (byFriends) { titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_like, R.string.activity_by_friends_like_multi, activity.sources, activity.target_statuses)); } else { titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_like, R.string.activity_about_me_like_multi, activity.sources)); } } displayUserProfileImages(activity.sources); summaryView.setText(activity.target_statuses[0].text_unescaped); summaryView.setVisibility(View.VISIBLE); break; } case Activity.ACTION_RETWEET: { activityTypeView.setImageResource(R.drawable.ic_activity_action_retweet); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_retweet), Mode.SRC_ATOP); if (byFriends) { titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_retweet, R.string.activity_by_friends_retweet_multi, activity.sources, activity.target_statuses)); } else titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_retweet, R.string.activity_about_me_retweet_multi, activity.sources)); displayUserProfileImages(activity.sources); summaryView.setText(activity.target_statuses[0].text_unescaped); summaryView.setVisibility(View.VISIBLE); break; } case Activity.ACTION_FAVORITED_RETWEET: { if (byFriends) { showNotSupported(); return; } if (adapter.shouldUseStarsForLikes()) { activityTypeView.setImageResource(R.drawable.ic_activity_action_favorite); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_favorite), Mode.SRC_ATOP); titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_favorited_retweet, R.string.activity_about_me_favorited_retweet_multi, activity.sources)); } else { activityTypeView.setImageResource(R.drawable.ic_activity_action_like); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_like), Mode.SRC_ATOP); titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_liked_retweet, R.string.activity_about_me_liked_retweet_multi, activity.sources)); } displayUserProfileImages(activity.sources); summaryView.setText(activity.target_statuses[0].text_unescaped); summaryView.setVisibility(View.VISIBLE); break; } case Activity.ACTION_RETWEETED_RETWEET: { if (byFriends) { showNotSupported(); return; } activityTypeView.setImageResource(R.drawable.ic_activity_action_retweet); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_retweet), Mode.SRC_ATOP); titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_retweeted_retweet, R.string.activity_about_me_retweeted_retweet_multi, activity.sources)); displayUserProfileImages(activity.sources); summaryView.setText(activity.target_statuses[0].text_unescaped); summaryView.setVisibility(View.VISIBLE); break; } case Activity.ACTION_RETWEETED_MENTION: { if (byFriends) { showNotSupported(); return; } activityTypeView.setImageResource(R.drawable.ic_activity_action_retweet); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_retweet), Mode.SRC_ATOP); titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_retweeted_mention, R.string.activity_about_me_retweeted_mention_multi, activity.sources)); displayUserProfileImages(activity.sources); summaryView.setText(activity.target_statuses[0].text_unescaped); summaryView.setVisibility(View.VISIBLE); break; } case Activity.ACTION_FAVORITED_MENTION: { if (byFriends) { showNotSupported(); return; } if (adapter.shouldUseStarsForLikes()) { activityTypeView.setImageResource(R.drawable.ic_activity_action_favorite); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_favorite), Mode.SRC_ATOP); titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_favorited_mention, R.string.activity_about_me_favorited_mention_multi, activity.sources)); } else { activityTypeView.setImageResource(R.drawable.ic_activity_action_like); activityTypeView.setColorFilter(ContextCompat.getColor(context, R.color.highlight_like), Mode.SRC_ATOP); titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_liked_mention, R.string.activity_about_me_liked_mention_multi, activity.sources)); } displayUserProfileImages(activity.sources); summaryView.setText(activity.target_statuses[0].text_unescaped); summaryView.setVisibility(View.VISIBLE); break; } case Activity.ACTION_LIST_CREATED: { if (!byFriends) { showNotSupported(); return; } activityTypeView.setImageResource(R.drawable.ic_activity_action_list_added); activityTypeView.setColorFilter(activityTypeView.getDefaultColor(), Mode.SRC_ATOP); titleView.setText(getTitleStringByFriends(R.string.activity_by_friends_list_created, R.string.activity_by_friends_list_created_multi, activity.sources, activity.target_object_user_lists)); displayUserProfileImages(activity.sources); boolean firstLine = true; summaryView.setText(""); for (ParcelableUserList item : activity.target_object_user_lists) { if (!firstLine) { summaryView.append("\n"); } summaryView.append(item.description); firstLine = false; } summaryView.setVisibility(View.VISIBLE); break; } case Activity.ACTION_LIST_MEMBER_ADDED: { if (byFriends) { showNotSupported(); return; } activityTypeView.setImageResource(R.drawable.ic_activity_action_list_added); activityTypeView.setColorFilter(activityTypeView.getDefaultColor(), Mode.SRC_ATOP); if (activity.sources.length == 1 && activity.target_object_user_lists != null && activity.target_object_user_lists.length == 1) { final UserColorNameManager manager = adapter.getUserColorNameManager(); final SpannableString firstDisplayName = new SpannableString( manager.getDisplayName(activity.sources[0], adapter.isNameFirst(), false)); final SpannableString listName = new SpannableString(activity.target_object_user_lists[0].name); firstDisplayName.setSpan(new StyleSpan(Typeface.BOLD), 0, firstDisplayName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); listName.setSpan(new StyleSpan(Typeface.BOLD), 0, listName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); final String format = context.getString(R.string.activity_about_me_list_member_added_with_name); final Configuration configuration = resources.getConfiguration(); titleView.setText(SpanFormatter.format(configuration.locale, format, firstDisplayName, listName)); } else { titleView.setText(getTitleStringAboutMe(R.string.activity_about_me_list_member_added, R.string.activity_about_me_list_member_added_multi, activity.sources)); } displayUserProfileImages(activity.sources); summaryView.setVisibility(View.GONE); break; } } }
From source file:org.ciasaboark.tacere.view.EventListItem.java
private void drawDateTimeText() { String beginDate = event.getLocalBeginDate(); String endDate = event.getLocalEndDate(); String beginTime = event.getLocalBeginTime(); String endTime = event.getLocalEndTime(); boolean usingExtendedMinutes = false; int extendMinutes = event.getExtendMinutes(); if (extendMinutes != 0) { usingExtendedMinutes = true;/* ww w.ja v a2 s . c o m*/ endDate = event.getLocalEffectiveEndDate(); endTime = event.getLocalEffectiveEndTime(); } //there are a number of different ways to display the date and time if (beginDate.equals(endDate)) { if (event.isAllDay()) { //field1: <begin date> //field2: 'All Day' dateTimeField1.setText(beginDate); dateTimeField2.setText(R.string.all_day); } else { //field1: <begin date> //field2: <begin time> - <end time> dateTimeField1.setText(beginDate); dateTimeField2.setText(beginTime + " - " + endTime); } } else { if (event.isAllDay()) { //field1: <begin date> - <end date> //field2: 'All Day' dateTimeField1.setText(beginDate + " - " + endDate); dateTimeField2.setText(R.string.all_day); } else { //field1: <begin date> <begin time> //field2: <end date> <end time> dateTimeField1.setText(beginDate + " " + beginTime); dateTimeField2.setText(endDate + " " + endTime); if (usingExtendedMinutes) { dateTimeField2.setTypeface(null, Typeface.BOLD); } } } dateTimeField1.setTextColor(textColor); dateTimeField2.setTextColor(textColor); if (isFutureEvent() && clockIcon != null) { try { Drawable d = clockIcon.getDrawable(); d.mutate().setColorFilter(iconTintColor, PorterDuff.Mode.MULTIPLY); clockIcon.setImageDrawable(d); } catch (NullPointerException e) { Log.e(TAG, "caught null pointer exception pulling drawable from clock icon"); } } }
From source file:org.ednovo.goorusearchwidget.ResourcePlayer.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); dialog = new ProgressDialog(this); prefsPrivate = getSharedPreferences(PREFS_PRIVATE, Context.MODE_PRIVATE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); setContentViewLayout = new RelativeLayout(ResourcePlayer.this); prefsPrivate = getSharedPreferences(PREFS_PRIVATE, Context.MODE_PRIVATE); token = prefsPrivate.getString("token", ""); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); Bundle extra = getIntent().getExtras(); if (extra != null) { value = extra.getInt("key"); gooruOID1 = extra.getStringArrayList("goor"); searchkeyword = extra.getString("searchkey"); limit = gooruOID1.size();/*from w w w . j av a2 s.c o m*/ gooruOID = gooruOID1.get(value); resourceGooruId = gooruOID; if (!gooruOID.isEmpty() || !gooruOID.equalsIgnoreCase("") || gooruOID != null) { if (checkInternetConnection()) { dialog = new ProgressDialog(ResourcePlayer.this); dialog.setTitle("gooru"); dialog.setMessage("Please wait while loading..."); dialog.setCancelable(false); dialog.show(); new getResourcesInfo().execute(); } else { dialog = new ProgressDialog(ResourcePlayer.this); dialog.setTitle("gooru"); dialog.setMessage("No internet connection"); dialog.show(); } } } Editor prefsPrivateEditor = prefsPrivate.edit(); // Authentication details prefsPrivateEditor.putString("searchkeyword", searchkeyword); prefsPrivateEditor.commit(); wvPlayer = new WebView(ResourcePlayer.this); wvPlayer.resumeTimers(); wvPlayer.getSettings().setJavaScriptEnabled(true); wvPlayer.getSettings().setPluginState(PluginState.ON); wvPlayer.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); wvPlayer.setWebViewClient(new HelloWebViewClient()); wvPlayer.setWebChromeClient(new MyWebChromeClient() { }); wvPlayer.getSettings().setPluginsEnabled(true); new getResourcesInfo().execute(); RelativeLayout temp = new RelativeLayout(ResourcePlayer.this); temp.setId(668); temp.setBackgroundColor(getResources().getColor(android.R.color.transparent)); header = new RelativeLayout(ResourcePlayer.this); header.setId(1); header.setBackgroundDrawable(getResources().getDrawable(R.drawable.navbar)); RelativeLayout.LayoutParams headerParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.MATCH_PARENT, 53); headerParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); headerParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, -1); ivCloseIcon = new ImageView(ResourcePlayer.this); ivCloseIcon.setId(130); ivCloseIcon.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams ivCloseIconIconParams = new RelativeLayout.LayoutParams(50, 50); ivCloseIconIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); ivCloseIconIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 1); ivCloseIcon.setPadding(0, 0, 0, 0); ivCloseIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); ivCloseIcon.setBackgroundDrawable(getResources().getDrawable(R.drawable.close_corner)); header.addView(ivCloseIcon, ivCloseIconIconParams); ivmoveforward = new ImageView(ResourcePlayer.this); ivmoveforward.setId(222); if (value == limit - 1) { ivmoveforward.setVisibility(View.GONE); } ivmoveforward.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams ivmoveforwardIconIconParams = new RelativeLayout.LayoutParams(21, 38); ivmoveforwardIconIconParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, -1); ivmoveforwardIconIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); ivmoveforwardIconIconParams.setMargins(0, 0, 30, 0); imageshare = new ImageView(ResourcePlayer.this); imageshare.setId(440); imageshare.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams imageshareIconParams = new RelativeLayout.LayoutParams(50, 50); imageshareIconParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, -1); imageshareIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); imageshareIconParams.setMargins(0, 10, 100, 0); tvDescriptionn = new TextView(ResourcePlayer.this); tvDescriptionn1 = new TextView(ResourcePlayer.this); edittext_copyurl = new EditText(ResourcePlayer.this); imageshare.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (desc == 0) { new getShortUrl().execute(); imageshare.setBackgroundDrawable(getResources().getDrawable(R.drawable.share_selected)); subheader.setVisibility(View.VISIBLE); subheader.removeAllViews(); tvDescriptionn.setVisibility(View.VISIBLE); tvDescriptionn1.setVisibility(View.VISIBLE); edittext_copyurl.setVisibility(View.VISIBLE); tvDescriptionn.setText("Share this with other by copying and pasting these links"); tvDescriptionn.setId(221); tvDescriptionn.setTextSize(18); tvDescriptionn.setTypeface(null, Typeface.BOLD); tvDescriptionn.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescriptionParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvDescriptionParams.setMargins(20, 10, 0, 20); subheader.addView(tvDescriptionn, tvDescriptionParams); tvDescriptionn1.setText("Collections"); tvDescriptionn1.setId(226); tvDescriptionn1.setTextSize(18); tvDescriptionn1.setTypeface(null, Typeface.BOLD); tvDescriptionn1.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescriptionParams1 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvDescriptionParams1.setMargins(20, 42, 0, 20); subheader.addView(tvDescriptionn1, tvDescriptionParams1); edittext_copyurl.setId(266); edittext_copyurl.setTextSize(18); edittext_copyurl.setTypeface(null, Typeface.BOLD); edittext_copyurl.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescriptionParams11 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvDescriptionParams11.setMargins(130, 35, 0, 20); subheader.addView(edittext_copyurl, tvDescriptionParams11); desc = 1; flag = 0; } else { imageshare.setBackgroundDrawable(getResources().getDrawable(R.drawable.share_normal)); subheader.removeAllViews(); subheader.setVisibility(View.GONE); desc = 0; } } }); imageshare.setBackgroundDrawable(getResources().getDrawable(R.drawable.share_normal)); ivmoveforward.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (value < limit - 1) { Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); // extras.putString("gooruOId",s); extras.putStringArrayList("goor", gooruOID1); value++; extras.putInt("key", value); intentResPlayer.putExtras(extras); urlcheck = 0; finish(); startActivity(intentResPlayer); } } }); ivmoveforward.setBackgroundDrawable(getResources().getDrawable(R.drawable.arrowright)); ivmoveback = new ImageView(ResourcePlayer.this); ivmoveback.setId(220); if (value == 0) { ivmoveback.setVisibility(View.GONE); } ivmoveback.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams ivmovebackIconIconParams = new RelativeLayout.LayoutParams(21, 38); ivmovebackIconIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); ivmovebackIconIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); ivmovebackIconIconParams.setMargins(55, 0, 0, 0); ivmoveback.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!(value <= 0)) { value--; Intent intentResPlayer = new Intent(getBaseContext(), ResourcePlayer.class); Bundle extras = new Bundle(); extras.putStringArrayList("goor", gooruOID1); extras.putInt("key", value); intentResPlayer.putExtras(extras); urlcheck = 0; finish(); startActivity(intentResPlayer); } } }); ivmoveback.setBackgroundDrawable(getResources().getDrawable(R.drawable.left)); webViewBack = new ImageView(ResourcePlayer.this); webViewBack.setId(323); webViewBack.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams webViewBackIconParams = new RelativeLayout.LayoutParams(25, 26); webViewBackIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); webViewBackIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); webViewBackIconParams.setMargins(175, 0, 0, 0); webViewBack.setBackgroundDrawable(getResources().getDrawable(R.drawable.arrow_leftactive)); webViewBack.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (wvPlayer.canGoBack()) { wvPlayer.goBack(); } } }); webViewRefresh = new ImageView(ResourcePlayer.this); webViewRefresh.setId(322); webViewRefresh.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams webViewRefreshIconParams = new RelativeLayout.LayoutParams(30, 30); webViewRefreshIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); webViewRefreshIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); webViewRefreshIconParams.setMargins(305, 0, 0, 0); webViewRefresh.setBackgroundDrawable(getResources().getDrawable(R.drawable.refresh)); webViewRefresh.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { wvPlayer.reload(); } }); webViewForward = new ImageView(ResourcePlayer.this); webViewForward.setId(321); webViewForward.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams webViewForwardIconParams = new RelativeLayout.LayoutParams(25, 26); webViewForwardIconParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, -1); webViewForwardIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); webViewForwardIconParams.setMargins(245, 0, 0, 0); webViewForward.setBackgroundDrawable(getResources().getDrawable(R.drawable.arrow_rightactive)); webViewForward.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (wvPlayer.canGoForward()) { wvPlayer.goForward(); } } }); ivResourceIcon = new ImageView(ResourcePlayer.this); ivResourceIcon.setId(30); ivResourceIcon.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams ivResourceIconParams = new RelativeLayout.LayoutParams(50, 25); ivResourceIconParams.addRule(RelativeLayout.CENTER_VERTICAL, -1); ivResourceIconParams.addRule(RelativeLayout.LEFT_OF, 130); ivResourceIcon.setPadding(50, 0, 0, 0); ivResourceIcon.setBackgroundDrawable(getResources().getDrawable(R.drawable.handouts)); header.addView(ivResourceIcon, ivResourceIconParams); tvLearn = new TextView(this); tvLearn.setText("Learn More"); tvLearn.setId(20); tvLearn.setPadding(100, 0, 0, 0); tvLearn.setTextSize(20); tvLearn.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvLearnParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvLearnParams.addRule(RelativeLayout.CENTER_VERTICAL, 1); tvLearnParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 1); tvAbout = new ImageView(ResourcePlayer.this); tvAbout.setId(21); tvAbout.setScaleType(ImageView.ScaleType.FIT_XY); RelativeLayout.LayoutParams webViewForwardIconParamsa = new RelativeLayout.LayoutParams(32, 32); webViewForwardIconParamsa.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, -1); webViewForwardIconParamsa.addRule(RelativeLayout.CENTER_VERTICAL, -1); webViewForwardIconParamsa.setMargins(0, 0, 200, 0); tvAbout.setBackgroundDrawable(getResources().getDrawable(R.drawable.info)); header.addView(tvAbout, webViewForwardIconParamsa); RelativeLayout fortvtitle = new RelativeLayout(this); RelativeLayout.LayoutParams tvTitleParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvTitleParams.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); tvTitleParams.addRule(RelativeLayout.CENTER_VERTICAL, 1); tvTitleParams.addRule(RelativeLayout.RIGHT_OF, 322); tvTitleParams.addRule(RelativeLayout.LEFT_OF, 21); header.addView(fortvtitle, tvTitleParams); tvTitle = new TextView(this); tvTitle.setText(""); tvTitle.setId(22); tvTitle.setPadding(0, 0, 0, 0); tvTitle.setTextSize(25); tvTitle.setSingleLine(true); tvTitle.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvTitleParamstv = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvTitleParamstv.addRule(RelativeLayout.CENTER_HORIZONTAL, 1); tvTitleParamstv.addRule(RelativeLayout.CENTER_VERTICAL, 1); fortvtitle.addView(tvTitle, tvTitleParamstv); tvViewsNLikes = new TextView(this); tvViewsNLikes.setText(""); tvViewsNLikes.setId(23); tvViewsNLikes.setPadding(0, 0, 5, 5); tvViewsNLikes.setTextSize(18); tvViewsNLikes.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvViewsNLikesParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvViewsNLikesParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 1); tvViewsNLikesParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 1); subheader = new RelativeLayout(ResourcePlayer.this); subheader.setId(100); subheader.setVisibility(View.GONE); subheader.setBackgroundDrawable(getResources().getDrawable(R.drawable.navbar)); RelativeLayout.LayoutParams subheaderParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, 100); subheaderParams.addRule(RelativeLayout.BELOW, 1); subheaderParams.addRule(RelativeLayout.CENTER_IN_PARENT, 1); RelativeLayout.LayoutParams wvPlayerParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.FILL_PARENT, RelativeLayout.LayoutParams.FILL_PARENT); wvPlayerParams.addRule(RelativeLayout.BELOW, 100); wvPlayerParams.addRule(RelativeLayout.CENTER_IN_PARENT, 100); LinearLayout videoLayout = new LinearLayout(this); videoLayout.setVisibility(View.GONE); header.addView(webViewBack, webViewBackIconParams); header.addView(webViewRefresh, webViewRefreshIconParams); header.addView(webViewForward, webViewForwardIconParams); header.addView(ivmoveforward, ivmoveforwardIconIconParams); header.addView(imageshare, imageshareIconParams); header.addView(ivmoveback, ivmovebackIconIconParams); temp.addView(header, headerParams); temp.addView(subheader, subheaderParams); temp.addView(wvPlayer, wvPlayerParams); temp.addView(videoLayout, wvPlayerParams); setContentViewLayout.addView(temp, layoutParams); setContentView(setContentViewLayout); tvDescription = new TextView(ResourcePlayer.this); tvDescription1 = new TextView(ResourcePlayer.this); tvAbout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (flag == 0) { subheader.setVisibility(View.VISIBLE); subheader.removeAllViews(); // tvDescriptionn.setVisibility(View.INVISIBLE); tvDescription1.setVisibility(View.VISIBLE); tvDescription.setVisibility(View.VISIBLE); tvDescription.setText("Description"); tvDescription.setId(221); tvDescription.setTextSize(18); tvDescription.setTypeface(null, Typeface.BOLD); tvDescription.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescriptionParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvDescriptionParams.setMargins(20, 10, 0, 20); tvDescriptionParams.addRule(RelativeLayout.BELOW, 220); tvDescription1.setText(description); tvDescription1.setLines(3); tvDescription1.setId(321); tvDescription1.setTextSize(15); tvDescription1.setTextColor(getResources().getColor(android.R.color.white)); RelativeLayout.LayoutParams tvDescription1Params = new RelativeLayout.LayoutParams(1100, 100); tvDescription1Params.addRule(RelativeLayout.CENTER_IN_PARENT, -1); tvDescription1.setPadding(100, 20, 100, 0); subheader.addView(tvDescription1, tvDescription1Params); desc = 0; flag = 1; flag1 = 0; } else { subheader.removeAllViews(); subheader.setVisibility(View.GONE); flag = 0; } } }); }
From source file:com.cloverstudio.spika.CreateGroupActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case GET_IMAGE_DIALOG: mGetImageDialog = new Dialog(CreateGroupActivity.this, R.style.TransparentDialogTheme); mGetImageDialog.getWindow().setGravity(Gravity.BOTTOM); mGetImageDialog.setContentView(R.layout.dialog_get_image); // Grab the window of the dialog, and change the width WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); Window window = mGetImageDialog.getWindow(); lp.copyFrom(window.getAttributes()); // This makes the dialog take up the full width lp.width = WindowManager.LayoutParams.MATCH_PARENT; lp.height = WindowManager.LayoutParams.WRAP_CONTENT; window.setAttributes(lp);/*from w w w . j a v a2s . co m*/ final Button btnGallery = (Button) mGetImageDialog.findViewById(R.id.btnGallery); btnGallery.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); btnGallery.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent galleryIntent = new Intent(CreateGroupActivity.this, CameraCropActivity.class); galleryIntent.putExtra("type", "gallery"); galleryIntent.putExtra("createGroup", true); CreateGroupActivity.this.startActivity(galleryIntent); mGetImageDialog.dismiss(); } }); final Button btnCamera = (Button) mGetImageDialog.findViewById(R.id.btnCamera); btnCamera.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); btnCamera.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent cameraIntent = new Intent(CreateGroupActivity.this, CameraCropActivity.class); cameraIntent.putExtra("type", "camera"); cameraIntent.putExtra("createGroup", true); CreateGroupActivity.this.startActivity(cameraIntent); mGetImageDialog.dismiss(); } }); final Button btnRemovePhoto = (Button) mGetImageDialog.findViewById(R.id.btnRemovePhoto); btnRemovePhoto.setTypeface(SpikaApp.getTfMyriadProBold(), Typeface.BOLD); btnRemovePhoto.setOnClickListener(new OnClickListener() { public void onClick(View v) { mGroupAvatarId = ""; gGroupImage = null; Utils.displayImage(mGroupAvatarId, mIvGroupImage, ImageLoader.LARGE, R.drawable.group_stub_large, false); mGetImageDialog.dismiss(); } }); return mGetImageDialog; default: return null; } }
From source file:io.karim.materialtabs.sample.TabsActivity.java
private String getStyleFromStyleInt(int styleInt) { switch (styleInt) { case Typeface.BOLD: default:// w ww . jav a2 s .c om return "bold"; case Typeface.ITALIC: return "italic"; case Typeface.NORMAL: return "normal"; } }