mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Implement rough home screen redesign
This commit is contained in:
parent
d4db46aeca
commit
a10c056ac5
@ -124,20 +124,25 @@
|
||||
android:name="firebase_messaging_auto_init_enabled"
|
||||
android:value="false" />
|
||||
|
||||
<!-- Session -->
|
||||
<activity
|
||||
android:name="org.thoughtcrime.securesms.loki.redesign.LandingActivity"
|
||||
android:name="org.thoughtcrime.securesms.loki.redesign.activities.LandingActivity"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name="org.thoughtcrime.securesms.loki.redesign.RegisterActivity"
|
||||
android:name="org.thoughtcrime.securesms.loki.redesign.activities.RegisterActivity"
|
||||
android:launchMode="singleTask" />
|
||||
<activity
|
||||
android:name="org.thoughtcrime.securesms.loki.redesign.DisplayNameActivity"
|
||||
android:name="org.thoughtcrime.securesms.loki.redesign.activities.DisplayNameActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity
|
||||
android:name="org.thoughtcrime.securesms.loki.redesign.RestoreActivity"
|
||||
android:name="org.thoughtcrime.securesms.loki.redesign.activities.RestoreActivity"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="adjustResize" />
|
||||
<activity
|
||||
android:name="org.thoughtcrime.securesms.loki.redesign.activities.HomeActivity"
|
||||
android:launchMode="singleTask" />
|
||||
<!-- Session -->
|
||||
<activity android:name="org.thoughtcrime.securesms.loki.LinkedDevicesActivity" />
|
||||
<activity
|
||||
android:name="org.thoughtcrime.securesms.WebRtcCallActivity"
|
||||
@ -216,7 +221,7 @@
|
||||
<activity-alias
|
||||
android:name=".RoutingActivity"
|
||||
android:exported="true"
|
||||
android:targetActivity="org.thoughtcrime.securesms.ConversationListActivity">
|
||||
android:targetActivity="org.thoughtcrime.securesms.loki.redesign.activities.HomeActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
|
7
res/drawable/new_conversation_button_background.xml
Normal file
7
res/drawable/new_conversation_button_background.xml
Normal file
@ -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>
|
7
res/drawable/new_conversation_button_foreground.xml
Normal file
7
res/drawable/new_conversation_button_foreground.xml
Normal file
@ -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>
|
BIN
res/font/roboto_light.ttf
Normal file
BIN
res/font/roboto_light.ttf
Normal file
Binary file not shown.
42
res/layout/activity_home.xml
Normal file
42
res/layout/activity_home.xml
Normal file
@ -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>
|
@ -21,7 +21,7 @@
|
||||
android:textColor="@color/text"
|
||||
android:text="Your Session begins here..." />
|
||||
|
||||
<org.thoughtcrime.securesms.loki.redesign.FakeChatView
|
||||
<org.thoughtcrime.securesms.loki.redesign.views.FakeChatView
|
||||
android:id="@+id/fakeChatView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/fake_chat_view_height"
|
||||
|
90
res/layout/conversation_view.xml
Normal file
90
res/layout/conversation_view.xml
Normal file
@ -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>
|
@ -4,6 +4,9 @@
|
||||
<!-- Session -->
|
||||
<color name="accent">#00F782</color>
|
||||
<color name="text">#FFFFFF</color>
|
||||
<color name="unimportant">#D8D8D8</color>
|
||||
<color name="cell_background">#1B1B1B</color>
|
||||
<color name="cell_selected">#0C0C0C</color>
|
||||
<color name="action_bar_background">#171717</color>
|
||||
<color name="navigation_bar_background">#121212</color>
|
||||
<color name="fake_chat_bubble_background">#3F4146</color>
|
||||
|
@ -13,7 +13,11 @@
|
||||
|
||||
<!-- Element Sizes -->
|
||||
<dimen name="medium_button_height">48dp</dimen>
|
||||
<dimen name="accent_line_thickness">4dp</dimen>
|
||||
<dimen name="medium_profile_picture_size">45dp</dimen>
|
||||
<dimen name="conversation_view_status_indicator_size">14dp</dimen>
|
||||
<dimen name="border_thickness">2dp</dimen>
|
||||
<dimen name="new_conversation_button_size">56dp</dimen>
|
||||
<dimen name="text_view_corner_radius">8dp</dimen>
|
||||
<dimen name="fake_chat_view_bubble_width">224dp</dimen>
|
||||
<dimen name="fake_chat_view_bubble_corner_radius">10dp</dimen>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">Loki Messenger</string>
|
||||
<string name="app_name">Session</string>
|
||||
<string name="install_url" translatable="false">https://signal.org/install</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
|
@ -5,6 +5,13 @@
|
||||
<style name="Session.DarkActionBar" parent="@style/Widget.AppCompat.ActionBar">
|
||||
<item name="background">@color/action_bar_background</item>
|
||||
<item name="android:background">@color/action_bar_background</item>
|
||||
<item name="titleTextStyle">@style/Session.TitleTextStyle</item>
|
||||
<item name="android:titleTextStyle">@style/Session.TitleTextStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="Session.TitleTextStyle" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
|
||||
<item name="android:textColor">@color/text</item>
|
||||
<item name="android:textSize">@dimen/very_large_font_size</item>
|
||||
</style>
|
||||
|
||||
<style name="MediumProminentFilledButton">
|
||||
|
@ -72,6 +72,7 @@ import org.thoughtcrime.securesms.loki.LokiPublicChatManager;
|
||||
import org.thoughtcrime.securesms.loki.LokiRSSFeedPoller;
|
||||
import org.thoughtcrime.securesms.loki.LokiUserDatabase;
|
||||
import org.thoughtcrime.securesms.loki.MultiDeviceUtilities;
|
||||
import org.thoughtcrime.securesms.loki.redesign.activities.HomeActivity;
|
||||
import org.thoughtcrime.securesms.notifications.MessageNotifier;
|
||||
import org.thoughtcrime.securesms.notifications.NotificationChannels;
|
||||
import org.thoughtcrime.securesms.providers.BlobProvider;
|
||||
@ -651,7 +652,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
||||
}
|
||||
|
||||
public void restartApplication() {
|
||||
Intent intent = new Intent(this, ConversationListActivity.class);
|
||||
Intent intent = new Intent(this, HomeActivity.class);
|
||||
ComponentName componentName = intent.getComponent();
|
||||
Intent mainIntent = Intent.makeRestartActivityTask(componentName);
|
||||
this.startActivity(mainIntent);
|
||||
|
@ -13,7 +13,8 @@ import android.support.v4.app.Fragment;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
||||
import org.thoughtcrime.securesms.jobs.PushNotificationReceiveJob;
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
import org.thoughtcrime.securesms.loki.redesign.LandingActivity;
|
||||
import org.thoughtcrime.securesms.loki.redesign.activities.HomeActivity;
|
||||
import org.thoughtcrime.securesms.loki.redesign.activities.LandingActivity;
|
||||
import org.thoughtcrime.securesms.loki.SeedActivity;
|
||||
import org.thoughtcrime.securesms.push.SignalServiceNetworkAccess;
|
||||
import org.thoughtcrime.securesms.service.KeyCachingService;
|
||||
@ -199,7 +200,7 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
|
||||
}
|
||||
|
||||
private Intent getConversationListIntent() {
|
||||
return new Intent(this, ConversationListActivity.class);
|
||||
return new Intent(this, HomeActivity.class);
|
||||
}
|
||||
|
||||
private void initializeClearKeyReceiver() {
|
||||
|
@ -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.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.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.ClipboardManager
|
@ -1,4 +1,4 @@
|
||||
package org.thoughtcrime.securesms.loki.redesign
|
||||
package org.thoughtcrime.securesms.loki.redesign.activities
|
||||
|
||||
import android.content.Intent
|
||||
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.LAYOUT_INFLATER_SERVICE
|
Loading…
Reference in New Issue
Block a user