Skip to content

Commit a28fdc9

Browse files
committed
Added version label to main menu and removed warning when purchase is cancelled
1 parent 8dcc174 commit a28fdc9

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

app/src/main/java/mini/app/orbis/MainMenuActivity.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class MainMenuActivity extends AppCompatActivity implements IabHelper.OnI
3737
@Override
3838
protected void onCreate(Bundle savedInstanceState) {
3939
super.onCreate(savedInstanceState);
40-
setContentView(R.layout.activity_main_menu); //TODO temp
40+
setContentView(R.layout.activity_main_menu);
4141

4242
View logo = findViewById(R.id.logo);
4343
final View logo_text = findViewById(R.id.logo_text);
@@ -50,6 +50,9 @@ protected void onCreate(Bundle savedInstanceState) {
5050

5151
FontManager.applyFontToView(this, (TextView) findViewById(R.id.trial_info_top), FontManager.Font.lato_bold);
5252
FontManager.applyFontToView(this, (TextView) findViewById(R.id.trial_info_bottom), FontManager.Font.lato);
53+
FontManager.applyFontToView(this, (TextView) findViewById(R.id.version_label), FontManager.Font.lato);
54+
55+
((TextView) findViewById(R.id.version_label)).setText("v" + VersionManager.versionName);
5356

5457
if(savedInstanceState != null) {
5558
logo_text.setVisibility(View.GONE);
@@ -64,7 +67,7 @@ protected void onCreate(Bundle savedInstanceState) {
6467

6568
Animation fadeInMenu = new AlphaAnimation(0, 1);
6669
fadeInMenu.setDuration(1000);
67-
fadeInMenu.setStartOffset(4000); // TODO
70+
fadeInMenu.setStartOffset(4000);
6871

6972
Animation fadeOut = new AlphaAnimation(1, 0);
7073
fadeOut.setDuration(1000);
@@ -94,6 +97,8 @@ public void onAnimationRepeat(Animation animation) {}
9497
logo_text.setAnimation(logoTextAnimations);
9598
menu.setAnimation(fadeInMenu);
9699

100+
findViewById(R.id.version_label).setAnimation(fadeInMenu);
101+
97102
findViewById(R.id.trial_info_bar).setVisibility(View.INVISIBLE);
98103

99104
initializeIAB();
@@ -252,18 +257,7 @@ public void onRequestPermissionsResult(int requestCode, String permissions[], in
252257

253258
@Override
254259
public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
255-
if (result.isFailure()) {
256-
AlertDialog dialog = new AlertDialog.Builder(this)
257-
.setTitle("Purchase Cancelled")
258-
.setMessage("It looks like the purchase was cancelled. If this is an error, please try reinstalling the app or contact the Orbis team.")
259-
.setIcon(R.drawable.ic_error)
260-
.setNeutralButton("Dismiss", null).create();
261-
dialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
262-
dialog.show();
263-
dialog.getWindow().getDecorView().setSystemUiVisibility(
264-
this.getWindow().getDecorView().getSystemUiVisibility());
265-
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
266-
} else if (purchase.getSku().equals(GlobalVars.SKU_PREMIUM)) {
260+
if (result.isSuccess() && purchase.getSku().equals(GlobalVars.SKU_PREMIUM)) {
267261
findViewById(R.id.trial_info_bar).setVisibility(View.INVISIBLE);
268262
startActivity(new Intent(this, PurchaseSuccessfulActivity.class));
269263
}

app/src/main/res/layout/activity_main_menu.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,11 @@
138138
</RelativeLayout>
139139

140140
</RelativeLayout>
141+
142+
<TextView
143+
android:layout_width="wrap_content"
144+
android:layout_height="wrap_content"
145+
android:textSize="@dimen/menu_version_label_text_size"
146+
android:layout_margin="@dimen/menu_version_label_margin"
147+
android:id="@+id/version_label"/>
141148
</RelativeLayout>

app/src/main/res/values/dimens.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<dimen name="menu_icon_distance">30dp</dimen>
1818
<dimen name="menu_text_height">120dp</dimen>
1919

20+
<dimen name="menu_version_label_text_size">12dp</dimen>
21+
<dimen name="menu_version_label_margin">10dp</dimen>
22+
2023
<!-- Gallery -->
2124
<dimen name="gallery_item_width">200dp</dimen>
2225
<dimen name="gallery_item_height">180dp</dimen>

0 commit comments

Comments
 (0)