add indicator
BIN
Habitica/res/drawable-hdpi/checkmark_small.png
Normal file
|
After Width: | Height: | Size: 383 B |
BIN
Habitica/res/drawable-hdpi/indicator_subscribe.png
Normal file
|
After Width: | Height: | Size: 232 B |
BIN
Habitica/res/drawable-mdpi/checkmark_small.png
Normal file
|
After Width: | Height: | Size: 291 B |
BIN
Habitica/res/drawable-night/indicator_subscribe.png
Normal file
|
After Width: | Height: | Size: 232 B |
BIN
Habitica/res/drawable-xhdpi/checkmark_small.png
Normal file
|
After Width: | Height: | Size: 449 B |
BIN
Habitica/res/drawable-xhdpi/indicator_subscribe.png
Normal file
|
After Width: | Height: | Size: 325 B |
BIN
Habitica/res/drawable-xxhdpi/checkmark_small.png
Normal file
|
After Width: | Height: | Size: 610 B |
BIN
Habitica/res/drawable-xxhdpi/indicator_subscribe.png
Normal file
|
After Width: | Height: | Size: 430 B |
11
Habitica/res/drawable/item_indicator_subscribe.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="24dp" android:height="24dp">
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/green_100" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:width="14dp" android:height="14dp" android:gravity="center">
|
||||
<bitmap android:src="@drawable/indicator_subscribe" />
|
||||
</item>
|
||||
</layer-list>
|
||||
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
<LinearLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_marginTop="6dp"
|
||||
|
|
@ -49,17 +50,36 @@
|
|||
/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/pin_indicator"
|
||||
android:layout_width="@dimen/shopitem_status_size"
|
||||
android:layout_height="@dimen/shopitem_status_size"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_alignStart="@id/container"
|
||||
android:layout_alignTop="@id/container"
|
||||
android:gravity="center"
|
||||
android:scaleType="center"
|
||||
android:textColor="@color/white" />
|
||||
android:padding="6dp">
|
||||
<ImageView
|
||||
android:id="@+id/completed_indicator"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="8dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:gravity="center"
|
||||
android:scaleType="center"
|
||||
android:textColor="@color/white"
|
||||
android:tintMode="multiply"
|
||||
app:tint="@color/text_dimmed"
|
||||
android:src="@drawable/checkmark_small"
|
||||
android:layout_marginBottom="6dp"/>
|
||||
<ImageView
|
||||
android:id="@+id/pin_indicator"
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="13dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:gravity="center"
|
||||
android:scaleType="center"
|
||||
android:textColor="@color/white" />
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:id="@+id/item_detail_indicator"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ class FullProfileActivity : BaseActivity() {
|
|||
this@FullProfileActivity,
|
||||
it,
|
||||
"Check out my avatar on Habitica!",
|
||||
"avatar_bottomsheet"
|
||||
"avatar_profile"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ open class AvatarOverviewFragment :
|
|||
requireActivity() as BaseActivity,
|
||||
it,
|
||||
"Check out my avatar on Habitica!",
|
||||
"avatar_bottomsheet"
|
||||
"avatar_customization"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -307,7 +307,11 @@ open class ShopFragment : BaseMainFragment<FragmentRefreshRecyclerviewBinding>()
|
|||
val specialCategory = ShopCategory()
|
||||
specialCategory.text = getString(R.string.special)
|
||||
val item = ShopItem.makeGemItem(context?.resources)
|
||||
item.limitedNumberLeft = user?.purchased?.plan?.numberOfGemsLeft
|
||||
if (user?.isSubscribed == true) {
|
||||
item.limitedNumberLeft = user.purchased?.plan?.numberOfGemsLeft
|
||||
} else {
|
||||
item.limitedNumberLeft = -1
|
||||
}
|
||||
specialCategory.items.add(item)
|
||||
specialCategory.items.add(ShopItem.makeFortifyItem(context?.resources))
|
||||
shop1.categories.add(specialCategory)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ import android.content.Context
|
|||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.databinding.RowShopitemBinding
|
||||
import com.habitrpg.android.habitica.models.shops.ShopItem
|
||||
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper
|
||||
|
|
@ -26,7 +28,13 @@ class ShopItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), Vi
|
|||
var isPinned = false
|
||||
set(value) {
|
||||
field = value
|
||||
binding.pinIndicator.visibility = if (isPinned) View.VISIBLE else View.GONE
|
||||
binding.pinIndicator.visibility = if (field) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
var isCompleted = false
|
||||
set(value) {
|
||||
field = value
|
||||
binding.completedIndicator.visibility = if (field) View.VISIBLE else View.GONE
|
||||
}
|
||||
|
||||
init {
|
||||
|
|
@ -78,6 +86,10 @@ class ShopItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), Vi
|
|||
binding.itemDetailIndicator.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
if (item.key == "gem" && item.limitedNumberLeft == -1) {
|
||||
binding.itemDetailIndicator.background = AppCompatResources.getDrawable(context, R.drawable.item_indicator_subscribe)
|
||||
}
|
||||
|
||||
if (binding.itemDetailIndicator.visibility == View.VISIBLE) {
|
||||
val layoutParams = binding.itemDetailIndicator.layoutParams
|
||||
layoutParams.width = if (binding.itemDetailIndicator.text.isBlank()) {
|
||||
|
|
|
|||