mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-28 04:25:18 +00:00
Back button for landing activities.
This commit is contained in:
parent
707ff9063c
commit
6b134a8403
10
res/drawable/ic_baseline_arrow_back_24.xml
Normal file
10
res/drawable/ic_baseline_arrow_back_24.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="24"
|
||||||
|
android:viewportHeight="24"
|
||||||
|
android:tint="?attr/colorControlNormal">
|
||||||
|
<path
|
||||||
|
android:fillColor="@android:color/white"
|
||||||
|
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
||||||
|
</vector>
|
32
res/layout/session_logo_action_bar_content.xml
Normal file
32
res/layout/session_logo_action_bar_content.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?actionBarSize">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@drawable/session_logo"/>
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
|
android:id="@+id/back_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_margin="@dimen/small_spacing"
|
||||||
|
android:padding="@dimen/small_spacing"
|
||||||
|
android:background="@drawable/circle_touch_highlight_background"
|
||||||
|
android:clickable="true"
|
||||||
|
android:focusable="true">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="24dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:src="@drawable/ic_baseline_arrow_back_24"
|
||||||
|
android:alpha="0.5"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -40,7 +40,7 @@ class LandingActivity : BaseActionBarActivity(), LinkDeviceSlaveModeDialogDelega
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_landing)
|
setContentView(R.layout.activity_landing)
|
||||||
setUpActionBarSessionLogo()
|
setUpActionBarSessionLogo(true)
|
||||||
fakeChatView.startAnimating()
|
fakeChatView.startAnimating()
|
||||||
registerButton.setOnClickListener { register() }
|
registerButton.setOnClickListener { register() }
|
||||||
restoreButton.setOnClickListener { restore() }
|
restoreButton.setOnClickListener { restore() }
|
||||||
|
@ -1,24 +1,36 @@
|
|||||||
package org.thoughtcrime.securesms.loki.utilities
|
package org.thoughtcrime.securesms.loki.utilities
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.appcompat.app.ActionBar
|
import android.view.View
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import android.view.Gravity
|
import androidx.appcompat.widget.Toolbar
|
||||||
import android.widget.ImageView
|
|
||||||
import android.widget.RelativeLayout
|
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
|
|
||||||
fun AppCompatActivity.setUpActionBarSessionLogo() {
|
fun BaseActionBarActivity.setUpActionBarSessionLogo(hideBackButton: Boolean = false) {
|
||||||
supportActionBar!!.setDisplayShowHomeEnabled(false)
|
val actionbar = supportActionBar!!
|
||||||
supportActionBar!!.setDisplayShowTitleEnabled(false)
|
|
||||||
val logoImageView = ImageView(this)
|
actionbar.setDisplayShowHomeEnabled(false)
|
||||||
logoImageView.setImageResource(R.drawable.session_logo)
|
actionbar.setDisplayShowTitleEnabled(false)
|
||||||
val logoImageViewContainer = RelativeLayout(this)
|
actionbar.setDisplayHomeAsUpEnabled(false)
|
||||||
logoImageViewContainer.addView(logoImageView)
|
actionbar.setHomeButtonEnabled(false)
|
||||||
logoImageViewContainer.gravity = Gravity.CENTER
|
|
||||||
val logoImageViewContainerLayoutParams = ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.WRAP_CONTENT)
|
actionbar.setCustomView(R.layout.session_logo_action_bar_content)
|
||||||
supportActionBar!!.setCustomView(logoImageViewContainer, logoImageViewContainerLayoutParams)
|
actionbar.setDisplayShowCustomEnabled(true)
|
||||||
supportActionBar!!.setDisplayShowCustomEnabled(true)
|
|
||||||
|
val rootView: Toolbar = actionbar.customView!!.parent as Toolbar
|
||||||
|
rootView.setPadding(0,0,0,0)
|
||||||
|
rootView.setContentInsetsAbsolute(0,0);
|
||||||
|
|
||||||
|
val backButton = actionbar.customView!!.findViewById<View>(R.id.back_button)
|
||||||
|
if (hideBackButton) {
|
||||||
|
backButton.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
backButton.visibility = View.VISIBLE
|
||||||
|
backButton.setOnClickListener {
|
||||||
|
onSupportNavigateUp()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val AppCompatActivity.defaultSessionRequestCode: Int
|
val AppCompatActivity.defaultSessionRequestCode: Int
|
||||||
|
Loading…
Reference in New Issue
Block a user