srctree

Robin Lindén parent 89f1d677 b6c44bf2
Add a sliding sidebar to the contact view

inlinesplit
app/src/main/AndroidManifest.xml added: 65, removed: 18, total 47
@@ -11,7 +11,9 @@
android:theme="@style/AppTheme">
<activity android:name=".ChatActivity">
</activity>
<activity android:name=".ContactListActivity">
<activity
android:name=".ContactListActivity"
android:theme="@style/AppTheme.NoActionBar">
</activity>
<activity android:name=".ProfileActivity">
<intent-filter>
 
app/src/main/java/ltd/evilcorp/atox/ContactListActivity.kt added: 65, removed: 18, total 47
@@ -1,8 +1,12 @@
package ltd.evilcorp.atox
 
import android.content.Intent
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.v4.content.ContextCompat
import android.support.v4.widget.DrawerLayout
import android.support.v7.app.AppCompatActivity
import android.support.v7.app.ActionBarDrawerToggle
import android.support.v7.widget.Toolbar
import android.view.View
import android.widget.ListView
import kotlinx.android.synthetic.main.contact_list_view_item.view.*
@@ -36,6 +40,22 @@ class ContactListActivity : AppCompatActivity() {
)
)
listView.adapter = ContactAdapter(this, contacts)
 
val drawer = findViewById<DrawerLayout>(R.id.drawerLayout)
val toolbar = findViewById<Toolbar>(R.id.toolbar)
val drawerToggle = object : ActionBarDrawerToggle(
this,
drawer,
toolbar,
R.string.navigation_drawer_open,
R.string.navigation_drawer_close
) {}
 
drawer.addDrawerListener(drawerToggle)
drawerToggle.syncState()
 
toolbar.title = resources.getString(R.string.app_name)
window.statusBarColor = ContextCompat.getColor(this, R.color.colorPrimaryDark)
}
 
override fun onBackPressed() {
 
app/src/main/res/layout/activity_contact_list.xml added: 65, removed: 18, total 47
@@ -1,8 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<ListView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/contactList"
tools:context=".ContactListActivity"/>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ContactListActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar">
<ListView
android:id="@+id/contactList"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ListView
android:id="@+id/drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:background="@android:color/white"/>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
 
app/src/main/res/values/strings.xml added: 65, removed: 18, total 47
@@ -1,3 +1,5 @@
<resources>
<string name="app_name">aTox</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
</resources>
 
app/src/main/res/values/styles.xml added: 65, removed: 18, total 47
@@ -1,11 +1,11 @@
<resources>
 
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
 
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</resources>