Skip to content

Commit

Permalink
Merge remote-tracking branch 'mastodon/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	mastodon/build.gradle
#	mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java
  • Loading branch information
LucasGGamerM committed Sep 28, 2023
2 parents 72a370a + 9a41a2d commit 58be221
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 19 deletions.
4 changes: 2 additions & 2 deletions mastodon/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ dependencies {
implementation 'me.grishka.litex:viewpager:1.0.0'
implementation 'me.grishka.litex:viewpager2:1.0.0'
implementation 'me.grishka.litex:palette:1.0.0'
implementation 'me.grishka.appkit:appkit:1.2.9'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'me.grishka.appkit:appkit:1.2.13'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'org.jsoup:jsoup:1.14.3'
implementation 'com.squareup:otto:1.3.8'
implementation 'de.psdev:async-otto:1.0.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
pager.setUserInputEnabled(!GlobalUserPreferences.disableSwipe);
pager.setAdapter(new ProfilePagerAdapter());
pager.getLayoutParams().height=getResources().getDisplayMetrics().heightPixels;
pager.setVisibility(View.GONE); // Prevents a strange NPE when search is opened on the search tab. Shown in onShown()

scrollView.setScrollableChildSupplier(this::getScrollableRecyclerView);
scrollView.getViewTreeObserver().addOnGlobalLayoutListener(this::updateMetadataHeight);
Expand Down Expand Up @@ -756,7 +755,7 @@ private void bindHeaderView(){
followingCount.setText(UiUtils.abbreviateNumber(account.followingCount));
followersLabel.setText(getResources().getQuantityString(R.plurals.followers, (int)Math.min(999, account.followersCount)));
followingLabel.setText(getResources().getQuantityString(R.plurals.following, (int)Math.min(999, account.followingCount)));

if (account.followersCount < 0) followersBtn.setVisibility(View.GONE);
if (account.followingCount < 0) followingBtn.setVisibility(View.GONE);
if (account.followersCount < 0 || account.followingCount < 0)
Expand Down Expand Up @@ -1425,28 +1424,25 @@ private boolean isActionButtonInView(){
return actionButton.getVisibility()==View.VISIBLE && actionButtonWrap.getTop()+actionButtonWrap.getHeight()>scrollView.getScrollY();
}

@Override
protected void onShown(){
super.onShown();
pager.setVisibility(View.VISIBLE);
}

private class ProfilePagerAdapter extends RecyclerView.Adapter<SimpleViewHolder>{
@NonNull
@Override
public SimpleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType){
FrameLayout view=tabViews[viewType];
if (view.getParent() != null) ((ViewGroup)view.getParent()).removeView(view);
view.setVisibility(View.VISIBLE);
FrameLayout view=new FrameLayout(parent.getContext());
view.setLayoutParams(new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
return new SimpleViewHolder(view);
}

@Override
public void onBindViewHolder(@NonNull SimpleViewHolder holder, int position){
Fragment fragment=getFragmentForPage(position);
FrameLayout fragmentView=tabViews[position];
fragmentView.setVisibility(View.VISIBLE);
if(fragmentView.getParent() instanceof ViewGroup parent)
parent.removeView(fragmentView);
((FrameLayout)holder.itemView).addView(fragmentView);
if(!fragment.isAdded()){
getChildFragmentManager().beginTransaction().add(holder.itemView.getId(), fragment).commit();
getChildFragmentManager().beginTransaction().add(fragmentView.getId(), fragment).commit();
holder.itemView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener(){
@Override
public boolean onPreDraw(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto

int width=right-left;
int height=bottom-top;
if(width==0 || height==0)
return;

float scale=Math.min(width/(float)child.getWidth(), height/(float)child.getHeight());
minScale=scale;
maxScale=Math.max(3f, height/(float)child.getHeight());
Expand Down Expand Up @@ -306,8 +309,6 @@ public void setValue(ZoomPanView object, float value){
}, 1f).setMinimumVisibleChange(DynamicAnimation.MIN_VISIBLE_CHANGE_ALPHA));
}
}else{
if(animatingTransition)
Log.w(TAG, "updateViewTransform: ", new Throwable().fillInStackTrace());
child.setScaleX(matrixValues[Matrix.MSCALE_X]);
child.setScaleY(matrixValues[Matrix.MSCALE_Y]);
child.setTranslationX(matrixValues[Matrix.MTRANS_X]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class MediaGridLayout extends ViewGroup{

private static final int GAP=2; // dp
private PhotoLayoutHelper.TiledLayoutResult tiledLayout;
private int[] columnStarts=new int[10], columnEnds=new int[10], rowStarts=new int[10], rowEnds=new int[10];
private int[] columnStarts, columnEnds, rowStarts, rowEnds;

public MediaGridLayout(Context context){
this(context, null);
Expand All @@ -41,6 +41,14 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
width=Math.round(width*(tiledLayout.width/(float)PhotoLayoutHelper.MAX_WIDTH));
}

if(rowStarts==null || rowStarts.length<tiledLayout.rowSizes.length){
rowStarts=new int[tiledLayout.rowSizes.length];
rowEnds=new int[tiledLayout.rowSizes.length];
}
if(columnStarts==null || columnStarts.length<tiledLayout.columnSizes.length){
columnStarts=new int[tiledLayout.columnSizes.length];
columnEnds=new int[tiledLayout.columnSizes.length];
}
int offset=0;
for(int i=0;i<tiledLayout.columnSizes.length;i++){
columnStarts[i]=offset;
Expand Down Expand Up @@ -73,7 +81,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){

@Override
protected void onLayout(boolean changed, int l, int t, int r, int b){
if(tiledLayout==null)
if(tiledLayout==null || rowStarts==null)
return;

int maxWidth=UiUtils.MAX_WIDTH;
Expand Down
2 changes: 2 additions & 0 deletions mastodon/src/main/res/values-gl-rES/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
<string name="next">Seguinte</string>
<string name="loading_instance">Obtendo info do servidor…</string>
<string name="error">Erro</string>
<string name="not_a_mastodon_instance">%s non semella ser un servidor Mastodon.</string>
<string name="ok">OK</string>
<string name="preparing_auth">Preparándose para a autenticación…</string>
<string name="finishing_auth">Rematando coa autenticación…</string>
<string name="user_boosted">%s promoveu</string>
<string name="in_reply_to">Como resposta a %s</string>
<string name="notifications">Notificacións</string>
<string name="user_followed_you">%s comezou a seguirte</string>
<string name="share_toot_title">Compartir</string>
<string name="settings">Axustes</string>
<string name="publish">Publicar</string>
Expand Down
2 changes: 1 addition & 1 deletion mastodon/src/main/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@
<!-- %s is the name of the post language -->
<string name="translate_post">Перевести %s</string>
<!-- %1$s is the language, %2$s is the name of the translation service -->
<string name="post_translated">Переведено с %1$s с помощью %2$s</string>
<string name="post_translated">%1$s переведён с помощью %2$s</string>
<string name="translation_show_original">Показать оригинал</string>
<string name="translation_failed">Перевод не удался. Возможно, администратор не включил переводы на этом сервере или на этом сервере установлена ​​более старая версия Mastodon, где переводы еще не поддерживаются.</string>
<string name="settings_privacy">Приватность и доступ</string>
Expand Down
19 changes: 19 additions & 0 deletions mastodon/src/main/res/values-uk-rUA/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -641,5 +641,24 @@
<string name="time_hours_ago_short">%dгод. тому</string>
<string name="time_days_ago_short">%dд. тому</string>
<!-- %s is the name of the post language -->
<string name="translate_post">Перекласти з %s</string>
<!-- %1$s is the language, %2$s is the name of the translation service -->
<string name="post_translated">Перекладено з %1$s за допомогою %2$s</string>
<string name="translation_show_original">Показати оригінал</string>
<string name="translation_failed">Не вдалося виконати переклад. Можливо, адміністратор не активував переклади на цьому сервері або цей сервер використовує стару версію Mastodon, де переклади ще не підтримуються.</string>
<string name="settings_privacy">Приватність і досяжність</string>
<string name="settings_discoverable">Враховувати профіль та дописи в алгоритмах пошуку</string>
<string name="settings_indexable">Включити загальнодоступні дописи в результати пошуку</string>
<plurals name="x_participants">
<item quantity="one">%,d учасник</item>
<item quantity="few">%,d учасники</item>
<item quantity="many">%,d учасників</item>
<item quantity="other">%,d учасника</item>
</plurals>
<plurals name="x_posts_today">
<item quantity="one">%,d допис сьогодні</item>
<item quantity="few">%,d дописи сьогодні</item>
<item quantity="many">%,d дописів сьогодні</item>
<item quantity="other">%,d дописа сьогодні</item>
</plurals>
</resources>

0 comments on commit 58be221

Please sign in to comment.