Skip to content

Commit d066d37

Browse files
committed
Refactorings
1 parent 5fca2f0 commit d066d37

File tree

1 file changed

+7
-10
lines changed
  • android-example-app/app/src/main/java/ch/freshbits/pathshare/example

1 file changed

+7
-10
lines changed

android-example-app/app/src/main/java/ch/freshbits/pathshare/example/MainActivity.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@
66
import android.content.SharedPreferences;
77
import android.content.pm.PackageManager;
88
import android.os.Bundle;
9-
import android.support.annotation.NonNull;
109
import android.util.Log;
11-
import android.view.View;
1210
import android.widget.Button;
1311
import android.widget.Toast;
1412

13+
import androidx.annotation.NonNull;
14+
1515
import java.net.URL;
1616
import java.util.Date;
1717

1818
import ch.freshbits.pathshare.sdk.Pathshare;
1919
import ch.freshbits.pathshare.sdk.helper.InvitationResponseListener;
2020
import ch.freshbits.pathshare.sdk.helper.PermissionRequester;
2121
import ch.freshbits.pathshare.sdk.helper.ResponseListener;
22-
import ch.freshbits.pathshare.sdk.helper.SessionExpirationListener;
2322
import ch.freshbits.pathshare.sdk.helper.SessionResponseListener;
2423
import ch.freshbits.pathshare.sdk.model.Destination;
2524
import ch.freshbits.pathshare.sdk.model.Session;
@@ -174,13 +173,11 @@ private boolean hasLocationPermission() {
174173

175174
@Override
176175
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
177-
switch (requestCode) {
178-
case TAG_PERMISSIONS_REQUEST_LOCATION_ACCESS: {
179-
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
180-
performJoinSession();
181-
} else {
182-
Toast.makeText(this, R.string.permission_access_fine_location_denied, Toast.LENGTH_SHORT).show();
183-
}
176+
if (requestCode == TAG_PERMISSIONS_REQUEST_LOCATION_ACCESS) {
177+
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
178+
performJoinSession();
179+
} else {
180+
Toast.makeText(this, R.string.permission_access_fine_location_denied, Toast.LENGTH_SHORT).show();
184181
}
185182
}
186183
}

0 commit comments

Comments
 (0)