resolve merge conflict in strings

This commit is contained in:
Leland Wu 2020-05-15 16:59:47 -04:00
parent 3194c16477
commit 0ab69c33ef
11 changed files with 76 additions and 17 deletions

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/animalitem_all_eggs" />
<corners android:bottomLeftRadius="6dp" android:bottomRightRadius="6dp"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>

View file

@ -10,9 +10,9 @@
android:layout_marginTop="6dp"
android:layout_marginBottom="6dp"
android:layout_width="80dp"
android:layout_height="112dp"
android:layout_height="108dp"
android:orientation="vertical"
android:background="@drawable/layout_rounded_bg_gray_700"
android:background="@drawable/layout_rounded_bg_shopitem"
android:layout_centerInParent="true">
style="@style/CardContent">
<com.facebook.drawee.view.SimpleDraweeView
@ -24,6 +24,7 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3.5dp"
android:layout_gravity="center_horizontal"
android:id="@+id/titleTextView"
android:textSize="13sp"
@ -31,9 +32,12 @@
style="@style/RowTitle"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:id="@+id/ownedTextView"
android:gravity="center"
android:textSize="12sp"
android:background="@drawable/layout_rounded_bg_shopitem_price"
style="@style/RowText"/>
</LinearLayout>
</RelativeLayout>

View file

@ -148,6 +148,7 @@
<color name="black">#000</color>
<color name="setup_background">#efeff4</color>
<color name="setup_label_background">#fafaff</color>
<color name="animalitem_all_eggs">#6ECDB2</color>
<color name="dark_brown">#794b00</color>
</resources>

View file

@ -53,7 +53,7 @@
<dimen name="pet_width">84dp</dimen>
<dimen name="bottom_menu_padding">28dp</dimen>
<dimen name="pet_image_width">68dp</dimen>
<dimen name="pet_image_height">68dp</dimen>
<dimen name="pet_image_height">65dp</dimen>
<dimen name="shop_height">124dp</dimen>
<dimen name="bar_icon_padding">10dp</dimen>
<dimen name="task_text_padding">16dp</dimen>

View file

@ -1015,4 +1015,5 @@
<string name="purchase_amount_error">You are unable to buy that amount.</string>
<string name="still_questions">Still have a question?</string>
<string name="delete_checklist_entry">Delete Checklist entry</string>
<string name="pet_ownership_fraction">%1$s/%2$s</string>
</resources>

View file

@ -6,6 +6,6 @@
</trust-anchors>
</debug-overrides>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">192.168.178.52</domain>
<domain includeSubdomains="true">10.0.0.107</domain>
</domain-config>
</network-security-config>

View file

@ -29,4 +29,8 @@ public interface Animal {
Integer getNumberOwned();
void setNumberOwned(Integer numberOwned);
Integer getTotalNumber();
void setTotalNumber(Integer totalNumber);
}

View file

@ -12,7 +12,10 @@ public class Mount extends RealmObject implements Animal {
boolean premium;
@Ignore
Integer numberOwned;
private Integer numberOwned;
@Ignore
private Integer totalNumber;
public String getKey() {
return key;
@ -82,4 +85,15 @@ public class Mount extends RealmObject implements Animal {
public void setNumberOwned(Integer numberOwned) {
this.numberOwned = numberOwned;
}
public Integer getTotalNumber() {
if (totalNumber == null) {
return 0;
}
return totalNumber;
}
public void setTotalNumber(Integer totalNumber) {
this.totalNumber = totalNumber;
}
}

View file

@ -14,6 +14,9 @@ public class Pet extends RealmObject implements Animal{
@Ignore
private Integer numberOwned;
@Ignore
private Integer totalNumber;
public String getKey() {
return key;
}
@ -83,4 +86,16 @@ public class Pet extends RealmObject implements Animal{
public void setNumberOwned(Integer numberOwned) {
this.numberOwned = numberOwned;
}
public Integer getTotalNumber() {
if (totalNumber == null) {
return 0;
}
return totalNumber;
}
public void setTotalNumber(Integer totalNumber) {
this.totalNumber = totalNumber;
}
}

View file

@ -1,14 +1,12 @@
package com.habitrpg.android.habitica.ui.adapter.inventory
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.BitmapDrawable
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.coordinatorlayout.widget.CoordinatorLayout
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.GridLayoutManager
import com.facebook.drawee.view.SimpleDraweeView
import com.habitrpg.android.habitica.R
@ -118,16 +116,22 @@ class StableRecyclerAdapter : androidx.recyclerview.widget.RecyclerView.Adapter<
}
ownedTextView.visibility = View.VISIBLE
this.imageView.alpha = 1.0f
this.titleView.alpha = 1.0f
this.ownedTextView.alpha = 1.0f
val imageName = if (itemType == "pets") {
"Pet-" + item.key
"Pet_Egg_" + item.animal
} else {
"Mount_Icon_" + item.key
}
this.ownedTextView.text = animal?.numberOwned?.toString()
ownedTextView.visibility = if (animal?.numberOwned == 0 || animal?.type == "special") View.GONE else View.VISIBLE
var owned = animal?.numberOwned?.toString()
var totalNum = animal?.totalNumber?.toString()
this.ownedTextView.text = context?.getString(R.string.pet_ownership_fraction, owned, totalNum)
ownedTextView.visibility = if (animal?.type == "special") View.GONE else View.VISIBLE
imageView.background = null
DataBindingUtils.loadImage(imageName) {
val drawable = BitmapDrawable(context?.resources, if (item.numberOwned > 0) it else it.extractAlpha())
val drawable = BitmapDrawable(context?.resources, it)
Observable.just(drawable)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer {
@ -135,7 +139,15 @@ class StableRecyclerAdapter : androidx.recyclerview.widget.RecyclerView.Adapter<
}, RxErrorHandler.handleEmptyError())
}
if (item.numberOwned <= 0) {
this.imageView.alpha = 0.1f
this.imageView.alpha = 0.2f
this.titleView.alpha = 0.2f
this.ownedTextView.alpha = 0.2f
}
if (item.numberOwned == item.totalNumber) {
this.ownedTextView.setTextColor(Color.parseColor("#FFFFFF"))
var new_background = context?.getDrawable(R.drawable.layout_rounded_bg_animalitem_complete)?.mutate()
this.ownedTextView.background = new_background
}
}

View file

@ -144,7 +144,6 @@ class StableRecyclerFragment : BaseFragment() {
val items = ArrayList<Any>()
var lastAnimal: Animal = unsortedAnimals[0] ?: return items
var lastSectionTitle = ""
for (animal in unsortedAnimals) {
val identifier = if (animal.animal.isNotEmpty() && animal.type != "special") animal.animal else animal.key
val lastIdentifier = if (lastAnimal.animal.isNotEmpty()) lastAnimal.animal else lastAnimal.key
@ -154,6 +153,9 @@ class StableRecyclerFragment : BaseFragment() {
}
lastAnimal = animal
}
lastAnimal.totalNumber += 1
if (animal.type != lastSectionTitle) {
if (items.size > 0 && items[items.size - 1].javaClass == String::class.java) {
items.removeAt(items.size - 1)
@ -175,6 +177,7 @@ class StableRecyclerFragment : BaseFragment() {
}
}
}
}
if (!((lastAnimal.type == "premium" || lastAnimal.type == "special") && lastAnimal.numberOwned == 0)) {
items.add(lastAnimal)
@ -187,6 +190,5 @@ class StableRecyclerFragment : BaseFragment() {
companion object {
private const val ITEM_TYPE_KEY = "CLASS_TYPE_KEY"
private const val HEADER_VIEW_TYPE = 0
private const val SECTION_VIEW_TYPE = 1
}
}