forked from upstream-mirrors/quik
Custom Toolbar
This commit is contained in:
@@ -2,6 +2,7 @@ package com.moez.QKSMS.ui.base
|
|||||||
|
|
||||||
import android.support.v7.app.AppCompatActivity
|
import android.support.v7.app.AppCompatActivity
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
|
import kotlinx.android.synthetic.main.toolbar.*
|
||||||
|
|
||||||
abstract class QkActivity : AppCompatActivity() {
|
abstract class QkActivity : AppCompatActivity() {
|
||||||
|
|
||||||
@@ -15,4 +16,15 @@ abstract class QkActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setContentView(layoutResID: Int) {
|
||||||
|
super.setContentView(layoutResID)
|
||||||
|
setSupportActionBar(toolbar)
|
||||||
|
title = title // The title may have been set before layout inflation
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setTitle(title: CharSequence?) {
|
||||||
|
super.setTitle(title)
|
||||||
|
toolbarTitle?.text = title
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -21,14 +21,14 @@ class GroupAvatarView(context: Context, attrs: AttributeSet?, defStyleAttr: Int)
|
|||||||
constructor(context: Context) : this(context, null, 0)
|
constructor(context: Context) : this(context, null, 0)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
if (!isInEditMode) {
|
View.inflate(context, R.layout.group_avatar_view, this)
|
||||||
View.inflate(context, R.layout.group_avatar_view, this)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFinishInflate() {
|
override fun onFinishInflate() {
|
||||||
super.onFinishInflate()
|
super.onFinishInflate()
|
||||||
updateView()
|
if (!isInEditMode) {
|
||||||
|
updateView()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateView() {
|
private fun updateView() {
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<gradient
|
||||||
|
android:angle="90"
|
||||||
|
android:endColor="#14000000"
|
||||||
|
android:startColor="#00000000" />
|
||||||
|
|
||||||
|
</shape>
|
||||||
@@ -6,22 +6,35 @@
|
|||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v4.widget.SwipeRefreshLayout
|
<include layout="@layout/toolbar" />
|
||||||
android:id="@+id/swipeRefresh"
|
|
||||||
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<android.support.v4.widget.SwipeRefreshLayout
|
||||||
android:id="@+id/conversationList"
|
android:id="@+id/swipeRefresh"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent">
|
||||||
android:clipChildren="false"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
tools:listitem="@layout/conversation_list_item" />
|
|
||||||
|
|
||||||
</android.support.v4.widget.SwipeRefreshLayout>
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/conversationList"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
tools:listitem="@layout/conversation_list_item" />
|
||||||
|
|
||||||
|
</android.support.v4.widget.SwipeRefreshLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:background="@drawable/ab_shadow" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -5,16 +5,29 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<android.support.v7.widget.RecyclerView
|
<include layout="@layout/toolbar" />
|
||||||
android:id="@+id/messageList"
|
|
||||||
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1">
|
||||||
android:clipChildren="false"
|
|
||||||
android:clipToPadding="false"
|
<android.support.v7.widget.RecyclerView
|
||||||
android:paddingBottom="8dp"
|
android:id="@+id/messageList"
|
||||||
android:paddingTop="8dp"
|
android:layout_width="match_parent"
|
||||||
tools:listitem="@layout/message_list_item_out" />
|
android:layout_height="match_parent"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:paddingBottom="8dp"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
tools:listitem="@layout/message_list_item_out" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="8dp"
|
||||||
|
android:background="@drawable/ab_shadow" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<android.support.v7.widget.Toolbar android:id="@+id/toolbar"
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:gravity="center_vertical"
|
||||||
|
android:minHeight="56dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/toolbarTitle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="left|center_vertical"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:textColor="@color/textPrimary"
|
||||||
|
android:textSize="20sp"
|
||||||
|
tools:text="Conversations" />
|
||||||
|
|
||||||
|
</android.support.v7.widget.Toolbar>
|
||||||
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
<style name="AppTheme" parent="AppBaseTheme" />
|
<style name="AppTheme" parent="AppBaseTheme" />
|
||||||
|
|
||||||
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
|
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
<item name="android:fontFamily">@font/lato</item>
|
<item name="android:fontFamily">@font/lato</item>
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
<item name="android:windowBackground">@color/white</item>
|
<item name="android:windowBackground">@color/white</item>
|
||||||
<item name="colorPrimary">@color/white</item>
|
<item name="colorPrimary">@color/white</item>
|
||||||
<item name="colorPrimaryDark">@color/statusLight</item>
|
<item name="colorPrimaryDark">@color/statusLight</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user