Show larger snackbar

This commit is contained in:
M66B 2022-01-22 21:14:01 +01:00
parent 6b5f75dc59
commit 9d4f94baf3
3 changed files with 13 additions and 8 deletions

View File

@ -3593,6 +3593,7 @@ public class FragmentCompose extends FragmentBase {
Log.i(ex);
Snackbar snackbar = Snackbar.make(view, ex.getMessage(), Snackbar.LENGTH_INDEFINITE)
.setGestureInsetBottomIgnored(true);
Helper.setSnackbarLines(snackbar, 7);
snackbar.setAction(R.string.title_fix, new View.OnClickListener() {
@Override
public void onClick(View v) {

View File

@ -7451,14 +7451,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
String text = args.getString("sigresult");
Snackbar sb = Snackbar.make(view, text, Snackbar.LENGTH_LONG)
.setGestureInsetBottomIgnored(true);
View sv = sb.getView();
if (sv != null) {
TextView tv = sv.findViewById(com.google.android.material.R.id.snackbar_text);
if (tv != null)
tv.setMaxLines(7);
}
Helper.setSnackbarLines(sb, 7);
sb.show();
}

View File

@ -111,6 +111,7 @@ import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.snackbar.Snackbar;
import org.openintents.openpgp.util.OpenPgpApi;
@ -1324,6 +1325,16 @@ public class Helper {
view.setLayoutParams(lparam);
}
static void setSnackbarLines(Snackbar snackbar, int lines) {
View sv = snackbar.getView();
if (sv == null)
return;
TextView tv = sv.findViewById(com.google.android.material.R.id.snackbar_text);
if (tv == null)
return;
tv.setMaxLines(lines);
}
static boolean isNight(Context context) {
// https://developer.android.com/guide/topics/ui/look-and-feel/darktheme#configuration_changes
int uiMode = context.getResources().getConfiguration().uiMode;