Skip to content

Commit

Permalink
Multiple UI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Kumaigorodski committed Dec 9, 2015
1 parent d05e8cc commit 81bbeb6
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 52 deletions.
Binary file modified app/app-release-xiaomi.apk
Binary file not shown.
Binary file modified app/app-release.apk
Binary file not shown.
6 changes: 3 additions & 3 deletions app/app.iml
Expand Up @@ -101,16 +101,16 @@
<orderEntry type="library" exported="" name="guava-16.0.1" level="project" />
<orderEntry type="library" exported="" name="bitcoinj-core-0.13.3" level="project" />
<orderEntry type="library" exported="" name="scrypt-1.4.0" level="project" />
<orderEntry type="library" exported="" name="protobuf-java-2.5.0" level="project" />
<orderEntry type="library" exported="" name="scala-library-2.11.7" level="project" />
<orderEntry type="library" exported="" name="protobuf-java-2.5.0" level="project" />
<orderEntry type="library" exported="" name="core-3.2.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.2.0" level="project" />
<orderEntry type="library" exported="" name="core-1.51.0.0" level="project" />
<orderEntry type="library" exported="" name="core-3.2.0" level="project" />
<orderEntry type="library" exported="" name="android-segmented-1.0.4" level="project" />
<orderEntry type="library" exported="" name="jbox2d-library-2.3.1-SNAPSHOT" level="project" />
<orderEntry type="library" exported="" name="jsr305-2.0.1" level="project" />
<orderEntry type="library" exported="" name="slf4j-api-1.7.7" level="project" />
<orderEntry type="library" exported="" name="okio-1.2.0" level="project" />
<orderEntry type="library" exported="" name="slf4j-api-1.7.7" level="project" />
<orderEntry type="library" name="scala-sdk-2.9.1.final" level="application" />
</component>
</module>
4 changes: 2 additions & 2 deletions app/build.gradle
Expand Up @@ -11,9 +11,9 @@ android {

defaultConfig {
applicationId "com.btcontract.wallet"
versionName "1.03"
versionName "1.04"
minSdkVersion 15
versionCode 25
versionCode 1
}

buildTypes {
Expand Down
17 changes: 9 additions & 8 deletions app/src/main/java/com/btcontract/wallet/TxsActivity.scala
Expand Up @@ -15,29 +15,28 @@ import android.text.Html
import android.net.Uri
import java.util.Date

import OnScrollListener.SCROLL_STATE_IDLE
import android.view.{View, ViewGroup}
import Utils.{humanAddr, wrap, denom, Outputs, PayDatas, none, sumIn, sumOut, app}
import R.string.{txs_received_to, txs_sent_to, txs_many_received_to, txs_many_sent_to, err_general}
import R.string.{txs_yes_fee, txs_incoming, txs_noaddr, dialog_ok, no_funds}
import android.view.{View, ViewGroup}
import View.{VISIBLE, GONE}
import OnScrollListener.SCROLL_STATE_IDLE
import org.bitcoinj.core._
import android.widget._


class TxsActivity extends InfoActivity { me =>
def onFail(exc: Throwable): Unit = new Builder(me).setMessage(err_general).show
lazy private[this] val time = String.format("%1$tb %1$te&#x200b;,&#160;%1$tY&#x200b;,&#160;%1$tR", _: Date)
lazy private[this] val allButton = getLayoutInflater.inflate(R.layout.frag_txs_all, null).asInstanceOf[ImageButton]
lazy private[this] val head = getLayoutInflater.inflate(R.layout.frag_denom_and_count_head, null)
lazy private[this] val allButton = getLayoutInflater.inflate(R.layout.frag_txs_all, null)
lazy private[this] val txsNum = head.findViewById(R.id.txsNumber).asInstanceOf[TextView]
lazy private[this] val list = findViewById(R.id.itemsList).asInstanceOf[ListView]

// Confirmation rings, number of txs and implicits for denom
lazy private[this] val confOpts = getResources getStringArray R.array.txs_normal_conf
lazy private[this] val txsOpts = getResources getStringArray R.array.txs_total
lazy implicit private[this] val dc = new DenomControl(me, head)
lazy implicit private[this] val noFunds = getString(no_funds)
lazy private[this] implicit val dc = new DenomControl(me, head)
lazy private[this] implicit val noFunds = getString(no_funds)

// Sent/received templates and fee
lazy private[this] val yesFee = me getString txs_yes_fee
Expand Down Expand Up @@ -70,13 +69,15 @@ class TxsActivity extends InfoActivity { me =>
override def onCreate(savedInstanceState: Bundle) =
{
super.onCreate(savedInstanceState)
val linesNum = if (scrHeight < 4.5) 3 else if (scrHeight < 4.8) 4
else if (scrHeight < 5.1) 5 else if (scrHeight < 5.5) 6
else if (scrHeight < 6.2) 10 else 12

if (app.isAlive) {
add(constantListener.mkTxt, Informer.PEERS).ui.run
new Anim(app.kit.currentBalance, Utils.appName)
setContentView(R.layout.activity_txs)

// Setup adapter here because scrWidth is not available on start
adapter = if (scrWidth < 2.0) new TxsListAdapter(new TxViewHolder(_), R.layout.frag_transaction_small)
else if (scrWidth < 3.2) new TxsListAdapter(new TxViewHolderNormal(_), R.layout.frag_transaction_normal)
else if (scrWidth < 4.4) new TxsListAdapter(new TxViewHolder(_), R.layout.frag_transaction_large)
Expand Down Expand Up @@ -130,7 +131,7 @@ class TxsActivity extends InfoActivity { me =>
app.kit.wallet addEventListener txsListListener

// Show lomited txs list
val range = scala.math.min(3, result.size)
val range = scala.math.min(linesNum, result.size)
if (range < result.size) list addFooterView allButton
adapter.transactions = result.subList(0, range)
list.addHeaderView(head, null, true)
Expand Down
19 changes: 10 additions & 9 deletions app/src/main/java/com/btcontract/wallet/Utils.scala
Expand Up @@ -260,8 +260,7 @@ abstract class InfoActivity extends TimerActivity { me =>

// Concrete dialogs
def mkClear(alert: Dialog) = {
def remove = rm(alert)(process)
def process = wrap(mkPayForm)(app.TransData.payments.clear)
def remove = rm(alert)(app.TransData.payments.clear)
val container = getLayoutInflater.inflate(R.layout.frag_top_clear, null)
val clear = container.findViewById(R.id.clearPayments).asInstanceOf[Button]
clear setOnClickListener new OnClickListener { def onClick(view: View) = remove }
Expand Down Expand Up @@ -545,16 +544,18 @@ abstract class TimerActivity extends Activity { me =>
val goTo: Class[_] => Unit = me startActivity new Intent(me, _)
val exitTo: Class[_] => Unit = goto => wrap(finish)(goTo apply goto)
lazy val prefs = app.getSharedPreferences("prefs", Context.MODE_PRIVATE)
lazy val maxDialog = metrics.densityDpi * 2.1
lazy val metrics = new DisplayMetrics
val timer = new Timer

lazy val scrWidth = {
// Screen width in inches
getWindowManager.getDefaultDisplay getMetrics metrics
metrics.widthPixels.toDouble / metrics.densityDpi
// Screen size in inches
lazy val metrics = new DisplayMetrics match { case mtx =>
getWindowManager.getDefaultDisplay getMetrics mtx
mtx
}

lazy val scrHeight = metrics.heightPixels.toDouble / metrics.densityDpi
lazy val scrWidth = metrics.widthPixels.toDouble / metrics.densityDpi
lazy val maxDialog = metrics.densityDpi * 2.1

// Navigation related methods and timer cancel
override def onDestroy = wrap(super.onDestroy)(timer.cancel)
implicit def anyToRunnable(process: => Unit): Runnable = new Runnable { def run = process }
Expand Down Expand Up @@ -592,7 +593,7 @@ abstract class TimerActivity extends Activity { me =>
}

def rm(prev: Dialog)(fun: => Unit) = {
timer.schedule(me anyToRunnable fun, 100)
timer.schedule(me anyToRunnable fun, 120)
prev.dismiss
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/btcontract/wallet/WalletApp.scala
Expand Up @@ -116,7 +116,7 @@ class WalletApp extends Application {
wallet addEventListener listener
wallet.allowSpendingUnconfirmedTransactions
peerGroup addPeerDiscovery new DnsDiscovery(params)
peerGroup.setUserAgent(Utils.appName, "1.03")
peerGroup.setUserAgent(Utils.appName, "1.04")
peerGroup setDownloadTxDependencies false
peerGroup setPingIntervalMsec 10000
peerGroup setMaxConnections 10
Expand Down
Binary file modified app/src/main/res/drawable-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-mdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xxhdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 13 additions & 17 deletions app/src/main/res/layout/activity_request.xml
@@ -1,29 +1,25 @@
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginTop="20dp" android:layout_marginBottom="20dp"
android:layout_height="fill_parent" android:layout_width="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
style="@style/StandardLinearLayout">

<TextView
style="@style/ReqItem"
style="@style/StdText"
android:maxWidth="245sp"
android:id="@+id/reqAddress"/>

<TextView
style="@style/ReqItem"
android:layout_centerVertical="true"
android:text="@string/req_generating"/>
android:id="@+id/reqAddress"
android:layout_width="wrap_content"/>

<ImageView
style="@style/ReqItem"
android:id="@+id/reqCode"
android:paddingTop="55dp"
android:layout_centerVertical="true"/>
android:layout_marginTop="25dp"
android:layout_marginBottom="25dp"
android:layout_width="@dimen/bitmap_qr_size"
android:layout_height="@dimen/bitmap_qr_size"/>

<Button
style="@style/ReqItem"
android:enabled="false"
android:id="@+id/reqShare"
android:text="@string/req_save"
android:layout_alignParentBottom="true"/>
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

</RelativeLayout>
</LinearLayout>
1 change: 0 additions & 1 deletion app/src/main/res/values-es/strings.xml
Expand Up @@ -124,7 +124,6 @@
<string name="restore_wallet">Restaurar monedero</string>

<!-- activity_request -->
<string name="req_generating">Generando código QR</string>
<string name="req_save">Compartir código QR</string>

<!-- activity_txs -->
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-ru/strings.xml
Expand Up @@ -125,7 +125,6 @@
<string name="restore_hint">Ваш мнемонический код</string>

<!-- activity_request -->
<string name="req_generating">Генерирую QR-код</string>
<string name="req_save">Поделиться картинкой</string>

<!-- activity_txs -->
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-uk/strings.xml
Expand Up @@ -125,7 +125,6 @@
<string name="restore_hint">Ваш мнемонічний код</string>

<!-- activity_request -->
<string name="req_generating">Генерую QR-код</string>
<string name="req_save">Поділитися картинкою</string>

<!-- activity_txs -->
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values-zh/strings.xml
Expand Up @@ -123,7 +123,6 @@
<string name="restore_wallet">还原钱包</string>

<!-- activity_request -->
<string name="req_generating">生成QR代码中</string>
<string name="req_save">分享QR代码</string>

<!-- activity_txs -->
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Expand Up @@ -124,7 +124,6 @@
<string name="restore_wallet">Restore Wallet</string>

<!-- activity_request -->
<string name="req_generating">Generating QR code</string>
<string name="req_save">Share QR code</string>

<!-- activity_txs -->
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/res/values/styles.xml
Expand Up @@ -67,12 +67,6 @@
<item name="android:paddingLeft">15dp</item>
</style>

<!-- for request page -->
<style name="ReqItem" parent="StdText">
<item name="android:layout_centerHorizontal">true</item>
<item name="android:layout_width">wrap_content</item>
</style>

<!-- for transactions -->
<style name="OneLinerText" parent="BaseText">
<item name="android:maxLines">1</item>
Expand All @@ -86,5 +80,4 @@
<style name="LiteNoBar" parent="@android:style/Theme.Holo.Light.NoActionBar"/>
<style name="LiteBar" parent="@android:style/Theme.Holo.Light"/>
<style name="DarkBar" parent="@android:style/Theme.Holo"/>

</resources>

0 comments on commit 81bbeb6

Please sign in to comment.