Skip to content

Commit

Permalink
Merge pull request #1 from BlockchainPractice/android/restore-credent…
Browse files Browse the repository at this point in the history
…ial-scan-SSI-6

Android/restore credential scan ssi 6
  • Loading branch information
adoroganov authored and GitHub Enterprise committed Jan 13, 2020
2 parents ac6c04f + 5d160fc commit b186587
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
9 changes: 7 additions & 2 deletions SovrinAgentApp/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ android {
}

dependencies {
implementation("com.github.devalexey.cordentity:cordentity-indy-utils:$cordentity_version")
implementation("com.github.devalexey.cordentity:cordentity-agent-connection:$cordentity_version")
implementation("com.github.hyperledger-labs.cordentity:cordentity-indy-utils:$cordentity_version")
implementation("com.github.hyperledger-labs.cordentity:cordentity-agent-connection:$cordentity_version")

implementation('net.java.dev.jna:jna:4.5.1@aar')

Expand All @@ -55,6 +55,11 @@ dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.hendraanggrian:collapsingtoolbarlayout-subtitle:27.1.0'

//TODO: migrate com.android.support to androidx https://developer.android.com/jetpack/androidx/migrate
// implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation "com.android.support.constraint:constraint-layout:1.1.3"

//noinspection GradleCompatible

androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class MainActivity : AppCompatActivity() {
supportActionBar?.setDisplayHomeAsUpEnabled(false)

nameClaims.addChangeListener { claims ->
val userName = claims.first()?.value ?: ""
val userName = claims.firstOrNull()?.value ?: ""
supportActionBar?.title = userName
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

package com.luxoft.supplychain.sovrinagentapp.ui.fragments

import android.content.Intent
import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v4.content.ContextCompat
import android.support.v4.widget.SwipeRefreshLayout
import android.support.v7.widget.DividerItemDecoration
import android.support.v7.widget.LinearLayoutManager
Expand All @@ -31,10 +33,13 @@ import com.luxoft.supplychain.sovrinagentapp.application.EXTRA_SERIAL
import com.luxoft.supplychain.sovrinagentapp.application.FIELD_KEY
import com.luxoft.supplychain.sovrinagentapp.application.TIME
import com.luxoft.supplychain.sovrinagentapp.data.ClaimAttribute
import com.luxoft.supplychain.sovrinagentapp.data.PackageState
import com.luxoft.supplychain.sovrinagentapp.ui.activities.SimpleScannerActivity
import com.luxoft.supplychain.sovrinagentapp.ui.adapters.ClaimsAdapter
import com.luxoft.supplychain.sovrinagentapp.utils.updateCredentialsInRealm
import io.realm.Realm
import kotlinx.android.synthetic.main.fragment_claims.*
import kotlinx.android.synthetic.main.fragment_claims.view.*
import org.koin.android.ext.android.inject

class ClaimsFragment : Fragment() {
Expand Down Expand Up @@ -62,6 +67,15 @@ class ClaimsFragment : Fragment() {
tvClaims.text = getString(R.string.verified_credentials, numCredRefs)
}

val getCredentialsButton = view.get_credentials
view.get_credentials.setOnClickListener {
ContextCompat.startActivity(getCredentialsButton.context,
Intent().setClass(getCredentialsButton.context, SimpleScannerActivity::class.java)
.putExtra("state", PackageState.GETPROOFS.name), null
)
}
getCredentialsButton.visibility = View.VISIBLE

val linearLayoutManager = LinearLayoutManager(activity)
recycler.layoutManager = linearLayoutManager
recycler.addItemDecoration(DividerItemDecoration(recycler.context, linearLayoutManager.orientation))
Expand Down
8 changes: 8 additions & 0 deletions SovrinAgentApp/app/src/main/res/layout/fragment_claims.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@

</LinearLayout>

<Button
android:id="@+id/get_credentials"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Get Credentials"
android:background="@drawable/gradient"
android:visibility="visible"/>

<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_container"
android:layout_width="match_parent"
Expand Down

0 comments on commit b186587

Please sign in to comment.