mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-26 01:37:43 +00:00
Re-add open group guidelines
This commit is contained in:
parent
0291171fb8
commit
d2d13ec696
@ -223,7 +223,7 @@
|
|||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
android:theme="@style/Theme.Session.DayNight.FlatActionBar" />
|
||||||
<activity
|
<activity
|
||||||
android:name="org.thoughtcrime.securesms.loki.activities.OpenGroupGuidelinesActivity"
|
android:name="org.thoughtcrime.securesms.conversation.v2.OpenGroupGuidelinesActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/Theme.TextSecure.DayNight" />
|
android:theme="@style/Theme.TextSecure.DayNight" />
|
||||||
<activity
|
<activity
|
||||||
|
@ -6,10 +6,7 @@ import android.content.res.Resources
|
|||||||
import android.database.Cursor
|
import android.database.Cursor
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.ActionMode
|
import android.view.*
|
||||||
import android.view.Menu
|
|
||||||
import android.view.MenuItem
|
|
||||||
import android.view.MotionEvent
|
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import androidx.loader.app.LoaderManager
|
import androidx.loader.app.LoaderManager
|
||||||
import androidx.loader.content.Loader
|
import androidx.loader.content.Loader
|
||||||
@ -17,12 +14,12 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
|||||||
import kotlinx.android.synthetic.main.activity_conversation_v2.*
|
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.view.*
|
||||||
import kotlinx.android.synthetic.main.activity_conversation_v2_action_bar.*
|
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.view.*
|
||||||
import kotlinx.android.synthetic.main.view_input_bar_recording.*
|
import kotlinx.android.synthetic.main.view_input_bar_recording.*
|
||||||
import kotlinx.android.synthetic.main.view_input_bar_recording.view.*
|
import kotlinx.android.synthetic.main.view_input_bar_recording.view.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.session.libsession.messaging.mentions.MentionsManager
|
import org.session.libsession.messaging.mentions.MentionsManager
|
||||||
import org.session.libsession.utilities.Util
|
|
||||||
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity
|
||||||
import org.thoughtcrime.securesms.conversation.v2.input_bar.InputBarButton
|
import org.thoughtcrime.securesms.conversation.v2.input_bar.InputBarButton
|
||||||
import org.thoughtcrime.securesms.conversation.v2.input_bar.InputBarDelegate
|
import org.thoughtcrime.securesms.conversation.v2.input_bar.InputBarDelegate
|
||||||
@ -98,6 +95,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
setUpToolBar()
|
setUpToolBar()
|
||||||
setUpInputBar()
|
setUpInputBar()
|
||||||
restoreDraftIfNeeded()
|
restoreDraftIfNeeded()
|
||||||
|
addOpenGroupGuidelinesIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpRecyclerView() {
|
private fun setUpRecyclerView() {
|
||||||
@ -155,6 +153,17 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
inputBar.text = text
|
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 {
|
override fun onPrepareOptionsMenu(menu: Menu): Boolean {
|
||||||
ConversationMenuHelper.onPrepareOptionsMenu(menu, menuInflater, thread, this) { onOptionsItemSelected(it) }
|
ConversationMenuHelper.onPrepareOptionsMenu(menu, menuInflater, thread, this) { onOptionsItemSelected(it) }
|
||||||
super.onPrepareOptionsMenu(menu)
|
super.onPrepareOptionsMenu(menu)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package org.thoughtcrime.securesms.loki.activities
|
package org.thoughtcrime.securesms.conversation.v2
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import kotlinx.android.synthetic.main.activity_open_group_guidelines.*
|
import kotlinx.android.synthetic.main.activity_open_group_guidelines.*
|
||||||
@ -7,7 +7,6 @@ import org.thoughtcrime.securesms.BaseActionBarActivity
|
|||||||
|
|
||||||
class OpenGroupGuidelinesActivity : BaseActionBarActivity() {
|
class OpenGroupGuidelinesActivity : BaseActionBarActivity() {
|
||||||
|
|
||||||
// region Lifecycle
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_open_group_guidelines)
|
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.
|
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()
|
""".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.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
@ -7,30 +7,20 @@ import android.view.LayoutInflater
|
|||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import kotlinx.android.synthetic.main.view_open_group_guidelines.view.*
|
import kotlinx.android.synthetic.main.view_open_group_guidelines.view.*
|
||||||
import network.loki.messenger.R
|
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
|
import org.thoughtcrime.securesms.loki.utilities.push
|
||||||
|
|
||||||
class OpenGroupGuidelinesView : FrameLayout {
|
class OpenGroupGuidelinesView : FrameLayout {
|
||||||
|
|
||||||
constructor(context: Context) : super(context) {
|
constructor(context: Context) : super(context) { initialize() }
|
||||||
setUpViewHierarchy()
|
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) {
|
private fun initialize() {
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
|
||||||
setUpViewHierarchy()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setUpViewHierarchy() {
|
|
||||||
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
val inflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||||
val contentView = inflater.inflate(R.layout.view_open_group_guidelines, null)
|
val contentView = inflater.inflate(R.layout.view_open_group_guidelines, null)
|
||||||
addView(contentView)
|
addView(contentView)
|
||||||
readButton.setOnClickListener {
|
readButton.setOnClickListener {
|
||||||
val activity = context as ConversationActivity
|
val activity = context as ConversationActivityV2
|
||||||
val intent = Intent(activity, OpenGroupGuidelinesActivity::class.java)
|
val intent = Intent(activity, OpenGroupGuidelinesActivity::class.java)
|
||||||
activity.push(intent)
|
activity.push(intent)
|
||||||
}
|
}
|
@ -40,7 +40,7 @@ class LinkPreviewView : LinearLayout {
|
|||||||
// Thumbnail
|
// Thumbnail
|
||||||
val linkPreview = message.linkPreviews.first()
|
val linkPreview = message.linkPreviews.first()
|
||||||
// TODO: Handle downloading state
|
// TODO: Handle downloading state
|
||||||
val uri = linkPreview.thumbnail.get().dataUri!!
|
val uri = linkPreview.thumbnail.get().dataUri ?: return
|
||||||
glide.load(uri).into(thumbnailImageView)
|
glide.load(uri).into(thumbnailImageView)
|
||||||
// TODO: Properly use glide and the actual thumbnail
|
// TODO: Properly use glide and the actual thumbnail
|
||||||
// Title
|
// Title
|
||||||
|
@ -79,7 +79,9 @@ class VisibleMessageContentView : LinearLayout {
|
|||||||
documentView.bind(message, VisibleMessageContentView.getTextColor(context, message))
|
documentView.bind(message, VisibleMessageContentView.getTextColor(context, message))
|
||||||
mainContainer.addView(documentView)
|
mainContainer.addView(documentView)
|
||||||
} else if (message is MmsMessageRecord && message.slideDeck.asAttachments().isNotEmpty()) {
|
} 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) {
|
} else if (message.isOpenGroupInvitation) {
|
||||||
val openGroupInvitationView = OpenGroupInvitationView(context)
|
val openGroupInvitationView = OpenGroupInvitationView(context)
|
||||||
openGroupInvitationView.bind(message, VisibleMessageContentView.getTextColor(context, message))
|
openGroupInvitationView.bind(message, VisibleMessageContentView.getTextColor(context, message))
|
||||||
|
@ -6,6 +6,12 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
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
|
<org.thoughtcrime.securesms.conversation.v2.ConversationRecyclerView
|
||||||
android:id="@+id/conversationRecyclerView"
|
android:id="@+id/conversationRecyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
android:layout_marginTop="@dimen/medium_spacing"
|
android:layout_marginTop="@dimen/medium_spacing"
|
||||||
android:layout_marginRight="@dimen/large_spacing"
|
android:layout_marginRight="@dimen/large_spacing"
|
||||||
android:layout_marginBottom="@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" />
|
android:textColor="@color/text" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -135,7 +135,7 @@
|
|||||||
android:background="?android:dividerHorizontal"
|
android:background="?android:dividerHorizontal"
|
||||||
android:elevation="1dp" />
|
android:elevation="1dp" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.loki.views.OpenGroupGuidelinesView
|
<org.thoughtcrime.securesms.conversation.v2.OpenGroupGuidelinesView
|
||||||
android:id="@+id/open_group_guidelines_view"
|
android:id="@+id/open_group_guidelines_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -31,8 +31,10 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:textSize="@dimen/small_font_size"
|
android:textSize="15dp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
android:text="@string/open_group_guidelines_pinned_message" />
|
android:text="@string/open_group_guidelines_pinned_message" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
@ -40,8 +42,9 @@
|
|||||||
android:maxWidth="260dp"
|
android:maxWidth="260dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="@color/text"
|
android:textColor="@color/text"
|
||||||
android:textSize="@dimen/small_font_size"
|
android:textSize="15dp"
|
||||||
android:maxLines="2"
|
android:maxLines="1"
|
||||||
|
android:ellipsize="end"
|
||||||
android:text="@string/open_group_guidelines_community_guidelines" />
|
android:text="@string/open_group_guidelines_community_guidelines" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -58,7 +61,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/small_button_height"
|
android:layout_height="@dimen/small_button_height"
|
||||||
android:layout_marginRight="12dp"
|
android:layout_marginRight="12dp"
|
||||||
android:textSize="@dimen/small_font_size"
|
android:textSize="15dp"
|
||||||
android:textStyle="normal"
|
android:textStyle="normal"
|
||||||
android:text="@string/open_group_guidelines_read" />
|
android:text="@string/open_group_guidelines_read" />
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user