This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int xPos = (canvas.getWidth() / 2); | |
int yPos = (int) ((canvas.getHeight() / 2) - ((textPaint.descent() + textPaint.ascent()) / 2)) ; | |
//((textPaint.descent() + textPaint.ascent()) / 2) is the distance from the baseline to the center. | |
canvas.drawText("Hello", xPos, yPos, textPaint); | |
https://stackoverflow.com/a/38415380 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#include <WiFi.h> // ESP32 | |
//#include <ESPmDNS.h> // ESP32 | |
#include <ESP8266WiFi.h> // ESP8266 | |
#include <ESP8266mDNS.h> // ESP8266 | |
#include <WiFiUdp.h> | |
#include <ArduinoOTA.h> | |
void setupOTA(char ssid[], char password[]) { | |
Serial.begin(115200); | |
Serial.println("Booting"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.accessibilityservice.AccessibilityService; | |
import android.accessibilityservice.GestureDescription; | |
import android.content.Context; | |
import android.graphics.Path; | |
import android.graphics.Rect; | |
import android.os.Build; | |
import android.provider.Settings; | |
import android.support.annotation.RequiresApi; | |
import android.text.TextUtils; | |
import android.util.Log; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stackoverflow Link: https://stackoverflow.com/a/19968400 | |
Handle uncaughtException, start activity: | |
public class MyApplication extends Application | |
{ | |
public void onCreate () | |
{ | |
// Setup handler for uncaught exceptions. | |
Thread.setDefaultUncaughtExceptionHandler (new Thread.UncaughtExceptionHandler() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedInputStream; | |
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.OutputStream; | |
import java.io.OutputStreamWriter; | |
import java.io.PrintWriter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
... | |
buildTypes { | |
release { | |
minifyEnabled true | |
... | |
} | |
debug { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity; | |
import android.content.Context; | |
import android.os.Build; | |
import android.util.DisplayMetrics; | |
public class DisplayUtils { | |
private static DisplayUtils instance; | |
public static DisplayUtils getInstance() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Save the raw script file locally then run chmod u+x sms_retriever_hash_v9.sh | |
Stackoverflow: https://stackoverflow.com/questions/53849023/android-sms-retriever-api-computing-apps-hash-string-problem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class RegexUtils { | |
//private static final String DISTANCE_PATTERN = "(?i)[0-9]{1,2}\\s??(?:mi|mile|miles|km)\\b"; | |
private static final String DISTANCE_PATTERN = "(?i)((?:\\d+)?\\.?\\d+)\\s??(?:mi|mile|miles|km)\\b"; | |
private static final String DISTANCE_UNIT_PATTERN = "(?i)(?:mi|mile|miles|km)\\b"; | |
private static final String TIME_PATTERN = "(?i)[0-9]{1,2}\\s??(?:min|hr)"; | |
private static final String TIME_UNIT_PATTERN = "(?i)(?:min|hr)"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
_____ _____ _ | |
| __ \ / ____| | | | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __ | |
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__| | |
| |__| | __/ |____| | | |_| | |_) | || (_) | | | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_| | |
__/ | | | |
|___/|_| | |
*/ |
NewerOlder