List of usage examples for android.graphics Typeface create
public static Typeface create(Typeface family, @Style int style)
From source file:net.xpece.commons.android.widget.CollapsingTitleLayout.java
public CollapsingTitleLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mTextPaint = new TextPaint(); mTextPaint.setAntiAlias(true);/* w ww. ja va2 s. c o m*/ if (AndroidUtils.API_21) { Typeface tf = Typeface.create("sans-serif-medium", Typeface.NORMAL); mTextPaint.setTypeface(tf); } else { Typeface tf = Typeface.create("sans-serif", Typeface.NORMAL); mTextPaint.setTypeface(tf); } TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CollapsingTitleLayout); mExpandedMarginLeft = mExpandedMarginRight = mExpandedMarginBottom = a .getDimensionPixelSize(R.styleable.CollapsingTitleLayout_expandedMargin, 0); final boolean isRtl = ViewCompat.getLayoutDirection(this) == ViewCompat.LAYOUT_DIRECTION_RTL; if (a.hasValue(R.styleable.CollapsingTitleLayout_expandedMarginStart)) { final int marginStart = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_expandedMarginStart, 0); if (isRtl) { mExpandedMarginRight = marginStart; } else { mExpandedMarginLeft = marginStart; } } if (a.hasValue(R.styleable.CollapsingTitleLayout_expandedMarginEnd)) { final int marginEnd = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_expandedMarginEnd, 0); if (isRtl) { mExpandedMarginLeft = marginEnd; } else { mExpandedMarginRight = marginEnd; } } if (a.hasValue(R.styleable.CollapsingTitleLayout_expandedMarginBottom)) { mExpandedMarginBottom = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_expandedMarginBottom, 0); } final int tp = a.getResourceId(R.styleable.CollapsingTitleLayout_android_textAppearance, android.R.style.TextAppearance); setTextAppearance(tp); if (a.hasValue(R.styleable.CollapsingTitleLayout_collapsedTextSize)) { mCollapsedTitleTextSize = a.getDimensionPixelSize(R.styleable.CollapsingTitleLayout_collapsedTextSize, 0); } mRequestedExpandedTitleTextSize = a .getDimensionPixelSize(R.styleable.CollapsingTitleLayout_expandedTextSize, mCollapsedTitleTextSize); final int interpolatorId = a.getResourceId(R.styleable.CollapsingTitleLayout_textSizeInterpolator, android.R.anim.accelerate_interpolator); mTextSizeInterpolator = AnimationUtils.loadInterpolator(context, interpolatorId); a.recycle(); mToolbarContentBounds = new Rect(); setWillNotDraw(false); }
From source file:com.funzio.pure2D.ui.vo.FontVO.java
public TextOptions createTextOptions(final UIManager manager) { final TextOptions options = TextOptions.getDefault(); options.id = name;//from w w w . j av a 2 s . c o m options.inCharacters = manager.evalString(characters); options.inMipmaps = texture_mipmaps; try { options.inTextPaint.setTypeface( Typeface.createFromAsset(manager.getContext().getAssets(), manager.evalString(typeface))); } catch (Exception e) { // Log.e(TAG, "Creating Typeface Error: " + typeface, e); // fallback solution options.inTextPaint.setTypeface(Typeface.create(typeface, TextOptions.getTypefaceStyle(style))); } options.inTextPaint.setTextSize(Float.valueOf(manager.evalString(size)) * mScale); options.inTextPaint.setColor(Color.parseColor(color)); options.inPaddingX = padding_x * mScale; options.inPaddingY = padding_y * mScale; // stroke final float ss = Float.valueOf(manager.evalString(stroke_size)) * mScale; if (ss > 0) { options.inStrokePaint = new TextPaint(options.inTextPaint); options.inStrokePaint.setColor(Color.parseColor(stroke_color)); options.inStrokePaint.setTextSize(ss); } // shadow if (shadow_radius > 0) { if (options.inStrokePaint == null) { options.inStrokePaint = new TextPaint(options.inTextPaint); } options.inStrokePaint.setShadowLayer(shadow_radius * mScale, shadow_dx * mScale, shadow_dy * mScale, Color.parseColor(shadow_color)); } return options; }
From source file:com.android.datetimepicker.time.AmPmCirclesView.java
public void initialize(Context context, TimePickerController controller, int amOrPm) { if (mIsInitialized) { Log.e(TAG, "AmPmCirclesView may only be initialized once."); return;/*from w ww . ja v a 2 s.c o m*/ } Resources res = context.getResources(); if (controller.isThemeDark()) { mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_circle_background_dark_theme); mAmPmTextColor = ContextCompat.getColor(context, R.color.mdtp_white); mAmPmDisabledTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled_dark_theme); mSelectedAlpha = SELECTED_ALPHA_THEME_DARK; } else { mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_white); mAmPmTextColor = ContextCompat.getColor(context, R.color.mdtp_ampm_text_color); mAmPmDisabledTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled); mSelectedAlpha = SELECTED_ALPHA; } mSelectedColor = controller.getAccentColor(); mTouchedColor = Utils.darkenColor(mSelectedColor); mAmPmSelectedTextColor = ContextCompat.getColor(context, R.color.mdtp_white); String typefaceFamily = res.getString(R.string.mdtp_sans_serif); Typeface tf = Typeface.create(typefaceFamily, Typeface.NORMAL); mPaint.setTypeface(tf); mPaint.setAntiAlias(true); mPaint.setTextAlign(Align.CENTER); mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier)); mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier)); String[] amPmTexts = new DateFormatSymbols().getAmPmStrings(); mAmText = amPmTexts[0]; mPmText = amPmTexts[1]; mAmDisabled = controller.isAmDisabled(); mPmDisabled = controller.isPmDisabled(); setAmOrPm(amOrPm); mAmOrPmPressed = -1; mIsInitialized = true; }
From source file:com.customdatepicker.time.RadialTextsView.java
public void initialize(Context context, String[] texts, String[] innerTexts, TimePickerController controller, SelectionValidator validator, boolean disappearsOut) { if (mIsInitialized) { Log.e(TAG, "This RadialTextsView may only be initialized once."); return;//from w ww .ja v a 2s .co m } Resources res = context.getResources(); // Set up the paint. int textColorRes = controller.isThemeDark() ? R.color.mdtp_white : R.color.mdtp_numbers_text_color; mPaint.setColor(ContextCompat.getColor(context, textColorRes)); String typefaceFamily = res.getString(R.string.mdtp_radial_numbers_typeface); mTypefaceLight = Typeface.create(typefaceFamily, Typeface.NORMAL); String typefaceFamilyRegular = res.getString(R.string.mdtp_sans_serif); mTypefaceRegular = Typeface.create(typefaceFamilyRegular, Typeface.NORMAL); mPaint.setAntiAlias(true); mPaint.setTextAlign(Align.CENTER); // Set up the selected paint int selectedTextColor = ContextCompat.getColor(context, R.color.mdtp_white); mSelectedPaint.setColor(selectedTextColor); mSelectedPaint.setAntiAlias(true); mSelectedPaint.setTextAlign(Align.CENTER); // Set up the inactive paint int inactiveColorRes = controller.isThemeDark() ? R.color.mdtp_date_picker_text_disabled_dark_theme : R.color.mdtp_date_picker_text_disabled; mInactivePaint.setColor(ContextCompat.getColor(context, inactiveColorRes)); mInactivePaint.setAntiAlias(true); mInactivePaint.setTextAlign(Align.CENTER); mTexts = texts; mInnerTexts = innerTexts; mIs24HourMode = controller.is24HourMode(); mHasInnerCircle = (innerTexts != null); // Calculate the radius for the main circle. if (mIs24HourMode || controller.getVersion() != TimePickerDialog.Version.VERSION_1) { mCircleRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier_24HourMode)); } else { mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier)); mAmPmCircleRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier)); } // Initialize the widths and heights of the grid, and calculate the values for the numbers. mTextGridHeights = new float[7]; mTextGridWidths = new float[7]; if (mHasInnerCircle) { mNumbersRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_outer)); mTextSizeMultiplier = Float.parseFloat(res.getString(R.string.mdtp_text_size_multiplier_outer)); mInnerNumbersRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_inner)); mInnerTextSizeMultiplier = Float.parseFloat(res.getString(R.string.mdtp_text_size_multiplier_inner)); mInnerTextGridHeights = new float[7]; mInnerTextGridWidths = new float[7]; } else { mNumbersRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_normal)); mTextSizeMultiplier = Float.parseFloat(res.getString(R.string.mdtp_text_size_multiplier_normal)); } mAnimationRadiusMultiplier = 1; mTransitionMidRadiusMultiplier = 1f + (0.05f * (disappearsOut ? -1 : 1)); mTransitionEndRadiusMultiplier = 1f + (0.3f * (disappearsOut ? 1 : -1)); mInvalidateUpdateListener = new InvalidateUpdateListener(); mValidator = validator; mTextGridValuesDirty = true; mIsInitialized = true; }
From source file:com.android.datetimepicker.time.RadialTextsView.java
public void initialize(Context context, String[] texts, String[] innerTexts, TimePickerController controller, SelectionValidator validator, boolean disappearsOut) { if (mIsInitialized) { Log.e(TAG, "This RadialTextsView may only be initialized once."); return;/* w w w . j a v a 2 s .c o m*/ } Resources res = context.getResources(); // Set up the paint. int textColorRes = controller.isThemeDark() ? R.color.mdtp_white : R.color.mdtp_numbers_text_color; mPaint.setColor(ContextCompat.getColor(context, textColorRes)); String typefaceFamily = res.getString(R.string.mdtp_radial_numbers_typeface); mTypefaceLight = Typeface.create(typefaceFamily, Typeface.NORMAL); String typefaceFamilyRegular = res.getString(R.string.mdtp_sans_serif); mTypefaceRegular = Typeface.create(typefaceFamilyRegular, Typeface.NORMAL); mPaint.setAntiAlias(true); mPaint.setTextAlign(Align.CENTER); // Set up the selected paint int selectedTextColor = ContextCompat.getColor(context, R.color.mdtp_white); mSelectedPaint.setColor(selectedTextColor); mSelectedPaint.setAntiAlias(true); mSelectedPaint.setTextAlign(Align.CENTER); // Set up the inactive paint int inactiveColorRes = controller.isThemeDark() ? R.color.mdtp_date_picker_text_disabled_dark_theme : R.color.mdtp_date_picker_text_disabled; mInactivePaint.setColor(ContextCompat.getColor(context, inactiveColorRes)); mInactivePaint.setAntiAlias(true); mInactivePaint.setTextAlign(Align.CENTER); mTexts = texts; mInnerTexts = innerTexts; mIs24HourMode = controller.is24HourMode(); mHasInnerCircle = (innerTexts != null); // Calculate the radius for the main circle. if (mIs24HourMode) { mCircleRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier_24HourMode)); } else { mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier)); mAmPmCircleRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier)); } // Initialize the widths and heights of the grid, and calculate the values for the numbers. mTextGridHeights = new float[7]; mTextGridWidths = new float[7]; if (mHasInnerCircle) { mNumbersRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_outer)); mTextSizeMultiplier = Float.parseFloat(res.getString(R.string.mdtp_text_size_multiplier_outer)); mInnerNumbersRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_inner)); mInnerTextSizeMultiplier = Float.parseFloat(res.getString(R.string.mdtp_text_size_multiplier_inner)); mInnerTextGridHeights = new float[7]; mInnerTextGridWidths = new float[7]; } else { mNumbersRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_normal)); mTextSizeMultiplier = Float.parseFloat(res.getString(R.string.mdtp_text_size_multiplier_normal)); } mAnimationRadiusMultiplier = 1; mTransitionMidRadiusMultiplier = 1f + (0.05f * (disappearsOut ? -1 : 1)); mTransitionEndRadiusMultiplier = 1f + (0.3f * (disappearsOut ? 1 : -1)); mInvalidateUpdateListener = new InvalidateUpdateListener(); mValidator = validator; mTextGridValuesDirty = true; mIsInitialized = true; }
From source file:com.mojtaba.materialdatetimepicker.time.AmPmCirclesView.java
public void initialize(Context context, TimePickerController controller, int amOrPm) { if (mIsInitialized) { Log.e(TAG, "AmPmCirclesView may only be initialized once."); return;//from w w w .j a va 2 s .c o m } Resources res = context.getResources(); if (controller.isThemeDark()) { mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_circle_background_dark_theme); mAmPmTextColor = ContextCompat.getColor(context, R.color.mdtp_white); mAmPmDisabledTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled_dark_theme); mSelectedAlpha = SELECTED_ALPHA_THEME_DARK; } else { mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_white); mAmPmTextColor = ContextCompat.getColor(context, R.color.mdtp_ampm_text_color); mAmPmDisabledTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled); mSelectedAlpha = SELECTED_ALPHA; } mSelectedColor = controller.getAccentColor(); mTouchedColor = Utils.darkenColor(mSelectedColor); mAmPmSelectedTextColor = ContextCompat.getColor(context, R.color.mdtp_white); String typefaceFamily = res.getString(R.string.mdtp_sans_serif); Typeface tf = Typeface.create(typefaceFamily, Typeface.NORMAL); mPaint.setTypeface(tf); mPaint.setAntiAlias(true); mPaint.setTextAlign(Align.CENTER); mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier)); mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier)); mAmText = ""; mPmText = ""; setAmOrPm(amOrPm); mAmOrPmPressed = -1; mIsInitialized = true; }
From source file:com.chauffeurprive.kronos.time.RadialTextsView.java
public void initialize(Context context, String[] texts, String[] innerTexts, TimePickerController controller, SelectionValidator validator, boolean disappearsOut) { if (mIsInitialized) { Log.e(TAG, "This RadialTextsView may only be initialized once."); return;//ww w . j a va 2s.co m } Resources res = context.getResources(); // Set up the paint. int textColorRes = controller.getTextColor(); mPaint.setColor(ContextCompat.getColor(context, textColorRes)); String typefaceFamily = res.getString(R.string.mdtp_radial_numbers_typeface); mTypefaceLight = Typeface.create(typefaceFamily, Typeface.NORMAL); String typefaceFamilyRegular = res.getString(R.string.mdtp_sans_serif); mTypefaceRegular = Typeface.create(typefaceFamilyRegular, Typeface.NORMAL); mPaint.setAntiAlias(true); mPaint.setTextAlign(Align.CENTER); // Set up the selected paint int selectedTextColor = ContextCompat.getColor(context, controller.getSelectedTextColor()); mSelectedPaint.setColor(selectedTextColor); mSelectedPaint.setAntiAlias(true); mSelectedPaint.setTextAlign(Align.CENTER); // Set up the inactive paint int inactiveColorRes = controller.getDisabledTextColor(); mInactivePaint.setColor(ContextCompat.getColor(context, inactiveColorRes)); mInactivePaint.setAntiAlias(true); mInactivePaint.setTextAlign(Align.CENTER); mTexts = texts; mInnerTexts = innerTexts; mIs24HourMode = controller.is24HourMode(); mHasInnerCircle = (innerTexts != null); // Calculate the radius for the main circle. if (mIs24HourMode) { mCircleRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier_24HourMode)); } else { mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier)); mAmPmCircleRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier)); } // Initialize the widths and heights of the grid, and calculate the values for the numbers. mTextGridHeights = new float[7]; mTextGridWidths = new float[7]; if (mHasInnerCircle) { mNumbersRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_outer)); mTextSizeMultiplier = Float.parseFloat(res.getString(R.string.mdtp_text_size_multiplier_outer)); mInnerNumbersRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_inner)); mInnerTextSizeMultiplier = Float.parseFloat(res.getString(R.string.mdtp_text_size_multiplier_inner)); mInnerTextGridHeights = new float[7]; mInnerTextGridWidths = new float[7]; } else { mNumbersRadiusMultiplier = Float .parseFloat(res.getString(R.string.mdtp_numbers_radius_multiplier_normal)); mTextSizeMultiplier = Float.parseFloat(res.getString(R.string.mdtp_text_size_multiplier_normal)); } mAnimationRadiusMultiplier = 1; mTransitionMidRadiusMultiplier = 1f + (0.05f * (disappearsOut ? -1 : 1)); mTransitionEndRadiusMultiplier = 1f + (0.3f * (disappearsOut ? 1 : -1)); mInvalidateUpdateListener = new InvalidateUpdateListener(); mValidator = validator; mTextGridValuesDirty = true; mIsInitialized = true; }
From source file:com.jarklee.materialdatetimepicker.time.AmPmCirclesView.java
public void initialize(Context context, TimePickerController controller, int amOrPm) { if (mIsInitialized) { Log.e(TAG, "AmPmCirclesView may only be initialized once."); return;//from w w w . jav a2 s. c o m } Resources res = context.getResources(); if (controller.isThemeDark()) { mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_circle_background_dark_theme); mAmPmTextColor = ContextCompat.getColor(context, R.color.mdtp_white); mAmPmDisabledTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled_dark_theme); mSelectedAlpha = SELECTED_ALPHA_THEME_DARK; } else { mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_white); mAmPmTextColor = ContextCompat.getColor(context, R.color.mdtp_ampm_text_color); mAmPmDisabledTextColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled); mSelectedAlpha = SELECTED_ALPHA; } mSelectedColor = controller.getAccentColor(); mTouchedColor = Utils.darkenColor(mSelectedColor); mAmPmSelectedTextColor = ContextCompat.getColor(context, R.color.mdtp_white); String typefaceFamily = res.getString(R.string.mdtp_sans_serif); Typeface tf = Typeface.create(typefaceFamily, Typeface.NORMAL); mPaint.setTypeface(tf); mPaint.setAntiAlias(true); mPaint.setTextAlign(Align.CENTER); mCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_circle_radius_multiplier)); mAmPmCircleRadiusMultiplier = Float.parseFloat(res.getString(R.string.mdtp_ampm_circle_radius_multiplier)); String[] amPmTexts = new DateFormatSymbols(getLocale()).getAmPmStrings(); mAmText = amPmTexts[0]; mPmText = amPmTexts[1]; mAmDisabled = controller.isAmDisabled(); mPmDisabled = controller.isPmDisabled(); setAmOrPm(amOrPm); mAmOrPmPressed = -1; mIsInitialized = true; }
From source file:com.stepstone.stepper.internal.widget.StepTab.java
public StepTab(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); LayoutInflater.from(getContext()).inflate(R.layout.ms_step_tab, this, true); mSelectedColor = ContextCompat.getColor(context, R.color.ms_selectedColor); mUnselectedColor = ContextCompat.getColor(context, R.color.ms_unselectedColor); mErrorColor = ContextCompat.getColor(context, R.color.ms_errorColor); mStepNumber = (TextView) findViewById(R.id.ms_stepNumber); mStepDoneIndicator = (ImageView) findViewById(R.id.ms_stepDoneIndicator); mStepIconBackground = (ImageView) findViewById(R.id.ms_stepIconBackground); mStepDivider = findViewById(R.id.ms_stepDivider); mStepTitle = ((TextView) findViewById(R.id.ms_stepTitle)); mTitleColor = mStepTitle.getCurrentTextColor(); Typeface typeface = mStepTitle.getTypeface(); mNormalTypeface = Typeface.create(typeface, Typeface.NORMAL); mBoldTypeface = Typeface.create(typeface, Typeface.BOLD); Drawable avd = createCircleToWarningDrawable(); mStepIconBackground.setImageDrawable(avd); }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.view_zenoss_event, container, false); Title = (TextView) rootView.findViewById(R.id.EventTitle); Component = (TextView) rootView.findViewById(R.id.Componant); EventClass = (TextView) rootView.findViewById(R.id.EventClass); Summary = (TextView) rootView.findViewById(R.id.Summary); FirstTime = (TextView) rootView.findViewById(R.id.FirstTime); LastTime = (TextView) rootView.findViewById(R.id.LastTime); ackIcon = (ImageView) rootView.findViewById(R.id.ackIcon); img = (ImageView) rootView.findViewById(R.id.summaryImage); EventCount = (TextView) rootView.findViewById(R.id.EventCount); agent = (TextView) rootView.findViewById(R.id.Agent); logList = (LinearLayout) rootView.findViewById(R.id.LogList); progressbar = (ProgressBar) rootView.findViewById(R.id.progressBar); Typeface Titles = Typeface.create("sans-serif-light", Typeface.NORMAL); Typeface Subtitles = Typeface.create("sans-serif", Typeface.BOLD); Title.setTypeface(Titles);//from w w w.j a v a2 s . c o m try { if (getActivity().getIntent().hasExtra("EventCount")) { EventCount.setText( "Count: " + Integer.toString(getActivity().getIntent().getIntExtra("EventCount", 0))); } else if (getArguments().getInt("EventCount", 0) != 0) { EventCount.setText("Count: " + Integer.toString(getArguments().getInt("EventCount", 0))); } else { EventCount.setText("Count: 0"); } } catch (Exception e) { e.printStackTrace(); } try { if (getActivity().getIntent().hasExtra("EventTitle")) { Title.setText(getActivity().getIntent().getStringExtra("EventTitle")); } else if (!getArguments().getString("EventTitle").equals("")) { Title.setText(getArguments().getString("EventTitle")); } else { Title.setText(getActivity().getString(R.string.eventDetailsTitlePlaceholder)); } } catch (Exception e) { e.printStackTrace(); } ackIcon.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { progressbar.setVisibility(View.VISIBLE); ((Thread) new Thread() { public void run() { if (settings.getBoolean(ZenossAPI.PREFERENCE_IS_ZAAS, false)) { API = new ZenossAPIZaas(); } else { API = new ZenossAPICore(); } ZenossCredentials credentials = null; try { credentials = new ZenossCredentials(getActivity()); } catch (Exception e) { BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "credentials", e); credentials = null; } try { API.Login(credentials); JSONObject ackJSON = API.AcknowledgeEvent(getArguments().getString("EventID")); if (ackJSON.getJSONObject("result").getBoolean("success")) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { progressbar.setVisibility(View.INVISIBLE); ackIcon.setImageResource(R.drawable.ic_acknowledged); mCallbacks.onItemAcknowledged(getArguments().getInt("position")); } }); RhybuddDataSource datasource = null; try { datasource = new RhybuddDataSource(getActivity()); datasource.open(); datasource.ackEvent(getArguments().getString("EventID")); } catch (Exception e) { e.printStackTrace(); BugSenseHandler.sendExceptionMessage("ViewZenossEventFragmentUpdate", "DBUpdate", e); } finally { if (null != datasource) datasource.close(); } } else { Toast.makeText(getActivity(), "Unable to acknowledge alert", Toast.LENGTH_SHORT) .show(); } } catch (Exception e) { getActivity().runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getActivity(), "Unable to acknowledge alert", Toast.LENGTH_SHORT) .show(); } }); BugSenseHandler.sendExceptionMessage("ViewZenossEventFragment", "outer try", e); } } }).start(); } }); return rootView; }