-
-
Notifications
You must be signed in to change notification settings - Fork 349
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' into snowflake_bridge_script
- Loading branch information
Showing
45 changed files
with
251 additions
and
281 deletions.
There are no files selected for viewing
Binary file not shown.
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
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
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
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
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
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
59 changes: 0 additions & 59 deletions
59
app/src/main/java/org/torproject/android/ui/v3onionservice/PermissionManager.java
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
app/src/main/java/org/torproject/android/ui/v3onionservice/PermissionManager.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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.torproject.android.ui.v3onionservice | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.net.Uri | ||
import android.os.PowerManager | ||
import android.provider.Settings | ||
import android.view.View | ||
|
||
import androidx.fragment.app.FragmentActivity | ||
|
||
import com.google.android.material.snackbar.Snackbar | ||
|
||
import org.torproject.android.R | ||
|
||
object PermissionManager { | ||
private const val SNACK_BAR_DURATION = 5000 | ||
|
||
@JvmStatic | ||
fun requestBatteryPermissions(activity: FragmentActivity, view: View) { | ||
val packageName = activity.packageName | ||
val pm = activity.applicationContext.getSystemService(Context.POWER_SERVICE) as PowerManager | ||
|
||
if (pm.isIgnoringBatteryOptimizations(packageName)) { | ||
return | ||
} | ||
|
||
Snackbar.make(view, R.string.consider_disable_battery_optimizations, | ||
SNACK_BAR_DURATION).setAction(R.string.disable) { | ||
val intent = Intent().apply { | ||
action = Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS | ||
data = Uri.parse("package:$packageName") | ||
} | ||
activity.startActivity(intent) | ||
}.show() | ||
} | ||
|
||
@JvmStatic | ||
fun requestDropBatteryPermissions(activity: FragmentActivity, view: View) { | ||
val pm = activity.applicationContext.getSystemService(Context.POWER_SERVICE) as PowerManager | ||
if (!pm.isIgnoringBatteryOptimizations(activity.packageName)) { | ||
return | ||
} | ||
|
||
Snackbar.make(view, R.string.consider_enable_battery_optimizations, | ||
SNACK_BAR_DURATION).setAction(R.string.enable) { | ||
val intent = Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS) | ||
activity.startActivity(intent) | ||
}.show() | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="960" | ||
android:viewportHeight="960" | ||
android:tint="?attr/colorControlNormal" | ||
android:autoMirrored="true"> | ||
<path | ||
android:fillColor="@android:color/white" | ||
android:pathData="M360,720Q327,720 303.5,696.5Q280,673 280,640L280,160Q280,127 303.5,103.5Q327,80 360,80L720,80Q753,80 776.5,103.5Q800,127 800,160L800,640Q800,673 776.5,696.5Q753,720 720,720L360,720ZM360,640L720,640Q720,640 720,640Q720,640 720,640L720,160Q720,160 720,160Q720,160 720,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640ZM200,880Q167,880 143.5,856.5Q120,833 120,800L120,240L200,240L200,800Q200,800 200,800Q200,800 200,800L640,800L640,880L200,880ZM360,640Q360,640 360,640Q360,640 360,640L360,160Q360,160 360,160Q360,160 360,160L360,160Q360,160 360,160Q360,160 360,160L360,640Q360,640 360,640Q360,640 360,640L360,640Z"/> | ||
</vector> |
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
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
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.