Got buttons working to switch tabs.

This commit is contained in:
jwinterm
2015-12-14 20:04:13 -08:00
parent e35465a111
commit 1455636dd4
6 changed files with 68 additions and 9 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ com.badlogic.gdx.graphics.Color: {
white: { a: 1, b: 1, g: 1, r: 1 },
red: { a: 1, b: 0, g: 0, r: 1 },
black: { a: 1, b: 0, g: 0, r: 0 },
blue: {a: 1, b: 1, g: 0, r: 0 }
blue: {a: 1, b: 0.9, g: 0.4, r: 0 }
},
com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
dialogDim: { name: white, color: { r: 0, g: 0, b: 0, a: 0.45 } },
Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 36 KiB

+1 -1
View File
@@ -11,4 +11,4 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
# Project target.
target=android-19
target=android-21
@@ -1,8 +1,6 @@
package com.jw.lightwallet.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
@@ -10,7 +8,6 @@ import com.jw.lightwallet.utils.Constants;
import com.jw.lightwallet.utils.DaemonValues;
import java.text.DecimalFormat;
import java.util.Date;
public class DaemonView {
@@ -2,12 +2,13 @@ package com.jw.lightwallet.screens;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Container;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Timer;
import com.jw.lightwallet.LightWallet;
import com.jw.lightwallet.daemon.DaemonRPC;
@@ -19,23 +20,24 @@ public class MainScreen extends AbstractScreen {
// Interface classes
DaemonRPC daemonrpc;
DaemonValues daemonvalues;
// Layout stuff
Stage stage;
Table screenlayout;
Image logo;
Texture logotex;
Table buttonrow;
TextButton daemonbutton;
TextButton walletbutton;
TextButton transferbutton;
TextButton txhistorybutton;
Table viewcontainer;
DaemonView daemonview;
WalletView walletview;
// Wallet layout
// Transfer layout
// Tx history layout
// Timer
Timer timer;
@@ -50,6 +52,7 @@ public class MainScreen extends AbstractScreen {
daemonvalues = new DaemonValues();
stage = new Stage();
Gdx.input.setInputProcessor(stage);
screenlayout = new Table();
viewcontainer = new Table();
@@ -58,9 +61,37 @@ public class MainScreen extends AbstractScreen {
buttonrow = new Table();
daemonbutton = new TextButton("Daemon", uiSkin);
daemonbutton.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
System.out.println("Daemon button Pressed");
viewcontainer.removeActor(walletview.walletlayout);
viewcontainer.add(daemonview.daemonlayout).expand().bottom();
}
});
walletbutton = new TextButton("Wallet", uiSkin);
walletbutton.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
System.out.println("Wallet button Pressed");
viewcontainer.removeActor(daemonview.daemonlayout);
viewcontainer.add(walletview.walletlayout).expand().bottom();
}
});
transferbutton = new TextButton("Transfer", uiSkin);
transferbutton.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
System.out.println("Transfer button Pressed");
}
});
txhistorybutton = new TextButton("History", uiSkin);
txhistorybutton.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
System.out.println("History button Pressed");
}
});
buttonrow.add(daemonbutton).width(Constants.WORLD_WIDTH/4);
buttonrow.add(walletbutton).width(Constants.WORLD_WIDTH/4);
@@ -71,6 +102,7 @@ public class MainScreen extends AbstractScreen {
screenlayout.add(logo).pad(10).center().row();
daemonview = new DaemonView();
walletview = new WalletView();
viewcontainer.add(daemonview.daemonlayout).expand().bottom();
screenlayout.add(viewcontainer);
@@ -1,5 +1,35 @@
package com.jw.lightwallet.screens;
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;
public class WalletView {
Table walletlayout;
Label addresslabel;
Label addressvalue;
Label unlockedlabel;
Label unlockedvalue;
Label lockedlabel;
Label lockedvalue;
int padvalue;
public WalletView () {
Skin uiSkin = new Skin(Gdx.files.internal("skin/uiskin.json"));
walletlayout = new Table();
padvalue = 15;
addresslabel = new Label("Address: ", uiSkin);
addressvalue = new Label("assssssssssssssddddddddddddddddddddddddddddssssssssssssssssssssssssssssssssffffffffffffffffd", uiSkin);
walletlayout.add(addresslabel).pad(padvalue);
walletlayout.add(addressvalue).pad(padvalue).row();
}
}