Revision bd9776f6
Added by Leszek Koltunski almost 3 years ago
| src/main/java/org/distorted/objects/RubikObject.java | ||
|---|---|---|
| 20 | 20 |
import android.widget.ImageButton; |
| 21 | 21 |
import android.widget.ImageView; |
| 22 | 22 |
|
| 23 |
import androidx.appcompat.content.res.AppCompatResources; |
|
| 24 |
|
|
| 23 | 25 |
import org.distorted.dmesh.ObjectMesh; |
| 24 | 26 |
import org.distorted.external.RubikFiles; |
| 25 | 27 |
import org.distorted.jsons.ObjectJson; |
| ... | ... | |
| 41 | 43 |
private final String mLowerName, mUpperName; |
| 42 | 44 |
private final int mIconID; |
| 43 | 45 |
private final String[][] mPatterns; |
| 46 |
private final int mPrice; |
|
| 44 | 47 |
|
| 45 | 48 |
private boolean mIsFree; |
| 46 |
private int mPrice; |
|
| 47 | 49 |
private int mJsonID, mMeshID, mExtrasID; |
| 48 | 50 |
private int mObjectMinor, mExtrasMinor; |
| 49 | 51 |
private int mNumScramble; |
| ... | ... | |
| 140 | 142 |
{
|
| 141 | 143 |
if( mIconID>0 ) |
| 142 | 144 |
{
|
| 143 |
mStaticIconD = act.getDrawable(mIconID);
|
|
| 145 |
mStaticIconD = AppCompatResources.getDrawable(act,mIconID);
|
|
| 144 | 146 |
} |
| 145 | 147 |
else |
| 146 | 148 |
{
|
| 147 | 149 |
RubikFiles files = RubikFiles.getInstance(); |
| 148 | 150 |
Bitmap bmp = files.getIcon(act,mLowerName+".png"); |
| 149 |
if( bmp==null ) mStaticIconD = act.getDrawable(R.drawable.unknown_icon);
|
|
| 151 |
if( bmp==null ) mStaticIconD = AppCompatResources.getDrawable(act,R.drawable.unknown_icon);
|
|
| 150 | 152 |
else mStaticIconD = new BitmapDrawable(act.getResources(), bmp); |
| 151 | 153 |
} |
| 152 | 154 |
} |
| ... | ... | |
| 157 | 159 |
{
|
| 158 | 160 |
if( mIconID>0 ) |
| 159 | 161 |
{
|
| 160 |
mRescaledIconD = act.getDrawable(mIconID);
|
|
| 162 |
mRescaledIconD = AppCompatResources.getDrawable(act,mIconID);
|
|
| 161 | 163 |
} |
| 162 | 164 |
else |
| 163 | 165 |
{
|
| 164 | 166 |
RubikFiles files = RubikFiles.getInstance(); |
| 165 | 167 |
Bitmap bmp = files.getIcon(act,mLowerName+".png"); |
| 166 |
if( bmp==null ) mRescaledIconD = act.getDrawable(R.drawable.unknown_icon);
|
|
| 168 |
if( bmp==null ) mRescaledIconD = AppCompatResources.getDrawable(act,R.drawable.unknown_icon);
|
|
| 167 | 169 |
else mRescaledIconD = new BitmapDrawable(act.getResources(), bmp); |
| 168 | 170 |
} |
| 169 | 171 |
} |
| src/main/java/org/distorted/objects/RubikObjectList.java | ||
|---|---|---|
| 476 | 476 |
|
| 477 | 477 |
if( object!=null && !object.isFree() && scores.isSolved(obj,LEVELS_SHOWN) ) |
| 478 | 478 |
{
|
| 479 |
if( SHOW_IAP_DEBUG ) android.util.Log.e("D", "object "+object.getUpperName()+" marked as free");
|
|
| 479 |
String shortName = object.getUpperName(); |
|
| 480 |
if( SHOW_IAP_DEBUG ) android.util.Log.e("D", "object "+shortName+" marked as free");
|
|
| 480 | 481 |
object.markFree(); |
| 482 |
String add = mBoughtObjects.length()==0 ? shortName : (","+shortName);
|
|
| 483 |
mBoughtObjects += add; |
|
| 481 | 484 |
int price = object.getPrice(); |
| 482 | 485 |
scores.changeNumStars(-price); |
| 483 | 486 |
ret++; |
| ... | ... | |
| 499 | 502 |
|
| 500 | 503 |
if( object!=null && !object.isFree() ) |
| 501 | 504 |
{
|
| 502 |
if( SHOW_IAP_DEBUG ) android.util.Log.e("D", "object "+object.getUpperName()+" marked as free");
|
|
| 505 |
String shortName = object.getUpperName(); |
|
| 506 |
if( SHOW_IAP_DEBUG ) android.util.Log.e("D", "object "+shortName+" marked as free");
|
|
| 503 | 507 |
object.markFree(); |
| 508 |
String add = mBoughtObjects.length()==0 ? shortName : (","+shortName);
|
|
| 509 |
mBoughtObjects += add; |
|
| 504 | 510 |
int price = object.getPrice(); |
| 505 | 511 |
scores.changeNumStars(-price); |
| 506 | 512 |
numToBeMarked--; |
Also available in: Unified diff
Fix marking objects as free.