Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
dinesh parmar committed Oct 22, 2019
1 parent 651dbb3 commit 0f5a898
Show file tree
Hide file tree
Showing 67 changed files with 1,901 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
10 changes: 10 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
43 changes: 43 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "ssl.hanshake.retrofit"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':ssl_retrofit')

implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.3'

implementation 'br.com.simplepass:loading-button-android:1.14.0'

}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package ssl.hanshake.retrofit

import androidx.test.InstrumentationRegistry
import androidx.test.runner.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getTargetContext()
assertEquals("ssl.hanshake.retrofit", appContext.packageName)
}
}
23 changes: 23 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ssl.hanshake.retrofit">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>

</manifest>
32 changes: 32 additions & 0 deletions app/src/main/assets/github.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIGXTCCBUWgAwIBAgIQAzcKtii/mNK7zeHCeX1GNDANBgkqhkiG9w0BAQsFADBwMQswCQYDVQQG
EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMS8w
LQYDVQQDEyZEaWdpQ2VydCBTSEEyIEhpZ2ggQXNzdXJhbmNlIFNlcnZlciBDQTAeFw0xOTA3MDgw
MDAwMDBaFw0yMDA3MTYxMjAwMDBaMGgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRUwEwYDVQQKEwxHaXRIdWIsIEluYy4xFTATBgNVBAMM
DCouZ2l0aHViLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALKk6u9UB/RrGpma
ny2dsicZBnCiE3XMCpvhwuSfnxQFEYaJLFhEjRQ5ZXgJNg9lw5KO3nsKxrmqKcnGJoUsQs8PO7yW
hJkCEYYubWaZhKyvvE89/8ehBzKhFAG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HMkoCIQD2g/GrOkxiEBsvOU33OaBWa/YpVM2q34oPQYsT2BBiTAB2AId1v+dZfPiMQ5lfvfNu
/1aNR1Y2/0q1YMG06v9eoIMPAAABa9K+dnUAAAQDAEcwRQIgKW7YYDCyZPlFtWRvxTSRnqgO8eVZ
aNIQircmagyJDUMCIQDTxO+FTCqXc9+zVTofe0fK27G4MgvfuWw79FcXRAJ5eTANBgkqhkiG9w0B
AQsFAAOCAQEAY5betC2DT9nbXVqVXvI/JF+XUR605OvYZ1QG2OBm2ktMhgtpFoRQmh2sPHvgTijV
pP9NX/jlPrnTm9Wo9w7glKqKYj+YEKgzEugiVF/q0d2NkeetEyNL6rHuvid9BS4o9Yzc8l346CDa
KbV1PPkhuBNsudoG1CwgWrB/FWzw1L3UevSkmXV9ZTcgGIZFvkJOSYR6vb6nh2Pjf6B9r70PQa98
9SEODJ14iaD0Nb5KtE+FJH+rweQgh8ibRdZeNNbHM5t56UVL9PvXvXWMTzQ4gG0/1LcruPG4BpbH
kRoKAOPjAauO4w0NMReg2qRIraSB6eLZwvpf2SyuHoaoXSgtkg==
-----END CERTIFICATE-----

Binary file added app/src/main/assets/load-der.crt
Binary file not shown.
40 changes: 40 additions & 0 deletions app/src/main/java/ssl/hanshake/retrofit/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package ssl.hanshake.retrofit

import ssl.hanshake.retrofit.network.NetworkListener
import ssl.hanshake.retrofit.network.NetworkTask
import ssl.hanshake.retrofit.network.RetrofitService


class MainActivity : SSLDemoActivity() {


override fun onStartSSLDemo(isSSLPin: Boolean) {

NetworkTask.taskResponse(String::class.java)
.from(this)
.call(object : NetworkListener<String> {
override fun preCall() {
preView(isSSLPin)
}

@Throws(Exception::class)
override fun onNetworkCall(): String {

val response = RetrofitService
.invokeFrom(context, isSSLPin)
.githubEvents
.execute()
return getResponseOutput(response)
}

override fun postCall(result: String) {
postView(isSSLPin, result)
}

override fun error(e: Exception) {
errorView(isSSLPin, e.message.toString())
}
})
}

}
40 changes: 40 additions & 0 deletions app/src/main/java/ssl/hanshake/retrofit/ProcessExtensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package ssl.hanshake.retrofit

import android.graphics.Color
import android.view.View
import android.widget.TextView

fun TextView.progressText(text: String) {
this.text = text
}

fun TextView.asResult(result: String) {
this.text = result
this.setTextColor(Color.parseColor("#ffffff"))
}

fun TextView.default() {
this.text = "Result"
}

fun TextView.asError(error: String) {
this.text = error
this.setTextColor(Color.parseColor("#ffad1457"))
}

fun View.disableProgress() {
setBackgroundColor(Color.parseColor("#aaaaaa"))
isEnabled=false
}

fun View.enableProgress() {
setBackgroundColor(Color.parseColor("#ffad1457"))
isEnabled=false

}

fun View.stableProgress() {
setBackgroundColor(Color.parseColor("#33b5e5"))
isEnabled=true

}
Loading

0 comments on commit 0f5a898

Please sign in to comment.