Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge release/10.7 into master #8251

Merged
merged 16 commits into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions WordPress/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ android {

defaultConfig {
applicationId "org.wordpress.android"
versionName "10.7-rc-1"
versionCode 604
versionName "10.7"
versionCode 608
minSdkVersion 16
targetSdkVersion 26

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ public void onClick(View view) {
mLikingUsersDivider.setVisibility(View.VISIBLE);
mLikingUsersLabel.setVisibility(View.VISIBLE);
mLikingUsersView.setVisibility(View.VISIBLE);
mLikingUsersView.showLikingUsers(mPost);
mLikingUsersView.showLikingUsers(mPost, mAccountStore.getAccount().getUserId());
}

private boolean showPhotoViewer(String imageUrl, View sourceView, int startX, int startY) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.wordpress.android.ui.reader.views;

import android.content.Context;
import android.os.Handler;
import android.os.AsyncTask;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
Expand All @@ -12,13 +12,13 @@
import org.wordpress.android.WordPress;
import org.wordpress.android.datasets.ReaderLikeTable;
import org.wordpress.android.datasets.ReaderUserTable;
import org.wordpress.android.fluxc.store.AccountStore;
import org.wordpress.android.models.ReaderPost;
import org.wordpress.android.models.ReaderUserIdList;
import org.wordpress.android.util.StringUtils;
import org.wordpress.android.util.image.ImageManager;
import org.wordpress.android.util.image.ImageType;

import java.lang.ref.WeakReference;
import java.util.ArrayList;

import javax.inject.Inject;
Expand All @@ -27,10 +27,9 @@
* LinearLayout which shows liking users - used by ReaderPostDetailFragment
*/
public class ReaderLikingUsersView extends LinearLayout {
private final int mLikeAvatarSz;

@Inject AccountStore mAccountStore;
@Inject ImageManager mImageManager;
private LoadAvatarsTask mLoadAvatarsTask;
private final int mLikeAvatarSz;

public ReaderLikingUsersView(Context context) {
this(context, null);
Expand All @@ -46,39 +45,32 @@ public ReaderLikingUsersView(Context context, AttributeSet attrs) {
mLikeAvatarSz = context.getResources().getDimensionPixelSize(R.dimen.avatar_sz_small);
}

public void showLikingUsers(final ReaderPost post) {
public void showLikingUsers(final ReaderPost post, final long currentUserId) {
if (post == null) {
return;
}

final Handler handler = new Handler();
new Thread() {
@Override
public void run() {
// get avatar URLs of liking users up to the max, sized to fit
int maxAvatars = getMaxAvatars();
ReaderUserIdList avatarIds = ReaderLikeTable.getLikesForPost(post);
// TODO: Probably a bad idea to have mAccountStore.getAccount().getUserId() here,
// a view should not read the account state
final ArrayList<String> avatars = ReaderUserTable.getAvatarUrls(avatarIds, maxAvatars, mLikeAvatarSz,
mAccountStore.getAccount().getUserId());

handler.post(new Runnable() {
@Override
public void run() {
showLikingAvatars(avatars);
}
});
}
}.start();
if (mLoadAvatarsTask != null) {
mLoadAvatarsTask.cancel(false);
}
mLoadAvatarsTask = new LoadAvatarsTask(this, currentUserId, mLikeAvatarSz, getMaxAvatars());
mLoadAvatarsTask.execute(post);
}

@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mLoadAvatarsTask != null) {
mLoadAvatarsTask.cancel(false);
}
}

/*
* returns count of avatars that can fit the current space
*/
private int getMaxAvatars() {
int marginAvatar = getResources().getDimensionPixelSize(R.dimen.margin_extra_small);
int marginReader = getResources().getDimensionPixelSize(R.dimen.reader_detail_margin);
final int marginAvatar = getResources().getDimensionPixelSize(R.dimen.margin_extra_small);
final int marginReader = getResources().getDimensionPixelSize(R.dimen.reader_detail_margin);
int likeAvatarSizeWithMargin = mLikeAvatarSz + (marginAvatar * 2);
int spaceForAvatars = getWidth() - (marginReader * 2);
return spaceForAvatars / likeAvatarSizeWithMargin;
Expand Down Expand Up @@ -116,4 +108,38 @@ private void showLikingAvatars(final ArrayList<String> avatarUrls) {
index++;
}
}

private static class LoadAvatarsTask extends AsyncTask<ReaderPost, Void, ArrayList<String>> {
private final WeakReference<ReaderLikingUsersView> mViewReference;
private final long mCurrentUserId;
private final int mLikeAvatarSize;
private final int mMaxAvatars;

LoadAvatarsTask(ReaderLikingUsersView view, long currentUserId, int likeAvatarSz, int maxAvatars) {
mViewReference = new WeakReference<>(view);
mCurrentUserId = currentUserId;
mLikeAvatarSize = likeAvatarSz;
mMaxAvatars = maxAvatars;
}

@Override
protected ArrayList<String> doInBackground(ReaderPost... posts) {
if (posts.length != 1 || posts[0] == null) {
return null;
}
ReaderPost post = posts[0];
ReaderUserIdList avatarIds = ReaderLikeTable.getLikesForPost(post);
return ReaderUserTable.getAvatarUrls(avatarIds, mMaxAvatars, mLikeAvatarSize, mCurrentUserId);
}

@Override
protected void onPostExecute(ArrayList<String> avatars) {
super.onPostExecute(avatars);
ReaderLikingUsersView view = mViewReference.get();
if (view != null && avatars != null && !isCancelled()) {
view.mLoadAvatarsTask = null;
view.showLikingAvatars(avatars);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public interface OnBlogInfoLoadedListener {
void onBlogInfoLoaded(ReaderBlog blogInfo);
}

private boolean mAttached;
private long mBlogId;
private long mFeedId;
private ReaderFollowButton mFollowButton;
Expand All @@ -63,6 +64,16 @@ public ReaderSiteHeaderView(Context context, AttributeSet attrs, int defStyleAtt
initView(context);
}

@Override protected void onAttachedToWindow() {
super.onAttachedToWindow();
mAttached = true;
}

@Override protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
mAttached = false;
}

private void initView(Context context) {
View view = inflate(context, R.layout.reader_site_header_view, this);
mFollowButton = view.findViewById(R.id.follow_button);
Expand Down Expand Up @@ -99,7 +110,9 @@ public void loadBlogInfo(long blogId, long feedId) {
ReaderActions.UpdateBlogInfoListener listener = new ReaderActions.UpdateBlogInfoListener() {
@Override
public void onResult(ReaderBlog serverBlogInfo) {
showBlogInfo(serverBlogInfo);
if (mAttached) {
showBlogInfo(serverBlogInfo);
}
}
};
if (mFeedId != 0) {
Expand Down
16 changes: 10 additions & 6 deletions WordPress/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Translation-Revision-Date: 2018-08-06 18:54:08+0000
Translation-Revision-Date: 2018-08-23 14:54:06+0000
Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;
Generator: GlotPress/2.4.0-alpha
Language: ar
-->
<resources>
<string name="themes_empty_list">لا توجد سمات مطابقة لبحثك</string>
<string name="reader_label_post_search_explainer">ما الذي ترغب في إيجاده؟</string>
<string name="site_settings_tags_empty_title_search">لا توجد وسوم مطابقة لبحثك</string>
<string name="site_settings_tags_empty_title">لا توجد لديك أي وسوم</string>
<string name="site_settings_tags_empty_subtitle">أضف وسومك المستخدمة بكثرة هنا بحيث يمكن تحديدها بسرعة عندما تقوم بإضافة وسوم إلى مقالاتك</string>
<string name="site_settings_tags_empty_button">إنشاء وسم</string>
<string name="media_empty_search_list">لا توجد وسائط مطابقة لبحثك</string>
<string name="sign_out_wpcom_confirm_with_no_changes">هل ترغب في تسجيل الخروج من وردبرس؟</string>
<string name="sign_out_wpcom_confirm_with_changes">لقد أدخلتَ تغييرات على المقالات التي لم يتم رفعها إلى موقعك. سيؤدي تسجيل الخروج الآن إلى حذف تلك التغييرات من جهازك. هل ترغب في تسجيل الخروج على أي حال؟</string>
<string name="people_empty_list_filtered_email_followers">لا يوجد متابعون للبريد الإلكتروني حتى الآن</string>
<string name="connection_service_facebook_notice">اعتبارًا من 1 أغسطس 2018، لن يسمح فيسبوك بعد الآن بالمشاركة المباشرة للمقالات على ملفات تعريف الفيسبوك. تبقى الاتصالات بصفحات الفيسبوك كما هي.</string>
<string name="reader_empty_posts_liked_description">ستظهر المقالات التي نالت إعجابك هنا</string>
Expand Down Expand Up @@ -48,7 +57,6 @@ Language: ar
<string name="reader_save_posts_locally_dialog_title">حفظ المقالات لوقت لاحق</string>
<string name="reader_empty_search_request_failed">يتعذر إجراء البحث</string>
<string name="reader_empty_search_title">لم يتم العثور على نتائج</string>
<string name="reader_label_post_search_explainer">البحث في وردبرس\nعن موقع أو مقالة</string>
<string name="comment_read_source_post">قراءة مقالة المصدر</string>
<string name="sites">المواقع</string>
<string name="reader_empty_saved_posts_description">انقر على %s لحفظ مقالة في القائمة لديك.</string>
Expand Down Expand Up @@ -128,7 +136,6 @@ Language: ar
<string name="notification_channel_general_title">عام</string>
<string name="photo_picker_use_photo">استخدام هذه الصورة</string>
<string name="media_preview_title">%1$d من %2$d</string>
<string name="stock_media_picker_empty_results">لا توجد تطابقات</string>
<string name="stock_media_picker_initial_empty_subtext">الصور التي وفّرها %s</string>
<string name="stock_media_picker_initial_empty_text">البحث للعثور على صور مجانية لإضافتها إلى مكتبة الوسائط الخاصة بك</string>
<string name="stock_media_picker_search_hint">البحث عن مكتبة الصور المجانية</string>
Expand Down Expand Up @@ -401,7 +408,6 @@ Language: ar
<string name="site_settings_tags_hint">إدارة علامات موقعك</string>
<string name="dlg_saving_tag">حفظ</string>
<string name="dlg_deleting_tag">جارٍ الحذف</string>
<string name="dlg_confirm_delete_tag">هل تريد حذف \"%s\" بشكل دائم؟</string>
<string name="error_tag_exists">توجد علامة تحمل هذا الاسم بالفعل</string>
<string name="add_new_tag">إضافة علامة جديدة</string>
<string name="tag_description_hint">الوصف</string>
Expand All @@ -420,7 +426,6 @@ Language: ar
<string name="site_settings_week_start_title">يبدأ الأسبوع في</string>
<string name="site_settings_tags_title">العلامات</string>
<string name="site_settings_traffic_header">المرور</string>
<string name="delete_no">لا تحذف</string>
<string name="delete_yes">حذف</string>
<string name="plugin_external_link_icon_content_description">رابط خارجي</string>
<string name="plugin_icon_content_description">رمز المكون الإضافي</string>
Expand Down Expand Up @@ -894,7 +899,6 @@ Language: ar
<string name="send_link">إرسال رابط</string>
<string name="label_clear_search_history">مسح محفوظات البحث</string>
<string name="dlg_confirm_clear_search_history">مسح محفوظات البحث؟</string>
<string name="reader_label_post_search_running">البحث…</string>
<string name="reader_title_related_post_detail">مقالة ذات صلة</string>
<string name="preview_screen_links_disabled">تم تعطيل الروابط في شاشة المعاينة</string>
<string name="draft_explainer">هذه المقالة مسود والتي لم تنشر بعد.</string>
Expand Down
2 changes: 0 additions & 2 deletions WordPress/src/main/res/values-bg/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ Language: bg
<string name="send_link">Изпращане на връзка</string>
<string name="label_clear_search_history">Изчистване на историята на търсенето</string>
<string name="dlg_confirm_clear_search_history">Изчистване на историята на търсенето?</string>
<string name="reader_label_post_search_running">Търсене…</string>
<string name="reader_title_related_post_detail">Свързана публикация</string>
<string name="preview_screen_links_disabled">Връзките на екрана за преглед са деактивирани</string>
<string name="draft_explainer">Тази публикация е непубликувана чернова</string>
Expand Down Expand Up @@ -633,7 +632,6 @@ Language: bg
<string name="select_all">Избор на всичко</string>
<string name="deselect_all">От–маркиране на всичко</string>
<string name="show">Показване</string>
<string name="sign_out_wpcom_confirm">Излизането от профила ще премахне всички данни на @%s в WordPress.com от това устройство, включително локалните чернови и локалните промени.</string>
<string name="stats_generic_error">Желаната статистина не може да бъде заредена</string>
<string name="verification_code">Верификационен код</string>
<string name="editor_toast_invalid_path">Невалиден път до файла</string>
Expand Down
10 changes: 2 additions & 8 deletions WordPress/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Translation-Revision-Date: 2018-08-02 14:54:56+0000
Translation-Revision-Date: 2018-08-15 09:08:33+0000
Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;
Generator: GlotPress/2.4.0-alpha
Language: cs_CZ
Expand Down Expand Up @@ -42,7 +42,6 @@ Language: cs_CZ
<string name="reader_save_posts_locally_dialog_title">Uložit příspěvek na později</string>
<string name="reader_empty_search_request_failed">Vyhledávání se nezdařilo</string>
<string name="reader_empty_search_title">Nebyly nalezeny žádné výsledky</string>
<string name="reader_label_post_search_explainer">Vyhledat stránku nebo příspěvek\nve WordPressu</string>
<string name="comment_read_source_post">Přečtěte si zdrojový příspěvek</string>
<string name="sites">Stránky</string>
<string name="signup_magic_link_title">Magický odkaz odeslán</string>
Expand Down Expand Up @@ -132,7 +131,6 @@ Language: cs_CZ
<string name="notification_channel_general_title">Všeobecné</string>
<string name="photo_picker_use_photo">Použijte tuto fotku</string>
<string name="media_preview_title">%1$d z %2$d</string>
<string name="stock_media_picker_empty_results">Žádné shody</string>
<string name="stock_media_picker_initial_empty_subtext">Fotografie poskytl %s</string>
<string name="stock_media_picker_initial_empty_text">Najděte obrázky které jsou zdarma a přidejte je do vaší knihovny</string>
<string name="stock_media_picker_search_hint">Prohledat knihovnu obrázků, které jsou zdarma</string>
Expand Down Expand Up @@ -164,7 +162,6 @@ Language: cs_CZ
<string name="stats_tab_tap_content_description">zobrazování %s</string>
<string name="stats_legend">legenda grafu statistik</string>
<string name="fab_create_desc">vytvořit</string>
<string name="fab_add_tag_desc">vytvořit štítek</string>
<string name="stats_bar_week_desc">Týden z %s</string>
<string name="stats_bar_date_value_desc">%s, %d zobrazení</string>
<string name="stats_bar_date_value_type_desc">%s, %d %s</string>
Expand Down Expand Up @@ -423,7 +420,7 @@ Language: cs_CZ
<string name="site_settings_tags_hint">Spravovat štítky webu</string>
<string name="dlg_saving_tag">Ukládání</string>
<string name="dlg_deleting_tag">Mazání</string>
<string name="dlg_confirm_delete_tag">Smazat nenávratně \'%s\'?</string>
<string name="dlg_confirm_delete_tag">Nenávratně smazat štítek \'%s\'?</string>
<string name="error_tag_exists">Štítek s tímto jménem už existuje</string>
<string name="add_new_tag">Přidat nový štítek</string>
<string name="tag_description_hint">Popis</string>
Expand All @@ -442,7 +439,6 @@ Language: cs_CZ
<string name="site_settings_week_start_title">Začátek týdne</string>
<string name="site_settings_tags_title">Štítky</string>
<string name="site_settings_traffic_header">Přenos</string>
<string name="delete_no">Nesmazat</string>
<string name="delete_yes">Smazat</string>
<string name="plugin_external_link_icon_content_description">Externí odkaz</string>
<string name="plugin_icon_content_description">Ikona pluginu</string>
Expand Down Expand Up @@ -941,7 +937,6 @@ Language: cs_CZ
<string name="label_clear_search_history">Smazat historii prohlížení</string>
<string name="dlg_confirm_clear_search_history">Smazat historii prohlížení?</string>
<string name="reader_empty_search_description">Žádný příspěvek nebyl nalezen %s pro váš jazyk.</string>
<string name="reader_label_post_search_running">Hledání…</string>
<string name="reader_hint_post_search">Prohledat WordPress.com</string>
<string name="reader_title_related_post_detail">Související příspěvky </string>
<string name="preview_screen_links_disabled">Odkazy jsou zakázány v náhledu na obrazovce</string>
Expand Down Expand Up @@ -1310,7 +1305,6 @@ Language: cs_CZ
<string name="reader_label_new_posts_subtitle">Klepněte pro jejich zobrazení</string>
<string name="my_site_header_configuration">Nastavení</string>
<string name="stats_unknown_author">Neznámý autor</string>
<string name="sign_out_wpcom_confirm">Po odpojení se vám z účtu vymažou všechny @%s WordPress.com údaje z tohoto zařízení, včetně lokálních konceptů a změn.</string>
<string name="select_all">Vybrat vše</string>
<string name="hide">Skrýt</string>
<string name="show">Zobrazit</string>
Expand Down
2 changes: 0 additions & 2 deletions WordPress/src/main/res/values-cy/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ Language: cy_GB
<string name="invite_people">Gwahodd Pobl</string>
<string name="label_clear_search_history">Clirio hanes chwilio</string>
<string name="dlg_confirm_clear_search_history">Clirio hanes chwilio?</string>
<string name="reader_label_post_search_running">Chwilio…</string>
<string name="reader_title_related_post_detail">Cofnodion Perthnasol</string>
<string name="preview_screen_links_disabled">Mae dolenni wedi eu hanalluogi ar y sgrin rhagolwg</string>
<string name="draft_explainer">Mae\'r cofnod yn ddrafft sydd heb ei gyhoeddi</string>
Expand Down Expand Up @@ -480,7 +479,6 @@ Language: cy_GB
<string name="show">Dangos</string>
<string name="hide">Cuddio</string>
<string name="select_all">Dewis y cyfan</string>
<string name="sign_out_wpcom_confirm">Bydd allgofnodi o\'ch cyfrif yn tynnu holl fanylion WordPress.com @%s o\'r ddyfais hon, gan gynnwys drafftiau a newidiadau lleol.</string>
<string name="stats_generic_error">Methu llwytho\'r ystadegau angenrheidiol</string>
<string name="auth_required">Mewngofnodwch eto i barhau.</string>
<string name="invalid_verification_code">Cod dilysu annilys</string>
Expand Down
Loading