use of org.wordpress.android.widgets.WPNetworkImageView in project WordPress-Android by wordpress-mobile.
the class MySiteFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.my_site_fragment, container, false);
int fabHeight = getResources().getDimensionPixelSize(android.support.design.R.dimen.design_fab_size_normal);
int fabMargin = getResources().getDimensionPixelSize(R.dimen.fab_margin);
mFabTargetYTranslation = (fabHeight + fabMargin) * 2;
mBlavatarSz = getResources().getDimensionPixelSize(R.dimen.blavatar_sz_small);
mBlavatarImageView = (WPNetworkImageView) rootView.findViewById(R.id.my_site_blavatar);
mBlogTitleTextView = (WPTextView) rootView.findViewById(R.id.my_site_title_label);
mBlogSubtitleTextView = (WPTextView) rootView.findViewById(R.id.my_site_subtitle_label);
mLookAndFeelHeader = (LinearLayout) rootView.findViewById(R.id.my_site_look_and_feel_header);
mThemesContainer = (RelativeLayout) rootView.findViewById(R.id.row_themes);
mPeopleView = (RelativeLayout) rootView.findViewById(R.id.row_people);
mPlanContainer = (RelativeLayout) rootView.findViewById(R.id.row_plan);
mConfigurationHeader = rootView.findViewById(R.id.row_configuration);
mSettingsView = rootView.findViewById(R.id.row_settings);
mAdminView = (RelativeLayout) rootView.findViewById(R.id.row_admin);
mScrollView = (ScrollView) rootView.findViewById(R.id.scroll_view);
mNoSiteView = (LinearLayout) rootView.findViewById(R.id.no_site_view);
mNoSiteDrakeImageView = (ImageView) rootView.findViewById(R.id.my_site_no_site_view_drake);
mFabView = rootView.findViewById(R.id.fab_button);
mCurrentPlanNameTextView = (WPTextView) rootView.findViewById(R.id.my_site_current_plan_text_view);
mPageView = (RelativeLayout) rootView.findViewById(R.id.row_pages);
// hide the FAB the first time the fragment is created in order to animate it in onResume()
if (savedInstanceState == null) {
mFabView.setVisibility(View.INVISIBLE);
}
mFabView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.addNewPostOrPageForResult(getActivity(), getSelectedSite(), false);
}
});
rootView.findViewById(R.id.switch_site).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showSitePicker();
}
});
rootView.findViewById(R.id.row_view_site).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewCurrentSite(getActivity(), getSelectedSite());
}
});
rootView.findViewById(R.id.row_stats).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewBlogStats(getActivity(), getSelectedSite());
}
});
mPlanContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewBlogPlans(getActivity(), getSelectedSite());
}
});
rootView.findViewById(R.id.row_blog_posts).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewCurrentBlogPosts(getActivity(), getSelectedSite());
}
});
rootView.findViewById(R.id.row_media).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewCurrentBlogMedia(getActivity(), getSelectedSite());
}
});
rootView.findViewById(R.id.row_pages).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewCurrentBlogPages(getActivity(), getSelectedSite());
}
});
rootView.findViewById(R.id.row_comments).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewCurrentBlogComments(getActivity(), getSelectedSite());
}
});
mThemesContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewCurrentBlogThemes(getActivity(), getSelectedSite());
}
});
mPeopleView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewCurrentBlogPeople(getActivity(), getSelectedSite());
}
});
mSettingsView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewBlogSettingsForResult(getActivity(), getSelectedSite());
}
});
rootView.findViewById(R.id.row_admin).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewBlogAdmin(getActivity(), getSelectedSite());
}
});
rootView.findViewById(R.id.my_site_add_site_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SitePickerActivity.addSite(getActivity(), mAccountStore.hasAccessToken());
}
});
return rootView;
}
use of org.wordpress.android.widgets.WPNetworkImageView in project WordPress-Android by wordpress-mobile.
the class MeFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final ViewGroup rootView = (ViewGroup) inflater.inflate(R.layout.me_fragment, container, false);
mAvatarFrame = (ViewGroup) rootView.findViewById(R.id.frame_avatar);
mAvatarContainer = (ViewGroup) rootView.findViewById(R.id.avatar_container);
mAvatarImageView = (WPNetworkImageView) rootView.findViewById(R.id.me_avatar);
mAvatarTooltipAnchor = rootView.findViewById(R.id.avatar_tooltip_anchor);
mProgressBar = rootView.findViewById(R.id.avatar_progress);
mDisplayNameTextView = (TextView) rootView.findViewById(R.id.me_display_name);
mUsernameTextView = (TextView) rootView.findViewById(R.id.me_username);
mLoginLogoutTextView = (TextView) rootView.findViewById(R.id.me_login_logout_text_view);
mMyProfileView = rootView.findViewById(R.id.row_my_profile);
mAccountSettingsView = rootView.findViewById(R.id.row_account_settings);
mNotificationsView = rootView.findViewById(R.id.row_notifications);
mNotificationsDividerView = rootView.findViewById(R.id.me_notifications_divider);
addDropShadowToAvatar();
mAvatarContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AnalyticsTracker.track(AnalyticsTracker.Stat.ME_GRAVATAR_TAPPED);
// User tapped the Gravatar so dismiss the tooltip
if (mGravatarToolTipView != null) {
mGravatarToolTipView.remove();
}
// and no need to promote the feature any more
AppPrefs.setGravatarChangePromoRequired(false);
if (PermissionUtils.checkAndRequestCameraAndStoragePermissions(MeFragment.this, CAMERA_AND_MEDIA_PERMISSION_REQUEST_CODE)) {
askForCameraOrGallery();
} else {
AppLockManager.getInstance().setExtendedTimeout();
}
}
});
mMyProfileView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewMyProfile(getActivity());
}
});
mAccountSettingsView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewAccountSettings(getActivity());
}
});
rootView.findViewById(R.id.row_app_settings).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewAppSettings(getActivity());
}
});
mNotificationsView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewNotificationsSettings(getActivity());
}
});
rootView.findViewById(R.id.row_support).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
ActivityLauncher.viewHelpAndSupport(getActivity(), Tag.ORIGIN_ME_SCREEN_HELP);
}
});
rootView.findViewById(R.id.row_logout).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mAccountStore.hasAccessToken()) {
signOutWordPressComWithConfirmation();
} else {
ActivityLauncher.showSignInForResult(getActivity());
}
}
});
if (savedInstanceState != null) {
if (savedInstanceState.getBoolean(IS_DISCONNECTING, false)) {
showDisconnectDialog(getActivity());
}
if (savedInstanceState.getBoolean(IS_UPDATING_GRAVATAR, false)) {
showGravatarProgressBar(true);
}
}
return rootView;
}
use of org.wordpress.android.widgets.WPNetworkImageView in project WordPress-Android by wordpress-mobile.
the class MeFragment method loadAvatar.
private void loadAvatar(String avatarUrl, String injectFilePath) {
if (injectFilePath != null && !injectFilePath.isEmpty()) {
// invalidate the specific gravatar entry from the bitmap cache. It will be updated via the injected
// request cache.
WordPress.getBitmapCache().removeSimilar(avatarUrl);
try {
// fool the network requests cache by injecting the new image. The Gravatar backend (plus CDNs)
// can't be trusted to have updated the image quick enough.
injectCache(new File(injectFilePath), avatarUrl);
} catch (IOException e) {
EventBus.getDefault().post(new GravatarLoadFinished(false));
}
// reset the WPNetworkImageView
mAvatarImageView.resetImage();
mAvatarImageView.removeCurrentUrlFromSkiplist();
}
mAvatarImageView.setImageUrl(avatarUrl, WPNetworkImageView.ImageType.AVATAR, new WPNetworkImageView.ImageLoadListener() {
@Override
public void onLoaded() {
EventBus.getDefault().post(new GravatarLoadFinished(true));
}
@Override
public void onError() {
EventBus.getDefault().post(new GravatarLoadFinished(false));
}
});
}
use of org.wordpress.android.widgets.WPNetworkImageView in project WordPress-Android by wordpress-mobile.
the class MediaItemFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.media_listitem_details, container, false);
mCaptionView = (TextView) view.findViewById(R.id.media_listitem_details_caption);
mDescriptionView = (TextView) view.findViewById(R.id.media_listitem_details_description);
mDateView = (TextView) view.findViewById(R.id.media_listitem_details_date);
mFileNameView = (TextView) view.findViewById(R.id.media_listitem_details_file_name);
mFileTypeView = (TextView) view.findViewById(R.id.media_listitem_details_file_type);
mImageView = (WPNetworkImageView) view.findViewById(R.id.media_listitem_details_image);
return view;
}
use of org.wordpress.android.widgets.WPNetworkImageView in project WordPress-Android by wordpress-mobile.
the class ReaderPostDetailHeaderView method showBlavatarAndAvatar.
private void showBlavatarAndAvatar(String blavatarUrl, String avatarUrl) {
boolean hasBlavatar = !TextUtils.isEmpty(blavatarUrl);
boolean hasAvatar = !TextUtils.isEmpty(avatarUrl);
AppLog.w(AppLog.T.READER, avatarUrl);
int frameSize = getResources().getDimensionPixelSize(R.dimen.reader_detail_header_avatar_frame);
View avatarFrame = findViewById(R.id.frame_avatar);
WPNetworkImageView imgBlavatar = (WPNetworkImageView) findViewById(R.id.image_header_blavatar);
WPNetworkImageView imgAvatar = (WPNetworkImageView) findViewById(R.id.image_header_avatar);
/*
* - if there's a blavatar and an avatar, show both of them overlaid using default sizing
* - if there's only a blavatar, show it the full size of the parent frame and hide the avatar
* - if there's only an avatar, show it the full size of the parent frame and hide the blavatar
* - if there's neither a blavatar nor an avatar, hide them both
*/
if (hasBlavatar && hasAvatar) {
int blavatarSz = getResources().getDimensionPixelSize(R.dimen.reader_detail_header_blavatar);
imgBlavatar.getLayoutParams().height = blavatarSz;
imgBlavatar.getLayoutParams().width = blavatarSz;
imgBlavatar.setImageUrl(PhotonUtils.getPhotonImageUrl(blavatarUrl, blavatarSz, blavatarSz), WPNetworkImageView.ImageType.BLAVATAR);
imgBlavatar.setVisibility(View.VISIBLE);
int avatarSz = getResources().getDimensionPixelSize(R.dimen.reader_detail_header_avatar);
imgAvatar.getLayoutParams().height = avatarSz;
imgAvatar.getLayoutParams().width = avatarSz;
imgAvatar.setImageUrl(GravatarUtils.fixGravatarUrl(avatarUrl, avatarSz), WPNetworkImageView.ImageType.AVATAR);
imgAvatar.setVisibility(View.VISIBLE);
} else if (hasBlavatar) {
imgBlavatar.getLayoutParams().height = frameSize;
imgBlavatar.getLayoutParams().width = frameSize;
imgBlavatar.setImageUrl(PhotonUtils.getPhotonImageUrl(blavatarUrl, frameSize, frameSize), WPNetworkImageView.ImageType.BLAVATAR);
imgBlavatar.setVisibility(View.VISIBLE);
imgAvatar.setVisibility(View.GONE);
} else if (hasAvatar) {
imgBlavatar.setVisibility(View.GONE);
imgAvatar.getLayoutParams().height = frameSize;
imgAvatar.getLayoutParams().width = frameSize;
imgAvatar.setImageUrl(GravatarUtils.fixGravatarUrl(avatarUrl, frameSize), WPNetworkImageView.ImageType.AVATAR);
imgAvatar.setVisibility(View.VISIBLE);
} else {
imgBlavatar.setVisibility(View.GONE);
imgAvatar.setVisibility(View.GONE);
}
// hide the frame if there's neither a blavatar nor an avatar
avatarFrame.setVisibility(hasAvatar || hasBlavatar ? View.VISIBLE : View.GONE);
if (mEnableBlogPreview) {
imgBlavatar.setOnClickListener(mClickListener);
imgAvatar.setOnClickListener(mClickListener);
}
}
Aggregations