Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/118 pixel polish #156

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,14 @@

public class BlockChain {
public static final String PEER_IP = "188.166.14.201";
public static final String PEER_IP2 = "207.154.243.156";
private static BlockChain instance;
private WalletAppKit kit;
private Context context;
private ProgressTracker progressTracker;

private InetAddress peeraddr;
private InetAddress peeraddr2;
private long addressChecksum = 0xb6b31b44L;
private String[] version = {"00", "69", "fc", "95"};
final NetworkParameters params = MultiChainParams.get(
Expand All @@ -61,6 +63,7 @@ private BlockChain(Context ctx) {
this.context = ctx;
try {
peeraddr = InetAddress.getByName(PEER_IP);
peeraddr2 = InetAddress.getByName(PEER_IP2);
progressTracker = new ProgressTracker();
} catch (UnknownHostException e) {
e.printStackTrace();
Expand Down Expand Up @@ -106,7 +109,8 @@ public void startDownload() {
kit.setBlockingStartup(false);

PeerAddress peer = new PeerAddress(params, peeraddr);
kit.setPeerNodes(peer);
PeerAddress peer2 = new PeerAddress(params, peeraddr2);
kit.setPeerNodes(peer, peer2);
kit.startAsync();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.os.Bundle;
import android.support.design.widget.CoordinatorLayout;
import android.support.v7.app.AppCompatActivity;
Expand Down Expand Up @@ -67,6 +69,9 @@ public void run() {
setAuthorizationStatus(CONFIRMED);
textVoterName.setText(getString(R.string.please_hand, preamble));
textVotingPasses.setText(getResources().getQuantityString(R.plurals.ballot_paper, votingPasses));
butProceed.setEnabled(true);
butProceed.getBackground().setColorFilter(null);
getSupportActionBar().setTitle(getTitle());
}
});
removeAllListeners();
Expand Down Expand Up @@ -231,7 +236,7 @@ private String createPreamble(Voter voter) {
if (gender == Gender.FEMALE || gender == Gender.MALE) {
// Capitalize the first word since this is sometimes van or van de.
String firstWord = Voter.capitalizeFirstLetter(voter.getLastName().split(" ")[0]);
preamble = voter.genderToString() + " " + firstWord + " " + voter.getLastName().substring(firstWord.length());
preamble = voter.getPreAmble();
} else {
preamble = voter.getFirstName() + " " + voter.getLastName();
}
Expand Down Expand Up @@ -286,7 +291,6 @@ public void setAuthorizationStatus(int newState) {
}
break;
case CONFIRMED:
System.out.println("confirmed");
showSnack(
getResources().getQuantityString(R.plurals.authorization_confirmed, votingPasses, votingPasses),
R.color.greenSucces,
Expand Down Expand Up @@ -332,6 +336,8 @@ public void confirmVote() {
this.pendingTransactions = BlockChain.getInstance(null).broadcastTransactions(signedTransactions);
setAuthorizationStatus(this.WAITING);
butProceed.setText(R.string.waiting_confirmation);
butProceed.setEnabled(false);
butProceed.getBackground().setColorFilter(Color.GRAY, PorterDuff.Mode.MULTIPLY);
attachTransactionListeners();
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,9 @@ public void writeToParcel(Parcel parcel, int i) {
parcel.writeStringArray(new String[] { getFirstName(), getLastName() });
parcel.writeInt(getGender().toInt());
}

public String getPreAmble() {
return genderToString() + " " + capitalizeFirstLetter(lastName);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ private void saveElection(Election election) {
public ArrayList<Election> loadElections(ArrayList<Asset> assetList) {
ArrayList<Election> electionChoices = new ArrayList<>();
for(Asset a : assetList) {
electionChoices.add(Election.parseElection(a, getApplicationContext()));
// Hide other assets
if (a.getName().indexOf("_") != -1) {
electionChoices.add(Election.parseElection(a, getApplicationContext()));
}
}
return electionChoices;
}
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/activity_result.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAlignment="center"
android:padding="16dp"
android:paddingTop="16dp"
android:paddingBottom="30dp"
android:textSize="14sp"
android:textColor="@color/govDarkBlue"
android:text="@string/voting_pass"/>
</LinearLayout>

<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:background="@android:color/darker_gray" />
android:background="@color/light_grey" />
<Button
android:id="@+id/transactionHistory"
android:layout_width="match_parent"
Expand Down
20 changes: 20 additions & 0 deletions app/src/main/res/layout/activity_splash_screen.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Empty items to push down the icon to the exact center
Should equal the size of the items below the ImageView -->

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="40sp" />

<View
android:layout_width="match_parent"
android:layout_height="30dp" />
</LinearLayout>

<TextView
android:id="@+id/text_splash_screen"
Expand All @@ -28,6 +46,8 @@
android:layout_height="wrap_content"
android:contentDescription="@string/app_name"
android:gravity="center"
android:paddingBottom="15dp"
android:paddingTop="25dp"
android:src="@drawable/voting_pass_icon" />

<TextView
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

<color name="button_after_timeout">#a0f88938</color>
<color name="grey">#a0acacac</color>
<color name="light_grey">#1e000000</color>
<color name="green">#00ff00</color>
<color name="white">#ffffff</color>
<color name="transparent">#00000000</color>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<item quantity="one">Authorization successful</item>
<item quantity="other">Authorization successful</item>
</plurals>
<string name="authorization_wait">Waiting for authorization.</string>
<string name="authorization_wait">Waiting for confirmation.</string>
<string name="address_not_found">This document is not registered for digital voting.</string>

<string name="has_right">%s has right to:</string>
Expand Down