Add share activity

This commit is contained in:
Robbie Page
2019-01-26 00:11:59 -05:00
committed by Jannis Mattheis
parent 85c255e462
commit f85b5312e6
4 changed files with 119 additions and 9 deletions

View File

@@ -1,12 +1,14 @@
package com.github.gotify;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.text.format.DateUtils;
import android.view.View;
import android.widget.Toast;
import androidx.annotation.NonNull;
import com.github.gotify.client.JSON;
import com.github.gotify.log.Log;
@@ -96,4 +98,16 @@ public class Utils {
if (str == null) return null;
return new Buffer().writeUtf8(str).inputStream();
}
public static <T> T first(T[] data) {
if (data.length != 1) {
throw new IllegalArgumentException("must be one element");
}
return data[0];
}
public static void showLongToast(Context context, String message) {
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
}
}