use of android.support.annotation.UiThread in project bugzy by cpunq.
the class HomeActivity method showFilters.
@UiThread
private void showFilters(List<Filter> filters) {
showContent();
if (mFilters != null) {
// Filters already present, clear the list and add new
removeFiltersFromNavigationView();
// Removed
}
mFilters = filters;
int defaultItemId = prepareNavHelperData(filters);
mHomeNavItemId = defaultItemId;
// Unlock the drawer
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
if (mCurrentFragment != null) {
/**
* This can happen in case of an orientation change or when user navigates
* back to this activity. The currently active fragment will call
* {@link #onFragmentsActivityCreated(Fragment, String, String)} before the
* filters get loaded.
* And hence, we won't go forward to select the default fragment
*/
String tag = mCurrentFragment.getTag();
if (mNavItemTagMap.containsKey(tag)) {
navigationView.getMenu().findItem(mNavItemTagMap.get(tag)).setChecked(true);
}
// If there already is a selected Fragment, don't select a new one
return;
}
// Set default fragment
MenuItem mi = navigationView.getMenu().findItem(defaultItemId);
mHomeNavItemId = mi.getItemId();
onNavigationItemSelected(mi.setChecked(true));
}
use of android.support.annotation.UiThread in project bugzy by cpunq.
the class HomeActivity method showUserInfo.
@UiThread
protected void showUserInfo(Person p) {
ImageView iv = navigationView.getHeaderView(0).findViewById(R.id.pro);
String url = mUrlGenerator.getPersonImageUrl(p.getPersonid());
Glide.with(this).load(url).apply(RequestOptions.circleCropTransform()).into(iv);
mUserName.setText(p.getFullname());
mUserEmail.setText(p.getEmail());
}
use of android.support.annotation.UiThread in project bugzy by cpunq.
the class LoginActivity method redirectToHome.
@UiThread
private void redirectToHome() {
Intent mHome = new Intent(this, HomeActivity.class);
startActivity(mHome);
this.finish();
}
use of android.support.annotation.UiThread in project SmoothProgressBar by castorflex.
the class SmoothProgressDrawable method drawStrokes.
@UiThread
private void drawStrokes(Canvas canvas) {
if (mReversed) {
canvas.translate(mBounds.width(), 0);
canvas.scale(-1, 1);
}
float prevValue = 0f;
int boundsWidth = mBounds.width();
if (mMirrorMode)
boundsWidth /= 2;
int width = boundsWidth + mSeparatorLength + mSectionsCount;
int centerY = mBounds.centerY();
float xSectionWidth = 1f / mSectionsCount;
float startX;
float endX;
float firstX = 0;
float lastX = 0;
float prev;
float end;
float spaceLength;
float xOffset;
float ratioSectionWidth;
float sectionWidth;
float drawLength;
int currentIndexColor = mColorsIndex;
if (mStartSection == mCurrentSections && mCurrentSections == mSectionsCount) {
firstX = canvas.getWidth();
}
for (int i = 0; i <= mCurrentSections; ++i) {
xOffset = xSectionWidth * i + mCurrentOffset;
prev = Math.max(0f, xOffset - xSectionWidth);
ratioSectionWidth = Math.abs(mInterpolator.getInterpolation(prev) - mInterpolator.getInterpolation(Math.min(xOffset, 1f)));
sectionWidth = (int) (width * ratioSectionWidth);
if (sectionWidth + prev < width)
spaceLength = Math.min(sectionWidth, mSeparatorLength);
else
spaceLength = 0f;
drawLength = sectionWidth > spaceLength ? sectionWidth - spaceLength : 0;
end = prevValue + drawLength;
if (end > prevValue && i >= mStartSection) {
float xFinishingOffset = mInterpolator.getInterpolation(Math.min(mFinishingOffset, 1f));
startX = Math.max(xFinishingOffset * width, Math.min(boundsWidth, prevValue));
endX = Math.min(boundsWidth, end);
drawLine(canvas, boundsWidth, startX, centerY, endX, centerY, currentIndexColor);
if (i == mStartSection) {
// first loop
firstX = startX - mSeparatorLength;
}
}
if (i == mCurrentSections) {
// because we want to keep the separator effect
lastX = prevValue + sectionWidth;
}
prevValue = end + spaceLength;
currentIndexColor = incrementColor(currentIndexColor);
}
drawBackgroundIfNeeded(canvas, firstX, lastX);
}
use of android.support.annotation.UiThread in project material-dialogs by afollestad.
the class MaterialDialog method setIconAttribute.
@SuppressWarnings("unused")
@UiThread
public void setIconAttribute(@AttrRes int attrId) {
Drawable d = DialogUtils.resolveDrawable(builder.context, attrId);
setIcon(d);
}
Aggregations