remove keyboard listener and rename resources
This commit is contained in:
parent
57ace448a5
commit
4f4e6c7ab5
10 changed files with 264 additions and 317 deletions
|
@ -3,7 +3,7 @@
|
|||
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/dialog_no_telegram_bg" />
|
||||
<solid android:color="@color/ctrl_light" />
|
||||
<corners android:radius="@dimen/dialog_button_radius" />
|
||||
</shape>
|
||||
</item>
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/dialog_continue_btn_active_bg" />
|
||||
<corners android:radius="@dimen/dialog_continue_button_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/ctrl_light" />
|
||||
<corners android:radius="@dimen/dialog_continue_button_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/dialog_continue_btn_non_active_bg" />
|
||||
<corners android:radius="@dimen/dialog_continue_button_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</selector>
|
|
@ -3,20 +3,20 @@
|
|||
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/dialog_continue_btn_active_bg" />
|
||||
<corners android:radius="@dimen/dialog_continue_button_radius" />
|
||||
<solid android:color="@color/ctrl_active_light" />
|
||||
<corners android:radius="@dimen/dialog_button_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/ctrl_light" />
|
||||
<corners android:radius="@dimen/dialog_continue_button_radius" />
|
||||
<corners android:radius="@dimen/dialog_button_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/dialog_continue_btn_active_bg" />
|
||||
<corners android:radius="@dimen/dialog_continue_button_radius" />
|
||||
<solid android:color="@color/ctrl_active_light" />
|
||||
<corners android:radius="@dimen/dialog_button_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
|
|
@ -11,7 +11,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
android:visibility="visible">
|
||||
android:visibility="visible"
|
||||
tools:visibility="gone">
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -31,25 +32,28 @@
|
|||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginRight="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginTop="@dimen/dialog_welcome_title_top_padding"
|
||||
android:layout_marginTop="85dp"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/welcome_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dialog_welcome_title_bottom_padding"
|
||||
android:text="@string/shared_string_welcome"
|
||||
android:layout_marginBottom="70dp"
|
||||
android:letterSpacing="-0.03"
|
||||
android:text="Hello!"
|
||||
android:textColor="?attr/ctrl_active_color"
|
||||
android:textSize="@dimen/title_welcome_text_size"
|
||||
app:typeface="@string/font_roboto_mono_bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/welcome_descr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:letterSpacing="0.0156"
|
||||
android:lineSpacingMultiplier="1.25"
|
||||
android:textColor="@color/app_bar_title_light"
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
tools:text="@string/welcome_descr" />
|
||||
|
@ -79,11 +83,12 @@
|
|||
android:background="?attr/card_bg_color"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/action_bar_height"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="@dimen/action_bar_height"
|
||||
android:orientation="horizontal">
|
||||
|
@ -114,258 +119,252 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<ScrollView
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true">
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/login_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginEnd="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginLeft="@dimen/dialog_padding_horizontal"
|
||||
android:layout_marginRight="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginStart="@dimen/dialog_padding_horizontal"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:textColor="@color/app_bar_title_light"
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
tools:text="@string/authorization_already_registered_in_telegram" />
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginLeft="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginRight="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginStart="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/no_telegram"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dialog_padding_vertical"
|
||||
android:background="@drawable/no_telegram_btn_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/no_telegram_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="2"
|
||||
android:text="@string/do_not_have_telegram"
|
||||
android:textColor="?attr/ctrl_active_color"
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
app:typeface="@string/font_roboto_mono_bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_telegram_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:contentDescription="@string/do_not_have_telegram"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_arrow_forward"
|
||||
android:tint="?attr/icon_color"
|
||||
tools:tint="@color/icon_light" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/login_input_type_descr"
|
||||
<TextView
|
||||
android:id="@+id/login_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginEnd="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginStart="@dimen/content_padding_standard"
|
||||
android:text="@string/enter_phone_number"
|
||||
android:layout_marginEnd="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginLeft="@dimen/dialog_padding_horizontal"
|
||||
android:layout_marginRight="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginStart="@dimen/dialog_padding_horizontal"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:letterSpacing="0.0156"
|
||||
android:lineSpacingMultiplier="1.25"
|
||||
android:textColor="@color/app_bar_title_light"
|
||||
android:textSize="@dimen/title_text_size"
|
||||
app:typeface="@string/font_roboto_mono_bold" />
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
tools:text="@string/already_registered_in_telegram" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/enter_phone_number_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:layout_marginRight="@dimen/dialog_welcome_padding_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
android:paddingBottom="@dimen/dialog_padding_horizontal">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
||||
<LinearLayout
|
||||
android:id="@+id/no_telegram"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hasClearButton="true">
|
||||
android:background="@drawable/btn_border_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||
android:id="@+id/phone_number_edit_text"
|
||||
android:layout_width="match_parent"
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/no_telegram_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/phone_number_title"
|
||||
android:inputType="phone" />
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="2"
|
||||
android:text="@string/do_not_have_telegram"
|
||||
android:textColor="?attr/ctrl_active_color"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
app:typeface="@string/font_roboto_mono_bold" />
|
||||
|
||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
||||
<ImageView
|
||||
android:id="@+id/no_telegram_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:contentDescription="@string/do_not_have_telegram"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_arrow_forward"
|
||||
android:tint="?attr/icon_color"
|
||||
tools:tint="@color/icon_light" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/phone_number_format"
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.telegram.ui.views.TextViewEx
|
||||
android:id="@+id/login_input_type_descr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:text="@string/phone_number_descr"
|
||||
android:textSize="@dimen/descr_text_size" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/enter_code_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/content_padding_standard"
|
||||
android:visibility="gone">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hasClearButton="true"
|
||||
app:labelText="@string/authentication_code">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||
android:id="@+id/code_edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
tools:text="123456" />
|
||||
|
||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/enter_password_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/content_padding_standard"
|
||||
android:visibility="gone">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hasClearButton="true"
|
||||
app:labelText="@string/shared_string_password">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||
android:id="@+id/password_edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword"
|
||||
tools:text="12345678" />
|
||||
|
||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/get_telegram_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/content_padding_standard"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/get_telegram_description_first"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginEnd="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginStart="@dimen/content_padding_standard"
|
||||
android:text="@string/enter_phone_number"
|
||||
android:textColor="@color/app_bar_title_light"
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
tools:text="@string/get_telegram_description_continue" />
|
||||
app:typeface="@string/font_roboto_mono_bold" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/google_play_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginEnd="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginStart="@dimen/content_padding_standard"
|
||||
android:src="@drawable/google_play_badge" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/get_telegram_description_second"
|
||||
<LinearLayout
|
||||
android:id="@+id/enter_phone_number_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginEnd="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginStart="@dimen/content_padding_standard"
|
||||
android:textColor="@color/app_bar_title_light"
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
tools:text="@string/get_telegram_after_creating_account" />
|
||||
android:orientation="vertical"
|
||||
android:visibility="visible">
|
||||
|
||||
</LinearLayout>
|
||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hasClearButton="true">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/progress_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||
android:id="@+id/phone_number_edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="@string/phone_number_title"
|
||||
android:inputType="phone" />
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="@dimen/progress_bar_size_small"
|
||||
android:layout_height="@dimen/progress_bar_size_small" />
|
||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/phone_number_format"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:text="@string/phone_number_descr"
|
||||
android:textSize="@dimen/descr_text_size" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/enter_code_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/content_padding_standard"
|
||||
android:visibility="gone">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hasClearButton="true"
|
||||
app:labelText="@string/authentication_code">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||
android:id="@+id/code_edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="number"
|
||||
tools:text="123456" />
|
||||
|
||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/enter_password_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/content_padding_standard"
|
||||
android:visibility="gone">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:hasClearButton="true"
|
||||
app:labelText="@string/shared_string_password">
|
||||
|
||||
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||
android:id="@+id/password_edit_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="textPassword"
|
||||
tools:text="12345678" />
|
||||
|
||||
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/get_telegram_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/content_padding_standard"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/get_telegram_description_first"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:textColor="@color/app_bar_title_light"
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
tools:text="@string/get_telegram_description_continue" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/google_play_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:src="@drawable/google_play_badge" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/get_telegram_description_second"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:textColor="@color/app_bar_title_light"
|
||||
android:textSize="@dimen/descr_text_size"
|
||||
tools:text="@string/get_telegram_after_creating_account" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/progress_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:visibility="gone">
|
||||
|
||||
<ProgressBar
|
||||
android:layout_width="@dimen/progress_bar_size_small"
|
||||
android:layout_height="@dimen/progress_bar_size_small" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</ScrollView>
|
||||
<Button
|
||||
android:id="@+id/continue_button"
|
||||
style="@style/DialogActionButtonActive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
android:layout_marginBottom="@dimen/dialog_button_bottom_padding"
|
||||
android:text="@string/shared_string_continue" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/continue_button"
|
||||
style="@style/DialogActionButtonActive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginBottom="@dimen/dialog_button_bottom_padding"
|
||||
android:layout_marginLeft="@dimen/content_padding_standard"
|
||||
android:layout_marginRight="@dimen/content_padding_standard"
|
||||
android:layout_marginTop="@dimen/content_padding_standard"
|
||||
android:text="@string/shared_string_continue" />
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -36,8 +36,4 @@
|
|||
|
||||
<color name="app_bar_title_light">#333333</color>
|
||||
|
||||
<color name="dialog_continue_btn_active_bg">#5959ff</color>
|
||||
<color name="dialog_continue_btn_non_active_bg">#f0f0f0</color>
|
||||
<color name="dialog_no_telegram_bg">#f0f0f0</color>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -17,8 +17,7 @@
|
|||
<dimen name="dialog_welcome_padding_horizontal">48dp</dimen>
|
||||
|
||||
<dimen name="dialog_button_height">36dp</dimen>
|
||||
<dimen name="dialog_button_radius">2dp</dimen>
|
||||
<dimen name="dialog_continue_button_radius">4dp</dimen>
|
||||
<dimen name="dialog_button_radius">4dp</dimen>
|
||||
<dimen name="dialog_button_bottom_padding">40dp</dimen>
|
||||
<dimen name="dialog_welcome_title_bottom_padding">96dp</dimen>
|
||||
<dimen name="dialog_welcome_title_top_padding">120dp</dimen>
|
||||
|
@ -46,7 +45,7 @@
|
|||
|
||||
<dimen name="buttons_bottom_bar_height">56dp</dimen>
|
||||
|
||||
<dimen name="text_button_letter_spacing" format="float">0.01</dimen>
|
||||
<dimen name="text_button_letter_spacing" format="float">0.07</dimen>
|
||||
|
||||
<!-- Text sizes -->
|
||||
|
||||
|
@ -56,7 +55,6 @@
|
|||
<dimen name="title_login_text_size">20sp</dimen>
|
||||
<dimen name="title_welcome_text_size">32sp</dimen>
|
||||
<dimen name="descr_text_size">16sp</dimen>
|
||||
<dimen name="continue_btn_text_size">14sp</dimen>
|
||||
|
||||
<dimen name="list_item_title_text_size">16sp</dimen>
|
||||
<dimen name="list_item_description_text_size">12sp</dimen>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<string name="get_telegram_after_creating_account">After creating an account, you can use this application.</string>
|
||||
<string name="shared_string_all">All</string>
|
||||
<string name="shared_string_off">Off</string>
|
||||
<string name="authorization_already_registered_in_telegram">You need an already registered account and phone number in Telegram</string>
|
||||
<string name="already_registered_in_telegram">You need an already registered account and phone number in Telegram</string>
|
||||
<string name="do_not_have_telegram">I don`t have Telegram account</string>
|
||||
<string name="enter_phone_number">Enter phone number</string>
|
||||
<string name="enter_authentication_code">Enter authentication code</string>
|
||||
|
|
|
@ -48,13 +48,13 @@
|
|||
<item name="android:paddingBottom">8dp</item>
|
||||
<item name="android:textColor">@color/white</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:textSize">@dimen/continue_btn_text_size</item>
|
||||
<item name="android:background">@drawable/btn_round_4dp</item>
|
||||
<item name="android:letterSpacing">0.07</item>
|
||||
<item name="android:textSize">@dimen/text_button_text_size</item>
|
||||
<item name="android:background">@drawable/btn_round_active</item>
|
||||
<item name="android:letterSpacing">@dimen/text_button_letter_spacing</item>
|
||||
</style>
|
||||
|
||||
<style name="DialogActionButtonActive.Welcome">
|
||||
<item name="android:background">@drawable/btn_round_purple</item>
|
||||
<item name="android:background">@drawable/btn_round_active</item>
|
||||
</style>
|
||||
|
||||
<style name="DialogActionButton">
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.support.annotation.StringRes
|
|||
import android.support.v4.app.DialogFragment
|
||||
import android.support.v4.app.FragmentManager
|
||||
import android.support.v7.widget.AppCompatImageView
|
||||
import android.text.Html
|
||||
import android.text.TextUtils
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.widget.*
|
||||
|
@ -17,12 +16,12 @@ import net.osmand.telegram.R
|
|||
import net.osmand.telegram.utils.AndroidUtils
|
||||
import studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||
import android.content.Intent
|
||||
import android.graphics.Rect
|
||||
import android.net.Uri
|
||||
import android.support.v4.content.ContextCompat
|
||||
import android.view.*
|
||||
import android.view.ViewGroup
|
||||
import android.text.Editable
|
||||
import android.text.Html
|
||||
import android.text.TextWatcher
|
||||
|
||||
|
||||
|
@ -36,15 +35,11 @@ class LoginDialogFragment : DialogFragment() {
|
|||
private const val LOGIN_DIALOG_TYPE_PARAM_KEY = "login_dialog_type_param"
|
||||
private const val SHOW_PROGRESS_PARAM_KEY = "show_progress_param"
|
||||
private const val SHOW_WELCOME_DIALOG_PARAM_KEY = "show_welcome_dialog_param"
|
||||
private const val TELEGRAM_PLAY_MARKET_LINK = "market://details?id=org.telegram.messenger"
|
||||
private const val TELEGRAM_NO_PLAY_MARKET_LINK = "https://play.google.com/store/apps/details?id=org.telegram.messenger"
|
||||
private const val SOFT_KEYBOARD_MIN_DETECTION_SIZE = 0.15
|
||||
private const val TELEGRAM_PACKAGE = "org.telegram.messenger"
|
||||
|
||||
var welcomeDialogShown = false
|
||||
private set
|
||||
|
||||
private var softKeyboardShown: Boolean = false
|
||||
|
||||
fun showWelcomeDialog(fragmentManager: FragmentManager) {
|
||||
welcomeDialogShown = true
|
||||
showDialog(fragmentManager, welcomeDialog = true)
|
||||
|
@ -97,8 +92,8 @@ class LoginDialogFragment : DialogFragment() {
|
|||
|
||||
private var showWelcomeDialog = false
|
||||
private var showProgress = false
|
||||
private var continueButtonEnabled = false
|
||||
private var dismissedManually = false
|
||||
private lateinit var continueButton: Button
|
||||
|
||||
enum class LoginDialogType(val viewId: Int, val editorId: Int,
|
||||
@StringRes val titleId: Int, @StringRes val descriptionId: Int,
|
||||
|
@ -132,32 +127,12 @@ class LoginDialogFragment : DialogFragment() {
|
|||
showWelcomeDialog = args.getBoolean(SHOW_WELCOME_DIALOG_PARAM_KEY, false)
|
||||
}
|
||||
val view = inflater.inflate(R.layout.login_dialog, container)
|
||||
buildDialog(view)
|
||||
view.viewTreeObserver.addOnGlobalLayoutListener {
|
||||
val r = Rect()
|
||||
view.getWindowVisibleDisplayFrame(r)
|
||||
val screenHeight = view.rootView.height
|
||||
val keypadHeight = screenHeight - r.bottom
|
||||
val softKeyboardVisible = keypadHeight > screenHeight * SOFT_KEYBOARD_MIN_DETECTION_SIZE
|
||||
if (!softKeyboardShown && softKeyboardVisible) {
|
||||
softKeyboardShown = softKeyboardVisible
|
||||
val continueButton = view?.findViewById<Button>(R.id.continue_button)
|
||||
if (continueButton?.layoutParams is ViewGroup.MarginLayoutParams) {
|
||||
val p = continueButton.layoutParams as ViewGroup.MarginLayoutParams
|
||||
p.setMargins(p.leftMargin, p.topMargin, p.rightMargin, AndroidUtils.dpToPx(context!!, 16F))
|
||||
continueButton.requestLayout()
|
||||
}
|
||||
} else if (softKeyboardShown && !softKeyboardVisible) {
|
||||
softKeyboardShown = softKeyboardVisible
|
||||
val continueButton = view?.findViewById<Button>(R.id.continue_button)
|
||||
if (continueButton?.layoutParams is ViewGroup.MarginLayoutParams) {
|
||||
val p = continueButton.layoutParams as ViewGroup.MarginLayoutParams
|
||||
p.setMargins(p.leftMargin, p.topMargin, p.rightMargin, AndroidUtils.dpToPx(context!!, 40F))
|
||||
continueButton.requestLayout()
|
||||
}
|
||||
}
|
||||
softKeyboardShown = softKeyboardVisible
|
||||
val button = view?.findViewById<Button>(R.id.continue_button)
|
||||
if (button != null) {
|
||||
continueButton = button
|
||||
}
|
||||
|
||||
buildDialog(view)
|
||||
return view
|
||||
}
|
||||
|
||||
|
@ -251,20 +226,12 @@ class LoginDialogFragment : DialogFragment() {
|
|||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
if (continueButton != null) {
|
||||
if (s.isEmpty()) {
|
||||
changeContinueButton(continueButton, false)
|
||||
} else {
|
||||
changeContinueButton(continueButton, true)
|
||||
}
|
||||
changeContinueButtonEnabled(!s.isEmpty())
|
||||
}
|
||||
}
|
||||
})
|
||||
if (continueButton != null) {
|
||||
if (editText.text.isEmpty()) {
|
||||
changeContinueButton(continueButton, false)
|
||||
} else {
|
||||
changeContinueButton(continueButton, true)
|
||||
}
|
||||
changeContinueButtonEnabled(!editText.text.isEmpty())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,7 +243,7 @@ class LoginDialogFragment : DialogFragment() {
|
|||
|
||||
noTelegramViewContainer?.setOnClickListener {
|
||||
val focusedView = dialog.currentFocus
|
||||
if (focusedView != null && softKeyboardShown) {
|
||||
if (focusedView != null) {
|
||||
AndroidUtils.hideSoftKeyboard(activity!!, focusedView)
|
||||
}
|
||||
updateDialog(LoginDialogType.GET_TELEGRAM, false)
|
||||
|
@ -293,10 +260,9 @@ class LoginDialogFragment : DialogFragment() {
|
|||
val getTelegramButton: ImageView? = view.findViewById(R.id.google_play_button)
|
||||
getTelegramButton?.setImageResource(R.drawable.google_play_badge)
|
||||
getTelegramButton?.setOnClickListener {
|
||||
try {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(TELEGRAM_PLAY_MARKET_LINK)))
|
||||
} catch (anfe: android.content.ActivityNotFoundException) {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(TELEGRAM_NO_PLAY_MARKET_LINK)))
|
||||
val app = getMainActivity()?.application
|
||||
if (app != null) {
|
||||
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(AndroidUtils.getPlayMarketLink(app, TELEGRAM_PACKAGE))))
|
||||
}
|
||||
}
|
||||
view.findViewById<Button>(R.id.continue_button).visibility = View.GONE
|
||||
|
@ -316,16 +282,15 @@ class LoginDialogFragment : DialogFragment() {
|
|||
progressView?.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
val continueButton: Button? = view?.findViewById(R.id.continue_button)
|
||||
if (continueButton != null) {
|
||||
continueButton.isEnabled = !showProgress && continueButtonEnabled
|
||||
continueButton.isEnabled = !showProgress && continueButton.isEnabled
|
||||
if (showProgress) {
|
||||
continueButton.setOnClickListener(null)
|
||||
} else {
|
||||
continueButton.setOnClickListener {
|
||||
showWelcomeDialog = false
|
||||
for (t in LoginDialogType.values()) {
|
||||
val layout: View? = view.findViewById(t.viewId)
|
||||
val layout: View? = view?.findViewById(t.viewId)
|
||||
val contains = t == loginDialogActiveType
|
||||
if (contains && layout != null) {
|
||||
val editText: ExtendedEditText? = layout.findViewById(t.editorId)
|
||||
|
@ -345,7 +310,7 @@ class LoginDialogFragment : DialogFragment() {
|
|||
if (loginDialogActiveType == LoginDialogType.ENTER_PHONE_NUMBER) {
|
||||
showWelcomeDialog = true
|
||||
val focusedView = dialog.currentFocus
|
||||
if (focusedView != null && softKeyboardShown) {
|
||||
if (focusedView != null) {
|
||||
AndroidUtils.hideSoftKeyboard(activity!!, focusedView)
|
||||
}
|
||||
buildDialog(view)
|
||||
|
@ -391,17 +356,12 @@ class LoginDialogFragment : DialogFragment() {
|
|||
buildDialog(view)
|
||||
}
|
||||
|
||||
private fun changeContinueButton(continueButton: Button, isActive: Boolean = false) {
|
||||
if (isActive) {
|
||||
continueButton.setBackgroundResource(R.drawable.btn_round_purple)
|
||||
private fun changeContinueButtonEnabled(enabled: Boolean) {
|
||||
if (enabled) {
|
||||
continueButton.setTextColor(ContextCompat.getColor(context!!, R.color.white))
|
||||
continueButtonEnabled = isActive
|
||||
continueButton.isEnabled = continueButtonEnabled
|
||||
} else {
|
||||
continueButton.setBackgroundResource(R.drawable.btn_round_4dp)
|
||||
continueButton.setTextColor(ContextCompat.getColor(context!!, R.color.secondary_text_light))
|
||||
continueButtonEnabled = isActive
|
||||
continueButton.isEnabled = continueButtonEnabled
|
||||
}
|
||||
continueButton.isEnabled = enabled
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,4 +73,21 @@ object AndroidUtils {
|
|||
FileProvider.getUriForFile(context, "net.osmand.telegram.fileprovider", file)
|
||||
}
|
||||
}
|
||||
|
||||
fun isGooglePlayInstalled(ctx: Context): Boolean {
|
||||
try {
|
||||
ctx.packageManager.getPackageInfo("com.android.vending", 0)
|
||||
} catch (e: PackageManager.NameNotFoundException) {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
fun getPlayMarketLink(ctx: Context, packageName: String): String {
|
||||
if (isGooglePlayInstalled(ctx)) {
|
||||
return "market://details?id=$packageName"
|
||||
}
|
||||
return "https://play.google.com/store/apps/details?id=$packageName"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue