Compose design + media upload

This commit is contained in:
Grishka
2022-02-04 13:50:19 +03:00
parent 20d3a62747
commit cc06715aa6
24 changed files with 668 additions and 85 deletions

View File

@@ -0,0 +1,31 @@
package org.joinmastodon.android.ui;
import android.app.AlertDialog;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import me.grishka.appkit.utils.V;
public class M3AlertDialogBuilder extends AlertDialog.Builder{
public M3AlertDialogBuilder(Context context){
super(context);
}
public M3AlertDialogBuilder(Context context, int themeResId){
super(context, themeResId);
}
@Override
public AlertDialog create(){
AlertDialog alert=super.create();
alert.create();
Button btn=alert.getButton(AlertDialog.BUTTON_POSITIVE);
if(btn!=null){
View buttonBar=(View) btn.getParent();
buttonBar.setPadding(V.dp(16), V.dp(24), V.dp(16), V.dp(24));
((View)buttonBar.getParent()).setPadding(0, 0, 0, 0);
}
return alert;
}
}

View File

@@ -4,6 +4,8 @@ import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.widget.TextView;
@@ -15,6 +17,8 @@ import androidx.annotation.ColorRes;
import androidx.browser.customtabs.CustomTabsIntent;
public class UiUtils{
private static Handler mainHandler=new Handler(Looper.getMainLooper());
private UiUtils(){}
public static void launchWebBrowser(Context context, String url){
@@ -56,4 +60,8 @@ public class UiUtils{
}
textView.setCompoundDrawablesRelative(drawables[0], drawables[1], drawables[2], drawables[3]);
}
public static void runOnUiThread(Runnable runnable){
mainHandler.post(runnable);
}
}