Remove Settings status footer and added instead a line below General's Night mode, View Network Status whith an icon that shows the current network status. When clicked it opens the Nodes dialog. Changed Nodes dialog title to show the current app version and added the block number as a single line below it.

This commit is contained in:
Severiano Jaramillo 2018-12-23 15:10:44 -06:00
parent 962afe78c6
commit f8e5a84da8
2 changed files with 25 additions and 36 deletions

View file

@ -70,9 +70,7 @@ class SettingsFragment : Fragment(), ServiceConnection {
btnViewBrainKey.setOnClickListener { getBrainkey(it) }
tvFooterAppVersion.text = String.format("%s v%s", getString(R.string.app_name), BuildConfig.VERSION_NAME)
ivConnectionStatusIcon.setOnClickListener { v ->
tvNetworkStatus.setOnClickListener { v ->
if (mNetworkService != null) {
// PublishSubject used to announce full node latencies updates
val fullNodePublishSubject = mNetworkService!!.nodeLatencyObservable
@ -84,7 +82,8 @@ class SettingsFragment : Fragment(), ServiceConnection {
nodesAdapter!!.add(fullNodes)
mNodesDialog = MaterialDialog(v.context)
.title(text = getString(R.string.title__bitshares_nodes_dialog, "-------"))
.title(text = String.format("%s v%s", getString(R.string.app_name), BuildConfig.VERSION_NAME))
.message(text = getString(R.string.title__bitshares_nodes_dialog, "-------"))
.customListAdapter(nodesAdapter as FullNodesAdapter)
.negativeButton(android.R.string.ok) {
mHandler.removeCallbacks(mRequestDynamicGlobalPropertiesTask)
@ -134,7 +133,7 @@ class SettingsFragment : Fragment(), ServiceConnection {
val dynamicGlobalProperties = message.result as DynamicGlobalProperties
if (mNodesDialog != null && mNodesDialog?.isShowing == true) {
val blockNumber = NumberFormat.getInstance().format(dynamicGlobalProperties.head_block_number)
mNodesDialog?.title(text = getString(R.string.title__bitshares_nodes_dialog, blockNumber))
mNodesDialog?.message(text = getString(R.string.title__bitshares_nodes_dialog, blockNumber))
}
}
}
@ -267,7 +266,8 @@ class SettingsFragment : Fragment(), ServiceConnection {
}
override fun onServiceDisconnected(name: ComponentName?) {
ivConnectionStatusIcon.setImageResource(R.drawable.ic_disconnected)
tvNetworkStatus.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null,
resources.getDrawable(R.drawable.ic_disconnected, null), null)
}
override fun onServiceConnected(name: ComponentName?, service: IBinder?) {
@ -275,7 +275,8 @@ class SettingsFragment : Fragment(), ServiceConnection {
val binder = service as NetworkService.LocalBinder
mNetworkService = binder.service
ivConnectionStatusIcon.setImageResource(R.drawable.ic_connected)
tvNetworkStatus.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null,
resources.getDrawable(R.drawable.ic_connected, null), null)
}
}

View file

@ -21,6 +21,8 @@
android:paddingEnd="@dimen/activity_horizontal_margin"
android:orientation="vertical">
<!-- General -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -47,6 +49,19 @@
android:textAppearance="@style/TextAppearance.Bitsy.Body1"
android:textColor="?android:textColorPrimary"/>
<TextView
android:id="@+id/tvNetworkStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:layout_marginEnd="2dp"
android:text="View Network Status"
android:gravity="center_vertical"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"
android:drawableEnd="@drawable/ic_disconnected"/>
<!-- Backup -->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -70,6 +85,8 @@
android:layout_marginTop="@dimen/spacing_same_topic"
android:text="@string/btn__view_and_copy"/>
<!-- Bugs or Ideas -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -91,33 +108,4 @@
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/lightGray">
<ImageView
android:id="@+id/ivFooterAppLogo"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="4dp"
android:padding="4dp"
android:src="@drawable/ic_bitsy_logo"/>
<TextView
android:id="@+id/tvFooterAppVersion"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginStart="8dp"
android:gravity="center"
android:layout_toEndOf="@+id/ivFooterAppLogo"
tools:text="BiTSy v2.0"
android:textColor="@android:color/secondary_text_light"/>
<ImageView
android:id="@+id/ivConnectionStatusIcon"
android:layout_width="30dp"
android:layout_height="30dp"
android:padding="4dp"
android:src="@drawable/ic_disconnected"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>