Skip to content

Commit 4608fe3

Browse files
author
Mohamed Sobhy
committed
Use Instabug v2.0-SNAPSHOT
Remove all un-necessary stuff from AndroidManifest and activities.
1 parent 294d13e commit 4608fe3

18 files changed

+45
-697
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ It's as easy as "Get ready, Get set, Go".
1414

1515
Grab it via Gradle:
1616
```groovy
17-
compile 'com.instabug.library:instabugsupport:1.7.1'
17+
compile 'com.instabug.library:instabugcompat:2.0-SNAPSHOT'
1818
```
1919
or via Maven: (if you're that kind of person :bowtie:)
2020
```xml
2121
<dependency>
2222
<groupId>com.instabug.library</groupId>
23-
<artifactId>instabugsupport</artifactId>
24-
<version>1.7.1</version>
23+
<artifactId>instabugcompat</artifactId>
24+
<version>2.0-SNAPSHOT</version>
2525
</dependency>
2626
```
2727
@@ -33,9 +33,8 @@ It's as easy as "Get ready, Get set, Go".
3333
public void onCreate() {
3434
super.onCreate();
3535
// ...
36-
Instabug
37-
.initialize(this, "<yourAppToken>")
38-
.setInvocationEvent(Instabug.IBGInvocationEvent.IBGInvocationEventShake);
36+
new Instabug.Builder(this, "<yourAppToken>")
37+
.build();
3938
// ...
4039
}
4140
```

app/build.gradle

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ android {
66

77
defaultConfig {
88
applicationId "com.example.instabug"
9-
minSdkVersion 10
9+
minSdkVersion 15
1010
targetSdkVersion 23
1111
versionCode 1
1212
versionName "1.0"
@@ -21,17 +21,21 @@ android {
2121

2222
repositories {
2323
maven {
24-
// NOTE add this only if interested in getting SNAPSHOT releases
24+
// TODO add this only if interested in getting SNAPSHOT releases
2525
url "https://oss.sonatype.org/content/repositories/snapshots"
2626
}
2727
}
2828

2929
dependencies {
3030
compile fileTree(dir: 'libs', include: ['*.jar'])
3131
testCompile 'junit:junit:4.12'
32+
compile 'com.jakewharton:butterknife:7.0.1'
33+
compile 'com.android.support:design:23.1.1'
3234
compile 'com.android.support:appcompat-v7:23.1.1'
33-
compile 'com.instabug.library:instabugsupport:1.7.1'
3435
compile 'com.google.android.gms:play-services:8.3.0'
35-
compile 'com.android.support:design:23.1.1'
36-
compile 'com.jakewharton:butterknife:7.0.1'
36+
compile('com.instabug.library:instabugcompat:2.0-SNAPSHOT') {
37+
exclude module: 'appcompat-v7'
38+
// if you're facing compilation issue in build.gradle about gms different versions
39+
exclude group: 'com.google.android.gms'
40+
}
3741
}

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
package="com.example.instabug"
44
xmlns:android="http://schemas.android.com/apk/res/android">
55

6-
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
7-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
8-
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
9-
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
10-
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
11-
<uses-permission android:name="android.permission.INTERNET"/>
12-
136
<uses-feature
147
android:glEsVersion="0x00020000"
158
android:required="true"/>
@@ -32,12 +25,6 @@
3225
</intent-filter>
3326
</activity>
3427

35-
<activity
36-
android:name=".ui.activities.SettingsActivity"
37-
android:label="@string/title_activity_settings"
38-
android:screenOrientation="portrait"
39-
android:windowSoftInputMode="stateHidden"/>
40-
4128
<activity android:name=".ui.activities.GoogleMapsActivity"/>
4229

4330
<meta-data
@@ -48,11 +35,5 @@
4835
android:value="AIzaSyAnraFz6auzHcIwsedNn--l1-XBk3Oh-gQ"/>
4936

5037
<activity android:name=".ui.activities.OpenGLActivity"/>
51-
<activity
52-
android:name=".ui.activities.PagerActivity"
53-
android:label="@string/title_activity_pager"/>
54-
<activity
55-
android:name=".ui.activities.TabHostActivity"
56-
android:label="@string/title_activity_tab_host"/>
5738
</application>
5839
</manifest>

app/src/main/java/com/example/instabug/SampleApplication.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import android.app.Application;
44

5+
import com.instabug.library.IBGColorTheme;
6+
import com.instabug.library.IBGInvocationEvent;
57
import com.instabug.library.Instabug;
68

79
/**
@@ -11,9 +13,12 @@ public class SampleApplication extends Application {
1113
@Override
1214
public void onCreate() {
1315
super.onCreate();
14-
Instabug
15-
.initialize(this, "f501f761142981d54b1fdea93963a934")
16-
.setInvocationEvent(Instabug.IBGInvocationEvent.IBGInvocationEventShake)
17-
.setEmailIsRequired(false);
16+
new Instabug.Builder(this, "f501f761142981d54b1fdea93963a934")
17+
.setDebugEnabled(true)
18+
.setEmailFieldRequired(false)
19+
.setColorTheme(IBGColorTheme.IBGColorThemeLight)
20+
.setInvocationEvent(IBGInvocationEvent.IBGInvocationEventFloatingButton)
21+
.setFloatingButtonOffsetFromTop(400)
22+
.build();
1823
}
1924
}

app/src/main/java/com/example/instabug/ui/activities/GoogleMapsActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ private void setUpMapIfNeeded() {
4949
// Try to obtain the map from the SupportMapFragment.
5050
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
5151
.getMap();
52-
Instabug.getInstance().addMapView(getSupportFragmentManager().findFragmentById(R.id.map).getView(), mMap);
52+
// TODO add this so that instabug recognizes you have a map and show it in the screenshot
53+
Instabug.addMapView(getSupportFragmentManager().findFragmentById(R.id.map).getView(), mMap);
5354

5455
// Check if we were successful in obtaining the map.
5556
if (mMap != null) {

app/src/main/java/com/example/instabug/ui/activities/MainActivity.java

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.example.instabug.ui.activities;
22

3+
import android.app.AlertDialog;
4+
import android.content.DialogInterface;
35
import android.content.Intent;
46
import android.net.Uri;
57
import android.os.Bundle;
@@ -16,7 +18,7 @@
1618

1719
import com.example.instabug.R;
1820
import com.instabug.library.Instabug;
19-
import com.instabug.wrapper.support.activity.InstabugActionBarActivity;
21+
import com.instabug.library.compat.InstabugActionBarActivity;
2022

2123
import butterknife.Bind;
2224
import butterknife.ButterKnife;
@@ -27,10 +29,8 @@ public class MainActivity extends InstabugActionBarActivity
2729

2830
@Bind(R.id.drawer_layout)
2931
DrawerLayout drawer;
30-
3132
@Bind(R.id.nav_view)
3233
NavigationView navigationView;
33-
3434
ImageView headerImage;
3535

3636
@Override
@@ -63,7 +63,7 @@ public void onClick(View v) {
6363

6464
@OnClick(R.id.feedback_fab)
6565
public void onFeedbackFABClicked() {
66-
Instabug.getInstance().invoke();
66+
Instabug.invoke();
6767
}
6868

6969
public void onHeaderImageClicked() {
@@ -82,40 +82,37 @@ public void onBackPressed() {
8282

8383
@Override
8484
public boolean onCreateOptionsMenu(Menu menu) {
85-
getMenuInflater().inflate(R.menu.main_activity, menu);
8685
return true;
8786
}
8887

8988
@Override
9089
public boolean onOptionsItemSelected(MenuItem item) {
91-
int id = item.getItemId();
92-
93-
if (id == R.id.action_settings) {
94-
Intent settingsIntent = new Intent(this, SettingsActivity.class);
95-
startActivity(settingsIntent);
96-
return true;
97-
}
98-
9990
return super.onOptionsItemSelected(item);
10091
}
10192

102-
@SuppressWarnings("StatementWithEmptyBody")
10393
@Override
10494
public boolean onNavigationItemSelected(MenuItem item) {
10595
int id = item.getItemId();
106-
10796
if (id == R.id.nav_home) {
108-
// Home
97+
AlertDialog alertDialog = new AlertDialog.Builder(this)
98+
.setMessage("Do you want to get a NullPointerException, because that's how " +
99+
"you get a NullPointerException :D")
100+
.setPositiveButton("Why not?", new DialogInterface.OnClickListener() {
101+
@Override
102+
public void onClick(DialogInterface dialog, int which) {
103+
throw new NullPointerException("Test issue in Instabug Sample app");
104+
}
105+
}).show();
106+
Instabug.setDialog(alertDialog);
109107
} else if (id == R.id.nav_maps) {
110-
startActivity(new Intent(MainActivity.this, GoogleMapsActivity.class));
108+
startActivity(new Intent(this, GoogleMapsActivity.class));
111109
} else if (id == R.id.nav_openGl) {
112-
startActivity(new Intent(MainActivity.this, OpenGLActivity.class));
113-
} else if (id == R.id.nav_tab_host) {
114-
startActivity(new Intent(MainActivity.this, TabHostActivity.class));
110+
startActivity(new Intent(this, OpenGLActivity.class));
115111
} else if (id == R.id.nav_share) {
116112
startActivity(Intent.createChooser(getShareIntent(), getResources().getString(R.string.share_to_friends)));
117113
} else if (id == R.id.nav_about) {
118-
Toast.makeText(MainActivity.this, "Coming soon", Toast.LENGTH_SHORT).show();
114+
// TODO click about to show dialog to test screenshot with dialogs
115+
Toast.makeText(this, "Coming soon", Toast.LENGTH_SHORT).show();
119116
}
120117

121118
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);

app/src/main/java/com/example/instabug/ui/activities/OpenGLActivity.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ public void onCreate(Bundle savedInstanceState) {
3636
// Create a GLSurfaceView instance and set it
3737
// as the ContentView for this Activity
3838
mGLView = new MyGLSurfaceView(this);
39-
Instabug.getInstance().setGLSurfaceView(mGLView);
39+
// TODO add this so that instabug recognizes you have an OpenGL surface and show it in the screenshot
40+
Instabug.setGLSurfaceView(mGLView);
4041
mainLayout.addView(mGLView, 0);
4142
}
4243

0 commit comments

Comments
 (0)