Skip to content

Instantly share code, notes, and snippets.

Avatar
🎧
Focusing

Mert Şimşek iammert

🎧
Focusing
View GitHub Profile
@iammert
iammert / BottomBackStackController.kt
Last active Sep 29, 2021
Multiple Back Stack Controller + Navigation Component (Instagram-like backstack)
View BottomBackStackController.kt
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.navigation.NavController
import androidx.navigation.fragment.NavHostFragment
import com.google.android.material.bottomnavigation.BottomNavigationView
import java.util.Stack
import kotlin.collections.HashMap
class BottomBackStackController {
@iammert
iammert / callback.kt
Last active Jan 10, 2021
croutine_intro
View callback.kt
api.fetchUser(object: Callback{
fun onResponse(userInfo: UserInfo){
userTextView.text = userInfo.name
}
})
View RawCertificatePinner.java
public final class RawCertificatePinner implements OkHttpCertificatePinner{
private static final String CERTIFICATE_TYPE = "BKS";
private static final String DEFAULT_TLS_VERSION = "TLSv1.2";
private final Context context;
@RawRes
private final int certificate;
private final String certificatePassword;
View list certfiicates inside BKS
keytool -list -keystore "/user/mert/desktop/certificate.bks" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "/user/mert/bcprov-jdk15on-159.jar" -storetype BKS -storepass mypassword
View multiple certificate same bks file.
keytool -importcert -v -trustcacerts -file "/user/mert/testcertificate.cer" -alias mytestalias -keystore "/user/mert/desktop/certificate.bks" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "/user/mert/bcprov-jdk15on-159.jar" -storetype BKS -storepass mypassword
keytool -importcert -v -trustcacerts -file "/user/mert/testcertificate2.cer" -alias mytestalias2 -keystore "/user/mert/desktop/certificate.bks" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "/user/mert/bcprov-jdk15on-159.jar" -storetype BKS -storepass mypassword
View sample bks creator cl
keytool -importcert -v -trustcacerts -file "/user/mert/testcertificate.cer" -alias mytestalias -keystore "/user/mert/desktop/certificate.bks" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "/user/mert/bcprov-jdk15on-159.jar" -storetype BKS -storepass mypassword
View sample bks creator pattern
keytool -importcert -v -trustcacerts -file "[YOUR_PUBLIC_CERTIFICATE_PATH]" -alias [YOUR_ALIAS] -keystore "[BKS_TARGET_PATH]" -provider org.bouncycastle.jce.provider.BouncyCastleProvider -providerpath "[BOUNCY_CASTLE_JAR_PATH]" -storetype BKS -storepass [YOUR_PASSWORD]
View scaleanimator.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<set>
<objectAnimator
android:duration="200"
android:propertyName="translationZ"
android:valueTo="6dp"
android:valueType="floatType" />
View ScalingLayout.java
public class ScalingLayout extends FrameLayout {
//...
viewOutline = new ScalingLayoutOutlineProvider(w, h, currentRadius);
setOutlineProvider(viewOutline);
//..
}
@iammert
iammert / ScalingLayoutOutlineProvider.java
Last active Jan 8, 2018
ScalingLayoutOutlineProvider
View ScalingLayoutOutlineProvider.java
public class ScalingLayoutOutlineProvider extends ViewOutlineProvider {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0, 0, width, height, radius);
}
}