-
Create new keystore.jks file with comand line (not android studio build menu)
Linux:
keytool -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore keystore.jks
Windows:
"C:\Program Files\Android\Android Studio\jre\bin\keytool.exe" -genkeypair -alias upload -keyalg RSA -keysize 2048 -validity 9125 -keystore "C:\keystore_new.jks"
-
Generate a .pem file from new keystore
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
class InfiniteViewPager2 @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyle: Int = 0, | |
defStyleRes: Int = 0 | |
) : FrameLayout(context, attrs, defStyle, defStyleRes) { | |
private val viewPager2: ViewPager2 by lazy { | |
findViewById(R.id.view_pager_infinite) | |
} |
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.text.TextWatcher; | |
import android.util.Log; | |
import android.widget.EditText; | |
import java.text.NumberFormat; | |
public class CustomTextWatcher implements TextWatcher { |
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.content.Context; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.widget.RelativeLayout; | |
/** | |
* Created by NguyenLinh on 17,June,2020 | |
*/ |
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 AES256Cipher { | |
public static byte[] ivBytes = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; | |
public static String AES_Encode(String str, String str2) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException { | |
byte[] bytes = str.getBytes("UTF-8"); | |
IvParameterSpec ivParameterSpec = new IvParameterSpec(ivBytes); | |
SecretKeySpec secretKeySpec = new SecretKeySpec(str2.getBytes("UTF-8"), "AES"); | |
Cipher instance = Cipher.getInstance("AES/CBC/PKCS5Padding"); | |
instance.init(1, secretKeySpec, ivParameterSpec); | |
return Base64.encodeToString(instance.doFinal(bytes), 0); |
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
package com.android.disastersdk.feature; | |
import com.android.disastersdk.utils.Logger; | |
import java.io.BufferedInputStream; | |
import java.io.BufferedOutputStream; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.FileOutputStream; |
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 int[] toIntArray(List<Integer> list) { | |
int[] ret = new int[list.size()]; | |
for (int i = 0; i < ret.length; i++) | |
ret[i] = list.get(i); | |
Log.d("ret", Arrays.toString(ret)); | |
return ret; | |
} | |
private String[] toStringArray(List<String> list) { | |
return list.toArray(new String[list.size()]); |
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
//file local.properties | |
tmdb_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxx" | |
//file build.gradle (Module: app) | |
buildTypes.each { | |
Properties properties = new Properties() | |
properties.load(project.rootProject.file("local.properties").newDataInputStream()) | |
def tmdbApiKey = properties.getProperty("tmdb_api_key", "") | |
it.buildConfigField 'String', "TMDB_API_KEY", tmdbApiKey |
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 java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
public class PingIP { | |
public static void runSystemCommand(String command) { | |
try { | |
Process p = Runtime.getRuntime().exec(command); | |
BufferedReader inputStream = new BufferedReader( |
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
@Override | |
public void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setStyle(STYLE_NO_FRAME, R.style.AppTheme); | |
} | |
@Override | |
public void onStart() { | |
super.onStart(); | |
ViewGroup.LayoutParams params = getDialog().getWindow().getAttributes(); |
NewerOlder