Skip to content

Commit

Permalink
Extract library
Browse files Browse the repository at this point in the history
  • Loading branch information
ligi committed Oct 26, 2018
1 parent e2b447c commit 2186f44
Show file tree
Hide file tree
Showing 36 changed files with 69 additions and 11 deletions.
File renamed without changes.
7 changes: 4 additions & 3 deletions app/build.gradle → demo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "im.status.hardwallet_lite_android"
applicationId "im.status.hardwallet_lite_android.demo"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
Expand All @@ -21,8 +21,9 @@ android {
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.madgag.spongycastle:core:1.58.0.0'
implementation 'com.madgag.spongycastle:prov:1.58.0.0'

implementation project(':lib')

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="im.status.hardwallet_lite_android">

<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc.hce" android:required="true" />
package="im.status.hardwallet_lite_android.demo">

<application
android:allowBackup="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import im.status.hardwallet_lite_android.R;
import im.status.hardwallet_lite_android.demo.R;
import im.status.hardwallet_lite_android.io.APDUResponse;
import im.status.hardwallet_lite_android.io.CardChannel;
import im.status.hardwallet_lite_android.io.CardManager;
Expand All @@ -30,10 +30,13 @@ protected void onCreate(Bundle savedInstanceState) {
nfcAdapter = NfcAdapter.getDefaultAdapter(this);
cardManager = new CardManager();

cardManager.setOnConnectedListener(new OnCardConnectedListener() {
cardManager.setOnCardConnectedListener(new OnCardConnectedListener() {
@Override
public void onConnected(CardChannel cardChannel) {
try {

Log.i(TAG, "onCardConnected()");

// Applet-specific code
WalletAppletCommandSet cmdSet = new WalletAppletCommandSet(cardChannel);

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions lib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
26 changes: 26 additions & 0 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
}

task androidSourcesJar(type: Jar) {
from android.sourceSets.main.java.source
classifier = 'sources'
}

artifacts {
archives androidSourcesJar
}

}

dependencies {
api 'com.madgag.spongycastle:core:1.58.0.0'
api 'com.madgag.spongycastle:prov:1.58.0.0'
}
21 changes: 21 additions & 0 deletions lib/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
8 changes: 8 additions & 0 deletions lib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="im.status.hardwallet_lite_android">

<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc.hce" android:required="true" />

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private void onCardDisconnected() {
isoDep = null;
}

public void setOnConnectedListener(OnCardConnectedListener onConnectedListener) {
public void setOnCardConnectedListener(OnCardConnectedListener onConnectedListener) {
onCardConnectedListener = onConnectedListener;
}
}
3 changes: 2 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include ':app'
include ':lib'
include ':demo'

0 comments on commit 2186f44

Please sign in to comment.