mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +00:00
Merge remote-tracking branch 'upstream/ui' into ui
# Conflicts: # app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt
This commit is contained in:
commit
d48f68afc2
@ -223,7 +223,7 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
||||
<activity
|
||||
android:name="org.thoughtcrime.securesms.loki.activities.OpenGroupGuidelinesActivity"
|
||||
android:name="org.thoughtcrime.securesms.conversation.v2.OpenGroupGuidelinesActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.TextSecure.DayNight" />
|
||||
<activity
|
||||
|
@ -6,10 +6,7 @@ import android.content.res.Resources
|
||||
import android.database.Cursor
|
||||
import android.graphics.Rect
|
||||
import android.os.Bundle
|
||||
import android.view.ActionMode
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.MotionEvent
|
||||
import android.view.*
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.loader.app.LoaderManager
|
||||
import androidx.loader.content.Loader
|
||||
@ -17,6 +14,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import kotlinx.android.synthetic.main.activity_conversation_v2.*
|
||||
import kotlinx.android.synthetic.main.activity_conversation_v2.view.*
|
||||
import kotlinx.android.synthetic.main.activity_conversation_v2_action_bar.*
|
||||
import kotlinx.android.synthetic.main.activity_home.*
|
||||
import kotlinx.android.synthetic.main.view_input_bar.view.*
|
||||
import kotlinx.android.synthetic.main.view_input_bar_recording.*
|
||||
import kotlinx.android.synthetic.main.view_input_bar_recording.view.*
|
||||
@ -98,6 +96,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
setUpToolBar()
|
||||
setUpInputBar()
|
||||
restoreDraftIfNeeded()
|
||||
addOpenGroupGuidelinesIfNeeded()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@ -165,6 +164,17 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
inputBar.text = text
|
||||
}
|
||||
|
||||
private fun addOpenGroupGuidelinesIfNeeded() {
|
||||
val openGroup = DatabaseFactory.getLokiThreadDatabase(this).getOpenGroupChat(threadID) ?: return
|
||||
val isOxenHostedOpenGroup = openGroup.room == "session" || openGroup.room == "oxen"
|
||||
|| openGroup.room == "lokinet" || openGroup.room == "crypto"
|
||||
if (!isOxenHostedOpenGroup) { return }
|
||||
openGroupGuidelinesView.visibility = View.VISIBLE
|
||||
val recyclerViewLayoutParams = conversationRecyclerView.layoutParams as RelativeLayout.LayoutParams
|
||||
recyclerViewLayoutParams.topMargin = toPx(57, resources)
|
||||
conversationRecyclerView.layoutParams = recyclerViewLayoutParams
|
||||
}
|
||||
|
||||
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||
ConversationMenuHelper.onPrepareOptionsMenu(menu, menuInflater, thread, this) { onOptionsItemSelected(it) }
|
||||
super.onPrepareOptionsMenu(menu)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package org.thoughtcrime.securesms.loki.activities
|
||||
package org.thoughtcrime.securesms.conversation.v2
|
||||
|
||||
import android.os.Bundle
|
||||
import kotlinx.android.synthetic.main.activity_open_group_guidelines.*
|
||||
@ -7,7 +7,6 @@ import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||
|
||||
class OpenGroupGuidelinesActivity : BaseActionBarActivity() {
|
||||
|
||||
// region Lifecycle
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_open_group_guidelines)
|
||||
@ -49,5 +48,4 @@ class OpenGroupGuidelinesActivity : BaseActionBarActivity() {
|
||||
Trust only those with an admin crown in chat. No admin will ever DM you first. No admin will ever message you for Oxen coins.
|
||||
""".trimIndent()
|
||||
}
|
||||
// endregion
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package org.thoughtcrime.securesms.loki.views
|
||||
package org.thoughtcrime.securesms.conversation.v2
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
@ -7,30 +7,20 @@ import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
import kotlinx.android.synthetic.main.view_open_group_guidelines.view.*
|
||||
import network.loki.messenger.R
|
||||
import org.thoughtcrime.securesms.conversation.ConversationActivity
|
||||
import org.thoughtcrime.securesms.loki.activities.OpenGroupGuidelinesActivity
|
||||
import org.thoughtcrime.securesms.loki.utilities.push
|
||||
|
||||
class OpenGroupGuidelinesView : FrameLayout {
|
||||
|
||||
constructor(context: Context) : super(context) {
|
||||
setUpViewHierarchy()
|
||||
}
|
||||
constructor(context: Context) : super(context) { initialize() }
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { initialize() }
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { initialize() }
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
|
||||
setUpViewHierarchy()
|
||||
}
|
||||
|
||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
setUpViewHierarchy()
|
||||
}
|
||||
|
||||
private fun setUpViewHierarchy() {
|
||||
private fun initialize() {
|
||||
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
val contentView = inflater.inflate(R.layout.view_open_group_guidelines, null)
|
||||
addView(contentView)
|
||||
readButton.setOnClickListener {
|
||||
val activity = context as ConversationActivity
|
||||
val activity = context as ConversationActivityV2
|
||||
val intent = Intent(activity, OpenGroupGuidelinesActivity::class.java)
|
||||
activity.push(intent)
|
||||
}
|
@ -40,7 +40,7 @@ class LinkPreviewView : LinearLayout {
|
||||
// Thumbnail
|
||||
val linkPreview = message.linkPreviews.first()
|
||||
// TODO: Handle downloading state
|
||||
val uri = linkPreview.thumbnail.get().dataUri!!
|
||||
val uri = linkPreview.thumbnail.get().dataUri ?: return
|
||||
glide.load(uri).into(thumbnailImageView)
|
||||
// TODO: Properly use glide and the actual thumbnail
|
||||
// Title
|
||||
|
@ -79,7 +79,9 @@ class VisibleMessageContentView : LinearLayout {
|
||||
documentView.bind(message, VisibleMessageContentView.getTextColor(context, message))
|
||||
mainContainer.addView(documentView)
|
||||
} else if (message is MmsMessageRecord && message.slideDeck.asAttachments().isNotEmpty()) {
|
||||
throw IllegalStateException("Not yet implemented; we may want to use Signal's album view here.")
|
||||
val dummyTextView = TextView(context)
|
||||
dummyTextView.text = "asifuygaihsfo"
|
||||
mainContainer.addView(dummyTextView)
|
||||
} else if (message.isOpenGroupInvitation) {
|
||||
val openGroupInvitationView = OpenGroupInvitationView(context)
|
||||
openGroupInvitationView.bind(message, VisibleMessageContentView.getTextColor(context, message))
|
||||
|
@ -6,6 +6,12 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<org.thoughtcrime.securesms.conversation.v2.OpenGroupGuidelinesView
|
||||
android:id="@+id/openGroupGuidelinesView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<org.thoughtcrime.securesms.conversation.v2.ConversationRecyclerView
|
||||
android:id="@+id/conversationRecyclerView"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -28,7 +28,7 @@
|
||||
android:layout_marginTop="@dimen/medium_spacing"
|
||||
android:layout_marginRight="@dimen/large_spacing"
|
||||
android:layout_marginBottom="@dimen/large_spacing"
|
||||
android:textSize="@dimen/medium_font_size"
|
||||
android:textSize="@dimen/small_font_size"
|
||||
android:textColor="@color/text" />
|
||||
|
||||
</LinearLayout>
|
||||
|
@ -135,7 +135,7 @@
|
||||
android:background="?android:dividerHorizontal"
|
||||
android:elevation="1dp" />
|
||||
|
||||
<org.thoughtcrime.securesms.loki.views.OpenGroupGuidelinesView
|
||||
<org.thoughtcrime.securesms.conversation.v2.OpenGroupGuidelinesView
|
||||
android:id="@+id/open_group_guidelines_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -31,8 +31,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text"
|
||||
android:textSize="@dimen/small_font_size"
|
||||
android:textSize="15dp"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/open_group_guidelines_pinned_message" />
|
||||
|
||||
<TextView
|
||||
@ -40,8 +42,9 @@
|
||||
android:maxWidth="260dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text"
|
||||
android:textSize="@dimen/small_font_size"
|
||||
android:maxLines="2"
|
||||
android:textSize="15dp"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:text="@string/open_group_guidelines_community_guidelines" />
|
||||
|
||||
</LinearLayout>
|
||||
@ -58,7 +61,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/small_button_height"
|
||||
android:layout_marginRight="12dp"
|
||||
android:textSize="@dimen/small_font_size"
|
||||
android:textSize="15dp"
|
||||
android:textStyle="normal"
|
||||
android:text="@string/open_group_guidelines_read" />
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user