Implement rough home screen redesign
parent
d4db46aeca
commit
a10c056ac5
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<gradient android:type="radial" android:gradientRadius="36dp" android:startColor="@color/accent" android:endColor="@android:color/transparent" />
|
||||||
|
</shape>
|
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="oval">
|
||||||
|
|
||||||
|
<solid android:color="@color/accent" />
|
||||||
|
</shape>
|
Binary file not shown.
@ -0,0 +1,42 @@
|
|||||||
|
<?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"
|
||||||
|
android:background="@drawable/default_session_background">
|
||||||
|
|
||||||
|
<android.support.v7.widget.RecyclerView
|
||||||
|
android:id="@+id/recyclerView"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
<!-- The button below intentionally uses dp for the text size and not sp -->
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="72dp">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="72dp"
|
||||||
|
android:layout_height="72dp"
|
||||||
|
android:background="@drawable/new_conversation_button_background" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="@dimen/new_conversation_button_size"
|
||||||
|
android:layout_height="@dimen/new_conversation_button_size"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:paddingLeft="1dp"
|
||||||
|
android:paddingBottom="2dp"
|
||||||
|
android:background="@drawable/new_conversation_button_foreground"
|
||||||
|
android:fontFamily="@font/roboto_light"
|
||||||
|
android:textSize="40dp"
|
||||||
|
android:textColor="#121212"
|
||||||
|
android:text="+"
|
||||||
|
android:elevation="0dp" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
@ -0,0 +1,90 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<org.thoughtcrime.securesms.loki.redesign.views.ConversationView
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/cell_background"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:gravity="center_vertical">
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/unreadMessagesIndicatorView"
|
||||||
|
android:layout_width="@dimen/accent_line_thickness"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/accent" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="@dimen/medium_profile_picture_size"
|
||||||
|
android:layout_height="@dimen/medium_profile_picture_size"
|
||||||
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
|
android:layout_marginLeft="@dimen/medium_spacing"
|
||||||
|
android:layout_marginBottom="@dimen/medium_spacing"
|
||||||
|
android:background="@color/unimportant" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/medium_spacing"
|
||||||
|
android:layout_marginRight="@dimen/medium_spacing"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/displayNameTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/medium_font_size"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:text="Spiderman" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/timestampTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="@dimen/medium_spacing"
|
||||||
|
android:textSize="@dimen/small_font_size"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:alpha="0.4"
|
||||||
|
android:text="9:41 AM" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/snippetTextView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="@dimen/medium_font_size"
|
||||||
|
android:textColor="@color/text"
|
||||||
|
android:text="Sorry, gotta go fight crime again" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/statusIndicatorImageView"
|
||||||
|
android:layout_width="@dimen/conversation_view_status_indicator_size"
|
||||||
|
android:layout_height="@dimen/conversation_view_status_indicator_size"
|
||||||
|
android:layout_marginLeft="@dimen/medium_spacing" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</org.thoughtcrime.securesms.loki.redesign.views.ConversationView>
|
@ -0,0 +1,40 @@
|
|||||||
|
package org.thoughtcrime.securesms.loki.redesign.activities
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.database.Cursor
|
||||||
|
import android.support.v7.widget.RecyclerView
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import org.thoughtcrime.securesms.database.CursorRecyclerViewAdapter
|
||||||
|
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||||
|
import org.thoughtcrime.securesms.database.model.ThreadRecord
|
||||||
|
import org.thoughtcrime.securesms.loki.redesign.views.ConversationView
|
||||||
|
|
||||||
|
class ConversationAdapter(context: Context, cursor: Cursor) : CursorRecyclerViewAdapter<ConversationAdapter.ViewHolder>(context, cursor) {
|
||||||
|
private val threadDatabase = DatabaseFactory.getThreadDatabase(context)
|
||||||
|
var conversationClickListener: ConversationClickListener? = null
|
||||||
|
|
||||||
|
class ViewHolder(val view: ConversationView) : RecyclerView.ViewHolder(view)
|
||||||
|
|
||||||
|
override fun onCreateItemViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
|
val view = ConversationView.get(context, parent)
|
||||||
|
view.setOnClickListener { conversationClickListener?.onConversationClick(view) }
|
||||||
|
view.setOnLongClickListener {
|
||||||
|
conversationClickListener?.onLongConversationClick(view)
|
||||||
|
true
|
||||||
|
}
|
||||||
|
return ViewHolder(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindItemViewHolder(viewHolder: ViewHolder, cursor: Cursor) {
|
||||||
|
viewHolder.view.bind(getThread(cursor)!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getThread(cursor: Cursor): ThreadRecord? {
|
||||||
|
return threadDatabase.readerFor(cursor).getCurrent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ConversationClickListener {
|
||||||
|
fun onConversationClick(view: ConversationView)
|
||||||
|
fun onLongConversationClick(view: ConversationView)
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.thoughtcrime.securesms.loki.redesign
|
package org.thoughtcrime.securesms.loki.redesign.activities
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
@ -0,0 +1,35 @@
|
|||||||
|
package org.thoughtcrime.securesms.loki.redesign.activities
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.support.v7.widget.LinearLayoutManager
|
||||||
|
import kotlinx.android.synthetic.main.activity_home.*
|
||||||
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.ApplicationContext
|
||||||
|
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||||
|
import org.thoughtcrime.securesms.database.DatabaseFactory
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||||
|
|
||||||
|
class HomeActivity : PassphraseRequiredActionBarActivity {
|
||||||
|
|
||||||
|
constructor() : super()
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?, isReady: Boolean) {
|
||||||
|
super.onCreate(savedInstanceState, isReady)
|
||||||
|
// Set content view
|
||||||
|
setContentView(R.layout.activity_home)
|
||||||
|
// Set title
|
||||||
|
supportActionBar!!.title = "Messages"
|
||||||
|
// Set up recycler view
|
||||||
|
val cursor = DatabaseFactory.getThreadDatabase(this).conversationList
|
||||||
|
recyclerView.adapter = ConversationAdapter(this, cursor)
|
||||||
|
recyclerView.layoutManager = LinearLayoutManager(this)
|
||||||
|
// Set up public chats and RSS feeds if needed
|
||||||
|
if (TextSecurePreferences.getLocalNumber(this) != null) {
|
||||||
|
val application = ApplicationContext.getInstance(this)
|
||||||
|
application.createDefaultPublicChatsIfNeeded()
|
||||||
|
application.createRSSFeedsIfNeeded()
|
||||||
|
application.lokiPublicChatManager.startPollersIfNeeded()
|
||||||
|
application.startRSSFeedPollersIfNeeded()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.thoughtcrime.securesms.loki.redesign
|
package org.thoughtcrime.securesms.loki.redesign.activities
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
@ -1,4 +1,4 @@
|
|||||||
package org.thoughtcrime.securesms.loki.redesign
|
package org.thoughtcrime.securesms.loki.redesign.activities
|
||||||
|
|
||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
@ -1,4 +1,4 @@
|
|||||||
package org.thoughtcrime.securesms.loki.redesign
|
package org.thoughtcrime.securesms.loki.redesign.activities
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
@ -0,0 +1,35 @@
|
|||||||
|
package org.thoughtcrime.securesms.loki.redesign.views
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import network.loki.messenger.R
|
||||||
|
import org.thoughtcrime.securesms.database.model.ThreadRecord
|
||||||
|
|
||||||
|
class ConversationView : LinearLayout {
|
||||||
|
|
||||||
|
// region Lifecycle
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun get(context: Context, parent: ViewGroup?): ConversationView {
|
||||||
|
return LayoutInflater.from(context).inflate(R.layout.conversation_view, parent, false) as ConversationView
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(context: Context) : super(context)
|
||||||
|
|
||||||
|
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
||||||
|
|
||||||
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
|
||||||
|
|
||||||
|
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes)
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region Updating
|
||||||
|
fun bind(thread: ThreadRecord) {
|
||||||
|
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package org.thoughtcrime.securesms.loki.redesign
|
package org.thoughtcrime.securesms.loki.redesign.views
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Context.LAYOUT_INFLATER_SERVICE
|
import android.content.Context.LAYOUT_INFLATER_SERVICE
|
Loading…
Reference in New Issue