Add a footer to the SettingsFragment, which contains the app logo, the app name, version name and the Connection status icon.

This commit is contained in:
Severiano Jaramillo 2018-12-21 18:40:35 -06:00
parent 80b5f9f571
commit ae8a2f17e3
2 changed files with 113 additions and 67 deletions

View file

@ -12,6 +12,7 @@ import android.widget.Toast
import androidx.fragment.app.Fragment
import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView
import cy.agorise.bitsybitshareswallet.BuildConfig
import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.repositories.AuthorityRepository
import cy.agorise.bitsybitshareswallet.utils.Constants
@ -44,6 +45,8 @@ class SettingsFragment : Fragment() {
initNightModeSwitch()
btnViewBrainKey.setOnClickListener { getBrainkey(it) }
tvFooterAppVersion.text = String.format("%s v%s", getString(R.string.app_name), BuildConfig.VERSION_NAME)
}
/**

View file

@ -5,76 +5,119 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="32dp"
tools:context=".fragments.SettingsFragment">
<TextView
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingStart="@dimen/activity_horizontal_margin"
android:paddingEnd="@dimen/activity_horizontal_margin"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/title__general"
android:textAppearance="@style/TextAppearance.Bitsy.Subtitle1"
android:textStyle="bold"/>
<Switch
android:id="@+id/switchAutoClose"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_different_topic"
android:switchPadding="12dp"
android:text="@string/msg__close_timer"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"
android:textColor="?android:textColorPrimary"/>
<Switch
android:id="@+id/switchNightMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:text="@string/msg__night_mode"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"
android:textColor="?android:textColorPrimary"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_different_section"
android:text="@string/title__backup"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_different_topic"
android:text="@string/msg__brainkey_description"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnViewBrainKey"
style="@style/Widget.Bitsy.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:text="@string/btn__view_and_copy"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_different_section"
android:text="@string/title__bugs_or_ideas"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:autoLink="all"
android:lineSpacingExtra="8dp"
android:text="@string/msg__bugs_or_ideas"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"/>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/title__general"
android:textAppearance="@style/TextAppearance.Bitsy.Subtitle1"
android:textStyle="bold"/>
<Switch
android:id="@+id/switchAutoClose"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_different_topic"
android:switchPadding="12dp"
android:text="@string/msg__close_timer"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"
android:textColor="?android:textColorPrimary"/>
<Switch
android:id="@+id/switchNightMode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:text="@string/msg__night_mode"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"
android:textColor="?android:textColorPrimary"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_different_section"
android:text="@string/title__backup"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_different_topic"
android:text="@string/msg__brainkey_description"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnViewBrainKey"
style="@style/Widget.Bitsy.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:text="@string/btn__view_and_copy"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_different_section"
android:text="@string/title__bugs_or_ideas"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_same_topic"
android:autoLink="all"
android:lineSpacingExtra="8dp"
android:text="@string/msg__bugs_or_ideas"
android:textAppearance="@style/TextAppearance.Bitsy.Body1"/>
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>