Skip to content

Commit 9a4c2dc

Browse files
author
niklasfessler
committed
Release 3.3.7
1 parent 8be7cd6 commit 9a4c2dc

File tree

13 files changed

+99
-97
lines changed

13 files changed

+99
-97
lines changed

.idea/caches/build_file_checksums.ser

0 Bytes
Binary file not shown.

.idea/jarRepositories.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bugbattle/build.gradle

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,13 @@
11
apply plugin: 'com.android.library'
22
apply from: 'maven-push.gradle'
33

4-
ext {
5-
bintrayRepo = 'BugBattle-Android'
6-
bintrayName = 'BugBattle-Android-SDK'
7-
8-
publishedGroupId = 'io.bugbattle'
9-
libraryName = 'Bugbattle-Android-SDK'
10-
artifact = 'Bugbattle-Android-SDK'
11-
12-
libraryDescription = 'BugBattle SDK for Android'
13-
14-
siteUrl = 'https://github.com/BugBattle/Android-SDK'
15-
gitUrl = 'https://github.com/BugBattle/Android-SDK.git'
16-
17-
libraryVersion = '3.3.6'
18-
19-
developerId = 'BugBattle GmbH'
20-
developerName = 'BugBattle'
21-
developerEmail = 'hello@bugbattle.io'
22-
23-
licenseName = 'MIT'
24-
licenseUrl = 'https://github.com/BugBattle/Android-SDK/blob/master/LICENSE.md'
25-
allLicenses = ["MIT"]
26-
}
27-
284
buildscript {
295
repositories {
306
google()
317
jcenter()
32-
mavenCentral() // NEW
8+
339
}
3410
dependencies {
35-
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
3611

3712
}
3813
}
@@ -50,7 +25,7 @@ android {
5025
versionCode 1
5126
versionName "1.0"
5227

53-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
28+
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
5429

5530
}
5631

@@ -70,15 +45,14 @@ android {
7045

7146
dependencies {
7247
implementation fileTree(dir: 'libs', include: ['*.jar'])
73-
implementation 'com.android.support:appcompat-v7:28.0.0'
48+
implementation 'androidx.appcompat:appcompat:1.2.0'
7449
implementation "androidx.annotation:annotation:1.2.0"
75-
implementation 'com.android.support:support-annotations:28.0.0'
76-
implementation 'com.android.support.constraint:constraint-layout:2.0.4'
77-
implementation 'com.android.support:design:28.0.0'
50+
implementation 'androidx.annotation:annotation:1.2.0'
51+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
52+
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
53+
implementation 'com.google.android.material:material:1.3.0'
7854
testImplementation 'junit:junit:4.12'
79-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
80-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
55+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
56+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
8157
}
8258

83-
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
84-
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'

bugbattle/src/main/java/bugbattle/io/bugbattle/model/PhoneMeta.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
import android.net.ConnectivityManager;
99
import android.net.NetworkInfo;
1010
import android.os.Build;
11-
import android.support.annotation.NonNull;
12-
import android.support.v4.content.ContextCompat;
11+
12+
import androidx.annotation.NonNull;
13+
import androidx.core.content.ContextCompat;
1314

1415
import org.json.JSONException;
1516
import org.json.JSONObject;

bugbattle/src/main/java/bugbattle/io/bugbattle/model/Replay.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ public void addInteractionToCurrentReplay(Interaction interaction) {
3232
if (ringBufferCounter == 0) {
3333
currentIndex = ringBufferCounter + 1;
3434
}
35-
screenshots[currentIndex - 1].addInteraction(interaction);
35+
if (screenshots[currentIndex - 1] != null) {
36+
screenshots[currentIndex - 1].addInteraction(interaction);
37+
}
3638
}
3739

3840
public void reset() {

bugbattle/src/main/java/bugbattle/io/bugbattle/service/FormDataHttpsHelper.java

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package bugbattle.io.bugbattle.service;
22

33
import android.os.Build;
4-
import android.support.annotation.RequiresApi;
4+
5+
import androidx.annotation.RequiresApi;
56

67
import java.io.BufferedInputStream;
78
import java.io.BufferedReader;
@@ -66,26 +67,27 @@ public FormDataHttpsHelper(String requestURL, String apiToken)
6667
@RequiresApi(api = Build.VERSION_CODES.O)
6768
public void addFilePart(File uploadFile)
6869
throws IOException {
69-
String fileName = uploadFile.getName();
70-
request.writeBytes(this.twoHyphens + this.boundary + this.crlf);
71-
request.writeBytes("Content-Disposition: form-data; name=\"file\";filename=\"" +
72-
fileName+"\"" + this.crlf);
73-
request.writeBytes("Content-Type: " +
74-
""+ URLConnection.guessContentTypeFromName(fileName) + this.crlf+ this.crlf);
75-
int size = (int) uploadFile.length();
76-
byte[] bytes = new byte[size];
77-
try {
78-
BufferedInputStream buf = new BufferedInputStream(new FileInputStream(uploadFile));
79-
buf.read(bytes, 0, bytes.length);
80-
buf.close();
81-
} catch (FileNotFoundException e) {
82-
e.printStackTrace();
83-
} catch (IOException e) {
84-
e.printStackTrace();
70+
if (uploadFile != null) {
71+
String fileName = uploadFile.getName();
72+
request.writeBytes(this.twoHyphens + this.boundary + this.crlf);
73+
request.writeBytes("Content-Disposition: form-data; name=\"file\";filename=\"" +
74+
fileName + "\"" + this.crlf);
75+
request.writeBytes("Content-Type: " +
76+
"" + URLConnection.guessContentTypeFromName(fileName) + this.crlf + this.crlf);
77+
int size = (int) uploadFile.length();
78+
byte[] bytes = new byte[size];
79+
try {
80+
BufferedInputStream buf = new BufferedInputStream(new FileInputStream(uploadFile));
81+
buf.read(bytes, 0, bytes.length);
82+
buf.close();
83+
} catch (FileNotFoundException e) {
84+
e.printStackTrace();
85+
} catch (IOException e) {
86+
e.printStackTrace();
87+
}
88+
request.write(bytes);
89+
request.writeBytes(this.crlf);
8590
}
86-
request.write(bytes);
87-
request.writeBytes(this.crlf);
88-
8991
}
9092

9193

bugbattle/src/main/java/bugbattle/io/bugbattle/service/HttpHelper.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
import android.graphics.Bitmap;
55
import android.os.AsyncTask;
66
import android.os.Build;
7-
import android.support.annotation.RequiresApi;
7+
8+
import androidx.annotation.RequiresApi;
89

910
import org.json.JSONArray;
1011
import org.json.JSONException;
@@ -148,10 +149,11 @@ private Integer postFeedback(FeedbackModel service) throws JSONException, IOExce
148149

149150
/**
150151
* Convert the Bitmap to a File in the cache
152+
*
151153
* @param bitmap image which is uploaded
152154
* @return return the file
153155
*/
154-
private File bitmapToFile(Bitmap bitmap) throws IOException {
156+
private File bitmapToFile(Bitmap bitmap) {
155157
try {
156158
File outputDir = context.getCacheDir();
157159
File outputFile = File.createTempFile("file", ".png", outputDir);
@@ -189,14 +191,13 @@ private JSONArray generateReplayImageUrls() throws IOException, JSONException {
189191
ScreenshotReplay[] replays = FeedbackModel.getInstance().getReplay().getScreenshots();
190192
List<Bitmap> bitmapList = new LinkedList<>();
191193

192-
for (int i = 0; i < replays.length; i++) {
193-
ScreenshotReplay replay = replays[i];
194+
for (ScreenshotReplay replay : replays) {
194195
if (replay != null) {
195196
bitmapList.add(replay.getScreenshot());
196197
}
197198
}
198199

199-
JSONObject obj = uploadImages(bitmapList.toArray(new Bitmap[bitmapList.size()]));
200+
JSONObject obj = uploadImages(bitmapList.toArray(new Bitmap[0]));
200201
JSONArray fileUrls = (JSONArray) obj.get("fileUrls");
201202
for (int i = 0; i < fileUrls.length(); i++) {
202203
JSONObject entry = new JSONObject();

bugbattle/src/main/java/bugbattle/io/bugbattle/view/Feedback.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import android.graphics.Matrix;
99
import android.net.Uri;
1010
import android.os.Bundle;
11-
import android.support.v7.app.AppCompatActivity;
1211
import android.text.Editable;
1312
import android.text.Html;
1413
import android.text.TextWatcher;
@@ -26,6 +25,8 @@
2625
import android.widget.TextView;
2726
import android.widget.Toast;
2827

28+
import androidx.appcompat.app.AppCompatActivity;
29+
2930
import bugbattle.io.bugbattle.R;
3031
import bugbattle.io.bugbattle.controller.LanguageController;
3132
import bugbattle.io.bugbattle.controller.OnHttpResponseListener;

bugbattle/src/main/java/bugbattle/io/bugbattle/view/ImageEditor.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@
1010
import android.graphics.Color;
1111
import android.os.Build;
1212
import android.os.Bundle;
13-
import android.support.annotation.RequiresApi;
14-
import android.support.v7.app.AppCompatActivity;
1513
import android.view.KeyEvent;
1614
import android.view.View;
1715
import android.widget.Button;
1816
import android.widget.ImageButton;
1917
import android.widget.ImageView;
2018

19+
import androidx.annotation.RequiresApi;
20+
import androidx.appcompat.app.AppCompatActivity;
21+
2122
import bugbattle.io.bugbattle.R;
2223
import bugbattle.io.bugbattle.controller.LanguageController;
2324
import bugbattle.io.bugbattle.model.FeedbackModel;
@@ -59,8 +60,12 @@ protected void onCreate(Bundle savedInstanceState) {
5960
}
6061
service = FeedbackModel.getInstance();
6162
if (android.os.Build.VERSION.SDK_INT > Build.VERSION_CODES.O) {
62-
if (service.getScreenshot().getWidth() > service.getScreenshot().getHeight()) {
63-
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
63+
if (service.getScreenshot() != null) {
64+
if (service.getScreenshot().getWidth() > service.getScreenshot().getHeight()) {
65+
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
66+
} else {
67+
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
68+
}
6469
} else {
6570
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
6671
}

bugbattle/src/main/res/layout/activity_feedback.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

3-
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
44
xmlns:app="http://schemas.android.com/apk/res-auto"
55
xmlns:tools="http://schemas.android.com/tools"
66
android:layout_width="match_parent"
@@ -28,7 +28,7 @@
2828
android:layout_width="match_parent"
2929
android:layout_height="match_parent">
3030

31-
<android.support.constraint.ConstraintLayout
31+
<androidx.constraintlayout.widget.ConstraintLayout
3232
android:id="@+id/bb_done_error"
3333
android:layout_width="match_parent"
3434
android:layout_height="match_parent"
@@ -78,9 +78,9 @@
7878
app:layout_constraintStart_toStartOf="parent"
7979
app:layout_constraintTop_toTopOf="parent" />
8080

81-
</android.support.constraint.ConstraintLayout>
81+
</androidx.constraintlayout.widget.ConstraintLayout>
8282

83-
<android.support.constraint.ConstraintLayout
83+
<androidx.constraintlayout.widget.ConstraintLayout
8484
android:id="@+id/bb_done_view"
8585
android:layout_width="match_parent"
8686
android:layout_height="match_parent"
@@ -125,9 +125,9 @@
125125
app:layout_constraintVertical_bias="1.0"
126126
app:srcCompat="@drawable/sent_icon" />
127127

128-
</android.support.constraint.ConstraintLayout>
128+
</androidx.constraintlayout.widget.ConstraintLayout>
129129

130-
<android.support.constraint.ConstraintLayout
130+
<androidx.constraintlayout.widget.ConstraintLayout
131131
android:id="@+id/bb_loading_view"
132132
android:layout_width="match_parent"
133133
android:layout_height="match_parent"
@@ -174,9 +174,9 @@
174174
app:layout_constraintEnd_toEndOf="parent"
175175
app:layout_constraintStart_toStartOf="parent" />
176176

177-
</android.support.constraint.ConstraintLayout>
177+
</androidx.constraintlayout.widget.ConstraintLayout>
178178

179-
<android.support.constraint.ConstraintLayout
179+
<androidx.constraintlayout.widget.ConstraintLayout
180180
android:id="@+id/bb_feedback"
181181
android:layout_width="match_parent"
182182
android:layout_height="match_parent"
@@ -398,9 +398,9 @@
398398
android:textColor="@color/black" />
399399
</RadioGroup>
400400

401-
</android.support.constraint.ConstraintLayout>
401+
</androidx.constraintlayout.widget.ConstraintLayout>
402402
</FrameLayout>
403403
</ScrollView>
404404

405405

406-
</android.support.constraint.ConstraintLayout>
406+
</androidx.constraintlayout.widget.ConstraintLayout>

0 commit comments

Comments
 (0)