From 26c96b794d0704f3b1452f9439b7027d89119268 Mon Sep 17 00:00:00 2001 From: Jonathan Raes Date: Wed, 21 Jun 2017 15:49:12 +0200 Subject: [PATCH 01/12] change progress circle to library one --- app/build.gradle | 1 + .../main/res/layout/activity_transaction_history.xml | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c8351ed..ad2d3a7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -53,6 +53,7 @@ dependencies { compile 'net.sf.scuba:scuba-sc-android:0.0.9' compile 'com.readystatesoftware.systembartint:systembartint:1.0.3' compile 'com.androidadvance:topsnackbar:1.1.1' + compile 'com.github.rahatarmanahmed:circularprogressview:2.5.0' // Logging dependencies for bitcoinj compile group: 'org.slf4j', name:'slf4j-api', version: '1.7.2' diff --git a/app/src/main/res/layout/activity_transaction_history.xml b/app/src/main/res/layout/activity_transaction_history.xml index b120ac6..0a9c896 100644 --- a/app/src/main/res/layout/activity_transaction_history.xml +++ b/app/src/main/res/layout/activity_transaction_history.xml @@ -19,12 +19,13 @@ tools:layout_editor_absoluteY="0dp" tools:layout_editor_absoluteX="8dp" /> - + android:layout_width="50dp" + android:layout_height="50dp" + android:layout_gravity="center" + app:cpv_animAutostart="true" + app:cpv_indeterminate="true" /> Date: Tue, 27 Jun 2017 16:29:38 +0200 Subject: [PATCH 02/12] ro.ttf is used everywhere, except ErrorDialog and toasts --- app/src/main/AndroidManifest.xml | 5 +- .../blockchain/BlockChain.java | 1 - .../blockchain/ProgressTracker.java | 3 - .../digitalvotingpass/MainActivity.java | 36 +++++++++--- .../ManualInputActivity.java | 56 +++++++++++++++---- .../digitalvotingpass/ResultActivity.java | 22 +++++++- .../digitalvotingpass/SplashActivity.java | 12 ++-- .../electionchoice/ElectionsAdapter.java | 6 ++ .../PassportConActivity.java | 12 +++- .../TransactionHistoryActivity.java | 16 +++++- .../TransactionsAdapter.java | 7 +++ .../utilities/CustomTypefaceSpan.java | 49 ++++++++++++++++ .../com/digitalvotingpass/utilities/Util.java | 11 +++- .../res/layout/activity_splash_screen.xml | 1 - .../layout/activity_transaction_history.xml | 1 + .../PassportTransactionFormatterTest.java | 1 - 16 files changed, 198 insertions(+), 41 deletions(-) create mode 100644 app/src/main/java/com/digitalvotingpass/utilities/CustomTypefaceSpan.java diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f4cbd9d..0e47a03 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -35,8 +35,9 @@ - + diff --git a/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java b/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java index 19615a0..6818d95 100644 --- a/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java +++ b/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java @@ -11,7 +11,6 @@ import com.digitalvotingpass.utilities.MultiChainAddressGenerator; import com.digitalvotingpass.utilities.Util; import com.google.common.util.concurrent.MoreExecutors; -import com.google.common.util.concurrent.Service; import org.bitcoinj.core.Address; import org.bitcoinj.core.Asset; diff --git a/app/src/main/java/com/digitalvotingpass/blockchain/ProgressTracker.java b/app/src/main/java/com/digitalvotingpass/blockchain/ProgressTracker.java index f07f995..eff0d06 100644 --- a/app/src/main/java/com/digitalvotingpass/blockchain/ProgressTracker.java +++ b/app/src/main/java/com/digitalvotingpass/blockchain/ProgressTracker.java @@ -1,8 +1,5 @@ package com.digitalvotingpass.blockchain; -import android.util.Log; - -import org.bitcoinj.core.Peer; import org.bitcoinj.core.listeners.DownloadProgressTracker; import java.util.ArrayList; diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java index b787995..48441b7 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java @@ -3,18 +3,23 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.Typeface; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.text.SpannableStringBuilder; +import android.text.Spanned; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; +import android.widget.TextView; import com.digitalvotingpass.camera.CameraActivity; import com.digitalvotingpass.electionchoice.Election; import com.digitalvotingpass.electionchoice.ElectionChoiceActivity; import com.digitalvotingpass.passportconnection.PassportConActivity; +import com.digitalvotingpass.utilities.CustomTypefaceSpan; import com.digitalvotingpass.utilities.Util; import com.google.gson.Gson; @@ -26,6 +31,7 @@ public class MainActivity extends AppCompatActivity { private Button manualInput; private Button startOCR; + private Typeface typeFace; public static final int GET_DOC_INFO = 1; public static final int CHOOSE_ELECTION = 2; @@ -36,12 +42,6 @@ protected void onCreate(Bundle savedInstanceState) { final MainActivity thisActivity = this; setContentView(R.layout.activity_main); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); - - // set the text of the appbar to the selected election - setElectionInAppBar(); manualInput = (Button) findViewById(R.id.manual_input_button); manualInput.setOnClickListener(new View.OnClickListener() { @@ -61,6 +61,20 @@ public void onClick(View v) { startActivityForResult(intent, GET_DOC_INFO); } }); + typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + manualInput.setTypeface(typeFace); + startOCR.setTypeface(typeFace); + ((TextView)findViewById(R.id.divider)).setTypeface(typeFace); + } + + @Override + protected void onResume() { + super.onResume(); + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); + // set the text of the appbar to the selected election + setElectionInAppBar(); } /** @@ -95,7 +109,6 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // Check if we got documentdata and set the documentData attribute if(requestCode == GET_DOC_INFO && resultCode == RESULT_OK) { - documentData = (DocumentData) data.getExtras().get(DocumentData.identifier); Intent intent = new Intent(this, PassportConActivity.class); intent.putExtra(DocumentData.identifier, documentData); @@ -118,8 +131,13 @@ public void setElectionInAppBar() { election = gson.fromJson(json, Election.class); if(election != null && getSupportActionBar() != null) { - getSupportActionBar().setTitle(election.getKind()); - getSupportActionBar().setSubtitle(election.getPlace()); + SpannableStringBuilder title = new SpannableStringBuilder(election.getKind()); + title.setSpan (new CustomTypefaceSpan("", typeFace), 0, title.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); + SpannableStringBuilder subtitle = new SpannableStringBuilder(election.getPlace()); + subtitle.setSpan (new CustomTypefaceSpan("", typeFace), 0, subtitle.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); + + getSupportActionBar().setTitle(title); + getSupportActionBar().setSubtitle(subtitle); } } diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java index 9940de2..904d82e 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java @@ -1,13 +1,16 @@ package com.digitalvotingpass.digitalvotingpass; import android.app.Activity; +import android.content.Context; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; +import android.support.annotation.LayoutRes; +import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; -import android.widget.ArrayAdapter; +import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; @@ -39,11 +42,8 @@ public class ManualInputActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_manual_input); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); - Typeface typeFace= Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + Typeface typeFace= Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); docNumber = (EditText) findViewById(R.id.doc_num); docNumber.setTypeface(typeFace); TextView docNumTitle = (TextView) findViewById(R.id.doc_num_title); @@ -54,6 +54,7 @@ protected void onCreate(Bundle savedInstanceState) { expDateTitle.setTypeface(typeFace); Button submitBut = (Button) findViewById(R.id.submit_button); + submitBut.setTypeface(typeFace); submitBut.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -74,6 +75,14 @@ public void onClick(View view) { } } + @Override + protected void onResume() { + super.onResume(); + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); + } + private void setupExpirySpinners() { expiryDaySpinner = (Spinner) findViewById(R.id.expiry_day_spinner); expiryMonthSpinner = (Spinner) findViewById(R.id.expiry_month_spinner); @@ -85,13 +94,14 @@ private void setupExpirySpinners() { } // Leave the default view (android.R.layout.simple_spinner_item) but set custom view for dropdown to add extra padding - ArrayAdapter dayAdapter = new ArrayAdapter<>(this, + ArrayAdapter dayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, days); + dayAdapter.setDropDownViewResource(R.layout.spinner_dropdown); expiryDaySpinner.setAdapter(dayAdapter); - ArrayAdapter monthAdapter = ArrayAdapter.createFromResource(this, - R.array.months_array, android.R.layout.simple_spinner_item); + final CharSequence[] strings = getApplicationContext().getResources().getTextArray(R.array.months_array); + ArrayAdapter monthAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, strings); monthAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); expiryMonthSpinner.setAdapter(monthAdapter); @@ -120,8 +130,8 @@ private void setupDOBSpinners () { dayAdapter.setDropDownViewResource(R.layout.spinner_dropdown); dobDaySpinner.setAdapter(dayAdapter); - ArrayAdapter monthAdapter = ArrayAdapter.createFromResource(this, - R.array.months_array, android.R.layout.simple_spinner_item); + final CharSequence[] strings = getApplicationContext().getResources().getTextArray(R.array.months_array); + ArrayAdapter monthAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, strings); monthAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dobMonthSpinner.setAdapter(monthAdapter); @@ -194,4 +204,30 @@ public boolean verifyInput() { return valid; } + private class ArrayAdapter extends android.widget.ArrayAdapter { + + Typeface typeFace; + + public ArrayAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull T[] objects) { + super(context, resource, objects); + typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + } + + public ArrayAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull List objects) { + super(context, resource, objects); + typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + } + + public View getView(int position, View convertView, ViewGroup parent) { + View v = super.getView(position, convertView, parent); + ((TextView) v).setTypeface(typeFace); + return v; + } + + public View getDropDownView(int position, View convertView, ViewGroup parent) { + View v =super.getDropDownView(position, convertView, parent); + ((TextView) v).setTypeface(typeFace); + return v; + } + } } diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java index 1e145b5..8724a51 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java @@ -3,6 +3,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; +import android.graphics.Typeface; import android.os.Bundle; import android.support.design.widget.CoordinatorLayout; import android.support.v7.app.AppCompatActivity; @@ -38,6 +39,7 @@ public class ResultActivity extends AppCompatActivity { private Button butTransactionHistory; private Button butProceed; private MenuItem cancelAction; + private Typeface typeFace; private int authorizationState = 1; private final int FAILED = 0; @@ -89,15 +91,19 @@ protected void onCreate(Bundle savedInstanceState) { signedTransactions = (ArrayList) extras.get("signedTransactions"); setContentView(R.layout.activity_result); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); textVoterName = (TextView) findViewById(R.id.voter_name); textVotingPassAmount = (TextView) findViewById(R.id.voting_pass_amount); textVotingPasses = (TextView) findViewById(R.id.voting_passes); butTransactionHistory = (Button) findViewById(R.id.transactionHistory); butProceed = (Button) findViewById(R.id.proceed); + typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + textVoterName.setTypeface(typeFace); + textVotingPassAmount.setTypeface(typeFace); + textVotingPasses.setTypeface(typeFace); + butTransactionHistory.setTypeface(typeFace); + butProceed.setTypeface(typeFace); + butTransactionHistory.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -115,6 +121,15 @@ public void onClick(View v) { }); } + @Override + protected void onResume() { + super.onResume(); + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); + // set the text of the appbar to the selected election + } + /** * Set the result_menu setup to the app bar. */ @@ -149,6 +164,7 @@ private void showSnack(CharSequence text, int backgroundColor, int textColor) { TextView textView = (TextView) snackbarView.findViewById(com.androidadvance.topsnackbar.R.id.snackbar_text); textView.setTextColor(getResources().getColor(textColor)); textView.setGravity(Gravity.CENTER_HORIZONTAL); + textView.setTypeface(typeFace); snack.show(); diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java index 233e943..999d163 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java @@ -6,26 +6,24 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; +import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; -import android.os.HandlerThread; import android.provider.Settings; import android.support.annotation.NonNull; import android.support.design.widget.Snackbar; import android.support.v13.app.ActivityCompat; import android.support.v4.content.ContextCompat; -import android.util.Log; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; -import android.widget.Toast; import com.digitalvotingpass.blockchain.BlockChain; import com.digitalvotingpass.blockchain.BlockchainCallBackListener; import com.digitalvotingpass.electionchoice.Election; import com.digitalvotingpass.electionchoice.ElectionChoiceActivity; -import com.digitalvotingpass.utilities.Util; import com.digitalvotingpass.utilities.ErrorDialog; +import com.digitalvotingpass.utilities.Util; import com.google.gson.Gson; import java.text.DecimalFormat; @@ -42,6 +40,7 @@ public class SplashActivity extends Activity implements BlockchainCallBackListen private Handler handler; private Handler initTextHandler; private BlockChain blockChain; + private Typeface typeFace; DecimalFormat percentFormatter = new DecimalFormat("##0.0"); @@ -83,6 +82,11 @@ public void onCreate(Bundle savedInstanceState) { currentTask = (TextView) findViewById(R.id.progress_current_task); downloadProgressBar = (ProgressBar) findViewById(R.id.download_progress_bar); + typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + downloadProgressText.setTypeface(typeFace); + currentTask.setTypeface(typeFace); + ((TextView) findViewById(R.id.text_splash_screen)).setTypeface(typeFace); + if (savedInstanceState == null) { try { blockChain = BlockChain.getInstance(getApplicationContext()); diff --git a/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java b/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java index e73a8be..e027989 100644 --- a/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java +++ b/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java @@ -1,6 +1,7 @@ package com.digitalvotingpass.electionchoice; import android.content.Context; +import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -78,6 +79,11 @@ public View getView(int position, View convertView, ViewGroup parent) { TextView kind = (TextView) convertView.findViewById(R.id.kind); TextView place = (TextView) convertView.findViewById(R.id.place); // Populate the data into the template view using the data object + + Typeface typeFace = Typeface.createFromAsset(convertView.getContext().getAssets(), "fonts/ro.ttf"); + kind.setTypeface(typeFace); + place.setTypeface(typeFace); + kind.setText(election.kind); place.setText(election.place); diff --git a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java index fc8179c..29b2815 100644 --- a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java +++ b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; +import android.graphics.Typeface; import android.nfc.NfcAdapter; import android.nfc.Tag; import android.os.Bundle; @@ -31,6 +32,7 @@ import org.bitcoinj.core.AssetBalance; import org.jmrtd.PassportService; + import java.security.PublicKey; import java.security.Security; import java.util.ArrayList; @@ -43,6 +45,7 @@ public class PassportConActivity extends AppCompatActivity { // Adapter for NFC connection private NfcAdapter mNfcAdapter; private DocumentData documentData; + private ImageView progressView; private PassportConActivity thisActivity; @@ -60,15 +63,15 @@ protected void onCreate(Bundle savedInstanceState) { thisActivity = this; setContentView(R.layout.activity_passport_con); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); TextView notice = (TextView) findViewById(R.id.notice); progressView = (ImageView) findViewById(R.id.progress_view); mNfcAdapter = NfcAdapter.getDefaultAdapter(this); checkNFCStatus(); notice.setText(R.string.nfc_enabled); + + Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + notice.setTypeface(typeFace); } /** @@ -79,6 +82,9 @@ protected void onCreate(Bundle savedInstanceState) { @Override protected void onResume() { super.onResume(); + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); // It's important, that the activity is in the foreground (resumed). Otherwise an IllegalStateException is thrown. setupForegroundDispatch(this, mNfcAdapter); checkNFCStatus(); diff --git a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java index db5a535..4870a73 100644 --- a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java +++ b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java @@ -4,6 +4,7 @@ import android.content.ClipboardManager; import android.content.Context; import android.content.SharedPreferences; +import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; @@ -12,6 +13,7 @@ import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.ListView; +import android.widget.TextView; import com.digitalvotingpass.blockchain.BlockChain; import com.digitalvotingpass.digitalvotingpass.R; @@ -76,9 +78,6 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_transaction_history); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); ListView transactionList = (ListView) findViewById(R.id.transaction_list); // create a transaction history array with all the transactions and add them to the list @@ -86,12 +85,23 @@ protected void onCreate(Bundle savedInstanceState) { adapter = new TransactionsAdapter(this, transactionHistory); transactionList.setAdapter(adapter); + Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + ((TextView)findViewById(R.id.no_transactions_text)).setTypeface(typeFace); + // Load transactions in separate thread since this can take a while. HandlerThread thread = new HandlerThread("transactions"); thread.start(); new Handler(thread.getLooper()).post(loadTransactions); } + @Override + protected void onResume() { + super.onResume(); + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); + } + /** * Sets listener on the app bar to copy the address to clipboard. * @param address string diff --git a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java index b992c61..d49947e 100644 --- a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java +++ b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java @@ -1,6 +1,7 @@ package com.digitalvotingpass.transactionhistory; import android.content.Context; +import android.graphics.Typeface; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; @@ -31,9 +32,15 @@ public View getView(int position, View convertView, @NonNull ViewGroup parent) { } if (transactionHistoryItem != null) { // Lookup view for data population + Typeface typeFace = Typeface.createFromAsset(getContext().getAssets(), "fonts/ro.ttf"); TextView title = (TextView) convertView.findViewById(R.id.title); TextView time = (TextView) convertView.findViewById(R.id.time); TextView details = (TextView) convertView.findViewById(R.id.details); + + title.setTypeface(typeFace); + time.setTypeface(typeFace); + details.setTypeface(typeFace); + // Populate the data into the template view using the data object title.setText(transactionHistoryItem.title); time.setText(transactionHistoryItem.time.toString()); diff --git a/app/src/main/java/com/digitalvotingpass/utilities/CustomTypefaceSpan.java b/app/src/main/java/com/digitalvotingpass/utilities/CustomTypefaceSpan.java new file mode 100644 index 0000000..d844934 --- /dev/null +++ b/app/src/main/java/com/digitalvotingpass/utilities/CustomTypefaceSpan.java @@ -0,0 +1,49 @@ +package com.digitalvotingpass.utilities; + +import android.annotation.SuppressLint; +import android.graphics.Paint; +import android.graphics.Typeface; +import android.text.TextPaint; +import android.text.style.TypefaceSpan; + +@SuppressLint("ParcelCreator") +public class CustomTypefaceSpan extends TypefaceSpan { + + private final Typeface newType; + + public CustomTypefaceSpan(String family, Typeface type) { + super(family); + newType = type; + } + + @Override + public void updateDrawState(TextPaint ds) { + applyCustomTypeFace(ds, newType); + } + + @Override + public void updateMeasureState(TextPaint paint) { + applyCustomTypeFace(paint, newType); + } + + private static void applyCustomTypeFace(Paint paint, Typeface tf) { + int oldStyle; + Typeface old = paint.getTypeface(); + if (old == null) { + oldStyle = 0; + } else { + oldStyle = old.getStyle(); + } + + int fake = oldStyle & ~tf.getStyle(); + if ((fake & Typeface.BOLD) != 0) { + paint.setFakeBoldText(true); + } + + if ((fake & Typeface.ITALIC) != 0) { + paint.setTextSkewX(-0.25f); + } + + paint.setTypeface(tf); + } +} \ No newline at end of file diff --git a/app/src/main/java/com/digitalvotingpass/utilities/Util.java b/app/src/main/java/com/digitalvotingpass/utilities/Util.java index 2608d08..992aaf8 100644 --- a/app/src/main/java/com/digitalvotingpass/utilities/Util.java +++ b/app/src/main/java/com/digitalvotingpass/utilities/Util.java @@ -4,9 +4,12 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Color; +import android.graphics.Typeface; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.v7.widget.Toolbar; +import android.text.SpannableStringBuilder; +import android.text.Spanned; import android.util.Log; import com.digitalvotingpass.digitalvotingpass.R; @@ -44,7 +47,8 @@ public static int getStatusBarHeight(Resources resources) { /** * Sets up a top-padding for the given app bar equal to the height of the status bar. * This increases the length of the app bar so it fits nicely below the status bar. - * This method also sets the status bar transparency. + * This method also sets the status bar transparency. (may not be needed) + * This method also sets the AppBar title to the activity title using the ro.ttf font. * * @param appBar Toolbar to set padding to * @param activity Activity - current activity @@ -52,6 +56,11 @@ public static int getStatusBarHeight(Resources resources) { public static void setupAppBar(Toolbar appBar, Activity activity) { appBar.setPadding(0, getStatusBarHeight(activity.getResources()), 0, 0); + Typeface typeFace= Typeface.createFromAsset(activity.getAssets(), "fonts/ro.ttf"); + SpannableStringBuilder s = new SpannableStringBuilder(activity.getTitle()); + s.setSpan (new CustomTypefaceSpan("", typeFace), 0, s.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); + appBar.setTitle(s); + SystemBarTintManager tintManager = new SystemBarTintManager(activity); tintManager.setStatusBarTintEnabled(true); tintManager.setNavigationBarTintEnabled(true); diff --git a/app/src/main/res/layout/activity_splash_screen.xml b/app/src/main/res/layout/activity_splash_screen.xml index ef29778..0ba6d96 100644 --- a/app/src/main/res/layout/activity_splash_screen.xml +++ b/app/src/main/res/layout/activity_splash_screen.xml @@ -1,5 +1,4 @@ Date: Tue, 27 Jun 2017 17:15:56 +0200 Subject: [PATCH 03/12] font used in toasts and snackbars --- .../digitalvotingpass/SplashActivity.java | 29 ++++++++++++------- .../PassportConActivity.java | 29 +++++++++++++++---- app/src/main/res/layout/toast_view.xml | 14 +++++++++ 3 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 app/src/main/res/layout/toast_view.xml diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java index 999d163..79edba2 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java @@ -112,21 +112,28 @@ public void onWindowFocusChanged(boolean hasFocus) { currentTask.setText(getString(R.string.no_connection)); if (!Util.isNetEnabled(getApplicationContext())) { - View.OnClickListener inputSnackbarListener = new View.OnClickListener() { - @Override - public void onClick(View v) { - startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); - } - }; - - Snackbar snackbar = Snackbar.make(findViewById(R.id.splash_screen_layout), getString(R.string.please_enable_connect_message), Snackbar.LENGTH_INDEFINITE); - snackbar.getView().setBackgroundColor(ContextCompat.getColor(this, R.color.redFailed)); - snackbar.setAction(R.string.go_network_settings, inputSnackbarListener); - snackbar.show(); + showSnackbar(); } } } + public void showSnackbar() { + View.OnClickListener inputSnackbarListener = new View.OnClickListener() { + @Override + public void onClick(View v) { + startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); + } + }; + Snackbar snackbar = Snackbar.make(findViewById(R.id.splash_screen_layout), getString(R.string.please_enable_connect_message), Snackbar.LENGTH_INDEFINITE); + snackbar.getView().setBackgroundColor(ContextCompat.getColor(this, R.color.redFailed)); + TextView textView = (TextView) (snackbar.getView()).findViewById(android.support.design.R.id.snackbar_text); + TextView actionTextView = (TextView) (snackbar.getView()).findViewById(android.support.design.R.id.snackbar_action); + textView.setTypeface(typeFace); + actionTextView.setTypeface(typeFace); + snackbar.setAction(R.string.go_network_settings, inputSnackbarListener); + snackbar.show(); + } + @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { diff --git a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java index 29b2815..30c49da 100644 --- a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java +++ b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java @@ -14,7 +14,9 @@ import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; +import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; @@ -45,6 +47,7 @@ public class PassportConActivity extends AppCompatActivity { // Adapter for NFC connection private NfcAdapter mNfcAdapter; private DocumentData documentData; + private Typeface typeFace; private ImageView progressView; private PassportConActivity thisActivity; @@ -70,7 +73,7 @@ protected void onCreate(Bundle savedInstanceState) { checkNFCStatus(); notice.setText(R.string.nfc_enabled); - Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); notice.setTypeface(typeFace); } @@ -211,10 +214,10 @@ public void handleConnectionFailed(Exception e) { displayCheckInputSnackbar(); progressView.setImageResource(R.drawable.nfc_icon_empty); } else if(e.toString().toLowerCase().contains("tag was lost")) { - Toast.makeText(this, getString(R.string.NFC_error), Toast.LENGTH_LONG).show(); + displayToast(getString(R.string.NFC_error)); progressView.setImageResource(R.drawable.nfc_icon_empty); } else { - Toast.makeText(this, getString(R.string.general_error), Toast.LENGTH_LONG).show(); + displayToast(getString(R.string.general_error)); progressView.setImageResource(R.drawable.nfc_icon_empty); } } @@ -236,7 +239,7 @@ public void startResultActivity(PublicKey pubKey, ArrayList signedTransa startActivity(intent); finish(); } else { - Toast.makeText(this, getString(R.string.NFC_error), Toast.LENGTH_LONG).show(); + displayToast(getString(R.string.NFC_error)); progressView.setImageResource(R.drawable.nfc_icon_empty); } } @@ -249,7 +252,7 @@ public void startResultActivity(PublicKey pubKey, ArrayList signedTransa public void checkNFCStatus() { if (mNfcAdapter == null) { // Stop here, we definitely need NFC - Toast.makeText(this, R.string.nfc_not_supported_error, Toast.LENGTH_LONG).show(); + displayToast(getString(R.string.nfc_not_supported_error)); finish(); return; } @@ -287,10 +290,26 @@ public void onClick(View v) { Snackbar inputSnackbar = Snackbar.make(findViewById(R.id.coordinator_layout), R.string.wrong_document_details, Snackbar.LENGTH_INDEFINITE); + TextView textView = (TextView) (inputSnackbar.getView()).findViewById(android.support.design.R.id.snackbar_text); + TextView actionTextView = (TextView) (inputSnackbar.getView()).findViewById(android.support.design.R.id.snackbar_action); + textView.setTypeface(typeFace); + actionTextView.setTypeface(typeFace); inputSnackbar.setAction(R.string.check_input, inputSnackbarListener); inputSnackbar.show(); } + public void displayToast(String text) { + LayoutInflater inflater = getLayoutInflater(); + View layout = inflater.inflate(R.layout.toast_view, + (ViewGroup) findViewById(R.id.custom_toast_container)); + Toast toast = new Toast(getApplicationContext()); + toast.setView(layout); + TextView textView = (TextView) layout.findViewById(R.id.text); + textView.setTypeface(typeFace); + textView.setText(text); + toast.show(); + } + /** * Update the documentdata in this activity and in the main activity. * @param requestCode requestCode diff --git a/app/src/main/res/layout/toast_view.xml b/app/src/main/res/layout/toast_view.xml new file mode 100644 index 0000000..6bd8963 --- /dev/null +++ b/app/src/main/res/layout/toast_view.xml @@ -0,0 +1,14 @@ + + + + + From a77cfcdbad5ac0758ad38fa79e1042675bf0afed Mon Sep 17 00:00:00 2001 From: Jonathan Raes Date: Wed, 28 Jun 2017 10:31:49 +0200 Subject: [PATCH 04/12] added forgotten snackbar, gave toast a background --- .../PassportConActivity.java | 20 +++++++++---------- .../main/res/drawable/toast_background.xml | 9 +++++++++ app/src/main/res/layout/toast_view.xml | 6 +++++- 3 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 app/src/main/res/drawable/toast_background.xml diff --git a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java index 30c49da..8732bed 100644 --- a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java +++ b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java @@ -266,10 +266,7 @@ public void onClick(View v) { } }; - Snackbar nfcDisabledSnackbar = Snackbar.make(findViewById(R.id.coordinator_layout), - R.string.nfc_disabled_error_snackbar, Snackbar.LENGTH_INDEFINITE); - nfcDisabledSnackbar.setAction(R.string.nfc_disabled_snackbar_action, nfcSnackbarListener); - nfcDisabledSnackbar.show(); + displaySnackbar(getString(R.string.nfc_disabled_error_snackbar), R.string.nfc_disabled_snackbar_action, nfcSnackbarListener); } } @@ -287,15 +284,18 @@ public void onClick(View v) { startActivityForResult(intent, MainActivity.GET_DOC_INFO); } }; + displaySnackbar(getString(R.string.wrong_document_details), R.string.check_input, inputSnackbarListener); + } - Snackbar inputSnackbar = Snackbar.make(findViewById(R.id.coordinator_layout), - R.string.wrong_document_details, Snackbar.LENGTH_INDEFINITE); - TextView textView = (TextView) (inputSnackbar.getView()).findViewById(android.support.design.R.id.snackbar_text); - TextView actionTextView = (TextView) (inputSnackbar.getView()).findViewById(android.support.design.R.id.snackbar_action); + public void displaySnackbar(String text, int actionString, View.OnClickListener listener) { + Snackbar snackbar = Snackbar.make(findViewById(R.id.coordinator_layout), + text, Snackbar.LENGTH_INDEFINITE); + TextView textView = (TextView) (snackbar.getView()).findViewById(android.support.design.R.id.snackbar_text); + TextView actionTextView = (TextView) (snackbar.getView()).findViewById(android.support.design.R.id.snackbar_action); textView.setTypeface(typeFace); actionTextView.setTypeface(typeFace); - inputSnackbar.setAction(R.string.check_input, inputSnackbarListener); - inputSnackbar.show(); + snackbar.setAction(actionString, listener); + snackbar.show(); } public void displayToast(String text) { diff --git a/app/src/main/res/drawable/toast_background.xml b/app/src/main/res/drawable/toast_background.xml new file mode 100644 index 0000000..0456672 --- /dev/null +++ b/app/src/main/res/drawable/toast_background.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/app/src/main/res/layout/toast_view.xml b/app/src/main/res/layout/toast_view.xml index 6bd8963..fa32b3a 100644 --- a/app/src/main/res/layout/toast_view.xml +++ b/app/src/main/res/layout/toast_view.xml @@ -4,11 +4,15 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" + android:background="@drawable/toast_background" android:layout_height="match_parent"> - From 33d00610716d27338a835bcd6360a10dc6b3184b Mon Sep 17 00:00:00 2001 From: klikooo Date: Wed, 28 Jun 2017 11:03:43 +0200 Subject: [PATCH 05/12] Connect to ePassportChain --- .../digitalvotingpass/blockchain/BlockChain.java | 16 ++++++++-------- app/src/main/res/values-nl/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java b/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java index 19615a0..db32720 100644 --- a/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java +++ b/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java @@ -38,24 +38,24 @@ import java.util.Map; public class BlockChain { - public static final String PEER_IP = "188.226.149.56"; + public static final String PEER_IP = "188.166.14.201"; private static BlockChain instance; private WalletAppKit kit; private Context context; private ProgressTracker progressTracker; private InetAddress peeraddr; - private long addressChecksum = 0xcc350cafL; - private String[] version = {"00", "62", "8f", "ed"}; + private long addressChecksum = 0xb6b31b44L; + private String[] version = {"00", "69", "fc", "95"}; final NetworkParameters params = MultiChainParams.get( - "00d7fa1a62c5f1eadd434b9f7a8a657a42bd895f160511af6de2d2cd690319b8", - "01000000000000000000000000000000000000000000000000000000000000000000000059c075b5dd26a328e185333ce1464b7279d476fbe901c38a003e694906e01c073b633559ffff0020ae0000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1704ffff002001040f4d756c7469436861696e20766f7465ffffffff0200000000000000002f76a91474f585ec0e5f452a80af1e059b9d5079ec501d5588ac1473706b703731000000000000ffffffff3b633559750000000000000000131073706b6e0200040101000104726f6f74756a00000000", - 6799, + "007c7ae31640a81e092921211a371e039dad1999f280b570ea264bc42eb09df1", + "0100000000000000000000000000000000000000000000000000000000000000000000009c65dfd6ace61ebc96a4c4c5f2263a9d343d4ea412fc659f83dc6515befcb00c65615359ffff00202f0000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1604ffff002001040e6550617373706f7274436861696effffffff0200000000000000002f76a914a7d204562402112cec85cffbad8419934b86f3a988ac1473706b703731000000000000ffffffff65615359750000000000000000131073706b6e0200040101000104726f6f74756a00000000", + 6747, Integer.parseInt(Arrays.toString(version).replaceAll(", |\\[|\\]", ""), 16), addressChecksum, - 0xf5dec1feL + 0xf3e9ecf0L ); - private Address masterAddress = Address.fromBase58(params, "1GoqgbPZUV2yuPZXohtAvB2NZbjcew8Rk93mMn"); + private Address masterAddress = Address.fromBase58(params, "1PgYKBGnDp3UHBcojWwzSTu7PLyAWgvpKpqjM7"); private BlockChain(Context ctx) { this.context = ctx; diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 4bcd207..87ced9b 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -126,6 +126,6 @@ %1$d stempas verzonden \n%2$s %3$s Naar %s - 1GoqgbPZUV2yuPZXohtAvB2NZbjcew8Rk93mMn|Overheid + 1PgYKBGnDp3UHBcojWwzSTu7PLyAWgvpKpqjM7|Overheid diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 31366e2..f393f62 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -127,7 +127,7 @@ Sent %1$d vote \n%2$s %3$s To %s - 1GoqgbPZUV2yuPZXohtAvB2NZbjcew8Rk93mMn|Government + 1PgYKBGnDp3UHBcojWwzSTu7PLyAWgvpKpqjM7|Government com.digitalvotingpass.ELECTION_OBJECT_KEY From 85c537e82a7fb4e10aa207dc031c15d1a6680e0e Mon Sep 17 00:00:00 2001 From: klikooo Date: Wed, 28 Jun 2017 11:09:37 +0200 Subject: [PATCH 06/12] Fix a test --- .../digitalvotingpass/digitalvotingpass/TestElectionChoice.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/androidTest/java/com/digitalvotingpass/digitalvotingpass/TestElectionChoice.java b/app/src/androidTest/java/com/digitalvotingpass/digitalvotingpass/TestElectionChoice.java index 5aeb891..c512d83 100644 --- a/app/src/androidTest/java/com/digitalvotingpass/digitalvotingpass/TestElectionChoice.java +++ b/app/src/androidTest/java/com/digitalvotingpass/digitalvotingpass/TestElectionChoice.java @@ -93,7 +93,7 @@ public void atElectionActivity() throws Exception { onView(withId(R.id.app_bar)).check(new ViewAssertion() { @Override public void check(View view, NoMatchingViewException noViewFoundException) { - assertEquals(((Toolbar) view).getTitle(), "Choose election"); + assertEquals(((Toolbar) view).getTitle(), electionActivity.getString(R.string.election_choice)); } }); } From a92104f8c82140bc7c2d36e25d19cbf3f1bb21ca Mon Sep 17 00:00:00 2001 From: klikooo Date: Wed, 28 Jun 2017 11:38:50 +0200 Subject: [PATCH 07/12] Add/change some string translations --- app/src/main/res/values-nl/strings.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 87ced9b..609a14b 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -80,13 +80,14 @@ Stempassen gevonden, kies verzilveren - Stempas succesvol verzilverd, %1$d stembiljet uitrijken. - Stempassen succesvol verzilverd, %1$d stembiljetten uitrijken. + Stempas succesvol verzilverd, overhandig %1$d stembiljet. + Stempassen succesvol verzilverd, overhandig %1$d stembiljetten. Wachten op bevestiging. Dit reisdocument is niet geregistreerd als digitale stempas. %s heeft recht op: + Overhandig %s Stembiljet Stembiljet From 2e48c402007d4eafe2e4cbaa8c4830aa8d7cb51a Mon Sep 17 00:00:00 2001 From: klikooo Date: Wed, 28 Jun 2017 12:08:30 +0200 Subject: [PATCH 08/12] Use other walletfile --- .../main/java/com/digitalvotingpass/blockchain/BlockChain.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java b/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java index db32720..b1dfdad 100644 --- a/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java +++ b/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java @@ -93,7 +93,7 @@ public void removeListener(BlockchainCallBackListener listener) { public void startDownload() { BriefLogFormatter.init(); - String filePrefix = "voting-wallet"; + String filePrefix = "ePassportChain"; File walletFile = new File(Environment.getExternalStorageDirectory() + "/" + Util.FOLDER_DIGITAL_VOTING_PASS); if (!walletFile.exists()) { walletFile.mkdirs(); From e407ace9f1c284a8bc7d30445ef14567678d701c Mon Sep 17 00:00:00 2001 From: Jonathan Raes Date: Wed, 28 Jun 2017 13:50:10 +0200 Subject: [PATCH 09/12] fixed toast bg + fixed primary colors --- app/src/main/res/drawable/toast_background.xml | 2 +- app/src/main/res/values/colors.xml | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/drawable/toast_background.xml b/app/src/main/res/drawable/toast_background.xml index 0456672..662c983 100644 --- a/app/src/main/res/drawable/toast_background.xml +++ b/app/src/main/res/drawable/toast_background.xml @@ -5,5 +5,5 @@ android:radius="10dp" /> + android:color="@color/dark_grey" /> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 11eeb9a..85345cd 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,7 +1,7 @@ - #3f51b5 - #303F9F + @color/govDarkBlue + @color/govDarkBlue #ff4081 #a0ffffff @@ -10,6 +10,7 @@ #a0f88938 #a0acacac + #a0282828 #00ff00 #ffffff #00000000 From 87accb854297ff2c63572936b0950ce4a9728337 Mon Sep 17 00:00:00 2001 From: Jonathan Raes Date: Wed, 28 Jun 2017 15:27:23 +0200 Subject: [PATCH 10/12] fix bottom margin set to overlay --- .../com/digitalvotingpass/camera/CameraFragment.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java b/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java index 6069369..be8de9f 100644 --- a/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java +++ b/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java @@ -73,7 +73,15 @@ public void run() { @Override public void run() { manualInput.setVisibility(View.VISIBLE); - overlay.setMargins(0,0,0,infoText.getHeight() + manualInput.getHeight()); + //Add layout listener to update overlay margin when the button has become visible + //If we call setMargins immediately the button is not yet visible and margin will be wrong + manualInput.addOnLayoutChangeListener(new View.OnLayoutChangeListener() { + @Override + public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) { + overlay.setMargins(0, 0, 0, controlPanel.getHeight()); + manualInput.removeOnLayoutChangeListener(this); + } + }); } }); } From dafb692a23f1010589447bfafcf568996a3c6076 Mon Sep 17 00:00:00 2001 From: Jonathan Raes Date: Wed, 28 Jun 2017 15:41:18 +0200 Subject: [PATCH 11/12] remove hardcoded font string duplication --- .../digitalvotingpass/camera/CameraFragment.java | 3 ++- .../digitalvotingpass/MainActivity.java | 2 +- .../digitalvotingpass/ManualInputActivity.java | 4 ++-- .../digitalvotingpass/ResultActivity.java | 2 +- .../digitalvotingpass/SplashActivity.java | 2 +- .../electionchoice/ElectionsAdapter.java | 3 ++- .../passportconnection/PassportConActivity.java | 2 +- .../TransactionHistoryActivity.java | 2 +- .../transactionhistory/TransactionsAdapter.java | 3 ++- .../java/com/digitalvotingpass/utilities/Util.java | 13 +++++++++++-- 10 files changed, 24 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java b/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java index 6069369..3eeec16 100644 --- a/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java +++ b/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java @@ -53,6 +53,7 @@ import com.digitalvotingpass.ocrscanner.Mrz; import com.digitalvotingpass.ocrscanner.TesseractOCR; import com.digitalvotingpass.utilities.ErrorDialog; +import com.digitalvotingpass.utilities.Util; import java.util.ArrayList; import java.util.List; @@ -210,7 +211,7 @@ public void onClick(View v) { }); infoText = (TextView) view.findViewById(R.id.info_text); - Typeface typeFace= Typeface.createFromAsset(getActivity().getAssets(), "fonts/ro.ttf"); + Typeface typeFace = Util.getMainFont(getActivity().getAssets()); infoText.setTypeface(typeFace); manualInput.setTypeface(typeFace); controlPanel = view.findViewById(R.id.control); diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java index 48441b7..6e34310 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java @@ -61,7 +61,7 @@ public void onClick(View v) { startActivityForResult(intent, GET_DOC_INFO); } }); - typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + typeFace = Util.getMainFont(getAssets()); manualInput.setTypeface(typeFace); startOCR.setTypeface(typeFace); ((TextView)findViewById(R.id.divider)).setTypeface(typeFace); diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java index 904d82e..dd1d739 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java @@ -210,12 +210,12 @@ private class ArrayAdapter extends android.widget.ArrayAdapter { public ArrayAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull T[] objects) { super(context, resource, objects); - typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + typeFace = Util.getMainFont(getAssets()); } public ArrayAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull List objects) { super(context, resource, objects); - typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + typeFace = Util.getMainFont(getAssets()); } public View getView(int position, View convertView, ViewGroup parent) { diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java index 8724a51..402f7d7 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java @@ -97,7 +97,7 @@ protected void onCreate(Bundle savedInstanceState) { butTransactionHistory = (Button) findViewById(R.id.transactionHistory); butProceed = (Button) findViewById(R.id.proceed); - typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + typeFace = Util.getMainFont(getAssets()); textVoterName.setTypeface(typeFace); textVotingPassAmount.setTypeface(typeFace); textVotingPasses.setTypeface(typeFace); diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java index 79edba2..0cf7fe1 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java @@ -82,7 +82,7 @@ public void onCreate(Bundle savedInstanceState) { currentTask = (TextView) findViewById(R.id.progress_current_task); downloadProgressBar = (ProgressBar) findViewById(R.id.download_progress_bar); - typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + typeFace = Util.getMainFont(getAssets()); downloadProgressText.setTypeface(typeFace); currentTask.setTypeface(typeFace); ((TextView) findViewById(R.id.text_splash_screen)).setTypeface(typeFace); diff --git a/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java b/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java index e027989..4618954 100644 --- a/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java +++ b/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java @@ -11,6 +11,7 @@ import android.widget.TextView; import com.digitalvotingpass.digitalvotingpass.R; +import com.digitalvotingpass.utilities.Util; import java.util.ArrayList; import java.util.List; @@ -80,7 +81,7 @@ public View getView(int position, View convertView, ViewGroup parent) { TextView place = (TextView) convertView.findViewById(R.id.place); // Populate the data into the template view using the data object - Typeface typeFace = Typeface.createFromAsset(convertView.getContext().getAssets(), "fonts/ro.ttf"); + Typeface typeFace = Util.getMainFont(convertView.getContext().getAssets()); kind.setTypeface(typeFace); place.setTypeface(typeFace); diff --git a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java index 8732bed..1923977 100644 --- a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java +++ b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java @@ -73,7 +73,7 @@ protected void onCreate(Bundle savedInstanceState) { checkNFCStatus(); notice.setText(R.string.nfc_enabled); - typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + typeFace = Util.getMainFont(getAssets()); notice.setTypeface(typeFace); } diff --git a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java index 4870a73..b367712 100644 --- a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java +++ b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java @@ -85,7 +85,7 @@ protected void onCreate(Bundle savedInstanceState) { adapter = new TransactionsAdapter(this, transactionHistory); transactionList.setAdapter(adapter); - Typeface typeFace = Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + Typeface typeFace = Util.getMainFont(getAssets()); ((TextView)findViewById(R.id.no_transactions_text)).setTypeface(typeFace); // Load transactions in separate thread since this can take a while. diff --git a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java index d49947e..597fa8d 100644 --- a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java +++ b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java @@ -10,6 +10,7 @@ import android.widget.TextView; import com.digitalvotingpass.digitalvotingpass.R; +import com.digitalvotingpass.utilities.Util; import java.util.List; @@ -32,7 +33,7 @@ public View getView(int position, View convertView, @NonNull ViewGroup parent) { } if (transactionHistoryItem != null) { // Lookup view for data population - Typeface typeFace = Typeface.createFromAsset(getContext().getAssets(), "fonts/ro.ttf"); + Typeface typeFace = Util.getMainFont(getContext().getAssets()); TextView title = (TextView) convertView.findViewById(R.id.title); TextView time = (TextView) convertView.findViewById(R.id.time); TextView details = (TextView) convertView.findViewById(R.id.details); diff --git a/app/src/main/java/com/digitalvotingpass/utilities/Util.java b/app/src/main/java/com/digitalvotingpass/utilities/Util.java index 992aaf8..2f9afd1 100644 --- a/app/src/main/java/com/digitalvotingpass/utilities/Util.java +++ b/app/src/main/java/com/digitalvotingpass/utilities/Util.java @@ -2,6 +2,7 @@ import android.app.Activity; import android.content.Context; +import android.content.res.AssetManager; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Typeface; @@ -15,6 +16,8 @@ import com.digitalvotingpass.digitalvotingpass.R; import com.readystatesoftware.systembartint.SystemBarTintManager; +import org.bitcoinj.core.Asset; + import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -25,9 +28,15 @@ public class Util { - public static final String FOLDER_DIGITAL_VOTING_PASS = "DigitalVotingPass"; + public static final String FONT_LOCATION = "fonts/ro.ttf"; + private static Typeface typeFace; + public static Typeface getMainFont(AssetManager assets) { + if (typeFace == null) + typeFace = Typeface.createFromAsset(assets, FONT_LOCATION); + return typeFace; + } /** * Returns the height of the status bar in pixels @@ -56,7 +65,7 @@ public static int getStatusBarHeight(Resources resources) { public static void setupAppBar(Toolbar appBar, Activity activity) { appBar.setPadding(0, getStatusBarHeight(activity.getResources()), 0, 0); - Typeface typeFace= Typeface.createFromAsset(activity.getAssets(), "fonts/ro.ttf"); + Typeface typeFace= Util.getMainFont(activity.getAssets()); SpannableStringBuilder s = new SpannableStringBuilder(activity.getTitle()); s.setSpan (new CustomTypefaceSpan("", typeFace), 0, s.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); appBar.setTitle(s); From d9ccb9963f2cdcdb9192234ce106432d6aa71675 Mon Sep 17 00:00:00 2001 From: Daan Middendorp Date: Thu, 29 Jun 2017 00:23:45 +0200 Subject: [PATCH 12/12] Revert "use ro.ttf font everywhere" --- app/src/main/AndroidManifest.xml | 5 +- .../blockchain/BlockChain.java | 1 + .../blockchain/ProgressTracker.java | 3 + .../camera/CameraFragment.java | 3 +- .../digitalvotingpass/MainActivity.java | 36 +++--------- .../ManualInputActivity.java | 56 ++++--------------- .../digitalvotingpass/ResultActivity.java | 22 +------- .../digitalvotingpass/SplashActivity.java | 41 +++++--------- .../electionchoice/ElectionsAdapter.java | 7 --- .../PassportConActivity.java | 55 +++++------------- .../TransactionHistoryActivity.java | 16 +----- .../TransactionsAdapter.java | 8 --- .../utilities/CustomTypefaceSpan.java | 49 ---------------- .../com/digitalvotingpass/utilities/Util.java | 22 +------- .../main/res/drawable/toast_background.xml | 9 --- .../res/layout/activity_splash_screen.xml | 1 + .../layout/activity_transaction_history.xml | 1 - app/src/main/res/layout/toast_view.xml | 18 ------ app/src/main/res/values/colors.xml | 5 +- .../PassportTransactionFormatterTest.java | 1 + 20 files changed, 68 insertions(+), 291 deletions(-) delete mode 100644 app/src/main/java/com/digitalvotingpass/utilities/CustomTypefaceSpan.java delete mode 100644 app/src/main/res/drawable/toast_background.xml delete mode 100644 app/src/main/res/layout/toast_view.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0e47a03..f4cbd9d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -35,9 +35,8 @@ - + diff --git a/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java b/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java index aa971ec..b1dfdad 100644 --- a/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java +++ b/app/src/main/java/com/digitalvotingpass/blockchain/BlockChain.java @@ -11,6 +11,7 @@ import com.digitalvotingpass.utilities.MultiChainAddressGenerator; import com.digitalvotingpass.utilities.Util; import com.google.common.util.concurrent.MoreExecutors; +import com.google.common.util.concurrent.Service; import org.bitcoinj.core.Address; import org.bitcoinj.core.Asset; diff --git a/app/src/main/java/com/digitalvotingpass/blockchain/ProgressTracker.java b/app/src/main/java/com/digitalvotingpass/blockchain/ProgressTracker.java index eff0d06..f07f995 100644 --- a/app/src/main/java/com/digitalvotingpass/blockchain/ProgressTracker.java +++ b/app/src/main/java/com/digitalvotingpass/blockchain/ProgressTracker.java @@ -1,5 +1,8 @@ package com.digitalvotingpass.blockchain; +import android.util.Log; + +import org.bitcoinj.core.Peer; import org.bitcoinj.core.listeners.DownloadProgressTracker; import java.util.ArrayList; diff --git a/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java b/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java index e3130cc..be8de9f 100644 --- a/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java +++ b/app/src/main/java/com/digitalvotingpass/camera/CameraFragment.java @@ -53,7 +53,6 @@ import com.digitalvotingpass.ocrscanner.Mrz; import com.digitalvotingpass.ocrscanner.TesseractOCR; import com.digitalvotingpass.utilities.ErrorDialog; -import com.digitalvotingpass.utilities.Util; import java.util.ArrayList; import java.util.List; @@ -219,7 +218,7 @@ public void onClick(View v) { }); infoText = (TextView) view.findViewById(R.id.info_text); - Typeface typeFace = Util.getMainFont(getActivity().getAssets()); + Typeface typeFace= Typeface.createFromAsset(getActivity().getAssets(), "fonts/ro.ttf"); infoText.setTypeface(typeFace); manualInput.setTypeface(typeFace); controlPanel = view.findViewById(R.id.control); diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java index 6e34310..b787995 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/MainActivity.java @@ -3,23 +3,18 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.graphics.Typeface; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; -import android.text.SpannableStringBuilder; -import android.text.Spanned; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; -import android.widget.TextView; import com.digitalvotingpass.camera.CameraActivity; import com.digitalvotingpass.electionchoice.Election; import com.digitalvotingpass.electionchoice.ElectionChoiceActivity; import com.digitalvotingpass.passportconnection.PassportConActivity; -import com.digitalvotingpass.utilities.CustomTypefaceSpan; import com.digitalvotingpass.utilities.Util; import com.google.gson.Gson; @@ -31,7 +26,6 @@ public class MainActivity extends AppCompatActivity { private Button manualInput; private Button startOCR; - private Typeface typeFace; public static final int GET_DOC_INFO = 1; public static final int CHOOSE_ELECTION = 2; @@ -42,6 +36,12 @@ protected void onCreate(Bundle savedInstanceState) { final MainActivity thisActivity = this; setContentView(R.layout.activity_main); + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); + + // set the text of the appbar to the selected election + setElectionInAppBar(); manualInput = (Button) findViewById(R.id.manual_input_button); manualInput.setOnClickListener(new View.OnClickListener() { @@ -61,20 +61,6 @@ public void onClick(View v) { startActivityForResult(intent, GET_DOC_INFO); } }); - typeFace = Util.getMainFont(getAssets()); - manualInput.setTypeface(typeFace); - startOCR.setTypeface(typeFace); - ((TextView)findViewById(R.id.divider)).setTypeface(typeFace); - } - - @Override - protected void onResume() { - super.onResume(); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); - // set the text of the appbar to the selected election - setElectionInAppBar(); } /** @@ -109,6 +95,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // Check if we got documentdata and set the documentData attribute if(requestCode == GET_DOC_INFO && resultCode == RESULT_OK) { + documentData = (DocumentData) data.getExtras().get(DocumentData.identifier); Intent intent = new Intent(this, PassportConActivity.class); intent.putExtra(DocumentData.identifier, documentData); @@ -131,13 +118,8 @@ public void setElectionInAppBar() { election = gson.fromJson(json, Election.class); if(election != null && getSupportActionBar() != null) { - SpannableStringBuilder title = new SpannableStringBuilder(election.getKind()); - title.setSpan (new CustomTypefaceSpan("", typeFace), 0, title.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); - SpannableStringBuilder subtitle = new SpannableStringBuilder(election.getPlace()); - subtitle.setSpan (new CustomTypefaceSpan("", typeFace), 0, subtitle.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); - - getSupportActionBar().setTitle(title); - getSupportActionBar().setSubtitle(subtitle); + getSupportActionBar().setTitle(election.getKind()); + getSupportActionBar().setSubtitle(election.getPlace()); } } diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java index dd1d739..9940de2 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ManualInputActivity.java @@ -1,16 +1,13 @@ package com.digitalvotingpass.digitalvotingpass; import android.app.Activity; -import android.content.Context; import android.content.Intent; import android.graphics.Typeface; import android.os.Bundle; -import android.support.annotation.LayoutRes; -import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; -import android.view.ViewGroup; +import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; @@ -42,8 +39,11 @@ public class ManualInputActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_manual_input); - + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); Typeface typeFace= Typeface.createFromAsset(getAssets(), "fonts/ro.ttf"); + docNumber = (EditText) findViewById(R.id.doc_num); docNumber.setTypeface(typeFace); TextView docNumTitle = (TextView) findViewById(R.id.doc_num_title); @@ -54,7 +54,6 @@ protected void onCreate(Bundle savedInstanceState) { expDateTitle.setTypeface(typeFace); Button submitBut = (Button) findViewById(R.id.submit_button); - submitBut.setTypeface(typeFace); submitBut.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -75,14 +74,6 @@ public void onClick(View view) { } } - @Override - protected void onResume() { - super.onResume(); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); - } - private void setupExpirySpinners() { expiryDaySpinner = (Spinner) findViewById(R.id.expiry_day_spinner); expiryMonthSpinner = (Spinner) findViewById(R.id.expiry_month_spinner); @@ -94,14 +85,13 @@ private void setupExpirySpinners() { } // Leave the default view (android.R.layout.simple_spinner_item) but set custom view for dropdown to add extra padding - ArrayAdapter dayAdapter = new ArrayAdapter(this, + ArrayAdapter dayAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, days); - dayAdapter.setDropDownViewResource(R.layout.spinner_dropdown); expiryDaySpinner.setAdapter(dayAdapter); - final CharSequence[] strings = getApplicationContext().getResources().getTextArray(R.array.months_array); - ArrayAdapter monthAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, strings); + ArrayAdapter monthAdapter = ArrayAdapter.createFromResource(this, + R.array.months_array, android.R.layout.simple_spinner_item); monthAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); expiryMonthSpinner.setAdapter(monthAdapter); @@ -130,8 +120,8 @@ private void setupDOBSpinners () { dayAdapter.setDropDownViewResource(R.layout.spinner_dropdown); dobDaySpinner.setAdapter(dayAdapter); - final CharSequence[] strings = getApplicationContext().getResources().getTextArray(R.array.months_array); - ArrayAdapter monthAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, strings); + ArrayAdapter monthAdapter = ArrayAdapter.createFromResource(this, + R.array.months_array, android.R.layout.simple_spinner_item); monthAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); dobMonthSpinner.setAdapter(monthAdapter); @@ -204,30 +194,4 @@ public boolean verifyInput() { return valid; } - private class ArrayAdapter extends android.widget.ArrayAdapter { - - Typeface typeFace; - - public ArrayAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull T[] objects) { - super(context, resource, objects); - typeFace = Util.getMainFont(getAssets()); - } - - public ArrayAdapter(@NonNull Context context, @LayoutRes int resource, @NonNull List objects) { - super(context, resource, objects); - typeFace = Util.getMainFont(getAssets()); - } - - public View getView(int position, View convertView, ViewGroup parent) { - View v = super.getView(position, convertView, parent); - ((TextView) v).setTypeface(typeFace); - return v; - } - - public View getDropDownView(int position, View convertView, ViewGroup parent) { - View v =super.getDropDownView(position, convertView, parent); - ((TextView) v).setTypeface(typeFace); - return v; - } - } } diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java index 402f7d7..1e145b5 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/ResultActivity.java @@ -3,7 +3,6 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.graphics.Typeface; import android.os.Bundle; import android.support.design.widget.CoordinatorLayout; import android.support.v7.app.AppCompatActivity; @@ -39,7 +38,6 @@ public class ResultActivity extends AppCompatActivity { private Button butTransactionHistory; private Button butProceed; private MenuItem cancelAction; - private Typeface typeFace; private int authorizationState = 1; private final int FAILED = 0; @@ -91,19 +89,15 @@ protected void onCreate(Bundle savedInstanceState) { signedTransactions = (ArrayList) extras.get("signedTransactions"); setContentView(R.layout.activity_result); + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); textVoterName = (TextView) findViewById(R.id.voter_name); textVotingPassAmount = (TextView) findViewById(R.id.voting_pass_amount); textVotingPasses = (TextView) findViewById(R.id.voting_passes); butTransactionHistory = (Button) findViewById(R.id.transactionHistory); butProceed = (Button) findViewById(R.id.proceed); - typeFace = Util.getMainFont(getAssets()); - textVoterName.setTypeface(typeFace); - textVotingPassAmount.setTypeface(typeFace); - textVotingPasses.setTypeface(typeFace); - butTransactionHistory.setTypeface(typeFace); - butProceed.setTypeface(typeFace); - butTransactionHistory.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { @@ -121,15 +115,6 @@ public void onClick(View v) { }); } - @Override - protected void onResume() { - super.onResume(); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); - // set the text of the appbar to the selected election - } - /** * Set the result_menu setup to the app bar. */ @@ -164,7 +149,6 @@ private void showSnack(CharSequence text, int backgroundColor, int textColor) { TextView textView = (TextView) snackbarView.findViewById(com.androidadvance.topsnackbar.R.id.snackbar_text); textView.setTextColor(getResources().getColor(textColor)); textView.setGravity(Gravity.CENTER_HORIZONTAL); - textView.setTypeface(typeFace); snack.show(); diff --git a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java index 0cf7fe1..233e943 100644 --- a/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java +++ b/app/src/main/java/com/digitalvotingpass/digitalvotingpass/SplashActivity.java @@ -6,24 +6,26 @@ import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageManager; -import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; +import android.os.HandlerThread; import android.provider.Settings; import android.support.annotation.NonNull; import android.support.design.widget.Snackbar; import android.support.v13.app.ActivityCompat; import android.support.v4.content.ContextCompat; +import android.util.Log; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; +import android.widget.Toast; import com.digitalvotingpass.blockchain.BlockChain; import com.digitalvotingpass.blockchain.BlockchainCallBackListener; import com.digitalvotingpass.electionchoice.Election; import com.digitalvotingpass.electionchoice.ElectionChoiceActivity; -import com.digitalvotingpass.utilities.ErrorDialog; import com.digitalvotingpass.utilities.Util; +import com.digitalvotingpass.utilities.ErrorDialog; import com.google.gson.Gson; import java.text.DecimalFormat; @@ -40,7 +42,6 @@ public class SplashActivity extends Activity implements BlockchainCallBackListen private Handler handler; private Handler initTextHandler; private BlockChain blockChain; - private Typeface typeFace; DecimalFormat percentFormatter = new DecimalFormat("##0.0"); @@ -82,11 +83,6 @@ public void onCreate(Bundle savedInstanceState) { currentTask = (TextView) findViewById(R.id.progress_current_task); downloadProgressBar = (ProgressBar) findViewById(R.id.download_progress_bar); - typeFace = Util.getMainFont(getAssets()); - downloadProgressText.setTypeface(typeFace); - currentTask.setTypeface(typeFace); - ((TextView) findViewById(R.id.text_splash_screen)).setTypeface(typeFace); - if (savedInstanceState == null) { try { blockChain = BlockChain.getInstance(getApplicationContext()); @@ -112,28 +108,21 @@ public void onWindowFocusChanged(boolean hasFocus) { currentTask.setText(getString(R.string.no_connection)); if (!Util.isNetEnabled(getApplicationContext())) { - showSnackbar(); + View.OnClickListener inputSnackbarListener = new View.OnClickListener() { + @Override + public void onClick(View v) { + startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); + } + }; + + Snackbar snackbar = Snackbar.make(findViewById(R.id.splash_screen_layout), getString(R.string.please_enable_connect_message), Snackbar.LENGTH_INDEFINITE); + snackbar.getView().setBackgroundColor(ContextCompat.getColor(this, R.color.redFailed)); + snackbar.setAction(R.string.go_network_settings, inputSnackbarListener); + snackbar.show(); } } } - public void showSnackbar() { - View.OnClickListener inputSnackbarListener = new View.OnClickListener() { - @Override - public void onClick(View v) { - startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)); - } - }; - Snackbar snackbar = Snackbar.make(findViewById(R.id.splash_screen_layout), getString(R.string.please_enable_connect_message), Snackbar.LENGTH_INDEFINITE); - snackbar.getView().setBackgroundColor(ContextCompat.getColor(this, R.color.redFailed)); - TextView textView = (TextView) (snackbar.getView()).findViewById(android.support.design.R.id.snackbar_text); - TextView actionTextView = (TextView) (snackbar.getView()).findViewById(android.support.design.R.id.snackbar_action); - textView.setTypeface(typeFace); - actionTextView.setTypeface(typeFace); - snackbar.setAction(R.string.go_network_settings, inputSnackbarListener); - snackbar.show(); - } - @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { diff --git a/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java b/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java index 4618954..e73a8be 100644 --- a/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java +++ b/app/src/main/java/com/digitalvotingpass/electionchoice/ElectionsAdapter.java @@ -1,7 +1,6 @@ package com.digitalvotingpass.electionchoice; import android.content.Context; -import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -11,7 +10,6 @@ import android.widget.TextView; import com.digitalvotingpass.digitalvotingpass.R; -import com.digitalvotingpass.utilities.Util; import java.util.ArrayList; import java.util.List; @@ -80,11 +78,6 @@ public View getView(int position, View convertView, ViewGroup parent) { TextView kind = (TextView) convertView.findViewById(R.id.kind); TextView place = (TextView) convertView.findViewById(R.id.place); // Populate the data into the template view using the data object - - Typeface typeFace = Util.getMainFont(convertView.getContext().getAssets()); - kind.setTypeface(typeFace); - place.setTypeface(typeFace); - kind.setText(election.kind); place.setText(election.place); diff --git a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java index 1923977..fc8179c 100644 --- a/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java +++ b/app/src/main/java/com/digitalvotingpass/passportconnection/PassportConActivity.java @@ -6,7 +6,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; -import android.graphics.Typeface; import android.nfc.NfcAdapter; import android.nfc.Tag; import android.os.Bundle; @@ -14,9 +13,7 @@ import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; -import android.view.LayoutInflater; import android.view.View; -import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; @@ -34,7 +31,6 @@ import org.bitcoinj.core.AssetBalance; import org.jmrtd.PassportService; - import java.security.PublicKey; import java.security.Security; import java.util.ArrayList; @@ -47,8 +43,6 @@ public class PassportConActivity extends AppCompatActivity { // Adapter for NFC connection private NfcAdapter mNfcAdapter; private DocumentData documentData; - private Typeface typeFace; - private ImageView progressView; private PassportConActivity thisActivity; @@ -66,15 +60,15 @@ protected void onCreate(Bundle savedInstanceState) { thisActivity = this; setContentView(R.layout.activity_passport_con); + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); TextView notice = (TextView) findViewById(R.id.notice); progressView = (ImageView) findViewById(R.id.progress_view); mNfcAdapter = NfcAdapter.getDefaultAdapter(this); checkNFCStatus(); notice.setText(R.string.nfc_enabled); - - typeFace = Util.getMainFont(getAssets()); - notice.setTypeface(typeFace); } /** @@ -85,9 +79,6 @@ protected void onCreate(Bundle savedInstanceState) { @Override protected void onResume() { super.onResume(); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); // It's important, that the activity is in the foreground (resumed). Otherwise an IllegalStateException is thrown. setupForegroundDispatch(this, mNfcAdapter); checkNFCStatus(); @@ -214,10 +205,10 @@ public void handleConnectionFailed(Exception e) { displayCheckInputSnackbar(); progressView.setImageResource(R.drawable.nfc_icon_empty); } else if(e.toString().toLowerCase().contains("tag was lost")) { - displayToast(getString(R.string.NFC_error)); + Toast.makeText(this, getString(R.string.NFC_error), Toast.LENGTH_LONG).show(); progressView.setImageResource(R.drawable.nfc_icon_empty); } else { - displayToast(getString(R.string.general_error)); + Toast.makeText(this, getString(R.string.general_error), Toast.LENGTH_LONG).show(); progressView.setImageResource(R.drawable.nfc_icon_empty); } } @@ -239,7 +230,7 @@ public void startResultActivity(PublicKey pubKey, ArrayList signedTransa startActivity(intent); finish(); } else { - displayToast(getString(R.string.NFC_error)); + Toast.makeText(this, getString(R.string.NFC_error), Toast.LENGTH_LONG).show(); progressView.setImageResource(R.drawable.nfc_icon_empty); } } @@ -252,7 +243,7 @@ public void startResultActivity(PublicKey pubKey, ArrayList signedTransa public void checkNFCStatus() { if (mNfcAdapter == null) { // Stop here, we definitely need NFC - displayToast(getString(R.string.nfc_not_supported_error)); + Toast.makeText(this, R.string.nfc_not_supported_error, Toast.LENGTH_LONG).show(); finish(); return; } @@ -266,7 +257,10 @@ public void onClick(View v) { } }; - displaySnackbar(getString(R.string.nfc_disabled_error_snackbar), R.string.nfc_disabled_snackbar_action, nfcSnackbarListener); + Snackbar nfcDisabledSnackbar = Snackbar.make(findViewById(R.id.coordinator_layout), + R.string.nfc_disabled_error_snackbar, Snackbar.LENGTH_INDEFINITE); + nfcDisabledSnackbar.setAction(R.string.nfc_disabled_snackbar_action, nfcSnackbarListener); + nfcDisabledSnackbar.show(); } } @@ -284,30 +278,11 @@ public void onClick(View v) { startActivityForResult(intent, MainActivity.GET_DOC_INFO); } }; - displaySnackbar(getString(R.string.wrong_document_details), R.string.check_input, inputSnackbarListener); - } - - public void displaySnackbar(String text, int actionString, View.OnClickListener listener) { - Snackbar snackbar = Snackbar.make(findViewById(R.id.coordinator_layout), - text, Snackbar.LENGTH_INDEFINITE); - TextView textView = (TextView) (snackbar.getView()).findViewById(android.support.design.R.id.snackbar_text); - TextView actionTextView = (TextView) (snackbar.getView()).findViewById(android.support.design.R.id.snackbar_action); - textView.setTypeface(typeFace); - actionTextView.setTypeface(typeFace); - snackbar.setAction(actionString, listener); - snackbar.show(); - } - public void displayToast(String text) { - LayoutInflater inflater = getLayoutInflater(); - View layout = inflater.inflate(R.layout.toast_view, - (ViewGroup) findViewById(R.id.custom_toast_container)); - Toast toast = new Toast(getApplicationContext()); - toast.setView(layout); - TextView textView = (TextView) layout.findViewById(R.id.text); - textView.setTypeface(typeFace); - textView.setText(text); - toast.show(); + Snackbar inputSnackbar = Snackbar.make(findViewById(R.id.coordinator_layout), + R.string.wrong_document_details, Snackbar.LENGTH_INDEFINITE); + inputSnackbar.setAction(R.string.check_input, inputSnackbarListener); + inputSnackbar.show(); } /** diff --git a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java index b367712..db5a535 100644 --- a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java +++ b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionHistoryActivity.java @@ -4,7 +4,6 @@ import android.content.ClipboardManager; import android.content.Context; import android.content.SharedPreferences; -import android.graphics.Typeface; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; @@ -13,7 +12,6 @@ import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.ListView; -import android.widget.TextView; import com.digitalvotingpass.blockchain.BlockChain; import com.digitalvotingpass.digitalvotingpass.R; @@ -78,6 +76,9 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_transaction_history); + Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); + setSupportActionBar(appBar); + Util.setupAppBar(appBar, this); ListView transactionList = (ListView) findViewById(R.id.transaction_list); // create a transaction history array with all the transactions and add them to the list @@ -85,23 +86,12 @@ protected void onCreate(Bundle savedInstanceState) { adapter = new TransactionsAdapter(this, transactionHistory); transactionList.setAdapter(adapter); - Typeface typeFace = Util.getMainFont(getAssets()); - ((TextView)findViewById(R.id.no_transactions_text)).setTypeface(typeFace); - // Load transactions in separate thread since this can take a while. HandlerThread thread = new HandlerThread("transactions"); thread.start(); new Handler(thread.getLooper()).post(loadTransactions); } - @Override - protected void onResume() { - super.onResume(); - Toolbar appBar = (Toolbar) findViewById(R.id.app_bar); - setSupportActionBar(appBar); - Util.setupAppBar(appBar, this); - } - /** * Sets listener on the app bar to copy the address to clipboard. * @param address string diff --git a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java index 597fa8d..b992c61 100644 --- a/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java +++ b/app/src/main/java/com/digitalvotingpass/transactionhistory/TransactionsAdapter.java @@ -1,7 +1,6 @@ package com.digitalvotingpass.transactionhistory; import android.content.Context; -import android.graphics.Typeface; import android.support.annotation.NonNull; import android.view.LayoutInflater; import android.view.View; @@ -10,7 +9,6 @@ import android.widget.TextView; import com.digitalvotingpass.digitalvotingpass.R; -import com.digitalvotingpass.utilities.Util; import java.util.List; @@ -33,15 +31,9 @@ public View getView(int position, View convertView, @NonNull ViewGroup parent) { } if (transactionHistoryItem != null) { // Lookup view for data population - Typeface typeFace = Util.getMainFont(getContext().getAssets()); TextView title = (TextView) convertView.findViewById(R.id.title); TextView time = (TextView) convertView.findViewById(R.id.time); TextView details = (TextView) convertView.findViewById(R.id.details); - - title.setTypeface(typeFace); - time.setTypeface(typeFace); - details.setTypeface(typeFace); - // Populate the data into the template view using the data object title.setText(transactionHistoryItem.title); time.setText(transactionHistoryItem.time.toString()); diff --git a/app/src/main/java/com/digitalvotingpass/utilities/CustomTypefaceSpan.java b/app/src/main/java/com/digitalvotingpass/utilities/CustomTypefaceSpan.java deleted file mode 100644 index d844934..0000000 --- a/app/src/main/java/com/digitalvotingpass/utilities/CustomTypefaceSpan.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.digitalvotingpass.utilities; - -import android.annotation.SuppressLint; -import android.graphics.Paint; -import android.graphics.Typeface; -import android.text.TextPaint; -import android.text.style.TypefaceSpan; - -@SuppressLint("ParcelCreator") -public class CustomTypefaceSpan extends TypefaceSpan { - - private final Typeface newType; - - public CustomTypefaceSpan(String family, Typeface type) { - super(family); - newType = type; - } - - @Override - public void updateDrawState(TextPaint ds) { - applyCustomTypeFace(ds, newType); - } - - @Override - public void updateMeasureState(TextPaint paint) { - applyCustomTypeFace(paint, newType); - } - - private static void applyCustomTypeFace(Paint paint, Typeface tf) { - int oldStyle; - Typeface old = paint.getTypeface(); - if (old == null) { - oldStyle = 0; - } else { - oldStyle = old.getStyle(); - } - - int fake = oldStyle & ~tf.getStyle(); - if ((fake & Typeface.BOLD) != 0) { - paint.setFakeBoldText(true); - } - - if ((fake & Typeface.ITALIC) != 0) { - paint.setTextSkewX(-0.25f); - } - - paint.setTypeface(tf); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/digitalvotingpass/utilities/Util.java b/app/src/main/java/com/digitalvotingpass/utilities/Util.java index 2f9afd1..2608d08 100644 --- a/app/src/main/java/com/digitalvotingpass/utilities/Util.java +++ b/app/src/main/java/com/digitalvotingpass/utilities/Util.java @@ -2,22 +2,16 @@ import android.app.Activity; import android.content.Context; -import android.content.res.AssetManager; import android.content.res.Resources; import android.graphics.Color; -import android.graphics.Typeface; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.support.v7.widget.Toolbar; -import android.text.SpannableStringBuilder; -import android.text.Spanned; import android.util.Log; import com.digitalvotingpass.digitalvotingpass.R; import com.readystatesoftware.systembartint.SystemBarTintManager; -import org.bitcoinj.core.Asset; - import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -28,15 +22,9 @@ public class Util { + public static final String FOLDER_DIGITAL_VOTING_PASS = "DigitalVotingPass"; - public static final String FONT_LOCATION = "fonts/ro.ttf"; - private static Typeface typeFace; - public static Typeface getMainFont(AssetManager assets) { - if (typeFace == null) - typeFace = Typeface.createFromAsset(assets, FONT_LOCATION); - return typeFace; - } /** * Returns the height of the status bar in pixels @@ -56,8 +44,7 @@ public static int getStatusBarHeight(Resources resources) { /** * Sets up a top-padding for the given app bar equal to the height of the status bar. * This increases the length of the app bar so it fits nicely below the status bar. - * This method also sets the status bar transparency. (may not be needed) - * This method also sets the AppBar title to the activity title using the ro.ttf font. + * This method also sets the status bar transparency. * * @param appBar Toolbar to set padding to * @param activity Activity - current activity @@ -65,11 +52,6 @@ public static int getStatusBarHeight(Resources resources) { public static void setupAppBar(Toolbar appBar, Activity activity) { appBar.setPadding(0, getStatusBarHeight(activity.getResources()), 0, 0); - Typeface typeFace= Util.getMainFont(activity.getAssets()); - SpannableStringBuilder s = new SpannableStringBuilder(activity.getTitle()); - s.setSpan (new CustomTypefaceSpan("", typeFace), 0, s.length(), Spanned.SPAN_EXCLUSIVE_INCLUSIVE); - appBar.setTitle(s); - SystemBarTintManager tintManager = new SystemBarTintManager(activity); tintManager.setStatusBarTintEnabled(true); tintManager.setNavigationBarTintEnabled(true); diff --git a/app/src/main/res/drawable/toast_background.xml b/app/src/main/res/drawable/toast_background.xml deleted file mode 100644 index 662c983..0000000 --- a/app/src/main/res/drawable/toast_background.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/app/src/main/res/layout/activity_splash_screen.xml b/app/src/main/res/layout/activity_splash_screen.xml index 0ba6d96..ef29778 100644 --- a/app/src/main/res/layout/activity_splash_screen.xml +++ b/app/src/main/res/layout/activity_splash_screen.xml @@ -1,4 +1,5 @@ - - - - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 85345cd..11eeb9a 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,7 +1,7 @@ - @color/govDarkBlue - @color/govDarkBlue + #3f51b5 + #303F9F #ff4081 #a0ffffff @@ -10,7 +10,6 @@ #a0f88938 #a0acacac - #a0282828 #00ff00 #ffffff #00000000 diff --git a/app/src/test/java/com/digitalvotingpass/passportconnection/PassportTransactionFormatterTest.java b/app/src/test/java/com/digitalvotingpass/passportconnection/PassportTransactionFormatterTest.java index cc04388..dfb9297 100644 --- a/app/src/test/java/com/digitalvotingpass/passportconnection/PassportTransactionFormatterTest.java +++ b/app/src/test/java/com/digitalvotingpass/passportconnection/PassportTransactionFormatterTest.java @@ -7,6 +7,7 @@ import org.bitcoinj.core.Address; import org.bitcoinj.core.Sha256Hash; import org.bitcoinj.core.TransactionOutput; + import org.junit.Before; import org.junit.Rule; import org.junit.Test;