-
-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:guardianproject/orbot
- Loading branch information
Showing
21 changed files
with
159 additions
and
65 deletions.
There are no files selected for viewing
20 changes: 14 additions & 6 deletions
20
app/src/main/java/org/torproject/android/ui/OrbotTileService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
package org.torproject.android.ui | ||
|
||
import android.app.PendingIntent | ||
import android.content.Intent | ||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK | ||
import android.os.Build | ||
import android.service.quicksettings.TileService | ||
|
||
import androidx.annotation.RequiresApi | ||
import org.torproject.android.OrbotActivity | ||
|
||
class OrbotTileService: TileService() { | ||
import org.torproject.android.OrbotActivity | ||
|
||
// Called when the user taps on your tile in an active or inactive state. | ||
@RequiresApi(Build.VERSION_CODES.N) | ||
class OrbotTileService : TileService() { | ||
override fun onClick() { | ||
super.onClick() | ||
val intent = Intent(this, OrbotActivity::class.java) | ||
.addFlags(FLAG_ACTIVITY_NEW_TASK) | ||
val intent = Intent(this, OrbotActivity::class.java).apply { | ||
addFlags(FLAG_ACTIVITY_NEW_TASK) | ||
} | ||
|
||
startActivityAndCollapse(intent) | ||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { | ||
val pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE) | ||
startActivityAndCollapse(pendingIntent) | ||
} else { | ||
startActivityAndCollapse(intent) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.