forked from github/wulkanowy-mirror
Add version text to login form (#188)
This commit is contained in:
parent
834ef7c297
commit
60c7316742
@ -80,6 +80,7 @@ configurations.all {
|
||||
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
||||
implementation('com.github.wulkanowy:api:0ac961607b') { exclude module: "threetenbp" }
|
||||
|
||||
implementation "androidx.legacy:legacy-support-v4:1.0.0"
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.github.wulkanowy.ui.modules.login.form
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
@ -9,6 +10,8 @@ import android.view.ViewGroup
|
||||
import android.view.inputmethod.EditorInfo.IME_ACTION_DONE
|
||||
import android.view.inputmethod.EditorInfo.IME_NULL
|
||||
import android.widget.ArrayAdapter
|
||||
import io.github.wulkanowy.BuildConfig.DEBUG
|
||||
import io.github.wulkanowy.BuildConfig.VERSION_NAME
|
||||
import io.github.wulkanowy.R
|
||||
import io.github.wulkanowy.ui.base.BaseFragment
|
||||
import io.github.wulkanowy.ui.modules.login.LoginActivity
|
||||
@ -26,6 +29,8 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
||||
fun newInstance() = LoginFormFragment()
|
||||
}
|
||||
|
||||
override val isDebug = DEBUG
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.fragment_login_form, container, false)
|
||||
}
|
||||
@ -66,6 +71,14 @@ class LoginFormFragment : BaseFragment(), LoginFormView {
|
||||
showSoftKeyboard()
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun showVersion() {
|
||||
loginVersion.apply {
|
||||
visibility = VISIBLE
|
||||
text = "${getString(R.string.app_name)} $VERSION_NAME"
|
||||
}
|
||||
}
|
||||
|
||||
override fun switchOptionsView() {
|
||||
(activity as? LoginActivity)?.onChildFragmentSwitchOptions()
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ class LoginFormPresenter @Inject constructor(
|
||||
super.onAttachView(view)
|
||||
view.run {
|
||||
initView()
|
||||
if (isDebug) showVersion()
|
||||
errorHandler.onBadCredentials = {
|
||||
setErrorPassIncorrect()
|
||||
showSoftKeyboard()
|
||||
|
@ -4,6 +4,8 @@ import io.github.wulkanowy.ui.base.BaseView
|
||||
|
||||
interface LoginFormView : BaseView {
|
||||
|
||||
val isDebug: Boolean
|
||||
|
||||
fun initView()
|
||||
|
||||
fun switchOptionsView()
|
||||
@ -22,6 +24,8 @@ interface LoginFormView : BaseView {
|
||||
|
||||
fun resetViewErrors()
|
||||
|
||||
fun showVersion()
|
||||
|
||||
fun showSoftKeyboard()
|
||||
|
||||
fun hideSoftKeyboard()
|
||||
|
@ -8,8 +8,8 @@
|
||||
android:id="@+id/loginFormProgressContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
@ -21,8 +21,8 @@
|
||||
android:layout_below="@id/loginFormProgressText"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:indeterminate="true"
|
||||
android:minHeight="30dp"
|
||||
android:minWidth="220dp" />
|
||||
android:minWidth="220dp"
|
||||
android:minHeight="30dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginFormProgressText"
|
||||
@ -44,16 +44,16 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginHeader"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:text="@string/login_header_default"
|
||||
android:textSize="16sp" />
|
||||
|
||||
@ -126,12 +126,22 @@
|
||||
style="?android:textAppearanceSmall"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:text="@string/login_sign_in"
|
||||
android:textColor="@android:color/white"
|
||||
android:textStyle="bold"
|
||||
app:backgroundTint="@color/colorPrimary" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/loginVersion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/second_text"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</RelativeLayout>
|
||||
|
@ -24,7 +24,7 @@
|
||||
android:layout_toEndOf="@id/timetableWidgetItemNumber"
|
||||
android:layout_toRightOf="@id/timetableWidgetItemNumber"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/second_text_color"
|
||||
android:textColor="@color/second_text"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
@ -39,7 +39,7 @@
|
||||
android:layout_toEndOf="@id/timetableWidgetItemTime"
|
||||
android:layout_toRightOf="@id/timetableWidgetItemTime"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/second_text_color"
|
||||
android:textColor="@color/second_text"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
@ -69,6 +69,6 @@
|
||||
android:layout_toEndOf="@id/timetableWidgetItemNumber"
|
||||
android:layout_toRightOf="@id/timetableWidgetItemNumber"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/second_text_color"
|
||||
android:textColor="@color/second_text"
|
||||
android:textSize="12sp" />
|
||||
</RelativeLayout>
|
||||
|
@ -14,8 +14,7 @@
|
||||
<color name="grade_one">#d65757</color>
|
||||
<color name="grade_default">#3d5f9c</color>
|
||||
|
||||
<color name="secondary_text">#4c4c4c</color>
|
||||
<color name="second_text_color">#333</color>
|
||||
<color name="second_text">#474747</color>
|
||||
|
||||
<color name="bottom_nav_background">#303030</color>
|
||||
<color name="bottom_nav_background_inverse">#ffffff</color>
|
||||
|
Loading…
x
Reference in New Issue
Block a user