Skip to content

Commit

Permalink
Merge pull request #185 from xidaokun/dev_v1.3
Browse files Browse the repository at this point in the history
Dev v1.3
  • Loading branch information
li.fayi authored Apr 21, 2019
2 parents fc9e7be + 02db81d commit 8f49305
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.breadwallet.R;
import com.breadwallet.presenter.activities.did.DidAuthorizeActivity;
import com.breadwallet.presenter.activities.util.BRActivity;
import com.breadwallet.presenter.customviews.LoadingDialog;
import com.breadwallet.presenter.interfaces.BRAuthCompletion;
import com.breadwallet.tools.manager.BRSharedPrefs;
import com.breadwallet.tools.threads.executor.BRExecutor;
import com.breadwallet.tools.security.AuthManager;
import com.breadwallet.tools.util.StringUtil;
import com.breadwallet.wallet.wallets.ela.BRElaTransaction;
import com.breadwallet.wallet.wallets.ela.ElaDataSource;
Expand Down Expand Up @@ -105,9 +104,10 @@ private boolean verifyUri(){
private void sendTx(){
if(null==mCandidates || mCandidates.size()<=0) return;
if (!isFinishing()) mLoadingDialog.show();
BRExecutor.getInstance().forLightWeightBackgroundTasks().execute(new Runnable() {

AuthManager.getInstance().authPrompt(this, this.getString(R.string.pin_author_vote), getString(R.string.pin_author_vote_msg), true, false, new BRAuthCompletion() {
@Override
public void run() {
public void onComplete() {
Log.d("posvote", "mCandidatesStr:"+mCandidatesStr);
BRSharedPrefs.cacheCandidate(VoteActivity.this, mCandidatesStr);
try {
Expand All @@ -116,15 +116,20 @@ public void run() {
e.printStackTrace();
}
String address = WalletElaManager.getInstance(VoteActivity.this).getAddress();
BigDecimal balance = BRSharedPrefs.getCachedBalance(VoteActivity.this, "ELA");
BRElaTransaction transaction = ElaDataSource.getInstance(VoteActivity.this).createElaTx(address, address, 0, "vote", mCandidates);
String txId = transaction.getTx();
if(StringUtil.isNullOrEmpty(txId)) return;
String mRwTxid = ElaDataSource.getInstance(VoteActivity.this).sendElaRawTx(txId);
dialogDismiss();
finish();
}

@Override
public void onCancel() {
//nothing
}
});

}

private BigDecimal mAmount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public void run() {
url = returnUrl + "?did=" + myDid + "&response=" + Uri.encode(new Gson().toJson(entity));
}

if(BRConstants.REA_PACKAGE_ID.equals(appId)){
if(BRConstants.REA_PACKAGE_ID.equals(appId) || BRConstants.DPOS_VOTE_ID.equals(appId)){
UiUtils.startWebviewActivity(DidAuthorizeActivity.this, url);
} else {
UiUtils.openUrlByBrowser(DidAuthorizeActivity.this, url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void setCname(String cname) {

private String flag;

private boolean checked ;
private boolean checked = true;

public AuthorInfoItem(String cname, String name, String flag){
this.cname = cname;
Expand Down Expand Up @@ -102,6 +102,6 @@ public String[] getValue(Context context){
return new String[]{realName, idNumber};
}
}
return null;
return new String[]{null, null};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public final class BRConstants {
public static final String URL_BLOG = "http://t.me/elastoswalletelephant";


public static final String DPOS_VOTE_ID = "317DD1D2188C459EB24EAEBC81932F6ADB305FF66F073AB1DC767869EF2B1A04273A8A8754652DA3B89E7692BEA99FA3A1E0B2CD767377300AA4A7B0E8C7D00E";
public static final String REA_PACKAGE_ID = "cc053c61afc22dda9a309e96943c1734";
public static final String DEVELOPER_WEBSITE = "62f3178e1ad6f98bf383ee5bc98ac8e7f9affaaf705ab337bde46082d3dde7a9";
public static final String HASH_ID = "14bd1d772afc8e633ce95b988646bd9ed5df65cb33ec98a43b41e6cb6de5276ca9cce91d069dc688619f1a250842b37d380d4fb984c9f912a2f86edcf5dddba9";
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/layout/activity_vote_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
app:layout_constraintLeft_toLeftOf="@+id/content_bg_view"
app:layout_constraintRight_toRightOf="@+id/content_bg_view"
android:textSize="14sp"
android:text="Votes:(ELA)"/>
android:text="@string/votes_ela"/>

<com.breadwallet.presenter.customviews.BaseTextView
android:id="@+id/vote_ela_amount"
Expand Down Expand Up @@ -103,7 +103,7 @@
app:layout_constraintBottom_toBottomOf="@+id/elephant_logo_icon"
android:layout_marginLeft="8dp"
android:textColor="@color/black_999999"
android:text="Wallet Balance:"/>
android:text="@string/vote_wallet_balance_title"/>

<com.breadwallet.presenter.customviews.BaseTextView
android:id="@+id/vote_ela_balance"
Expand Down Expand Up @@ -131,7 +131,7 @@
android:layout_width="140dp"
android:layout_height="54dp"
android:layout_marginBottom="32dp"
android:text="Cancel"
android:text="@string/vote_cancel_btn_txt"
android:textSize="18sp"
app:buttonType="3"
android:textColor="#ff3365"
Expand All @@ -146,7 +146,7 @@
android:layout_width="140dp"
android:layout_height="54dp"
android:layout_marginBottom="32dp"
android:text="Confirm"
android:text="@string/vote_confirm_btn_txt"
android:textSize="18sp"
app:buttonType="6"
android:textColor="#ff3365"
Expand All @@ -165,7 +165,7 @@
app:layout_constraintTop_toBottomOf="@+id/content_bg_view"
android:textColor="@color/black_999999"
android:layout_marginTop="15dp"
android:text="You only need to pay a little transaction fee: 0.0001 ELA."/>
android:text="@string/vote_hint"/>

<com.breadwallet.presenter.customviews.BaseTextView
android:id="@+id/vote_text_hint2"
Expand All @@ -175,7 +175,7 @@
android:layout_marginRight="16dp"
android:layout_marginTop="10dp"
android:textColor="@color/black_999999"
android:text="You can spend your ELA anytime after vote while your votes will be revoked."
android:text="@string/vote_hint2"
app:layout_constraintTop_toBottomOf="@+id/vote_text_hint1"/>

</android.support.constraint.ConstraintLayout>
8 changes: 8 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1029,4 +1029,12 @@
<string name="redpackage_title">红包</string>
<string name="vote_title">投票</string>
<string name="vote_nodes_count">你将要向%1$d个节点投票(最多36个).</string>
<string name="vote_hint">你只需要支付少量的手续费: 0.0001 ELA.</string>
<string name="vote_hint2">投票结束后,您可以随时使用ELA,但您的投票将被取消。</string>
<string name="pin_author_vote">授权投票</string>
<string name="vote_cancel_btn_txt">取消</string>
<string name="vote_confirm_btn_txt">确认</string>
<string name="votes_ela">选票:(ELA)</string>
<string name="vote_wallet_balance_title">钱包余额:</string>
<string name="pin_author_vote_msg">请输入PIN码授权投票</string>
</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1012,4 +1012,12 @@
<string name="invalid_email">無效郵件</string>
<string name="invalid_id">無效ID</string>
<string name="vote_title">投票</string>
<string name="pin_author_vote">授权投票</string>
<string name="vote_cancel_btn_txt">取消</string>
<string name="vote_confirm_btn_txt">确认</string>
<string name="vote_hint">你只需要支付少量的手續費: 0.0001 ELA.</string>
<string name="vote_hint2">投票結束後,您可以隨時使用ELA,但您的投票將被取消。</string>
<string name="votes_ela">选票:(ELA)</string>
<string name="vote_wallet_balance_title">錢包餘額:</string>
<string name="pin_author_vote_msg">請輸入PIN碼授權投票</string>
</resources>
8 changes: 8 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1037,4 +1037,12 @@
<string name="vote_title">Vote</string>
<string name="vote_nodes_count">You are going to vote %1$d nodes (36 max).</string>
<string name="vote_balance">%1$s ELA</string>
<string name="vote_wallet_balance_title">Wallet Balance:</string>
<string name="vote_hint">You only need to pay a little transaction fee: 0.0001 ELA.</string>
<string name="vote_hint2">You can spend your ELA anytime after vote while your votes will be revoked.</string>
<string name="pin_author_vote">Authorize Vote</string>
<string name="vote_cancel_btn_txt">Cancel</string>
<string name="vote_confirm_btn_txt">Confirm</string>
<string name="votes_ela">Votes:(ELA)</string>
<string name="pin_author_vote_msg">Please enter your PIN to authorize this vote</string>
</resources>

0 comments on commit 8f49305

Please sign in to comment.