clean & minor fix
parent
2db567144d
commit
c8149209a1
@ -1,42 +0,0 @@
|
||||
/**
|
||||
* Copyright (C) 2011 Whisper Systems
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import network.loki.messenger.R;
|
||||
|
||||
public class Dialogs {
|
||||
public static void showAlertDialog(Context context, String title, String message) {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
|
||||
dialog.setTitle(title);
|
||||
dialog.setMessage(message);
|
||||
dialog.setIconAttribute(R.attr.dialog_alert_icon);
|
||||
dialog.setPositiveButton(android.R.string.ok, null);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public static void showInfoDialog(Context context, String title, String message) {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
|
||||
dialog.setTitle(title);
|
||||
dialog.setMessage(message);
|
||||
dialog.setIconAttribute(R.attr.dialog_info_icon);
|
||||
dialog.setPositiveButton(android.R.string.ok, null);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
|
||||
import android.graphics.PointF;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class MathUtils {
|
||||
|
||||
/**
|
||||
* For more info:
|
||||
* <a href="http://math.stackexchange.com/questions/190111/how-to-check-if-a-point-is-inside-a-rectangle">StackOverflow: How to check point is in rectangle</a>
|
||||
*
|
||||
* @param pt point to check
|
||||
* @param v1 vertex 1 of the triangle
|
||||
* @param v2 vertex 2 of the triangle
|
||||
* @param v3 vertex 3 of the triangle
|
||||
* @return true if point (x, y) is inside the triangle
|
||||
*/
|
||||
public static boolean pointInTriangle(@NonNull PointF pt, @NonNull PointF v1,
|
||||
@NonNull PointF v2, @NonNull PointF v3) {
|
||||
|
||||
boolean b1 = crossProduct(pt, v1, v2) < 0.0f;
|
||||
boolean b2 = crossProduct(pt, v2, v3) < 0.0f;
|
||||
boolean b3 = crossProduct(pt, v3, v1) < 0.0f;
|
||||
|
||||
return (b1 == b2) && (b2 == b3);
|
||||
}
|
||||
|
||||
/**
|
||||
* calculates cross product of vectors AB and AC
|
||||
*
|
||||
* @param a beginning of 2 vectors
|
||||
* @param b end of vector 1
|
||||
* @param c enf of vector 2
|
||||
* @return cross product AB * AC
|
||||
*/
|
||||
private static float crossProduct(@NonNull PointF a, @NonNull PointF b, @NonNull PointF c) {
|
||||
return crossProduct(a.x, a.y, b.x, b.y, c.x, c.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* calculates cross product of vectors AB and AC
|
||||
*
|
||||
* @param ax X coordinate of point A
|
||||
* @param ay Y coordinate of point A
|
||||
* @param bx X coordinate of point B
|
||||
* @param by Y coordinate of point B
|
||||
* @param cx X coordinate of point C
|
||||
* @param cy Y coordinate of point C
|
||||
* @return cross product AB * AC
|
||||
*/
|
||||
private static float crossProduct(float ax, float ay, float bx, float by, float cx, float cy) {
|
||||
return (ax - cx) * (by - cy) - (bx - cx) * (ay - cy);
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
package org.session.libsession.messaging.sending_receiving.attachments
|
||||
|
||||
enum class AttachmentTransferProgress(val value: Int) {
|
||||
TRANSFER_PROGRESS_DONE(0),
|
||||
TRANSFER_PROGRESS_STARTED(1),
|
||||
TRANSFER_PROGRESS_PENDING(2),
|
||||
TRANSFER_PROGRESS_FAILED(3)
|
||||
object AttachmentTransferProgress {
|
||||
const val TRANSFER_PROGRESS_DONE = 0
|
||||
const val TRANSFER_PROGRESS_STARTED = 1
|
||||
const val TRANSFER_PROGRESS_PENDING = 2
|
||||
const val TRANSFER_PROGRESS_FAILED = 3
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
package org.thoughtcrime.securesms.util;
|
||||
package org.session.libsession.utilities;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.MessageDigest;
|
@ -1,13 +1,13 @@
|
||||
package org.session.libsession.utilities
|
||||
|
||||
enum class MediaTypes(val value: String) {
|
||||
IMAGE_PNG("image/png"),
|
||||
IMAGE_JPEG("image/jpeg"),
|
||||
IMAGE_WEBP("image/webp"),
|
||||
IMAGE_GIF("image/gif"),
|
||||
AUDIO_AAC("audio/aac"),
|
||||
AUDIO_UNSPECIFIED("audio/*"),
|
||||
VIDEO_UNSPECIFIED("video/*"),
|
||||
VCARD("text/x-vcard"),
|
||||
LONG_TEXT("text/x-signal-plain")
|
||||
object MediaTypes {
|
||||
const val IMAGE_PNG = "image/png"
|
||||
const val IMAGE_JPEG = "image/jpeg"
|
||||
const val IMAGE_WEBP = "image/webp"
|
||||
const val IMAGE_GIF = "image/gif"
|
||||
const val AUDIO_AAC = "audio/aac"
|
||||
const val AUDIO_UNSPECIFIED = "audio/*"
|
||||
const val VIDEO_UNSPECIFIED = "video/*"
|
||||
const val VCARD = "text/x-vcard"
|
||||
const val LONG_TEXT = "text/x-signal-plain"
|
||||
}
|
Loading…
Reference in New Issue