Add the button for opening OsmAnd to "Live Now" screen

This commit is contained in:
Alex Sytnyk 2018-08-03 18:44:42 +03:00
parent c15f294dc4
commit 3e9f4ead06
3 changed files with 33 additions and 6 deletions

View file

@ -5,6 +5,10 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -13,4 +17,18 @@
android:paddingBottom="@dimen/list_view_bottom_padding" android:paddingBottom="@dimen/list_view_bottom_padding"
android:scrollbars="vertical"/> android:scrollbars="vertical"/>
<Button
android:id="@+id/open_osmand_btn"
style="@style/DialogActionButtonActive"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center_horizontal"
android:layout_marginBottom="@dimen/content_padding_big"
android:drawableLeft="@drawable/ic_action_osmand_plus"
android:drawablePadding="@dimen/content_padding_standard"
android:drawableStart="@drawable/ic_action_osmand_plus"
android:text="@string/open_osmand"/>
</FrameLayout>
</LinearLayout> </LinearLayout>

View file

@ -1,4 +1,5 @@
<resources> <resources>
<string name="open_osmand">Open OsmAnd</string>
<string name="shared_string_live">Live</string> <string name="shared_string_live">Live</string>
<string name="shared_string_bot">Bot</string> <string name="shared_string_bot">Bot</string>
<string name="get_telegram_title">Registration in Telegram</string> <string name="get_telegram_title">Registration in Telegram</string>

View file

@ -11,6 +11,7 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import net.osmand.Location import net.osmand.Location
@ -18,6 +19,7 @@ import net.osmand.telegram.R
import net.osmand.telegram.TelegramApplication import net.osmand.telegram.TelegramApplication
import net.osmand.telegram.TelegramLocationProvider.TelegramCompassListener import net.osmand.telegram.TelegramLocationProvider.TelegramCompassListener
import net.osmand.telegram.TelegramLocationProvider.TelegramLocationListener import net.osmand.telegram.TelegramLocationProvider.TelegramLocationListener
import net.osmand.telegram.helpers.OsmandAidlHelper
import net.osmand.telegram.helpers.TelegramHelper.* import net.osmand.telegram.helpers.TelegramHelper.*
import net.osmand.telegram.helpers.TelegramUiHelper import net.osmand.telegram.helpers.TelegramUiHelper
import net.osmand.telegram.helpers.TelegramUiHelper.ChatItem import net.osmand.telegram.helpers.TelegramUiHelper.ChatItem
@ -67,6 +69,12 @@ class LiveNowTabFragment : Fragment(), TelegramListener, TelegramIncomingMessage
} }
}) })
} }
mainView.findViewById<Button>(R.id.open_osmand_btn).setOnClickListener {
val intent = activity?.packageManager?.getLaunchIntentForPackage(OsmandAidlHelper.OSMAND_PACKAGE_NAME)
if (intent != null) {
startActivity(intent)
}
}
return mainView return mainView
} }