This file contains hidden or 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.Application | |
import android.content.Context | |
class App : Application() { | |
companion object { | |
lateinit var mApp: Application | |
fun context(): Context { | |
return mApp.applicationContext | |
} | |
} |
This file contains hidden or 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
public class MyActivity extends Activity implements Thread.UncaughtExceptionHandler{ | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
} | |
@Override | |
public void uncaughtException(Thread thread, Throwable ex) { | |
if(ex.getClass().equals(OutOfMemoryError.class)) |
This file contains hidden or 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.support.constraint.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<FrameLayout | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
android:layout_marginEnd="0dp" | |
android:layout_marginStart="0dp" | |
android:layout_marginTop="0dp" |
This file contains hidden or 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
private fun vibrate() { | |
val vibe = ctx.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator? | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |
vibe?.vibrate(VibrationEffect.createOneShot(150, 10)) | |
} else { | |
vibe?.vibrate(150) | |
}; | |
} |
This file contains hidden or 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
<style name="autotext_style"> | |
<item name="autoSizeTextType">uniform</item> | |
<item name="autoSizeMinTextSize">10sp</item>> | |
<item name="autoSizeMaxTextSize">1000sp</item> | |
<item name="autoSizeStepGranularity">2sp</item> | |
</style> |
This file contains hidden or 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 { | |
//... | |
// Deprecated version | |
// dataBinding { enabled = true } | |
// Current version | |
buildFeatures { | |
dataBinding = true | |
// viewBinding = true |
This file contains hidden or 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
public static byte[] strToByteArr(String str) { | |
byte[] val = new byte[str.length() / 2]; | |
for (int i = 0; i < val.length; i++) { | |
int index = i * 2; | |
int j = Integer.parseInt(str.substring(index, index + 2), 16); | |
val[i] = (byte) j; | |
} | |
return val; | |
} |
This file contains hidden or 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
byte[] merge(byte[] a, byte[] b) { | |
int aLen = a.length; | |
int bLen = b.length; | |
byte[] c= new byte[aLen + bLen]; | |
System.arraycopy(a, 0, c, 0, aLen); | |
System.arraycopy(b, 0, c, aLen, bLen); | |
return c; | |
} |
This file contains hidden or 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
public class MZ85 | |
{ | |
private MZ85() | |
{ | |
} | |
public static byte[] ENCODER = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', | |
'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '.', '-', | |
':', '+', '=', '^', '!', '/', '*', '?', '&', '<', '>', '(', ')', '[', ']', '{', '}', '@', '%', '$', '#', '0' }; |
NewerOlder