back to osmand button

This commit is contained in:
veliymolfar 2020-01-09 18:01:00 +02:00
parent 9908398378
commit 4de8ab7baf
6 changed files with 41 additions and 0 deletions

View file

@ -295,6 +295,30 @@
</FrameLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/bg_list_item_dark">
<net.osmand.telegram.ui.views.TextViewEx
android:id="@+id/back_to_osmand"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:drawableStart="@drawable/ic_action_undo"
android:drawableLeft="@drawable/ic_action_undo"
android:drawablePadding="@dimen/my_location_text_sides_margin"
android:gravity="center_vertical"
android:minHeight="@dimen/list_item_height_min"
android:paddingStart="@dimen/content_padding_standard"
android:paddingLeft="@dimen/content_padding_standard"
android:text="@string/back_to_osmand"
android:textColor="?attr/colorPrimaryDark"
android:textSize="@dimen/list_item_title_text_size"
app:typeface="@string/font_roboto_regular" />
</FrameLayout>
</android.support.design.widget.AppBarLayout>
<FrameLayout

View file

@ -12,6 +12,7 @@
<attr name="primary_btn_text_color" format="reference" />
<attr name="secondary_btn_bg" format="reference" />
<attr name="shared_chat_card_bg" format="reference" />
<attr name="bg_list_item_dark" format="reference" />
</declare-styleable>
<declare-styleable name="TextViewEx">

View file

@ -45,4 +45,6 @@
<color name="live_track_active_icon">#F54522</color>
<color name="bg_list_item_dark">#727272</color>
</resources>

View file

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="back_to_osmand">Back to OsmAnd</string>
<string name="shared_string_suggested">Suggested</string>
<string name="status_widget_title">OsmAnd Tracker status</string>
<string name="buffer_time_descr">Maximum time to store points in the buffer</string>

View file

@ -29,6 +29,7 @@
<item name="windowNoTitle">true</item>
<item name="bottom_nav_shadow">@drawable/bg_bottom_bar_shadow_with_line_day</item>
<item name="shared_chat_card_bg">@drawable/chat_card_bg_light</item>
<item name="bg_list_item_dark">@color/bg_list_item_dark</item>
</style>
<style name="AppTheme.NoActionbar">

View file

@ -75,6 +75,7 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
private lateinit var sharingStatusTitle: TextView
private lateinit var sharingStatusIcon: ImageView
private lateinit var startSharingBtn: View
private lateinit var backToOsmAndBtn: TextView
private lateinit var searchBoxBg: GradientDrawable
@ -243,6 +244,16 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
}
}
backToOsmAndBtn = mainView.findViewById<TextView>(R.id.back_to_osmand).apply {
setOnClickListener {
val startIntent = app.packageManager.getLaunchIntentForPackage("net.osmand.plus")
if (startIntent != null) {
startIntent.addCategory(Intent.CATEGORY_LAUNCHER)
startActivity(startIntent)
}
}
}
lastChatsInfo = settings.lastChatsInfo
return mainView
@ -478,6 +489,7 @@ class MyLocationTabFragment : Fragment(), TelegramListener {
textContainer.visibility = if (sharingMode) View.GONE else View.VISIBLE
titleContainer.visibility = if (sharingMode) View.VISIBLE else View.GONE
startSharingBtn.visibility = if (sharingMode) View.VISIBLE else View.GONE
backToOsmAndBtn.visibility = if (sharingMode) View.VISIBLE else View.GONE
headerParams.scrollFlags =
if (sharingMode) 0 else AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL
stopSharingSwitcher.isChecked = true