add the numbers grid at the Pin tab

This commit is contained in:
tibbi 2017-08-01 21:53:59 +02:00
parent 67d6b0482e
commit 16a5637d71
4 changed files with 173 additions and 0 deletions

View file

@ -10,5 +10,30 @@ class PinTab(context: Context, attrs: AttributeSet) : RelativeLayout(context, at
override fun onFinishInflate() { override fun onFinishInflate() {
super.onFinishInflate() super.onFinishInflate()
context.updateTextColors(pin_lock_holder) context.updateTextColors(pin_lock_holder)
pin_0.setOnClickListener { addNumber(0) }
pin_1.setOnClickListener { addNumber(1) }
pin_2.setOnClickListener { addNumber(2) }
pin_3.setOnClickListener { addNumber(3) }
pin_4.setOnClickListener { addNumber(4) }
pin_5.setOnClickListener { addNumber(5) }
pin_6.setOnClickListener { addNumber(6) }
pin_7.setOnClickListener { addNumber(7) }
pin_8.setOnClickListener { addNumber(8) }
pin_9.setOnClickListener { addNumber(9) }
pin_c.setOnClickListener { clear() }
pin_ok.setOnClickListener { confirmPIN() }
}
private fun addNumber(number: Int) {
}
private fun clear() {
}
private fun confirmPIN() {
} }
} }

View file

@ -26,4 +26,136 @@
android:paddingTop="@dimen/small_margin" android:paddingTop="@dimen/small_margin"
android:textSize="@dimen/big_text_size"/> android:textSize="@dimen/big_text_size"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/pin_lock_current_pin"
android:layout_marginTop="@dimen/activity_margin"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_1"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="1"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_2"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="2"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_3"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="3"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_4"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="4"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_5"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="5"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_6"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="6"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_7"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="7"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_8"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="8"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_9"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="9"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_c"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="C"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/pin_0"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="0"/>
<ImageView
android:id="@+id/pin_ok"
style="@style/PinNumberStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_check"/>
</LinearLayout>
</LinearLayout>
</com.simplemobiletools.gallery.views.PinTab> </com.simplemobiletools.gallery.views.PinTab>

View file

@ -3,4 +3,9 @@
<style name="FullScreenTheme" parent="FullScreenTheme.Base"> <style name="FullScreenTheme" parent="FullScreenTheme.Base">
<item name="android:windowTranslucentNavigation">true</item> <item name="android:windowTranslucentNavigation">true</item>
</style> </style>
<style name="PinNumberStyle" parent="PinNumberStyle.Base">
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
</style>
</resources> </resources>

View file

@ -15,4 +15,15 @@
<style name="MyFullScreenActionBar" parent="Widget.AppCompat.Light.ActionBar"> <style name="MyFullScreenActionBar" parent="Widget.AppCompat.Light.ActionBar">
<item name="titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item> <item name="titleTextStyle">@style/AppTheme.ActionBar.TitleTextStyle</item>
</style> </style>
<style name="PinNumberStyle.Base">
<item name="android:gravity">center</item>
<item name="android:padding">@dimen/small_margin</item>
<item name="android:textSize">@dimen/big_text_size</item>
</style>
<style name="PinNumberStyle" parent="PinNumberStyle.Base">
<item name="android:background">?attr/selectableItemBackground</item>
</style>
</resources> </resources>