Merge branch 'master' into donations
# Conflicts: # mastodon/src/main/res/values/strings.xml
This commit is contained in:
commit
2dae00800e
|
@ -5,31 +5,62 @@ import android.view.View;
|
|||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.gson.JsonIOException;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import org.joinmastodon.android.R;
|
||||
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
import me.grishka.appkit.api.ErrorResponse;
|
||||
|
||||
public class MastodonErrorResponse extends ErrorResponse{
|
||||
public final String error;
|
||||
public final int httpStatus;
|
||||
public final Throwable underlyingException;
|
||||
public final int messageResource;
|
||||
|
||||
public MastodonErrorResponse(String error, int httpStatus, Throwable exception){
|
||||
this.error=error;
|
||||
this.httpStatus=httpStatus;
|
||||
this.underlyingException=exception;
|
||||
|
||||
if(exception instanceof UnknownHostException){
|
||||
this.messageResource=R.string.could_not_reach_server;
|
||||
}else if(exception instanceof SocketTimeoutException){
|
||||
this.messageResource=R.string.connection_timed_out;
|
||||
}else if(exception instanceof JsonSyntaxException || exception instanceof JsonIOException || httpStatus>=500){
|
||||
this.messageResource=R.string.server_error;
|
||||
}else if(httpStatus==404){
|
||||
this.messageResource=R.string.not_found;
|
||||
}else{
|
||||
this.messageResource=0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindErrorView(View view){
|
||||
TextView text=view.findViewById(R.id.error_text);
|
||||
text.setText(error);
|
||||
String message;
|
||||
if(messageResource>0){
|
||||
message=view.getContext().getString(messageResource, error);
|
||||
}else{
|
||||
message=error;
|
||||
}
|
||||
text.setText(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showToast(Context context){
|
||||
if(context==null)
|
||||
return;
|
||||
Toast.makeText(context, error, Toast.LENGTH_SHORT).show();
|
||||
String message;
|
||||
if(messageResource>0){
|
||||
message=context.getString(messageResource, error);
|
||||
}else{
|
||||
message=error;
|
||||
}
|
||||
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,6 +100,7 @@ public class SettingsServerAboutFragment extends LoaderFragment{
|
|||
scroller.setClipToPadding(false);
|
||||
scroller.addView(scrollingLayout);
|
||||
|
||||
if(!TextUtils.isEmpty(instance.thumbnail)){
|
||||
FixedAspectRatioImageView banner=new FixedAspectRatioImageView(getActivity());
|
||||
banner.setAspectRatio(1.914893617f);
|
||||
banner.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
@ -109,6 +110,9 @@ public class SettingsServerAboutFragment extends LoaderFragment{
|
|||
LinearLayout.LayoutParams blp=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
blp.bottomMargin=V.dp(24);
|
||||
scrollingLayout.addView(banner, blp);
|
||||
}else{
|
||||
scrollingLayout.setPadding(0, V.dp(24), 0, 0);
|
||||
}
|
||||
|
||||
boolean needDivider=false;
|
||||
if(instance.contactAccount!=null){
|
||||
|
|
|
@ -173,7 +173,7 @@ public class MediaGridStatusDisplayItem extends StatusDisplayItem{
|
|||
}
|
||||
controllers.add(c);
|
||||
|
||||
if (item.status.translation != null){
|
||||
if (item.status.translation!=null && item.status.translation.mediaAttachments!=null){
|
||||
if(item.status.translationState==Status.TranslationState.SHOWN){
|
||||
if(!item.translatedAttachments.containsKey(att.id)){
|
||||
Optional<Translation.MediaAttachment> translatedAttachment=Arrays.stream(item.status.translation.mediaAttachments).filter(mediaAttachment->mediaAttachment.id.equals(att.id)).findFirst();
|
||||
|
|
|
@ -313,7 +313,12 @@ public class ComposeMediaViewController{
|
|||
int maxSize=0;
|
||||
String contentType=fragment.getActivity().getContentResolver().getType(attachment.uri);
|
||||
if(contentType!=null && contentType.startsWith("image/")){
|
||||
maxSize=2_073_600; // TODO get this from instance configuration when it gets added there
|
||||
Instance instance=fragment.instance;
|
||||
if(instance.configuration!=null && instance.configuration.mediaAttachments!=null && instance.configuration.mediaAttachments.imageMatrixLimit>0){
|
||||
maxSize=instance.configuration.mediaAttachments.imageMatrixLimit;
|
||||
}else{
|
||||
maxSize=2_073_600;
|
||||
}
|
||||
}
|
||||
attachment.progressBar.setProgress(0);
|
||||
attachment.speedTracker.reset();
|
||||
|
|
|
@ -141,6 +141,7 @@
|
|||
android:layout_marginHorizontal="16dp"
|
||||
android:textAppearance="@style/m3_body_large"
|
||||
android:textColor="?colorM3OnSurface"
|
||||
android:textIsSelectable="true"
|
||||
tools:text="A cute black cat"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -314,7 +314,7 @@
|
|||
<string name="instance_signup_closed">This server does not accept new registrations.</string>
|
||||
<string name="text_copied">Copied to clipboard</string>
|
||||
<string name="add_bookmark">Bookmark</string>
|
||||
<string name="remove_bookmark">Remove Bookmark</string>
|
||||
<string name="remove_bookmark">Remove bookmark</string>
|
||||
<string name="bookmarks">Bookmarks</string>
|
||||
<string name="your_favorites">Your favorites</string>
|
||||
<string name="login_title">Welcome back</string>
|
||||
|
@ -751,10 +751,14 @@
|
|||
<string name="visibility_subtitle_unlisted">Fewer algorithmic fanfares</string>
|
||||
<string name="visibility_subtitle_followers">Only your followers</string>
|
||||
<string name="visibility_subtitle_private">Everyone mentioned in the post</string>
|
||||
<string name="view_boosts">View Boosts</string>
|
||||
<string name="view_favorites">View Favorites</string>
|
||||
<string name="undo_reblog">Undo Boost</string>
|
||||
<string name="undo_favorite">Undo Favorite</string>
|
||||
<string name="view_boosts">View boosts</string>
|
||||
<string name="view_favorites">View favorites</string>
|
||||
<string name="undo_reblog">Undo boost</string>
|
||||
<string name="undo_favorite">Undo favorite</string>
|
||||
<string name="could_not_reach_server">Couldn’t reach the server. Check your connection and try again?</string>
|
||||
<string name="connection_timed_out">The request timed out. Check your connection and try again?</string>
|
||||
<string name="server_error">Something went wrong talking with your server. It’s probably not your fault. Try again?</string>
|
||||
<string name="not_found">It could’ve been deleted, or maybe it never existed at all.</string>
|
||||
<string name="dismiss">Dismiss</string>
|
||||
<string name="donation_once">Just once</string>
|
||||
<string name="donation_monthly">Monthly</string>
|
||||
|
|
Loading…
Reference in New Issue