Implement new private chat screen redesign
parent
f8737c3f81
commit
bb976a4bff
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<solid android:color="@color/unimportant_button_background" />
|
||||||
|
|
||||||
|
<corners android:radius="24dp" />
|
||||||
|
|
||||||
|
<stroke android:width="@dimen/border_thickness" android:color="@color/unimportant_button_background" />
|
||||||
|
</shape>
|
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v4.view.ViewPager
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/viewPager"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" >
|
||||||
|
|
||||||
|
<android.support.design.widget.TabLayout
|
||||||
|
style="@style/Session.DarkTabLayout"
|
||||||
|
android:id="@+id/tabLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/tab_bar_height" />
|
||||||
|
|
||||||
|
</android.support.v4.view.ViewPager>
|
@ -0,0 +1,95 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/contentView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/default_session_background"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
style="@style/SessionEditText"
|
||||||
|
android:id="@+id/publicKeyEditText"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
|
android:layout_marginRight="@dimen/very_large_spacing"
|
||||||
|
android:hint="Enter Session ID of recipient" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
|
android:layout_marginRight="@dimen/very_large_spacing"
|
||||||
|
android:textSize="@dimen/small_font_size"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:text="Users can share their Session ID by going into their account settings and tapping "Share Session ID", or by sharing their QR code." />
|
||||||
|
|
||||||
|
<org.thoughtcrime.securesms.loki.redesign.views.SeparatorView
|
||||||
|
android:id="@+id/separatorView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="32dp"
|
||||||
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
|
android:layout_marginRight="@dimen/very_large_spacing" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/publicKeyTextView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
|
android:layout_marginRight="@dimen/very_large_spacing"
|
||||||
|
android:textSize="@dimen/medium_font_size"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:fontFamily="@font/space_mono_regular"
|
||||||
|
android:textAlignment="center"
|
||||||
|
android:text="05987d601943c267879be41830888066c6a024cbdc9a548d06813924bf3372ea78" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/very_large_spacing"
|
||||||
|
android:layout_marginTop="@dimen/large_spacing"
|
||||||
|
android:layout_marginRight="@dimen/very_large_spacing"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/MediumUnimportantFilledButton"
|
||||||
|
android:id="@+id/copyButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/medium_button_height"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:text="Copy" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/MediumUnimportantFilledButton"
|
||||||
|
android:id="@+id/shareButton"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="@dimen/medium_button_height"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginLeft="@dimen/medium_spacing"
|
||||||
|
android:text="Share" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
style="@style/MediumProminentOutlineButton"
|
||||||
|
android:id="@+id/createPrivateChatButton"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/medium_button_height"
|
||||||
|
android:layout_marginLeft="90dp"
|
||||||
|
android:layout_marginRight="90dp"
|
||||||
|
android:layout_marginBottom="@dimen/medium_spacing"
|
||||||
|
android:text="Next" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
@ -0,0 +1,18 @@
|
|||||||
|
<?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="match_parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/titleTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:textSize="@dimen/small_font_size"
|
||||||
|
android:text="Your Public Key" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -0,0 +1,63 @@
|
|||||||
|
package org.thoughtcrime.securesms.loki.redesign.activities
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.support.v4.app.Fragment
|
||||||
|
import android.support.v4.app.FragmentManager
|
||||||
|
import android.support.v4.app.FragmentPagerAdapter
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import kotlinx.android.synthetic.main.activity_new_private_chat.*
|
||||||
|
import kotlinx.android.synthetic.main.fragment_enter_public_key.*
|
||||||
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
|
|
||||||
|
class NewPrivateChatActivity : BaseActionBarActivity() {
|
||||||
|
private val adapter = Adapter(supportFragmentManager)
|
||||||
|
|
||||||
|
// region Lifecycle
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
// Set content view
|
||||||
|
setContentView(R.layout.activity_new_private_chat)
|
||||||
|
// Set title
|
||||||
|
supportActionBar!!.title = "New Conversation"
|
||||||
|
// Set up view pager
|
||||||
|
viewPager.adapter = adapter
|
||||||
|
tabLayout.setupWithViewPager(viewPager)
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
// region Adapter
|
||||||
|
private class Adapter(manager: FragmentManager) : FragmentPagerAdapter(manager) {
|
||||||
|
|
||||||
|
override fun getCount(): Int {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getItem(index: Int): Fragment {
|
||||||
|
return EnterPublicKeyFragment()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getPageTitle(index: Int): CharSequence? {
|
||||||
|
return when (index) {
|
||||||
|
0 -> "Enter Public Key"
|
||||||
|
1 -> "Scan QR Code"
|
||||||
|
else -> throw IllegalStateException()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
class EnterPublicKeyFragment : Fragment() {
|
||||||
|
|
||||||
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
|
return inflater.inflate(R.layout.fragment_enter_public_key, container, false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
separatorView.title = "Test"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package org.thoughtcrime.securesms.loki.redesign.views
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.graphics.Canvas
|
||||||
|
import android.graphics.Paint
|
||||||
|
import android.graphics.Path
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.widget.RelativeLayout
|
||||||
|
import kotlinx.android.synthetic.main.view_separator.view.*
|
||||||
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.loki.getColorWithID
|
||||||
|
import org.thoughtcrime.securesms.loki.toPx
|
||||||
|
|
||||||
|
class SeparatorView : RelativeLayout {
|
||||||
|
lateinit var title: CharSequence
|
||||||
|
|
||||||
|
private val path = Path()
|
||||||
|
|
||||||
|
private val paint: Paint = {
|
||||||
|
val result = Paint()
|
||||||
|
result.style = Paint.Style.STROKE
|
||||||
|
result.color = resources.getColorWithID(R.color.separator, context.theme)
|
||||||
|
result.strokeWidth = 2.0f
|
||||||
|
result.isAntiAlias = true
|
||||||
|
result
|
||||||
|
}()
|
||||||
|
|
||||||
|
// region Lifecycle
|
||||||
|
constructor(context: Context) : super(context) {
|
||||||
|
setUpViewHierarchy()
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||||
|
setUpViewHierarchy()
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||||
|
setUpViewHierarchy()
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
|
||||||
|
setUpViewHierarchy()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setUpViewHierarchy() {
|
||||||
|
val inflater = context.applicationContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||||
|
val contentView = inflater.inflate(R.layout.view_separator, null)
|
||||||
|
val layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
|
||||||
|
addView(contentView, layoutParams)
|
||||||
|
setWillNotDraw(false)
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region Updating
|
||||||
|
override fun onDraw(c: Canvas) {
|
||||||
|
super.onDraw(c)
|
||||||
|
val w = width.toFloat()
|
||||||
|
val h = height.toFloat()
|
||||||
|
val hMargin = toPx(10, resources).toFloat()
|
||||||
|
path.reset()
|
||||||
|
path.moveTo(0.0f, h / 2)
|
||||||
|
path.lineTo(titleTextView.left - hMargin, h / 2)
|
||||||
|
path.addRoundRect(titleTextView.left - hMargin, 0.0f, titleTextView.right + hMargin, h, h / 2, h / 2, Path.Direction.CCW)
|
||||||
|
path.moveTo(titleTextView.right + hMargin, h / 2)
|
||||||
|
path.lineTo(w, h / 2)
|
||||||
|
path.close()
|
||||||
|
c.drawPath(path, paint)
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
}
|
Loading…
Reference in New Issue