mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-30 13:35:18 +00:00
Make chips look better
This commit is contained in:
parent
54b93e56a0
commit
43c5fce526
@ -10,6 +10,7 @@ import android.view.LayoutInflater
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
|
import android.widget.GridLayout
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory
|
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory
|
||||||
@ -184,8 +185,9 @@ class EnterChatURLFragment : Fragment() {
|
|||||||
|
|
||||||
private fun populateDefaultGroups(groups: List<DefaultGroup>) {
|
private fun populateDefaultGroups(groups: List<DefaultGroup>) {
|
||||||
defaultRoomsGridLayout.removeAllViews()
|
defaultRoomsGridLayout.removeAllViews()
|
||||||
|
defaultRoomsGridLayout.useDefaultMargins = false
|
||||||
groups.forEach { defaultGroup ->
|
groups.forEach { defaultGroup ->
|
||||||
val chip = layoutInflater.inflate(R.layout.default_group_chip,defaultRoomsGridLayout, false) as Chip
|
val chip = layoutInflater.inflate(R.layout.default_group_chip, defaultRoomsGridLayout, false) as Chip
|
||||||
val drawable = defaultGroup.image?.let { bytes ->
|
val drawable = defaultGroup.image?.let { bytes ->
|
||||||
val bitmap = BitmapFactory.decodeByteArray(bytes,0,bytes.size)
|
val bitmap = BitmapFactory.decodeByteArray(bytes,0,bytes.size)
|
||||||
RoundedBitmapDrawableFactory.create(resources,bitmap).apply {
|
RoundedBitmapDrawableFactory.create(resources,bitmap).apply {
|
||||||
@ -197,10 +199,10 @@ class EnterChatURLFragment : Fragment() {
|
|||||||
chip.setOnClickListener {
|
chip.setOnClickListener {
|
||||||
(requireActivity() as JoinPublicChatActivity).joinPublicChatIfPossible(defaultGroup.joinURL)
|
(requireActivity() as JoinPublicChatActivity).joinPublicChatIfPossible(defaultGroup.joinURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultRoomsGridLayout.addView(chip)
|
defaultRoomsGridLayout.addView(chip)
|
||||||
}
|
}
|
||||||
if (groups.size and 1 != 0) {
|
if ((groups.size and 1) != 0) { // This checks that the number of rooms is even
|
||||||
// add a filler weight 1 view
|
|
||||||
layoutInflater.inflate(R.layout.grid_layout_filler, defaultRoomsGridLayout)
|
layoutInflater.inflate(R.layout.grid_layout_filler, defaultRoomsGridLayout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,12 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
<<<<<<< HEAD
|
||||||
android:paddingHorizontal="24dp"
|
android:paddingHorizontal="24dp"
|
||||||
android:id="@+id/defaultRoomsParent"
|
android:id="@+id/defaultRoomsParent"
|
||||||
|
=======
|
||||||
|
android:id="@+id/defaultRoomsContainer"
|
||||||
|
>>>>>>> 133bcac17 (Make chips look better)
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -42,12 +46,14 @@
|
|||||||
android:layout_marginVertical="16dp"
|
android:layout_marginVertical="16dp"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
|
android:paddingHorizontal="24dp"
|
||||||
android:text="@string/activity_join_public_chat_join_rooms"
|
android:text="@string/activity_join_public_chat_join_rooms"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<GridLayout
|
<GridLayout
|
||||||
android:id="@+id/defaultRoomsGridLayout"
|
android:id="@+id/defaultRoomsGridLayout"
|
||||||
android:columnCount="2"
|
android:columnCount="2"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -4,11 +4,13 @@
|
|||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:theme="@style/Theme.MaterialComponents.DayNight"
|
android:theme="@style/Theme.MaterialComponents.DayNight"
|
||||||
style="?attr/chipStyle"
|
style="?attr/chipStyle"
|
||||||
app:chipStartPadding="6dp"
|
app:chipStartPadding="4dp"
|
||||||
|
app:chipBackgroundColor="@color/open_group_chip_color"
|
||||||
android:layout_columnWeight="1"
|
android:layout_columnWeight="1"
|
||||||
android:layout_marginHorizontal="2dp"
|
|
||||||
tools:text="Main Group"
|
tools:text="Main Group"
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
tools:layout_width="wrap_content"
|
tools:layout_width="wrap_content"
|
||||||
|
app:chipMinTouchTargetSize="0dp"
|
||||||
|
android:layout_margin="4dp"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="52dp" />
|
android:layout_height="wrap_content" />
|
@ -33,8 +33,12 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
<<<<<<< HEAD
|
||||||
android:paddingHorizontal="24dp"
|
android:paddingHorizontal="24dp"
|
||||||
android:id="@+id/defaultRoomsParent"
|
android:id="@+id/defaultRoomsParent"
|
||||||
|
=======
|
||||||
|
android:id="@+id/defaultRoomsContainer"
|
||||||
|
>>>>>>> 133bcac17 (Make chips look better)
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@ -42,12 +46,14 @@
|
|||||||
android:layout_marginVertical="16dp"
|
android:layout_marginVertical="16dp"
|
||||||
android:textSize="18sp"
|
android:textSize="18sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
|
android:paddingHorizontal="24dp"
|
||||||
android:text="@string/activity_join_public_chat_join_rooms"
|
android:text="@string/activity_join_public_chat_join_rooms"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
<GridLayout
|
<GridLayout
|
||||||
android:id="@+id/defaultRoomsGridLayout"
|
android:id="@+id/defaultRoomsGridLayout"
|
||||||
android:columnCount="2"
|
android:columnCount="2"
|
||||||
|
android:paddingHorizontal="16dp"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
<color name="new_conversation_button_collapsed_background">#F5F5F5</color>
|
<color name="new_conversation_button_collapsed_background">#F5F5F5</color>
|
||||||
<color name="pn_option_background">#FCFCFC</color>
|
<color name="pn_option_background">#FCFCFC</color>
|
||||||
<color name="fake_chat_bubble_background">#F5F5F5</color>
|
<color name="fake_chat_bubble_background">#F5F5F5</color>
|
||||||
|
<color name="open_group_chip_color">#0D000000</color>
|
||||||
|
|
||||||
|
|
||||||
<color name="default_background_start">#ffffff</color>
|
<color name="default_background_start">#ffffff</color>
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
<color name="pn_option_background">#1B1B1B</color>
|
<color name="pn_option_background">#1B1B1B</color>
|
||||||
<color name="pn_option_border">#212121</color>
|
<color name="pn_option_border">#212121</color>
|
||||||
<color name="paths_building">#FFCE3A</color>
|
<color name="paths_building">#FFCE3A</color>
|
||||||
|
<color name="open_group_chip_color">#0DFFFFFF</color>
|
||||||
|
|
||||||
<array name="profile_picture_placeholder_colors">
|
<array name="profile_picture_placeholder_colors">
|
||||||
<item>#5ff8b0</item>
|
<item>#5ff8b0</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user