Refactored Login screen
This commit is contained in:
parent
36b9fe3927
commit
46b1bba997
19 changed files with 703 additions and 377 deletions
|
@ -4,128 +4,134 @@ apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-android-extensions'
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 27
|
compileSdkVersion 27
|
||||||
|
buildToolsVersion "27.0.3"
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
manifest.srcFile "AndroidManifest.xml"
|
manifest.srcFile "AndroidManifest.xml"
|
||||||
jni.srcDirs = []
|
jni.srcDirs = []
|
||||||
jniLibs.srcDirs = ["libs"]
|
jniLibs.srcDirs = ["libs"]
|
||||||
aidl.srcDirs = ["src"]
|
aidl.srcDirs = ["src"]
|
||||||
java.srcDirs = ["src"]
|
java.srcDirs = ["src"]
|
||||||
resources.srcDirs = ["src"]
|
resources.srcDirs = ["src"]
|
||||||
res.srcDirs = ["res"]
|
res.srcDirs = ["res"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "net.osmand.telegram"
|
applicationId "net.osmand.telegram"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
|
versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName
|
versionName System.getenv("APK_VERSION") ? System.getenv("APK_VERSION").toString() : versionName
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions "abi"
|
flavorDimensions "abi"
|
||||||
|
|
||||||
productFlavors {
|
productFlavors {
|
||||||
x86 {
|
x86 {
|
||||||
dimension "abi"
|
dimension "abi"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilter "x86"
|
abiFilter "x86"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
armv7 {
|
armv7 {
|
||||||
dimension "abi"
|
dimension "abi"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilter "armeabi-v7a"
|
abiFilter "armeabi-v7a"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
arm64 {
|
arm64 {
|
||||||
dimension "abi"
|
dimension "abi"
|
||||||
ndk {
|
ndk {
|
||||||
abiFilter "arm64-v8a"
|
abiFilter "arm64-v8a"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fat {
|
fat {
|
||||||
dimension "abi"
|
dimension "abi"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
development {
|
development {
|
||||||
storeFile file("../keystores/debug.keystore")
|
storeFile file("../keystores/debug.keystore")
|
||||||
storePassword "android"
|
storePassword "android"
|
||||||
keyAlias "androiddebugkey"
|
keyAlias "androiddebugkey"
|
||||||
keyPassword "android"
|
keyPassword "android"
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
storeFile file("/var/lib/jenkins/osmand_key")
|
storeFile file("/var/lib/jenkins/osmand_key")
|
||||||
storePassword System.getenv("OSMAND_APK_PASSWORD")
|
storePassword System.getenv("OSMAND_APK_PASSWORD")
|
||||||
keyAlias "osmand"
|
keyAlias "osmand"
|
||||||
keyPassword System.getenv("OSMAND_APK_PASSWORD")
|
keyPassword System.getenv("OSMAND_APK_PASSWORD")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
debug {
|
debug {
|
||||||
signingConfig signingConfigs.development
|
signingConfig signingConfigs.development
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
}
|
}
|
||||||
release {
|
release {
|
||||||
signingConfig signingConfigs.publishing
|
signingConfig signingConfigs.publishing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lintOptions {
|
lintOptions {
|
||||||
// use this line to check all rules except those listed
|
// use this line to check all rules except those listed
|
||||||
disable 'InvalidPackage'
|
disable 'InvalidPackage'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task downloadTdLibzip {
|
task downloadTdLibzip {
|
||||||
doLast {
|
doLast {
|
||||||
ant.get(src: 'https://core.telegram.org/tdlib/tdlib.zip', dest: 'tdlib.zip', skipexisting: 'true')
|
ant.get(src: 'https://core.telegram.org/tdlib/tdlib.zip', dest: 'tdlib.zip', skipexisting: 'true')
|
||||||
ant.unzip(src: 'tdlib.zip', dest: 'tdlib/')
|
ant.unzip(src: 'tdlib.zip', dest: 'tdlib/')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyNativeLibs(type: Copy) {
|
task copyNativeLibs(type: Copy) {
|
||||||
dependsOn downloadTdLibzip
|
dependsOn downloadTdLibzip
|
||||||
from "tdlib/libtd/src/main/libs"
|
from "tdlib/libtd/src/main/libs"
|
||||||
into "libs"
|
into "libs"
|
||||||
}
|
}
|
||||||
|
|
||||||
task copyJavaSources(type: Copy) {
|
task copyJavaSources(type: Copy) {
|
||||||
dependsOn downloadTdLibzip
|
dependsOn downloadTdLibzip
|
||||||
from "tdlib/libtd/src/main/java/org/drinkless/td"
|
from "tdlib/libtd/src/main/java/org/drinkless/td"
|
||||||
into "src/org/drinkless/td"
|
into "src/org/drinkless/td"
|
||||||
}
|
}
|
||||||
|
|
||||||
task downloadPrebuiltTelegram {
|
task downloadPrebuiltTelegram {
|
||||||
dependsOn downloadTdLibzip, copyNativeLibs, copyJavaSources
|
dependsOn downloadTdLibzip, copyNativeLibs, copyJavaSources
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
android.applicationVariants.all { variant ->
|
android.applicationVariants.all { variant ->
|
||||||
variant.javaCompiler.dependsOn(downloadPrebuiltTelegram)
|
variant.javaCompiler.dependsOn(downloadPrebuiltTelegram)
|
||||||
variant.preBuild.dependsOn(downloadPrebuiltTelegram)
|
variant.preBuild.dependsOn(downloadPrebuiltTelegram)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation project(path: ':OsmAnd-java', configuration: 'android')
|
implementation project(path: ':OsmAnd-java', configuration: 'android')
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
implementation 'com.android.support:appcompat-v7:27.1.1'
|
implementation 'com.android.support:appcompat-v7:27.1.1'
|
||||||
implementation 'com.android.support:support-annotations:27.1.1'
|
implementation 'com.android.support:design:27.1.1'
|
||||||
implementation 'commons-logging:commons-logging-api:1.1'
|
implementation 'com.android.support:customtabs:27.1.1'
|
||||||
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
implementation 'com.android.support:support-annotations:27.1.1'
|
||||||
implementation 'com.vividsolutions:jts-core:1.14.0'
|
implementation 'commons-logging:commons-logging-api:1.1'
|
||||||
|
implementation 'com.android.support:recyclerview-v7:27.1.1'
|
||||||
|
implementation 'com.vividsolutions:jts-core:1.14.0'
|
||||||
|
implementation("com.github.HITGIF:TextFieldBoxes:1.4.4") {
|
||||||
|
exclude group: 'com.android.support'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
OsmAnd-telegram/res/drawable-hdpi/ic_arrow_back.png
Normal file
BIN
OsmAnd-telegram/res/drawable-hdpi/ic_arrow_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
OsmAnd-telegram/res/drawable-mdpi/ic_arrow_back.png
Normal file
BIN
OsmAnd-telegram/res/drawable-mdpi/ic_arrow_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd-telegram/res/drawable-xhdpi/ic_arrow_back.png
Normal file
BIN
OsmAnd-telegram/res/drawable-xhdpi/ic_arrow_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
OsmAnd-telegram/res/drawable-xxhdpi/ic_arrow_back.png
Normal file
BIN
OsmAnd-telegram/res/drawable-xxhdpi/ic_arrow_back.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
23
OsmAnd-telegram/res/drawable/btn_round.xml
Normal file
23
OsmAnd-telegram/res/drawable/btn_round.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?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/ctrl_active_color_light" />
|
||||||
|
<corners android:radius="@dimen/dialog_button_radius" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:state_enabled="false">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/ctrl_color_light" />
|
||||||
|
<corners android:radius="@dimen/dialog_button_radius" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/ctrl_color_light" />
|
||||||
|
<corners android:radius="@dimen/dialog_button_radius" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</selector>
|
23
OsmAnd-telegram/res/drawable/btn_round_blue.xml
Normal file
23
OsmAnd-telegram/res/drawable/btn_round_blue.xml
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<?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/ctrl_active_color_light" />
|
||||||
|
<corners android:radius="@dimen/dialog_button_radius" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item android:state_enabled="false">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/ctrl_color_light" />
|
||||||
|
<corners android:radius="@dimen/dialog_button_radius" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/ctrl_active_color_light" />
|
||||||
|
<corners android:radius="@dimen/dialog_button_radius" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</selector>
|
|
@ -1,14 +1,34 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
tools:context=".MainActivity">
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".MainActivity">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<LinearLayout
|
||||||
android:id="@+id/groups_view"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:orientation="vertical">
|
||||||
android:scrollbars="vertical" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/groups_view"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:scrollbars="vertical" />
|
||||||
|
|
||||||
|
<android.support.design.widget.BottomNavigationView
|
||||||
|
android:id="@+id/bottom_navigation"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="visible"
|
||||||
|
app:itemBackground="?attr/bg_color"
|
||||||
|
app:menu="@menu/bottom_navigation_menu"
|
||||||
|
tools:itemIconTint="@color/ctrl_active_color_light"
|
||||||
|
tools:itemTextColor="@color/ctrl_active_color_light"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</android.support.design.widget.CoordinatorLayout>
|
|
@ -7,7 +7,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@color/dialogTitleBackgroundColor"
|
android:background="?attr/ctrl_active_color"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:gravity="center_horizontal">
|
android:gravity="center_horizontal">
|
||||||
|
|
||||||
|
|
|
@ -1,143 +1,234 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:fillViewport="true"
|
android:layout_height="match_parent"
|
||||||
android:paddingBottom="@dimen/dialog_padding_vertical"
|
android:orientation="vertical">
|
||||||
android:paddingLeft="@dimen/dialog_padding_horizontal"
|
|
||||||
android:paddingRight="@dimen/dialog_padding_horizontal"
|
|
||||||
android:paddingTop="@dimen/dialog_padding_vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/welcome_layout"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:orientation="vertical">
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginLeft="@dimen/dialog_padding_horizontal_edit"
|
||||||
|
android:layout_marginRight="@dimen/dialog_padding_horizontal_edit"
|
||||||
|
android:layout_marginTop="@dimen/dialog_padding_vertical"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/welcome_title"
|
||||||
android:layout_height="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_weight="0.2"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:text="@string/shared_string_welcome"
|
||||||
android:text="@string/login_to_telegram"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textSize="@dimen/dialog_title_text_size"
|
android:textSize="@dimen/title_text_size"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_gravity="center"
|
android:layout_marginTop="@dimen/dialog_padding_vertical"
|
||||||
android:layout_weight="0.6"
|
android:layout_weight="1"
|
||||||
android:gravity="center"
|
android:fillViewport="true">
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<LinearLayout
|
<TextView
|
||||||
android:id="@+id/enterPhoneNumberLayout"
|
android:id="@+id/welcome_descr"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:visibility="visible">
|
android:textSize="@dimen/descr_text_size"
|
||||||
|
tools:text="@string/welcome_descr" />
|
||||||
|
|
||||||
<TextView
|
</ScrollView>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/phone_number_title" />
|
|
||||||
|
|
||||||
<EditText
|
<Button
|
||||||
android:id="@+id/phoneNumberEditText"
|
android:id="@+id/welcome_continue_button"
|
||||||
android:layout_width="match_parent"
|
style="@style/DialogActionButtonActive"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:hint="@string/phone_number_title"
|
android:layout_height="wrap_content"
|
||||||
android:inputType="phone"
|
android:layout_gravity="center"
|
||||||
tools:text="+380661234567" />
|
android:layout_marginBottom="@dimen/dialog_padding_vertical"
|
||||||
|
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" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/enterCodeLayout"
|
android:id="@+id/login_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="gone">
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/authentication_code" />
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="@dimen/action_bar_height"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<EditText
|
<android.support.v7.widget.AppCompatImageView
|
||||||
android:id="@+id/codeEditText"
|
android:id="@+id/back_button"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="@dimen/dialog_button_height"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/dialog_button_height"
|
||||||
android:hint="@string/authentication_code"
|
android:layout_marginEnd="@dimen/content_padding_standard"
|
||||||
android:inputType="number"
|
android:layout_marginLeft="@dimen/content_padding_half"
|
||||||
tools:text="123456" />
|
android:layout_marginRight="@dimen/content_padding_standard"
|
||||||
|
android:layout_marginStart="@dimen/content_padding_half"
|
||||||
|
android:background="?attr/selectableItemBackgroundBorderless"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:src="@drawable/ic_arrow_back"
|
||||||
|
android:tint="?attr/icon_color" />
|
||||||
|
|
||||||
</LinearLayout>
|
<TextView
|
||||||
|
android:id="@+id/login_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/content_padding_standard"
|
||||||
|
android:layout_marginRight="@dimen/content_padding_standard"
|
||||||
|
android:textColor="?attr/ctrl_active_color"
|
||||||
|
android:textSize="@dimen/title_text_size"
|
||||||
|
android:textStyle="bold"
|
||||||
|
tools:text="@string/shared_string_authorization" />
|
||||||
|
|
||||||
<LinearLayout
|
</LinearLayout>
|
||||||
android:id="@+id/enterPasswordLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/login_description"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:text="@string/shared_string_password" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="@dimen/content_padding_standard"
|
||||||
|
android:layout_marginEnd="@dimen/dialog_padding_horizontal"
|
||||||
|
android:layout_marginLeft="@dimen/dialog_padding_horizontal"
|
||||||
|
android:layout_marginRight="@dimen/dialog_padding_horizontal"
|
||||||
|
android:layout_marginStart="@dimen/dialog_padding_horizontal"
|
||||||
|
android:layout_marginTop="@dimen/content_padding_standard"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
|
android:textSize="@dimen/descr_text_size"
|
||||||
|
tools:text="@string/shared_string_authorization_descr" />
|
||||||
|
|
||||||
<EditText
|
<ScrollView
|
||||||
android:id="@+id/passwordEditText"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_height="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_weight="1"
|
||||||
android:hint="@string/shared_string_password"
|
android:fillViewport="true">
|
||||||
android:inputType="textPassword"
|
|
||||||
tools:text="12345678" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/dialog_padding_horizontal_edit"
|
||||||
|
android:layout_marginLeft="@dimen/dialog_padding_horizontal_edit"
|
||||||
|
android:layout_marginRight="@dimen/dialog_padding_horizontal_edit"
|
||||||
|
android:layout_marginStart="@dimen/dialog_padding_horizontal_edit"
|
||||||
|
android:layout_marginTop="@dimen/content_padding_standard"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/progressLayout"
|
android:id="@+id/enter_phone_number_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:orientation="vertical"
|
||||||
android:orientation="vertical"
|
android:visibility="visible">
|
||||||
android:visibility="visible">
|
|
||||||
|
|
||||||
<ProgressBar
|
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
||||||
android:layout_width="@dimen/progress_bar_size_small"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/progress_bar_size_small" />
|
android:layout_height="wrap_content"
|
||||||
|
app:hasClearButton="true"
|
||||||
|
app:labelText="@string/phone_number_title">
|
||||||
|
|
||||||
</LinearLayout>
|
<studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||||
|
android:id="@+id/phone_number_edit_text"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="phone"
|
||||||
|
android:text="@string/plus"
|
||||||
|
tools:text="+380661234567" />
|
||||||
|
|
||||||
</LinearLayout>
|
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
||||||
|
|
||||||
<LinearLayout
|
</LinearLayout>
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="0dp"
|
|
||||||
android:layout_weight="0.2"
|
|
||||||
android:gravity="bottom"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<Button
|
<LinearLayout
|
||||||
android:id="@+id/calcelButton"
|
android:id="@+id/enter_code_layout"
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
android:layout_width="match_parent"
|
||||||
android:layout_width="0dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:orientation="vertical"
|
||||||
android:layout_weight="1"
|
android:visibility="gone">
|
||||||
android:text="@string/shared_string_cancel" />
|
|
||||||
|
|
||||||
<Button
|
<studio.carbonylgroup.textfieldboxes.TextFieldBoxes
|
||||||
android:id="@+id/continueButton"
|
android:layout_width="match_parent"
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="0dp"
|
app:hasClearButton="true"
|
||||||
android:layout_height="wrap_content"
|
app:labelText="@string/authentication_code">
|
||||||
android:layout_weight="1"
|
|
||||||
android:text="@string/shared_string_continue" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
<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" />
|
||||||
|
|
||||||
</LinearLayout>
|
</studio.carbonylgroup.textfieldboxes.TextFieldBoxes>
|
||||||
|
|
||||||
</ScrollView>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/enter_password_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
|
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/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>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
|
||||||
|
<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_padding_vertical"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
12
OsmAnd-telegram/res/menu/bottom_navigation_menu.xml
Normal file
12
OsmAnd-telegram/res/menu/bottom_navigation_menu.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_my_location"
|
||||||
|
android:icon="@drawable/ic_action_polygom_dark"
|
||||||
|
android:title="@string/my_location"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_live_now"
|
||||||
|
android:icon="@drawable/ic_action_view"
|
||||||
|
android:title="@string/live_now"/>
|
||||||
|
</menu>
|
|
@ -3,5 +3,7 @@
|
||||||
<declare-styleable name="AppTheme">
|
<declare-styleable name="AppTheme">
|
||||||
<attr name="bg_color" format="reference" />
|
<attr name="bg_color" format="reference" />
|
||||||
<attr name="icon_color" format="reference" />
|
<attr name="icon_color" format="reference" />
|
||||||
|
<attr name="ctrl_active_color" format="reference" />
|
||||||
|
<attr name="ctrl_color" format="reference" />
|
||||||
</declare-styleable>
|
</declare-styleable>
|
||||||
</resources>
|
</resources>
|
|
@ -1,16 +1,31 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="colorPrimary">#3F51B5</color>
|
<color name="white_color">#fff</color>
|
||||||
<color name="colorPrimaryDark">#303F9F</color>
|
|
||||||
<color name="colorAccent">#FF4081</color>
|
|
||||||
|
|
||||||
<color name="bg_color_light">#fff</color>
|
<color name="bg_color_light">#fff</color>
|
||||||
<color name="bg_color_dark">#333b40</color>
|
<color name="bg_color_dark">#222526</color>
|
||||||
<color name="icon_color_light">#ccc</color>
|
|
||||||
<color name="icon_color_dark">#ff4f4f4f</color>
|
|
||||||
|
|
||||||
<color name="osmand_orange">#ff8f00</color>
|
<color name="icon_color_light">#727272</color>
|
||||||
|
<color name="icon_color_dark">#727272</color>
|
||||||
|
|
||||||
<color name="dialogTitleBackgroundColor">#2f7af5</color>
|
<color name="osmand_orange">#ff8f00</color>
|
||||||
|
|
||||||
|
<color name="ctrl_active_color_light">#237bff</color>
|
||||||
|
<color name="ctrl_active_color_dark">#d28521</color>
|
||||||
|
|
||||||
|
<color name="ctrl_color_light">#f0f0f0</color>
|
||||||
|
<color name="ctrl_color_dark">#17191a</color>
|
||||||
|
|
||||||
|
<color name="primary_text_color_light">#212121</color>
|
||||||
|
<color name="primary_text_color_dark">#cccccc</color>
|
||||||
|
|
||||||
|
<color name="secondary_text_color_light">#727272</color>
|
||||||
|
<color name="secondary_text_color_dark">#727272</color>
|
||||||
|
|
||||||
|
<color name="description_text_color_light">#b3b3b3</color>
|
||||||
|
<color name="description_text_color_dark">#4d4d4d</color>
|
||||||
|
|
||||||
|
<color name="divider_color_light">#f0f0f0</color>
|
||||||
|
<color name="divider_color_dark">#2d3133</color>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<dimen name="content_padding_half">8dp</dimen>
|
<dimen name="content_padding_half">8dp</dimen>
|
||||||
<dimen name="content_padding_standard">16dp</dimen>
|
<dimen name="content_padding_standard">16dp</dimen>
|
||||||
<dimen name="progress_bar_size_small">32dp</dimen>
|
<dimen name="progress_bar_size_small">32dp</dimen>
|
||||||
<dimen name="dialog_title_text_size">22sp</dimen>
|
<dimen name="dialog_title_text_size">22sp</dimen>
|
||||||
<dimen name="dialog_padding_vertical">24dp</dimen>
|
<dimen name="dialog_padding_vertical">24dp</dimen>
|
||||||
<dimen name="dialog_padding_horizontal">48dp</dimen>
|
<dimen name="dialog_padding_horizontal">60dp</dimen>
|
||||||
<dimen name="list_item_height_min">48dp</dimen>
|
<dimen name="dialog_padding_horizontal_edit">44dp</dimen>
|
||||||
|
<dimen name="list_item_height_min">48dp</dimen>
|
||||||
|
<dimen name="dialog_button_height">36dp</dimen>
|
||||||
|
<dimen name="dialog_button_radius">2dp</dimen>
|
||||||
|
<dimen name="title_text_size">18sp</dimen>
|
||||||
|
<dimen name="descr_text_size">16sp</dimen>
|
||||||
|
<dimen name="action_bar_height">60dp</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
|
@ -1,64 +1,75 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">OsmAnd Telegram</string>
|
<string name="app_name">OsmAnd Telegram</string>
|
||||||
<string name="phone_number_title">Phone number in the international format</string>
|
<string name="phone_number_title">Phone number</string>
|
||||||
<string name="shared_string_password">Password</string>
|
<string name="phone_number_descr">Phone number in the international format</string>
|
||||||
<string name="authentication_code">Authentication code</string>
|
<string name="shared_string_password">Password</string>
|
||||||
<string name="login_to_telegram">Login to telegram</string>
|
<string name="enter_code">Enter code</string>
|
||||||
<string name="shared_string_login">Login</string>
|
<string name="authentication_code">Authentication code</string>
|
||||||
<string name="shared_string_logout">Logout</string>
|
<string name="authentication_code_descr">You have been sent a code by Telegram. It will be used by OsmAnd to login into your account.</string>
|
||||||
<string name="not_logged_in">You are not logged in</string>
|
<string name="enter_password">Enter password</string>
|
||||||
<string name="initialization">Initialization</string>
|
<string name="password_descr">Please enter your Telegram account\'s password to finish authorization</string>
|
||||||
<string name="logging_out">Logging out</string>
|
<string name="shared_string_login">Login</string>
|
||||||
<string name="closing">Closing</string>
|
<string name="shared_string_logout">Logout</string>
|
||||||
<string name="shared_string_continue">Continue</string>
|
<string name="not_logged_in">You are not logged in</string>
|
||||||
<string name="shared_string_cancel">Cancel</string>
|
<string name="initialization">Initialization</string>
|
||||||
<string name="gps_network_not_enabled">Location service not enabled. Turn it on?</string>
|
<string name="logging_out">Logging out</string>
|
||||||
<string name="shared_string_settings">Settings</string>
|
<string name="closing">Closing</string>
|
||||||
<string name="no_location_permission">App has no permission to access location data.</string>
|
<string name="shared_string_continue">Continue</string>
|
||||||
<string name="gps_not_available">Please enable GPS in the settings</string>
|
<string name="shared_string_cancel">Cancel</string>
|
||||||
<string name="location_service_no_gps_available">The share location service requires a location provider to be turned on.</string>
|
<string name="gps_network_not_enabled">Location service not enabled. Turn it on?</string>
|
||||||
<string name="osmand_service">Background mode</string>
|
<string name="shared_string_settings">Settings</string>
|
||||||
<string name="osmand_service_descr">OsmAnd Telegram runs in the background with the screen off.</string>
|
<string name="no_location_permission">App has no permission to access location data.</string>
|
||||||
<string name="shared_string_distance">Distance</string>
|
<string name="gps_not_available">Please enable GPS in the settings</string>
|
||||||
<string name="share_location">Share location</string>
|
<string name="location_service_no_gps_available">The share location service requires a location provider to be turned on.</string>
|
||||||
<string name="sharing_location">Sharing location</string>
|
<string name="osmand_service">Background mode</string>
|
||||||
<string name="shared_string_paused">Paused</string>
|
<string name="osmand_service_descr">OsmAnd Telegram runs in the background with the screen off.</string>
|
||||||
<string name="shared_string_no_data">No data</string>
|
<string name="shared_string_distance">Distance</string>
|
||||||
<string name="shared_string_pause">Pause</string>
|
<string name="share_location">Share location</string>
|
||||||
<string name="shared_string_start">Start</string>
|
<string name="sharing_location">Sharing location</string>
|
||||||
<string name="shared_string_stop">Stop</string>
|
<string name="shared_string_paused">Paused</string>
|
||||||
<string name="process_service">OsmAnd Telegram service</string>
|
<string name="shared_string_no_data">No data</string>
|
||||||
<string name="osmand_logo">OsmAnd logo</string>
|
<string name="shared_string_pause">Pause</string>
|
||||||
<string name="install_osmand_dialog_message">You need to install free or paid version of OsmAnd first</string>
|
<string name="shared_string_start">Start</string>
|
||||||
<string name="install_osmand">Install OsmAnd</string>
|
<string name="shared_string_stop">Stop</string>
|
||||||
<string name="show_users_on_map">Show users on map</string>
|
<string name="process_service">OsmAnd Telegram service</string>
|
||||||
<string name="active_chats">Active chats</string>
|
<string name="osmand_logo">OsmAnd logo</string>
|
||||||
|
<string name="install_osmand_dialog_message">You need to install free or paid version of OsmAnd first</string>
|
||||||
|
<string name="install_osmand">Install OsmAnd</string>
|
||||||
|
<string name="show_users_on_map">Show users on map</string>
|
||||||
|
<string name="active_chats">Active chats</string>
|
||||||
|
<string name="shared_string_authorization">Authorization</string>
|
||||||
|
<string name="shared_string_authorization_descr">Please enter the phone number of your Telegram account in the international format</string>
|
||||||
|
<string name="shared_string_welcome">Welcome</string>
|
||||||
|
|
||||||
<string name="yard">yd</string>
|
<string name="yard">yd</string>
|
||||||
<string name="foot">ft</string>
|
<string name="foot">ft</string>
|
||||||
<string name="mile">mi</string>
|
<string name="mile">mi</string>
|
||||||
<string name="km">km</string>
|
<string name="km">km</string>
|
||||||
<string name="m">m</string>
|
<string name="m">m</string>
|
||||||
<string name="nm">nmi</string>
|
<string name="nm">nmi</string>
|
||||||
<string name="min_mile">min/m</string>
|
<string name="min_mile">min/m</string>
|
||||||
<string name="min_km">min/km</string>
|
<string name="min_km">min/km</string>
|
||||||
<string name="nm_h">nmi/h</string>
|
<string name="nm_h">nmi/h</string>
|
||||||
<string name="m_s">m/s</string>
|
<string name="m_s">m/s</string>
|
||||||
<string name="km_h">km/h</string>
|
<string name="km_h">km/h</string>
|
||||||
<string name="mile_per_hour">mph</string>
|
<string name="mile_per_hour">mph</string>
|
||||||
<string name="si_kmh">Kilometers per hour</string>
|
<string name="si_kmh">Kilometers per hour</string>
|
||||||
<string name="si_mph">Miles per hour</string>
|
<string name="si_mph">Miles per hour</string>
|
||||||
<string name="si_m_s">Meters per second</string>
|
<string name="si_m_s">Meters per second</string>
|
||||||
<string name="si_min_km">Minutes per kilometer</string>
|
<string name="si_min_km">Minutes per kilometer</string>
|
||||||
<string name="si_min_m">Minutes per mile</string>
|
<string name="si_min_m">Minutes per mile</string>
|
||||||
<string name="si_nm_h">Nautical miles per hour (knot)</string>
|
<string name="si_nm_h">Nautical miles per hour (knot)</string>
|
||||||
<string name="si_mi_feet">Miles/feet</string>
|
<string name="si_mi_feet">Miles/feet</string>
|
||||||
<string name="si_mi_yard">Miles/yards</string>
|
<string name="si_mi_yard">Miles/yards</string>
|
||||||
<string name="si_km_m">Kilometers/meters</string>
|
<string name="si_km_m">Kilometers/meters</string>
|
||||||
<string name="si_nm">Nautical miles</string>
|
<string name="si_nm">Nautical miles</string>
|
||||||
<string name="si_mi_meters">Miles/meters</string>
|
<string name="si_mi_meters">Miles/meters</string>
|
||||||
<string name="shared_string_hour_short">h</string>
|
<string name="shared_string_hour_short">h</string>
|
||||||
<string name="shared_string_minute_short">min</string>
|
<string name="shared_string_minute_short">min</string>
|
||||||
|
<string name="plus">+</string>
|
||||||
|
<string name="welcome_descr"><![CDATA[<b>OsmAnd Location Sharing</b> allows you to share your location and see locations of other people in the OsmAnd.<br/><br/>The application works on base of Telegram API. To use this app you must have a Telegram account.]]></string>
|
||||||
|
<string name="my_location">My location</string>
|
||||||
|
<string name="live_now">Live now</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,19 +1,55 @@
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||||
<!-- Customize your theme here. -->
|
<item name="android:windowBackground">@color/bg_color_light</item>
|
||||||
<item name="colorPrimary">@color/colorPrimary</item>
|
<item name="android:colorBackground">@color/bg_color_light</item>
|
||||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
<item name="colorControlNormal">@color/primary_text_color_light</item>
|
||||||
<item name="colorAccent">@color/colorAccent</item>
|
<item name="colorControlActivated">@color/ctrl_active_color_light</item>
|
||||||
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
|
|
||||||
<item name="bg_color">@color/bg_color_light</item>
|
<item name="colorPrimary">@color/ctrl_active_color_light</item>
|
||||||
<item name="icon_color">@color/icon_color_light</item>
|
<item name="colorPrimaryDark">@color/bg_color_light</item>
|
||||||
</style>
|
<item name="colorAccent">@color/ctrl_active_color_light</item>
|
||||||
|
<item name="android:textColorPrimary">@color/primary_text_color_light</item>
|
||||||
|
<item name="android:textColorSecondary">@color/secondary_text_color_light</item>
|
||||||
|
<item name="android:textColorTertiary">@color/description_text_color_light</item>
|
||||||
|
|
||||||
<style name="AppTheme.NoActionbar">
|
<item name="bg_color">@color/bg_color_light</item>
|
||||||
<item name="windowActionBar">false</item>
|
<item name="icon_color">@color/icon_color_light</item>
|
||||||
<item name="windowNoTitle">true</item>
|
<item name="ctrl_active_color">@color/ctrl_active_color_light</item>
|
||||||
</style>
|
<item name="ctrl_color">@color/ctrl_color_light</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme.NoActionbar">
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="DialogActionButtonActive">
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:minHeight">@dimen/dialog_button_height</item>
|
||||||
|
<item name="android:paddingLeft">16dp</item>
|
||||||
|
<item name="android:paddingRight">16dp</item>
|
||||||
|
<item name="android:paddingTop">8dp</item>
|
||||||
|
<item name="android:paddingBottom">8dp</item>
|
||||||
|
<item name="android:textColor">@color/white_color</item>
|
||||||
|
<item name="android:textAllCaps">false</item>
|
||||||
|
<item name="android:background">@drawable/btn_round_blue</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="DialogActionButton">
|
||||||
|
<item name="android:layout_width">wrap_content</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
<item name="android:minHeight">@dimen/dialog_button_height</item>
|
||||||
|
<item name="android:paddingLeft">16dp</item>
|
||||||
|
<item name="android:paddingRight">16dp</item>
|
||||||
|
<item name="android:paddingTop">8dp</item>
|
||||||
|
<item name="android:paddingBottom">8dp</item>
|
||||||
|
<item name="android:textColor">@color/secondary_text_color_light</item>
|
||||||
|
<item name="android:textAllCaps">false</item>
|
||||||
|
<item name="android:background">@drawable/btn_round</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,18 +1,25 @@
|
||||||
package net.osmand.telegram
|
package net.osmand.telegram
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.support.annotation.StringRes
|
||||||
import android.support.v4.app.DialogFragment
|
import android.support.v4.app.DialogFragment
|
||||||
import android.support.v4.app.FragmentManager
|
import android.support.v4.app.FragmentManager
|
||||||
|
import android.support.v7.widget.AppCompatImageView
|
||||||
|
import android.text.Html
|
||||||
|
import android.text.TextUtils
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.view.inputmethod.EditorInfo
|
import android.view.inputmethod.EditorInfo
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.TextView
|
||||||
import net.osmand.telegram.utils.AndroidUtils
|
|
||||||
import net.osmand.PlatformUtil
|
import net.osmand.PlatformUtil
|
||||||
|
import net.osmand.telegram.utils.AndroidUtils
|
||||||
|
import studio.carbonylgroup.textfieldboxes.ExtendedEditText
|
||||||
|
|
||||||
|
|
||||||
class LoginDialogFragment : DialogFragment() {
|
class LoginDialogFragment : DialogFragment() {
|
||||||
|
@ -22,24 +29,44 @@ class LoginDialogFragment : DialogFragment() {
|
||||||
private const val TAG = "LoginDialogFragment"
|
private const val TAG = "LoginDialogFragment"
|
||||||
private val LOG = PlatformUtil.getLog(LoginDialogFragment::class.java)
|
private val LOG = PlatformUtil.getLog(LoginDialogFragment::class.java)
|
||||||
|
|
||||||
private const val ENTER_PHONE_NUMBER_PARAM_KEY: String = "enter_phone_number_param_key"
|
private const val LOGIN_DIALOG_TYPE_PARAM_KEY = "login_dialog_type_param"
|
||||||
private const val ENTER_CODE_PARAM_KEY = "enter_code_param_key"
|
private const val SHOW_PROGRESS_PARAM_KEY = "show_progress_param"
|
||||||
private const val ENTER_PASSWORD_PARAM_KEY = "enter_password_param_key"
|
private const val SHOW_WELCOME_DIALOG_PARAM_KEY = "show_welcome_dialog_param"
|
||||||
private const val SHOW_PROGRESS_PARAM_KEY = "show_progress_param_key"
|
|
||||||
|
|
||||||
fun showDialog(fragmentManager: FragmentManager, vararg loginDialogType: LoginDialogType) {
|
var welcomeDialogShown = false
|
||||||
|
private set
|
||||||
|
|
||||||
|
fun showWelcomeDialog(fragmentManager: FragmentManager) {
|
||||||
|
welcomeDialogShown = true
|
||||||
|
showDialog(fragmentManager, welcomeDialog = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun showDialog(fragmentManager: FragmentManager, loginDialogType: LoginDialogType? = null, welcomeDialog: Boolean = false) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
/*
|
||||||
|
mapActivity.getSupportFragmentManager().beginTransaction()
|
||||||
|
.setCustomAnimations(slideInAnim, slideOutAnim, slideInAnim, slideOutAnim)
|
||||||
|
.add(R.id.fragmentContainer, fragment, TAG)
|
||||||
|
.addToBackStack(TAG).commitAllowingStateLoss()
|
||||||
|
*/
|
||||||
|
|
||||||
var fragment = getFragment(fragmentManager)
|
var fragment = getFragment(fragmentManager)
|
||||||
if (fragment == null) {
|
if (fragment == null) {
|
||||||
fragment = LoginDialogFragment()
|
fragment = LoginDialogFragment()
|
||||||
val args = Bundle()
|
val args = Bundle()
|
||||||
for (t in loginDialogType) {
|
if (loginDialogType != null) {
|
||||||
args.putBoolean(t.paramKey, true)
|
args.putString(LOGIN_DIALOG_TYPE_PARAM_KEY, loginDialogType.name)
|
||||||
}
|
}
|
||||||
|
args.putBoolean(SHOW_WELCOME_DIALOG_PARAM_KEY, welcomeDialog)
|
||||||
fragment.arguments = args
|
fragment.arguments = args
|
||||||
fragment.show(fragmentManager, TAG)
|
fragment.show(fragmentManager, TAG)
|
||||||
} else {
|
} else {
|
||||||
fragment.updateDialog(*loginDialogType)
|
var showWelcomeDialog = welcomeDialog
|
||||||
|
if (fragment.showWelcomeDialog) {
|
||||||
|
showWelcomeDialog = fragment.showWelcomeDialog
|
||||||
|
}
|
||||||
|
fragment.updateDialog(loginDialogType, showWelcomeDialog)
|
||||||
}
|
}
|
||||||
} catch (e: RuntimeException) {
|
} catch (e: RuntimeException) {
|
||||||
LOG.error(e)
|
LOG.error(e)
|
||||||
|
@ -57,15 +84,20 @@ class LoginDialogFragment : DialogFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private var loginDialogActiveTypes: Set<LoginDialogType>? = null
|
private var loginDialogActiveType: LoginDialogType? = null
|
||||||
|
|
||||||
|
private var showWelcomeDialog = false
|
||||||
|
private var showProgress = false
|
||||||
private var dismissedManually = false
|
private var dismissedManually = false
|
||||||
|
|
||||||
enum class LoginDialogType(val paramKey: String, val viewId: Int, val editorId: Int) {
|
enum class LoginDialogType(val viewId: Int, val editorId: Int,
|
||||||
ENTER_PHONE_NUMBER(ENTER_PHONE_NUMBER_PARAM_KEY, R.id.enterPhoneNumberLayout, R.id.phoneNumberEditText),
|
@StringRes val titleId: Int, @StringRes val descriptionId: Int) {
|
||||||
ENTER_CODE(ENTER_CODE_PARAM_KEY, R.id.enterCodeLayout, R.id.codeEditText),
|
ENTER_PHONE_NUMBER(R.id.enter_phone_number_layout, R.id.phone_number_edit_text,
|
||||||
ENTER_PASSWORD(ENTER_PASSWORD_PARAM_KEY, R.id.enterPasswordLayout, R.id.passwordEditText),
|
R.string.shared_string_authorization, R.string.shared_string_authorization_descr),
|
||||||
SHOW_PROGRESS(SHOW_PROGRESS_PARAM_KEY, R.id.progressLayout, 0);
|
ENTER_CODE(R.id.enter_code_layout, R.id.code_edit_text,
|
||||||
|
R.string.enter_code, R.string.authentication_code_descr),
|
||||||
|
ENTER_PASSWORD(R.id.enter_password_layout, R.id.password_edit_text,
|
||||||
|
R.string.enter_password, R.string.password_descr);
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -77,25 +109,30 @@ class LoginDialogFragment : DialogFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
|
|
||||||
val loginDialogActiveTypes: MutableSet<LoginDialogType> = HashSet()
|
|
||||||
|
|
||||||
val args = savedInstanceState ?: arguments
|
val args = savedInstanceState ?: arguments
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
for (t in LoginDialogType.values()) {
|
val loginDialogTypeParam = args.getString(LOGIN_DIALOG_TYPE_PARAM_KEY)
|
||||||
if (args.getBoolean(t.paramKey, false)) {
|
if (loginDialogTypeParam != null) {
|
||||||
loginDialogActiveTypes.add(t)
|
loginDialogActiveType = LoginDialogType.valueOf(loginDialogTypeParam)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
showProgress = args.getBoolean(SHOW_PROGRESS_PARAM_KEY, false)
|
||||||
|
showWelcomeDialog = args.getBoolean(SHOW_WELCOME_DIALOG_PARAM_KEY, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loginDialogActiveTypes = loginDialogActiveTypes
|
|
||||||
|
|
||||||
val view = inflater.inflate(R.layout.login_dialog, container)
|
val view = inflater.inflate(R.layout.login_dialog, container)
|
||||||
buildDialog(view)
|
buildDialog(view)
|
||||||
return view
|
return view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||||
|
return object : Dialog(requireActivity(), theme) {
|
||||||
|
override fun onBackPressed() {
|
||||||
|
if (!dismissedManually) {
|
||||||
|
activity?.finish()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDismiss(dialog: DialogInterface?) {
|
override fun onDismiss(dialog: DialogInterface?) {
|
||||||
super.onDismiss(dialog)
|
super.onDismiss(dialog)
|
||||||
if (!dismissedManually) {
|
if (!dismissedManually) {
|
||||||
|
@ -103,22 +140,46 @@ class LoginDialogFragment : DialogFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
private fun buildDialog(view: View?) {
|
private fun buildDialog(view: View?) {
|
||||||
val loginDialogActiveTypes = this.loginDialogActiveTypes
|
if (showWelcomeDialog) {
|
||||||
var hasProgress = false
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
|
view?.findViewById<TextView>(R.id.welcome_descr)?.text = Html.fromHtml(getString(R.string.welcome_descr), android.text.Html.FROM_HTML_MODE_LEGACY)
|
||||||
|
} else {
|
||||||
|
view?.findViewById<TextView>(R.id.welcome_descr)?.text = Html.fromHtml(getString(R.string.welcome_descr))
|
||||||
|
}
|
||||||
|
val continueButton = view?.findViewById<Button>(R.id.welcome_continue_button)
|
||||||
|
continueButton?.setOnClickListener {
|
||||||
|
showWelcomeDialog = false
|
||||||
|
if (loginDialogActiveType == null) {
|
||||||
|
loginDialogActiveType = LoginDialogType.ENTER_PHONE_NUMBER
|
||||||
|
showProgress = true
|
||||||
|
}
|
||||||
|
buildDialog(view)
|
||||||
|
}
|
||||||
|
view?.findViewById<View>(R.id.login_layout)?.visibility = View.GONE
|
||||||
|
view?.findViewById<View>(R.id.welcome_layout)?.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
view?.findViewById<View>(R.id.login_layout)?.visibility = View.VISIBLE
|
||||||
|
view?.findViewById<View>(R.id.welcome_layout)?.visibility = View.GONE
|
||||||
|
}
|
||||||
|
|
||||||
|
val loginDialogActiveType = this.loginDialogActiveType
|
||||||
var focusRequested = false
|
var focusRequested = false
|
||||||
for (t in LoginDialogType.values()) {
|
for (t in LoginDialogType.values()) {
|
||||||
val layout: View? = view?.findViewById(t.viewId)
|
val layout: View? = view?.findViewById(t.viewId)
|
||||||
val contains = loginDialogActiveTypes?.contains(t) ?: false
|
val contains = t == loginDialogActiveType && !showProgress
|
||||||
when {
|
when {
|
||||||
contains -> {
|
contains -> {
|
||||||
if (t == LoginDialogType.SHOW_PROGRESS) {
|
|
||||||
hasProgress = true
|
|
||||||
}
|
|
||||||
if (layout != null) {
|
if (layout != null) {
|
||||||
|
val titleView: TextView? = view.findViewById(R.id.login_title)
|
||||||
|
val descriptionView: TextView? = view.findViewById(R.id.login_description)
|
||||||
|
titleView?.text = getText(t.titleId)
|
||||||
|
descriptionView?.text = getText(t.descriptionId)
|
||||||
|
|
||||||
layout.visibility = View.VISIBLE
|
layout.visibility = View.VISIBLE
|
||||||
val editText: EditText? = layout.findViewById(t.editorId)
|
val editText: ExtendedEditText? = layout.findViewById(t.editorId)
|
||||||
if (editText != null) {
|
if (editText != null && !showWelcomeDialog) {
|
||||||
editText.setOnEditorActionListener { _, actionId, _ ->
|
editText.setOnEditorActionListener { _, actionId, _ ->
|
||||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||||
applyAuthParam(t, editText.text.toString())
|
applyAuthParam(t, editText.text.toString())
|
||||||
|
@ -127,7 +188,7 @@ class LoginDialogFragment : DialogFragment() {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
if (!focusRequested) {
|
if (!focusRequested) {
|
||||||
editText.requestFocus()
|
editText.setSelection(editText.length())
|
||||||
AndroidUtils.softKeyboardDelayed(editText)
|
AndroidUtils.softKeyboardDelayed(editText)
|
||||||
focusRequested = true
|
focusRequested = true
|
||||||
}
|
}
|
||||||
|
@ -136,30 +197,39 @@ class LoginDialogFragment : DialogFragment() {
|
||||||
}
|
}
|
||||||
else -> layout?.visibility = View.GONE
|
else -> layout?.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
val progressView: View? = view?.findViewById(R.id.progress_layout)
|
||||||
|
if (showProgress) {
|
||||||
|
progressView?.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
progressView?.visibility = View.GONE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val continueButton: Button? = view?.findViewById(R.id.continueButton)
|
val continueButton: Button? = view?.findViewById(R.id.continue_button)
|
||||||
if (continueButton != null) {
|
if (continueButton != null) {
|
||||||
continueButton.isEnabled = !hasProgress
|
continueButton.isEnabled = !showProgress
|
||||||
if (hasProgress) {
|
if (showProgress) {
|
||||||
continueButton.setOnClickListener(null)
|
continueButton.setOnClickListener(null)
|
||||||
} else {
|
} else {
|
||||||
continueButton.setOnClickListener {
|
continueButton.setOnClickListener {
|
||||||
for (t in LoginDialogType.values()) {
|
for (t in LoginDialogType.values()) {
|
||||||
val layout: View? = view.findViewById(t.viewId)
|
val layout: View? = view.findViewById(t.viewId)
|
||||||
val contains = loginDialogActiveTypes?.contains(t) ?: false
|
val contains = t == loginDialogActiveType
|
||||||
if (contains && layout != null) {
|
if (contains && layout != null) {
|
||||||
val editText: EditText? = layout.findViewById(t.editorId)
|
val editText: ExtendedEditText? = layout.findViewById(t.editorId)
|
||||||
if (editText != null) {
|
val text = editText?.text.toString()
|
||||||
applyAuthParam(t, editText.text.toString())
|
if (!TextUtils.isEmpty(text) && text.length > 1) {
|
||||||
|
applyAuthParam(t, text)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val cancelButton: Button? = view?.findViewById(R.id.calcelButton)
|
val cancelButton: AppCompatImageView? = view?.findViewById(R.id.back_button)
|
||||||
|
cancelButton?.visibility = if (loginDialogActiveType == LoginDialogType.ENTER_PHONE_NUMBER) View.INVISIBLE else View.VISIBLE
|
||||||
cancelButton?.setOnClickListener {
|
cancelButton?.setOnClickListener {
|
||||||
dismiss()
|
showProgress()
|
||||||
|
getMainActivity()?.loginTelegram()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,12 +239,12 @@ class LoginDialogFragment : DialogFragment() {
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
super.onSaveInstanceState(outState)
|
super.onSaveInstanceState(outState)
|
||||||
val loginDialogActiveTypes = this.loginDialogActiveTypes
|
val loginDialogActiveType = this.loginDialogActiveType
|
||||||
if (loginDialogActiveTypes != null) {
|
if (loginDialogActiveType != null) {
|
||||||
for (t in loginDialogActiveTypes) {
|
outState.putString(LOGIN_DIALOG_TYPE_PARAM_KEY, loginDialogActiveType.name)
|
||||||
outState.putBoolean(t.paramKey, true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
outState.putBoolean(SHOW_PROGRESS_PARAM_KEY, showProgress)
|
||||||
|
outState.putBoolean(SHOW_WELCOME_DIALOG_PARAM_KEY, showWelcomeDialog)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMainActivity(): MainActivity? {
|
private fun getMainActivity(): MainActivity? {
|
||||||
|
@ -186,13 +256,15 @@ class LoginDialogFragment : DialogFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateDialog(vararg loginDialogType: LoginDialogType) {
|
private fun updateDialog(loginDialogType: LoginDialogType? = null, welcomeDialog: Boolean = false) {
|
||||||
val loginDialogActiveTypes: MutableSet<LoginDialogType> = HashSet()
|
this.loginDialogActiveType = loginDialogType
|
||||||
for (t in loginDialogType) {
|
showProgress = false
|
||||||
loginDialogActiveTypes.add(t)
|
showWelcomeDialog = welcomeDialog
|
||||||
}
|
buildDialog(view)
|
||||||
this.loginDialogActiveTypes = loginDialogActiveTypes
|
}
|
||||||
|
|
||||||
|
fun showProgress() {
|
||||||
|
showProgress = true
|
||||||
buildDialog(view)
|
buildDialog(view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,10 @@ class MainActivity : AppCompatActivity(), TelegramListener {
|
||||||
|
|
||||||
// specify an viewAdapter (see also next example)
|
// specify an viewAdapter (see also next example)
|
||||||
adapter = chatViewAdapter
|
adapter = chatViewAdapter
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!LoginDialogFragment.welcomeDialogShown) {
|
||||||
|
LoginDialogFragment.showWelcomeDialog(supportFragmentManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
telegramAuthorizationRequestHandler = telegramHelper.setTelegramAuthorizationRequestHandler(object : TelegramAuthorizationRequestListener {
|
telegramAuthorizationRequestHandler = telegramHelper.setTelegramAuthorizationRequestHandler(object : TelegramAuthorizationRequestListener {
|
||||||
|
@ -132,9 +135,7 @@ class MainActivity : AppCompatActivity(), TelegramListener {
|
||||||
runOnUi {
|
runOnUi {
|
||||||
val fm = supportFragmentManager
|
val fm = supportFragmentManager
|
||||||
when (newTelegramAuthorizationState) {
|
when (newTelegramAuthorizationState) {
|
||||||
TelegramAuthorizationState.READY,
|
TelegramAuthorizationState.READY -> LoginDialogFragment.dismiss(fm)
|
||||||
TelegramAuthorizationState.CLOSED,
|
|
||||||
TelegramAuthorizationState.UNKNOWN -> LoginDialogFragment.dismiss(fm)
|
|
||||||
else -> Unit
|
else -> Unit
|
||||||
}
|
}
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
|
@ -216,6 +217,13 @@ class MainActivity : AppCompatActivity(), TelegramListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun loginTelegram() {
|
||||||
|
if (telegramHelper.getTelegramAuthorizationState() != TelegramAuthorizationState.CLOSED) {
|
||||||
|
telegramHelper.logout()
|
||||||
|
}
|
||||||
|
telegramHelper.init()
|
||||||
|
}
|
||||||
|
|
||||||
fun logoutTelegram(silent: Boolean = false) {
|
fun logoutTelegram(silent: Boolean = false) {
|
||||||
if (telegramHelper.getTelegramAuthorizationState() == TelegramAuthorizationState.READY) {
|
if (telegramHelper.getTelegramAuthorizationState() == TelegramAuthorizationState.READY) {
|
||||||
telegramHelper.logout()
|
telegramHelper.logout()
|
||||||
|
@ -241,7 +249,7 @@ class MainActivity : AppCompatActivity(), TelegramListener {
|
||||||
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
|
||||||
return when (item?.itemId) {
|
return when (item?.itemId) {
|
||||||
LOGIN_MENU_ID -> {
|
LOGIN_MENU_ID -> {
|
||||||
telegramHelper.init()
|
loginTelegram()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
LOGOUT_MENU_ID -> {
|
LOGOUT_MENU_ID -> {
|
||||||
|
@ -312,12 +320,11 @@ class MainActivity : AppCompatActivity(), TelegramListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun applyAuthParam(loginDialogFragment: LoginDialogFragment?, loginDialogType: LoginDialogType, text: String) {
|
fun applyAuthParam(loginDialogFragment: LoginDialogFragment?, loginDialogType: LoginDialogType, text: String) {
|
||||||
loginDialogFragment?.updateDialog(LoginDialogType.SHOW_PROGRESS)
|
loginDialogFragment?.showProgress()
|
||||||
when (loginDialogType) {
|
when (loginDialogType) {
|
||||||
LoginDialogType.ENTER_PHONE_NUMBER -> telegramAuthorizationRequestHandler?.applyAuthenticationParameter(TelegramAuthenticationParameterType.PHONE_NUMBER, text)
|
LoginDialogType.ENTER_PHONE_NUMBER -> telegramAuthorizationRequestHandler?.applyAuthenticationParameter(TelegramAuthenticationParameterType.PHONE_NUMBER, text)
|
||||||
LoginDialogType.ENTER_CODE -> telegramAuthorizationRequestHandler?.applyAuthenticationParameter(TelegramAuthenticationParameterType.CODE, text)
|
LoginDialogType.ENTER_CODE -> telegramAuthorizationRequestHandler?.applyAuthenticationParameter(TelegramAuthenticationParameterType.CODE, text)
|
||||||
LoginDialogType.ENTER_PASSWORD -> telegramAuthorizationRequestHandler?.applyAuthenticationParameter(TelegramAuthenticationParameterType.PASSWORD, text)
|
LoginDialogType.ENTER_PASSWORD -> telegramAuthorizationRequestHandler?.applyAuthenticationParameter(TelegramAuthenticationParameterType.PASSWORD, text)
|
||||||
else -> Unit
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,11 +358,11 @@ class MainActivity : AppCompatActivity(), TelegramListener {
|
||||||
val builder = AlertDialog.Builder(requireContext())
|
val builder = AlertDialog.Builder(requireContext())
|
||||||
builder.setView(R.layout.install_osmand_dialog)
|
builder.setView(R.layout.install_osmand_dialog)
|
||||||
.setNegativeButton("Cancel", null)
|
.setNegativeButton("Cancel", null)
|
||||||
.setPositiveButton("Install", { _, _ ->
|
.setPositiveButton("Install") { _, _ ->
|
||||||
val intent = Intent()
|
val intent = Intent()
|
||||||
intent.data = Uri.parse("market://details?id=net.osmand.plus")
|
intent.data = Uri.parse("market://details?id=net.osmand.plus")
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
})
|
}
|
||||||
return builder.create()
|
return builder.create()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ object AndroidUtils {
|
||||||
|
|
||||||
fun softKeyboardDelayed(view: View) {
|
fun softKeyboardDelayed(view: View) {
|
||||||
view.post {
|
view.post {
|
||||||
|
view.requestFocus()
|
||||||
if (!isHardwareKeyboardAvailable(view.context)) {
|
if (!isHardwareKeyboardAvailable(view.context)) {
|
||||||
val imm = view.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager?
|
val imm = view.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager?
|
||||||
imm?.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT)
|
imm?.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT)
|
||||||
|
|
Loading…
Reference in a new issue