Skip to content

Commit 8c9d690

Browse files
authored
Merge pull request #40 from sentry-demos/main_activity_swap
Feat: Launch empowerplant as first Activity
2 parents 52fe8d9 + 86cb4c3 commit 8c9d690

File tree

9 files changed

+62
-40
lines changed

9 files changed

+62
-40
lines changed

app-debug.apk

459 Bytes
Binary file not shown.

app-release.apk

848 Bytes
Binary file not shown.

app/build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ android {
3232
applicationId "com.example.vu.android"
3333
minSdkVersion 21
3434
targetSdkVersion 29
35-
versionCode 20
36-
versionName "2.0.0"
35+
versionCode 21
36+
versionName "2.1.0"
3737

3838
externalNativeBuild {
3939
cmake {
@@ -89,6 +89,11 @@ dependencies {
8989
def fragment_version = "1.3.2"
9090
// Java language implementation
9191
implementation "androidx.fragment:fragment:$fragment_version"
92+
93+
// Warning: upgrading the room version beyond 2.0.0 may
94+
// cause errors running automated Saucelabs tests that generate data.
95+
// If you upgrade the room version, ensure you run associated automated
96+
// tests locally and that they pass.
9297
def room_version = "2.0.0"
9398

9499
implementation "androidx.room:room-runtime:$room_version"

app/src/main/AndroidManifest.xml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,23 @@
1818
android:supportsRtl="true"
1919
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
2020

21-
<activity android:name=".MainActivity" android:exported="true">
21+
<activity android:name=".MainActivity" android:parentActivityName=".empowerplant.EmpowerPlantActivity"
22+
android:label="List App">
23+
<meta-data
24+
android:name="android.support.PARENT_ACTIVITY"
25+
android:value=".empowerplant.EmpowerPlantActivity" />
26+
</activity>
27+
<activity
28+
android:exported="true"
29+
android:name=".empowerplant.EmpowerPlantActivity"
30+
android:label="@string/title_activity_empowerplant"
31+
>
2232
<intent-filter>
2333
<action android:name="android.intent.action.MAIN" />
2434

2535
<category android:name="android.intent.category.LAUNCHER" />
2636
</intent-filter>
27-
</activity>
28-
<activity
29-
android:name=".empowerplant.EmpowerPlantActivity"
30-
android:label="@string/title_activity_empowerplant"
31-
android:parentActivityName=".MainActivity">
32-
<meta-data
33-
android:name="android.support.PARENT_ACTIVITY"
34-
android:value=".MainActivity" />
37+
3538
</activity>
3639

3740
<meta-data

app/src/main/java/com/example/vu/android/MainActivity.java

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
package com.example.vu.android;
22

3-
import android.content.Intent;
43
import android.os.Bundle;
54
import android.view.Menu;
6-
import android.view.MenuItem;
75
import android.widget.Button;
86

9-
import com.example.vu.android.empowerplant.EmpowerPlantActivity;
10-
117
import io.sentry.Breadcrumb;
12-
import io.sentry.ISpan;
138
import io.sentry.Sentry;
149
import io.sentry.SentryLevel;
15-
import io.sentry.protocol.User;
1610

1711
public class MainActivity extends MyBaseActivity {
1812

@@ -108,17 +102,17 @@ public boolean onCreateOptionsMenu(Menu menu) {
108102
return true;
109103
}
110104

111-
@Override
112-
public boolean onOptionsItemSelected(MenuItem item) {
113-
switch(item.getItemId()) {
114-
case R.id.action_open_empowerplant:
115-
Intent intent = new Intent(this, EmpowerPlantActivity.class);
116-
startActivity(intent);
117-
return true;
118-
119-
}
120-
return super.onOptionsItemSelected(item);
121-
}
105+
// @Override
106+
// public boolean onOptionsItemSelected(MenuItem item) {
107+
// switch(item.getItemId()) {
108+
// case R.id.action_open_empowerplant:
109+
// Intent intent = new Intent(this, EmpowerPlantActivity.class);
110+
// startActivity(intent);
111+
// return true;
112+
//
113+
// }
114+
// return super.onOptionsItemSelected(item);
115+
// } // uncommenting will restore navigation from listapp to empowerplant store items
122116

123117

124118
// private String getIPAddress(){

app/src/main/java/com/example/vu/android/empowerplant/EmpowerPlantActivity.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
package com.example.vu.android.empowerplant;
22

33

4+
import android.content.Intent;
45
import android.os.Bundle;
5-
6-
7-
import androidx.fragment.app.FragmentTransaction;
8-
9-
106
import android.view.Menu;
117
import android.view.MenuItem;
128
import android.view.View;
139
import android.widget.TextView;
1410

11+
import androidx.fragment.app.FragmentTransaction;
12+
13+
import com.example.vu.android.MainActivity;
1514
import com.example.vu.android.MyBaseActivity;
1615
import com.example.vu.android.R;
1716

@@ -62,7 +61,10 @@ public boolean onOptionsItemSelected(MenuItem item) {
6261
case R.id.action_cart:
6362
fragment.checkout();
6463
return(true);
65-
64+
case R.id.action_open_listapp:
65+
Intent intent = new Intent(this, MainActivity.class);
66+
startActivity(intent);
67+
return true;
6668
}
6769
return(super.onOptionsItemSelected(item));
6870
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<vector android:height="24dp" android:tint="#FFFCFC"
2+
android:viewportHeight="24" android:viewportWidth="24"
3+
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
4+
<path android:fillColor="@android:color/white" android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
5+
</vector>

app/src/main/res/menu/empowerplant_toplevel.xml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,25 @@
66
<!-- android:icon="@drawable/outline_shopping_cart_white_24dp"-->
77
<!-- android:title="tool store"-->
88
<!-- app:showAsAction="always"/>-->
9-
109
<item
1110
android:id="@+id/action_cart"
1211
android:icon="@drawable/outline_shopping_cart_white_24dp"
1312
android:title="Cart"
1413
app:actionLayout="@layout/custom_action_item_layout"
1514
app:showAsAction="always"/>
15+
<item
16+
android:id="@+id/action_more"
17+
android:icon="@drawable/ic_baseline_more_vert_24"
18+
android:title="More"
19+
app:showAsAction="always">
20+
<menu>
21+
<item
22+
android:id="@+id/action_open_listapp"
23+
android:icon="@drawable/outline_handyman_white_24dp"
24+
android:title="List App"
25+
app:showAsAction="always"/>
26+
</menu>
27+
</item>
28+
1629

1730
</menu>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<menu xmlns:android="http://schemas.android.com/apk/res/android"
22
xmlns:app="http://schemas.android.com/apk/res-auto" >
33

4-
<item
5-
android:id="@+id/action_open_empowerplant"
6-
android:icon="@drawable/outline_handyman_white_24dp"
7-
android:title="shopping cart"
8-
app:showAsAction="always"/>
4+
<!-- <item-->
5+
<!-- android:id="@+id/action_open_empowerplant"-->
6+
<!-- android:icon="@drawable/outline_handyman_white_24dp"-->
7+
<!-- android:title="shopping cart"-->
8+
<!-- app:showAsAction="always"/>-->
99

1010
</menu>

0 commit comments

Comments
 (0)