Make chips look better

pull/537/head
Niels Andriesse 3 years ago
parent 54b93e56a0
commit 43c5fce526

@ -10,6 +10,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import android.widget.GridLayout
import android.widget.Toast
import androidx.activity.viewModels
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory
@ -184,8 +185,9 @@ class EnterChatURLFragment : Fragment() {
private fun populateDefaultGroups(groups: List<DefaultGroup>) {
defaultRoomsGridLayout.removeAllViews()
defaultRoomsGridLayout.useDefaultMargins = false
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 bitmap = BitmapFactory.decodeByteArray(bytes,0,bytes.size)
RoundedBitmapDrawableFactory.create(resources,bitmap).apply {
@ -197,10 +199,10 @@ class EnterChatURLFragment : Fragment() {
chip.setOnClickListener {
(requireActivity() as JoinPublicChatActivity).joinPublicChatIfPossible(defaultGroup.joinURL)
}
defaultRoomsGridLayout.addView(chip)
}
if (groups.size and 1 != 0) {
// add a filler weight 1 view
if ((groups.size and 1) != 0) { // This checks that the number of rooms is even
layoutInflater.inflate(R.layout.grid_layout_filler, defaultRoomsGridLayout)
}
}

@ -33,8 +33,12 @@
<LinearLayout
android:visibility="gone"
<<<<<<< HEAD
android:paddingHorizontal="24dp"
android:id="@+id/defaultRoomsParent"
=======
android:id="@+id/defaultRoomsContainer"
>>>>>>> 133bcac17 (Make chips look better)
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -42,12 +46,14 @@
android:layout_marginVertical="16dp"
android:textSize="18sp"
android:textStyle="bold"
android:paddingHorizontal="24dp"
android:text="@string/activity_join_public_chat_join_rooms"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<GridLayout
android:id="@+id/defaultRoomsGridLayout"
android:columnCount="2"
android:paddingHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>

@ -4,11 +4,13 @@
xmlns:tools="http://schemas.android.com/tools"
android:theme="@style/Theme.MaterialComponents.DayNight"
style="?attr/chipStyle"
app:chipStartPadding="6dp"
app:chipStartPadding="4dp"
app:chipBackgroundColor="@color/open_group_chip_color"
android:layout_columnWeight="1"
android:layout_marginHorizontal="2dp"
tools:text="Main Group"
android:ellipsize="end"
tools:layout_width="wrap_content"
app:chipMinTouchTargetSize="0dp"
android:layout_margin="4dp"
android:layout_width="0dp"
android:layout_height="52dp" />
android:layout_height="wrap_content" />

@ -33,8 +33,12 @@
<LinearLayout
android:visibility="gone"
<<<<<<< HEAD
android:paddingHorizontal="24dp"
android:id="@+id/defaultRoomsParent"
=======
android:id="@+id/defaultRoomsContainer"
>>>>>>> 133bcac17 (Make chips look better)
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
@ -42,12 +46,14 @@
android:layout_marginVertical="16dp"
android:textSize="18sp"
android:textStyle="bold"
android:paddingHorizontal="24dp"
android:text="@string/activity_join_public_chat_join_rooms"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<GridLayout
android:id="@+id/defaultRoomsGridLayout"
android:columnCount="2"
android:paddingHorizontal="16dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>

@ -22,6 +22,7 @@
<color name="new_conversation_button_collapsed_background">#F5F5F5</color>
<color name="pn_option_background">#FCFCFC</color>
<color name="fake_chat_bubble_background">#F5F5F5</color>
<color name="open_group_chip_color">#0D000000</color>
<color name="default_background_start">#ffffff</color>

@ -31,6 +31,7 @@
<color name="pn_option_background">#1B1B1B</color>
<color name="pn_option_border">#212121</color>
<color name="paths_building">#FFCE3A</color>
<color name="open_group_chip_color">#0DFFFFFF</color>
<array name="profile_picture_placeholder_colors">
<item>#5ff8b0</item>

Loading…
Cancel
Save