mirror of
https://github.com/jwinterm/LightWallet2.git
synced 2026-11-10 08:13:55 +01:00
Moved check wallet queue out of timer to render loop. Added tiny fony.
This commit is contained in:
@@ -171,10 +171,11 @@ public class CreateScreen extends AbstractScreen {
|
||||
};
|
||||
Label success_label = new Label("Wallet successfully created. " + name + " file is your binary wallet file. "
|
||||
+ name + ".keys is your keys file; "
|
||||
+ "the keys file is password protected and you can restore your binary wallet file with it. " +
|
||||
" A text file named " + name + "info.txt has also been created. This file contains your wallet recovery seed and view key. " +
|
||||
"Please encrypt this file or print it and delete it. Your wallet seed allows wallet recovery and bypasses your password." +
|
||||
"A file named lightwallet.conf has also been created; this file specifies the wallet and node currently in use.", uiSkin);
|
||||
+ "the keys file is password protected and you can restore your binary wallet file with it. "
|
||||
+ " A text file named " + name + "info.txt has also been created. This file contains your wallet recovery seed and view key. "
|
||||
+ "Please encrypt this file or print it and delete it. Your wallet seed allows wallet recovery and bypasses your password."
|
||||
+ "The text file " + name + "txs.txt is empty, but will contain your tx history after syncing the wallet and making txs. "
|
||||
+ "A file named lightwallet.conf has also been created; this file specifies the wallet and node currently in use.", uiSkin);
|
||||
success_label.setWrap(true);
|
||||
success_dialog.add(success_label).width(400).row();
|
||||
success_dialog.button("Continue", true).addListener(new ClickListener() {
|
||||
@@ -246,6 +247,10 @@ public class CreateScreen extends AbstractScreen {
|
||||
confwriter.println("Node address: " + nodetext.getText());
|
||||
confwriter.close();
|
||||
|
||||
PrintWriter txwriter = new PrintWriter(name + "tx.txt", "UTF-8");
|
||||
txwriter.println("Transaction history: ");
|
||||
txwriter.close();
|
||||
|
||||
success_dialog.show(stage);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,13 +4,15 @@ import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.jw.lightwallet.utils.Constants;
|
||||
import com.jw.lightwallet.LightWallet;
|
||||
import com.jw.lightwallet.utils.DaemonValues;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class DaemonView {
|
||||
|
||||
LightWallet game;
|
||||
|
||||
Table daemonlayout;
|
||||
|
||||
Label nodelabel;
|
||||
@@ -29,9 +31,11 @@ public class DaemonView {
|
||||
int padvalue;
|
||||
|
||||
|
||||
public DaemonView () {
|
||||
public DaemonView (final LightWallet game) {
|
||||
|
||||
this.game = game;
|
||||
|
||||
Skin uiSkin = new Skin(Gdx.files.internal("skin/uiskin.json"));
|
||||
Skin uiSkin = new Skin(Gdx.files.internal("skin/uiskin.json"));
|
||||
|
||||
daemonlayout = new Table();
|
||||
padvalue = 15;
|
||||
@@ -69,7 +73,7 @@ public class DaemonView {
|
||||
}
|
||||
|
||||
public void Update(DaemonValues daemonvalues) {
|
||||
nodevalue.setText(Constants.moneroclubdmn);
|
||||
nodevalue.setText(game.walletvalues.getNode());
|
||||
statusvalue.setText(daemonvalues.getStatus());
|
||||
heightvalue.setText(String.valueOf(daemonvalues.getBlockheight()));
|
||||
hashratevalue.setText(new DecimalFormat("##.##").format(daemonvalues.getHashrate()) + " Mh/s");
|
||||
|
||||
@@ -170,13 +170,7 @@ public class ImportKeysScreen extends AbstractScreen {
|
||||
System.out.println("result "+obj);
|
||||
}
|
||||
};
|
||||
Label successlabel = new Label("Wallet successfully imported. " + game.walletvalues.getName() + " file is your binary wallet file. "
|
||||
+ game.walletvalues.getName() + ".keys is your keys file; "
|
||||
+ "the keys file is password protected and you can restore your binary wallet file with it. "
|
||||
+ " A text file named " + game.walletvalues.getName() + "info.txt has also been created. "
|
||||
+ "This file contains your wallet recovery seed and view key. "
|
||||
+ "Please encrypt this file or print it and delete it. Your wallet seed allows wallet recovery and bypasses your password."
|
||||
+ "A file named lightwallet.conf has also been created; this file specifies the wallet and node currently in use.", uiSkin);
|
||||
Label successlabel = new Label("", uiSkin);
|
||||
successlabel.setWrap(true);
|
||||
successdialog.add(successlabel).width(400).row();
|
||||
successdialog.button("Continue", true).addListener(new ClickListener() {
|
||||
@@ -230,7 +224,7 @@ public class ImportKeysScreen extends AbstractScreen {
|
||||
|
||||
|
||||
try {
|
||||
Process tr = Runtime.getRuntime().exec("simplewallet --wallet-file " + name + " --password " + pw);
|
||||
Process tr = Runtime.getRuntime().exec("simplewallet --wallet-file " + name + " --password " + pw + " --daemon-address http://localhost:66666");
|
||||
Writer wr = new OutputStreamWriter( tr.getOutputStream() );
|
||||
BufferedReader rd = new BufferedReader( new InputStreamReader( tr.getInputStream() ) );
|
||||
|
||||
@@ -284,6 +278,18 @@ public class ImportKeysScreen extends AbstractScreen {
|
||||
confwriter.println("Node address: " + nodetext.getText());
|
||||
confwriter.close();
|
||||
|
||||
PrintWriter txwriter = new PrintWriter(name + "tx.txt", "UTF-8");
|
||||
txwriter.println("Transaction history: ");
|
||||
txwriter.close();
|
||||
|
||||
successlabel.setText("Wallet successfully imported. " + game.walletvalues.getName() + " file is your binary wallet file. "
|
||||
+ game.walletvalues.getName() + ".keys is your keys file; "
|
||||
+ "the keys file is password protected and you can restore your binary wallet file with it. "
|
||||
+ " A text file named " + game.walletvalues.getName() + "info.txt has also been created. "
|
||||
+ "This file contains your wallet recovery seed and view key. "
|
||||
+ "Please encrypt this file or print it and delete it. Your wallet seed allows wallet recovery and bypasses your password."
|
||||
+ "The text file " + game.walletvalues.getName() + "txs.txt is empty, but will contain your tx history after syncing the wallet. "
|
||||
+ "A file named lightwallet.conf has also been created; this file specifies the wallet and node currently in use.");
|
||||
successdialog.show(stage);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.jw.lightwallet.screens;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.Texture;
|
||||
@@ -132,7 +135,7 @@ public class MainScreen extends AbstractScreen {
|
||||
|
||||
screenlayout.add(logo).pad(10).center().row();
|
||||
|
||||
daemonview = new DaemonView();
|
||||
daemonview = new DaemonView(game);
|
||||
walletview = new WalletView(game);
|
||||
transactionview = new TransactionView();
|
||||
historyview = new HistoryView();
|
||||
@@ -187,7 +190,7 @@ public class MainScreen extends AbstractScreen {
|
||||
}, 1f, 10f);
|
||||
|
||||
// Timer task to get output from simplewallet logging and check balances
|
||||
wallettimer.scheduleTask(new Timer.Task() {
|
||||
/*wallettimer.scheduleTask(new Timer.Task() {
|
||||
@Override
|
||||
public void run() {
|
||||
String queuepoll = wq.poll();
|
||||
@@ -201,9 +204,20 @@ public class MainScreen extends AbstractScreen {
|
||||
String height = queuepoll.split("height ")[1].split(",")[0];
|
||||
walletview.syncvalue.setText(height + " / " + daemonvalues.getBlockheight());
|
||||
}
|
||||
else if (queuepoll != null && queuepoll.contains("money")) {
|
||||
PrintWriter txout;
|
||||
try {
|
||||
txout = new PrintWriter(new BufferedWriter(new FileWriter(game.walletvalues.getName() + "tx.txt", true)));
|
||||
txout.println(queuepoll);
|
||||
txout.close();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e){e.printStackTrace();}
|
||||
}
|
||||
}, 1f, 0.05f);
|
||||
}, 1f, 0.05f);*/
|
||||
|
||||
// Timer task to get network info from daemon
|
||||
balancetimer.scheduleTask(new Timer.Task() {
|
||||
@@ -221,6 +235,31 @@ public class MainScreen extends AbstractScreen {
|
||||
stage.draw();
|
||||
stage.act(delta);
|
||||
|
||||
// Poll wallet thread and check block height and if transaction data is in output
|
||||
String queuepoll = wq.poll();
|
||||
// Gdx.app.log(LightWallet.LOG, "Queue result: " + queuepoll);
|
||||
try{
|
||||
if (queuepoll != null && queuepoll.contains("height:")) {
|
||||
String height = queuepoll.split("height: ")[1].split(",")[0];
|
||||
walletview.syncvalue.setText(height + " / " + daemonvalues.getBlockheight());
|
||||
}
|
||||
else if (queuepoll != null && queuepoll.contains("height ")) {
|
||||
String height = queuepoll.split("height ")[1].split(",")[0];
|
||||
walletview.syncvalue.setText(height + " / " + daemonvalues.getBlockheight());
|
||||
}
|
||||
else if (queuepoll != null && queuepoll.contains("money")) {
|
||||
PrintWriter txout;
|
||||
try {
|
||||
txout = new PrintWriter(new BufferedWriter(new FileWriter(game.walletvalues.getName() + "tx.txt", true)));
|
||||
txout.println(queuepoll);
|
||||
txout.close();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (NullPointerException e){e.printStackTrace();}
|
||||
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
|
||||
@@ -34,24 +34,24 @@ public class TransactionView {
|
||||
padvalue = 15;
|
||||
|
||||
addresslabel = new Label("Send to address: ", uiSkin);
|
||||
addressvalue = new TextField("", uiSkin);
|
||||
txlayout.add(addresslabel).pad(padvalue).width(150);
|
||||
txlayout.add(addressvalue).pad(padvalue).width(650).row();
|
||||
addressvalue = new TextField("", uiSkin, "tinytext");
|
||||
txlayout.add(addresslabel).pad(padvalue).width(100);
|
||||
txlayout.add(addressvalue).pad(padvalue).width(600).row();
|
||||
|
||||
amountlabel = new Label("Send amount XMR: ", uiSkin);
|
||||
amountvalue = new TextField("", uiSkin);
|
||||
txlayout.add(amountlabel).pad(padvalue).width(150);
|
||||
txlayout.add(amountvalue).pad(padvalue).width(650).row();
|
||||
txlayout.add(amountlabel).pad(padvalue).width(100);
|
||||
txlayout.add(amountvalue).pad(padvalue).width(100).row();
|
||||
|
||||
mixinlabel = new Label("Mixin level: ", uiSkin);
|
||||
mixinvalue = new TextField("", uiSkin);
|
||||
txlayout.add(mixinlabel).pad(padvalue).width(150);
|
||||
txlayout.add(mixinvalue).pad(padvalue).width(650).row();
|
||||
txlayout.add(mixinlabel).pad(padvalue).width(100);
|
||||
txlayout.add(mixinvalue).pad(padvalue).width(50).row();
|
||||
|
||||
idlabel = new Label("Payment id: ", uiSkin);
|
||||
idvalue = new TextField("", uiSkin);
|
||||
txlayout.add(idlabel).pad(padvalue).width(150);
|
||||
txlayout.add(idvalue).pad(padvalue).width(650).row();
|
||||
idvalue = new TextField("", uiSkin, "tinytext");
|
||||
txlayout.add(idlabel).pad(padvalue).width(100);
|
||||
txlayout.add(idvalue).pad(padvalue).width(600).row();
|
||||
|
||||
sendbtn = new TextButton("Payola!", uiSkin);
|
||||
txlayout.add(sendbtn).row();
|
||||
|
||||
Reference in New Issue
Block a user