Revision 4ac0ea40
Added by Leszek Koltunski almost 3 years ago
| src/main/java/org/distorted/purchase/PurchaseActivity.java | ||
|---|---|---|
| 222 | 222 |
|
| 223 | 223 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 224 | 224 |
// PUBLIC API |
| 225 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 226 |
|
|
| 227 |
public void changeObject(int ordinal) |
|
| 228 |
{
|
|
| 229 |
mObjectOrdinal = ordinal; |
|
| 230 |
RubikObject object = RubikObjectList.getObject(ordinal); |
|
| 231 |
PurchaseSurfaceView view = findViewById(R.id.purchaseSurfaceView); |
|
| 232 |
ObjectControl control = view.getObjectControl(); |
|
| 233 |
changeIfDifferent(object,ordinal,control); |
|
| 234 |
} |
|
| 235 |
|
|
| 236 | 225 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 237 | 226 |
|
| 238 | 227 |
public int getScreenWidthInPixels() |
| ... | ... | |
| 292 | 281 |
|
| 293 | 282 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 294 | 283 |
|
| 295 |
public boolean isVertical() |
|
| 284 |
int getObjectPrice() |
|
| 285 |
{
|
|
| 286 |
if( mObjectOrdinal>=0 && mObjectOrdinal< RubikObjectList.getNumObjects() ) |
|
| 287 |
{
|
|
| 288 |
RubikObject object = RubikObjectList.getObject(mObjectOrdinal); |
|
| 289 |
return object==null ? 0 : object.getPrice(); |
|
| 290 |
} |
|
| 291 |
|
|
| 292 |
return 0; |
|
| 293 |
} |
|
| 294 |
|
|
| 295 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 296 |
|
|
| 297 |
boolean isVertical() |
|
| 296 | 298 |
{
|
| 297 | 299 |
PurchaseSurfaceView view = findViewById(R.id.purchaseSurfaceView); |
| 298 | 300 |
return view.isVertical(); |
| src/main/java/org/distorted/purchase/PurchaseScreenPane.java | ||
|---|---|---|
| 11 | 11 |
|
| 12 | 12 |
import android.util.TypedValue; |
| 13 | 13 |
import android.view.View; |
| 14 |
import android.widget.Button; |
|
| 14 |
import android.widget.ImageButton;
|
|
| 15 | 15 |
import android.widget.ImageView; |
| 16 | 16 |
import android.widget.LinearLayout; |
| 17 | 17 |
import android.widget.TextView; |
| ... | ... | |
| 27 | 27 |
|
| 28 | 28 |
public class PurchaseScreenPane |
| 29 | 29 |
{
|
| 30 |
private static final int UNLOCK_ALL_PRICE = 1000;
|
|
| 30 |
private static final int UNLOCK_ALL_PRICE = 500;
|
|
| 31 | 31 |
|
| 32 | 32 |
private static final int[] IMAGES = |
| 33 | 33 |
{
|
| ... | ... | |
| 86 | 86 |
|
| 87 | 87 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 88 | 88 |
|
| 89 |
private void setUpButtons(LinearLayout one, LinearLayout all) |
|
| 89 |
private void setUpButtons(int price, LinearLayout one, LinearLayout all)
|
|
| 90 | 90 |
{
|
| 91 |
Button butO = one.findViewById(R.id.purchaseButtonOne); |
|
| 92 |
Button butA = all.findViewById(R.id.purchaseButtonAll); |
|
| 91 |
ImageButton butO = one.findViewById(R.id.purchaseButtonOne);
|
|
| 92 |
ImageButton butA = all.findViewById(R.id.purchaseButtonAll);
|
|
| 93 | 93 |
|
| 94 | 94 |
butO.setOnClickListener( new View.OnClickListener() |
| 95 | 95 |
{
|
| ... | ... | |
| 201 | 201 |
text = allLayout.findViewById(R.id.purchaseTextAll); |
| 202 | 202 |
text.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); |
| 203 | 203 |
|
| 204 |
setUpButtons(oneLayout,allLayout); |
|
| 204 |
int price = act.getObjectPrice(); |
|
| 205 |
setUpButtons(price,oneLayout,allLayout); |
|
| 205 | 206 |
} |
| 206 | 207 |
} |
| src/main/res/layout/purchase.xml | ||
|---|---|---|
| 76 | 76 |
android:maxLines="1" |
| 77 | 77 |
android:text="@string/buy_one"/> |
| 78 | 78 |
|
| 79 |
<Button |
|
| 79 |
<ImageButton
|
|
| 80 | 80 |
android:id="@+id/purchaseButtonOne" |
| 81 | 81 |
android:layout_width="0dp" |
| 82 | 82 |
android:layout_height="match_parent" |
| 83 | 83 |
android:layout_weight="1.0" |
| 84 | 84 |
android:gravity="center_vertical|end" |
| 85 | 85 |
android:backgroundTint="@color/dark_white" |
| 86 |
android:paddingStart="5dp" |
|
| 87 |
android:textSize="26sp" |
|
| 88 |
android:singleLine="true" |
|
| 89 |
android:maxLines="1"/> |
|
| 86 |
android:scaleType="fitCenter" |
|
| 87 |
android:src="@drawable/price_50"/> |
|
| 90 | 88 |
|
| 91 | 89 |
</LinearLayout> |
| 92 | 90 |
|
| ... | ... | |
| 111 | 109 |
android:maxLines="1" |
| 112 | 110 |
android:text="@string/buy_all"/> |
| 113 | 111 |
|
| 114 |
<Button |
|
| 112 |
<ImageButton
|
|
| 115 | 113 |
android:id="@+id/purchaseButtonAll" |
| 116 | 114 |
android:layout_width="0dp" |
| 117 | 115 |
android:layout_height="match_parent" |
| 118 | 116 |
android:layout_weight="1.0" |
| 119 | 117 |
android:gravity="center_vertical|end" |
| 120 | 118 |
android:backgroundTint="@color/dark_white" |
| 121 |
android:paddingStart="5dp" |
|
| 122 |
android:textSize="26sp" |
|
| 123 |
android:singleLine="true" |
|
| 124 |
android:maxLines="1"/> |
|
| 119 |
android:scaleType="fitCenter" |
|
| 120 |
android:src="@drawable/price_500"/> |
|
| 125 | 121 |
</LinearLayout> |
| 126 | 122 |
|
| 127 | 123 |
<LinearLayout |
| src/main/res/values-ja/strings.xml | ||
|---|---|---|
| 56 | 56 |
<string name="install">インストール</string> |
| 57 | 57 |
<string name="abandon_solve">あきらめる</string> |
| 58 | 58 |
|
| 59 |
<string name="buy_one">このキューブをアンロックする</string>
|
|
| 60 |
<string name="buy_all">すべてのロックを解除する</string>
|
|
| 59 |
<string name="buy_one">キューブをアンロックして</string>
|
|
| 60 |
<string name="buy_all">全部のロックを解除して</string>
|
|
| 61 | 61 |
|
| 62 | 62 |
<string name="config_details">詳細</string> |
| 63 | 63 |
<string name="config_name">名前</string> |
Also available in: Unified diff
Purchase Pane: buttons