Skip to content

Conversation

@snovaisg
Copy link

  • Kyber use case implemented in a simple activity (SwapMock1Activity): get rates between ETHER and APPC and swap them.

  • Last version before changing to android mvp

Simao Novais and others added 4 commits August 10, 2018 12:13
Built infrastructure to support token swap feature

Token swap works (from eth to appc|eos|knc)
@Trinkes Trinkes changed the base branch from master to dev August 16, 2018 13:01
@Trinkes Trinkes changed the base branch from dev to feature/implement-kyber August 20, 2018 09:17
@Trinkes Trinkes changed the base branch from feature/implement-kyber to dev August 20, 2018 09:19
@Trinkes Trinkes changed the base branch from dev to feature/implement-kyber August 20, 2018 09:19
public SwapDataMapper swapDataMapper;
@Inject SwapProofWriter swapBlockChainWriter;
@Inject SwapProof swapProof;
Spinner fromToken;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not injected variables can be private

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// Another interface callback
}

public void getExpectedRate(View v) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use an OnClickListener instead of xml to listener click events

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}

public void switchToMock1() {
Intent myIntent = new Intent(this, SwapMock1Activity.class);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwapMock1Activity should be the one creating its intent

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Override public BigInteger writeGetterSwapProof(SwapProof swapProof) {
String from = swapProof.getFromAddress();
String to = swapProof.getToAddress();
Function getRates = new SwapDataMapper().getDataExpectedRate(swapProof);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwapDataMapper should be injected on constructor of SwapBlockchainWriter

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

import javax.inject.Inject;
import org.web3j.utils.Convert;

public class SwapMock1Activity extends AppCompatActivity {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give a better name to this activity

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

String data) {

this.chainId = chainId;
this.gasPrice = gasSettingsRepositoryType.getGasSettings(false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can't be here, the swapProff gas price value has to be sent over its constructor

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

switch (v.getId()) {
case R.id.save: {
onSave();
//onSave();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SwapActivity should create its Intent

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

android:layout_marginStart="56dp"
android:layout_marginTop="32dp"
android:onClick="testApprove"
android:text="approve"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

create a string on strings.xml file for this kind of text

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

>

<Button
android:id="@+id/bt1"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give better names to this ids

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use constraints instead of margins to organize the view

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants