Answer: The primary constructor is part of the class header. Unlike Java, you don't need to declare a constructor in the body of the class. Here's an example:
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.example.yourapp; | |
| import android.annotation.SuppressLint; | |
| import android.content.Context; | |
| import android.content.SharedPreferences; | |
| import android.os.Build; | |
| import android.security.KeyPairGeneratorSpec; | |
| import android.security.keystore.KeyGenParameterSpec; | |
| import android.security.keystore.KeyProperties; | |
| import android.support.annotation.RequiresApi; |
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.util.Log; | |
| import java.io.IOException; | |
| import okhttp3.CipherSuite; | |
| import okhttp3.Handshake; | |
| import okhttp3.Response; | |
| import okhttp3.TlsVersion; | |
| /** Prints TLS Version and Cipher Suite for SSL Calls through OkHttp3 */ | |
| public class SSLHandshakeInterceptor implements okhttp3.Interceptor { | |
Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.
Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.
Check the gist's comments for any further tips and instructions, especially if you are running into problems!
Results after following the guide as of 11.01.2017 13:08:
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.IOException; | |
| import okhttp3.HttpUrl; | |
| import okhttp3.Interceptor; | |
| import okhttp3.OkHttpClient; | |
| import okhttp3.Request; | |
| /** An interceptor that allows runtime changes to the URL hostname. */ | |
| public final class HostSelectionInterceptor implements Interceptor { | |
| private volatile String host; |