Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -258,7 +258,7 @@ public class HashtagTimelineFragment extends PinnableStatusListFragment{
|
||||
}
|
||||
|
||||
private void updateHeader(){
|
||||
if(hashtag==null)
|
||||
if(hashtag==null || getActivity()==null)
|
||||
return;
|
||||
|
||||
if(hashtag.history!=null && !hashtag.history.isEmpty()){
|
||||
|
||||
@@ -47,13 +47,12 @@ public class SplashFragment extends AppKitFragment{
|
||||
private ProgressBarButton defaultServerButton;
|
||||
private ProgressBar defaultServerProgress;
|
||||
private String chosenDefaultServer=DEFAULT_SERVER;
|
||||
private boolean loadingDefaultServer;
|
||||
private boolean loadingDefaultServer, loadedDefaultServer;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState){
|
||||
super.onCreate(savedInstanceState);
|
||||
motionEffect=new InterpolatingMotionEffect(MastodonApp.context);
|
||||
loadAndChooseDefaultServer();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -101,6 +100,8 @@ public class SplashFragment extends AppKitFragment{
|
||||
});
|
||||
}
|
||||
});
|
||||
if(!loadedDefaultServer && !loadingDefaultServer)
|
||||
loadAndChooseDefaultServer();
|
||||
|
||||
return contentView;
|
||||
}
|
||||
@@ -239,6 +240,7 @@ public class SplashFragment extends AppKitFragment{
|
||||
private void setChosenDefaultServer(String domain){
|
||||
chosenDefaultServer=domain;
|
||||
loadingDefaultServer=false;
|
||||
loadedDefaultServer=true;
|
||||
if(defaultServerButton!=null && getActivity()!=null){
|
||||
defaultServerButton.setTextVisible(true);
|
||||
defaultServerProgress.setVisibility(View.GONE);
|
||||
|
||||
@@ -68,6 +68,14 @@ public class Attachment extends BaseModel{
|
||||
return 1080;
|
||||
}
|
||||
|
||||
public boolean hasKnownDimensions(){
|
||||
return meta!=null && (
|
||||
(meta.height>0 && meta.width>0)
|
||||
|| (meta.original!=null && meta.original.height>0 && meta.original.width>0)
|
||||
|| (meta.small!=null && meta.small.height>0 && meta.small.width>0)
|
||||
);
|
||||
}
|
||||
|
||||
public double getDuration(){
|
||||
if(meta==null)
|
||||
return 0;
|
||||
|
||||
@@ -66,6 +66,10 @@ public class BlurhashCrossfadeDrawable extends Drawable{
|
||||
|
||||
public void setImageDrawable(Drawable imageDrawable){
|
||||
this.imageDrawable=imageDrawable;
|
||||
if(imageDrawable!=null){
|
||||
width=imageDrawable.getIntrinsicWidth();
|
||||
height=imageDrawable.getIntrinsicHeight();
|
||||
}
|
||||
invalidateSelf();
|
||||
}
|
||||
|
||||
@@ -99,11 +103,15 @@ public class BlurhashCrossfadeDrawable extends Drawable{
|
||||
|
||||
@Override
|
||||
public int getIntrinsicWidth(){
|
||||
if(width==0)
|
||||
return imageDrawable==null ? 1920 : imageDrawable.getIntrinsicWidth();
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIntrinsicHeight(){
|
||||
if(height==0)
|
||||
return imageDrawable==null ? 1080 : imageDrawable.getIntrinsicHeight();
|
||||
return height;
|
||||
}
|
||||
|
||||
|
||||
@@ -734,9 +734,18 @@ public class PhotoViewer implements ZoomPanView.Listener{
|
||||
public void onBind(Attachment item){
|
||||
super.onBind(item);
|
||||
FrameLayout.LayoutParams params=(FrameLayout.LayoutParams) imageView.getLayoutParams();
|
||||
params.width=item.getWidth();
|
||||
params.height=item.getHeight();
|
||||
ViewImageLoader.load(this, listener.getPhotoViewCurrentDrawable(getAbsoluteAdapterPosition()), new UrlImageLoaderRequest(item.url), false);
|
||||
Drawable currentDrawable=listener.getPhotoViewCurrentDrawable(getAbsoluteAdapterPosition());
|
||||
if(item.hasKnownDimensions()){
|
||||
params.width=item.getWidth();
|
||||
params.height=item.getHeight();
|
||||
}else if(currentDrawable!=null){
|
||||
params.width=currentDrawable.getIntrinsicWidth();
|
||||
params.height=currentDrawable.getIntrinsicHeight();
|
||||
}else{
|
||||
params.width=1920;
|
||||
params.height=1080;
|
||||
}
|
||||
ViewImageLoader.load(this, currentDrawable, new UrlImageLoaderRequest(item.url), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -778,9 +787,18 @@ public class PhotoViewer implements ZoomPanView.Listener{
|
||||
super.onBind(item);
|
||||
playerReady=false;
|
||||
FrameLayout.LayoutParams params=(FrameLayout.LayoutParams) wrap.getLayoutParams();
|
||||
params.width=item.getWidth();
|
||||
params.height=item.getHeight();
|
||||
wrap.setBackground(listener.getPhotoViewCurrentDrawable(getAbsoluteAdapterPosition()));
|
||||
Drawable currentDrawable=listener.getPhotoViewCurrentDrawable(getAbsoluteAdapterPosition());
|
||||
if(item.hasKnownDimensions()){
|
||||
params.width=item.getWidth();
|
||||
params.height=item.getHeight();
|
||||
}else if(currentDrawable!=null){
|
||||
params.width=currentDrawable.getIntrinsicWidth();
|
||||
params.height=currentDrawable.getIntrinsicHeight();
|
||||
}else{
|
||||
params.width=1920;
|
||||
params.height=1080;
|
||||
}
|
||||
wrap.setBackground(currentDrawable);
|
||||
progressBar.setVisibility(item.type==Attachment.Type.VIDEO ? View.VISIBLE : View.GONE);
|
||||
if(itemView.isAttachedToWindow()){
|
||||
reset();
|
||||
@@ -841,7 +859,9 @@ public class PhotoViewer implements ZoomPanView.Listener{
|
||||
@Override
|
||||
public boolean onError(MediaPlayer mp, int what, int extra){
|
||||
Log.e(TAG, "video player onError() called with: mp = ["+mp+"], what = ["+what+"], extra = ["+extra+"]");
|
||||
return false;
|
||||
Toast.makeText(activity, R.string.error_playing_video, Toast.LENGTH_SHORT).show();
|
||||
onStartSwipeToDismissTransition(0f);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void prepareAndStartPlayer(){
|
||||
@@ -862,6 +882,8 @@ public class PhotoViewer implements ZoomPanView.Listener{
|
||||
player.prepareAsync();
|
||||
}catch(IOException x){
|
||||
Log.w(TAG, "Error initializing gif player", x);
|
||||
Toast.makeText(activity, R.string.error_playing_video, Toast.LENGTH_SHORT).show();
|
||||
onStartSwipeToDismissTransition(0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,10 @@ public class ZoomPanView extends FrameLayout implements ScaleGestureDetector.OnS
|
||||
|
||||
int width=right-left;
|
||||
int height=bottom-top;
|
||||
if(width==0 || height==0)
|
||||
if(width==0 || height==0 || child.getWidth()==0 || child.getWidth()==0){
|
||||
matrix.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
float scale=Math.min(width/(float)child.getWidth(), height/(float)child.getHeight());
|
||||
minScale=scale;
|
||||
|
||||
@@ -28,6 +28,7 @@ public class MediaAttachmentViewController{
|
||||
private final Context context;
|
||||
private boolean didClear;
|
||||
private Status status;
|
||||
private Attachment attachment;
|
||||
|
||||
public MediaAttachmentViewController(Context context, MediaGridStatusDisplayItem.GridItemType type){
|
||||
view=context.getSystemService(LayoutInflater.class).inflate(switch(type){
|
||||
@@ -54,6 +55,7 @@ public class MediaAttachmentViewController{
|
||||
|
||||
public void bind(Attachment attachment, Status status){
|
||||
this.status=status;
|
||||
this.attachment=attachment;
|
||||
crossfadeDrawable.setSize(attachment.getWidth(), attachment.getHeight());
|
||||
crossfadeDrawable.setBlurhashDrawable(attachment.blurhashPlaceholder);
|
||||
crossfadeDrawable.setCrossfadeAlpha(0f);
|
||||
@@ -76,6 +78,11 @@ public class MediaAttachmentViewController{
|
||||
crossfadeDrawable.setImageDrawable(drawable);
|
||||
if(didClear)
|
||||
crossfadeDrawable.animateAlpha(0f);
|
||||
// Make sure the image is not stretched if the server returned wrong dimensions
|
||||
if(drawable!=null && (drawable.getIntrinsicWidth()!=attachment.getWidth() || drawable.getIntrinsicHeight()!=attachment.getHeight())){
|
||||
photo.setImageDrawable(null);
|
||||
photo.setImageDrawable(crossfadeDrawable);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearImage(){
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
<string name="user_sent_follow_request">%s հետեւելու հարցում է ուղարկել</string>
|
||||
<string name="user_favorited">%s-ը հավանեց ձեր գրառումը</string>
|
||||
<string name="notification_boosted">%s տարածեց ձեր գրառումը</string>
|
||||
<string name="poll_ended">Տեսեք ձեր քվեարկած հարցման արդյունքները</string>
|
||||
<string name="share_toot_title">Տարածել</string>
|
||||
<string name="settings">Կարգավորումներ</string>
|
||||
<string name="publish">Հրապարակել</string>
|
||||
@@ -102,6 +103,7 @@
|
||||
<string name="deleting">Ջնջում…</string>
|
||||
<string name="play">Նվագարկել</string>
|
||||
<string name="pause">Դադար տալ</string>
|
||||
<string name="log_out">Ելք</string>
|
||||
<string name="add_account">Ավելացնել հաշիվ</string>
|
||||
<string name="search_hint">Որոնել</string>
|
||||
<string name="hashtags">Պիտակներ</string>
|
||||
|
||||
@@ -554,5 +554,18 @@
|
||||
<string name="time_hours_ago_short">%dj yang lalu</string>
|
||||
<string name="time_days_ago_short">%dh yang lalu</string>
|
||||
<!-- %s is the name of the post language -->
|
||||
<string name="translate_post">Terjemahkan dari bahasa %s</string>
|
||||
<!-- %1$s is the language, %2$s is the name of the translation service -->
|
||||
<string name="post_translated">Diterjemahkan dari bahasa %1$s menggunakan %2$s</string>
|
||||
<string name="translation_show_original">Tampilkan yang asli</string>
|
||||
<string name="translation_failed">Terjemahan gagal. Administrator mungkin belum mengaktifkan terjemahan di server ini atau server ini menjalankan Mastodon versi lama yang belum mendukung terjemahan.</string>
|
||||
<string name="settings_privacy">Privasi dan jangkauan</string>
|
||||
<string name="settings_discoverable">Fiturkan profil dan kiriman dalam algoritma penjelajahan</string>
|
||||
<string name="settings_indexable">Sertakan kiriman publik dalam hasil pencarian</string>
|
||||
<plurals name="x_participants">
|
||||
<item quantity="other">%,d peserta</item>
|
||||
</plurals>
|
||||
<plurals name="x_posts_today">
|
||||
<item quantity="other">%,d kiriman hari ini</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
||||
@@ -572,5 +572,15 @@
|
||||
<string name="time_hours_ago_short">%dh atrás</string>
|
||||
<string name="time_days_ago_short">%dd atrás</string>
|
||||
<!-- %s is the name of the post language -->
|
||||
<string name="translate_post">Traduzido de %s</string>
|
||||
<!-- %1$s is the language, %2$s is the name of the translation service -->
|
||||
<string name="post_translated">Traduzido de %1$s usando %2$s</string>
|
||||
<string name="translation_show_original">Mostrar original</string>
|
||||
<string name="translation_failed">A tradução falhou. Talvez o administrador não tenha habilitado as traduções neste servidor ou este servidor esteja executando uma versão mais antiga do Mastodon onde as traduções ainda não são suportadas.</string>
|
||||
<string name="settings_privacy">Privacidade e alcance</string>
|
||||
<string name="settings_indexable">Incluir publicações públicas nos resultados de pesquisa</string>
|
||||
<plurals name="x_participants">
|
||||
<item quantity="one">%,d participante</item>
|
||||
<item quantity="other">%,d participantes</item>
|
||||
</plurals>
|
||||
</resources>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<string name="discard">ඉවතලන්න</string>
|
||||
<string name="cancel">අවලංගු</string>
|
||||
<string name="media">මාධ්ය</string>
|
||||
<string name="profile_about">පිලිබඳව</string>
|
||||
<string name="profile_about">පිළිබඳව</string>
|
||||
<string name="edit_profile">පැතිකඩ සංස්කරණය</string>
|
||||
<string name="mute_user">%s නිහඬ</string>
|
||||
<string name="unmute_user">%s නොනිහඬ</string>
|
||||
|
||||
@@ -608,4 +608,6 @@
|
||||
<item quantity="one">%,d post today</item>
|
||||
<item quantity="other">%,d posts today</item>
|
||||
</plurals>
|
||||
|
||||
<string name="error_playing_video">Error playing video</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user