Skip to content

Commit e416ebc

Browse files
U-METAL103\103U-METAL103\103
authored andcommitted
google sucks
1 parent df3bda0 commit e416ebc

8 files changed

Lines changed: 32 additions & 893 deletions

File tree

app/src/main/java/joshuatee/wx/radar/VideoRecordActivity.kt

Lines changed: 7 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,14 @@
1818
along with wX. If not, see <http://www.gnu.org/licenses/>.
1919
2020
*/
21-
//Modded by ELY M.
2221

2322
package joshuatee.wx.radar
2423

25-
import android.Manifest
26-
import android.app.Activity
27-
import android.content.Context
2824
import android.content.Intent
2925
import android.content.pm.PackageManager
30-
import android.media.projection.MediaProjectionManager
3126
import android.net.Uri
32-
import android.os.Build
3327
import android.os.Bundle
3428
import android.provider.Settings
35-
import androidx.core.app.ActivityCompat
3629
import androidx.appcompat.app.AppCompatActivity
3730
import androidx.appcompat.widget.Toolbar
3831
import joshuatee.wx.R
@@ -45,8 +38,6 @@ import joshuatee.wx.util.UtilityLog
4538
abstract class VideoRecordActivity : AppCompatActivity() {
4639

4740
companion object {
48-
private const val CREATE_SCREEN_CAPTURE = 4242
49-
5041
/** code to post/handler request for permission */
5142
private const val REQUEST_CODE_PERM = 999
5243
}
@@ -56,6 +47,7 @@ abstract class VideoRecordActivity : AppCompatActivity() {
5647
lateinit var toolbarBottom: Toolbar
5748
lateinit var objectToolbar: ObjectToolbar
5849
lateinit var objectToolbarBottom: ObjectToolbar
50+
private lateinit var telecineService: TelecineService
5951

6052
protected fun onCreate(savedInstanceState: Bundle?, layoutResId: Int, menuResId: Int?, bottomToolbar: Boolean) {
6153
setTheme(UIPreferences.themeInt)
@@ -90,96 +82,38 @@ abstract class VideoRecordActivity : AppCompatActivity() {
9082
}
9183

9284
protected fun checkOverlayPerms() {
93-
UtilityLog.d("wx", "checkOverlayPerms start")
94-
if (isStoragePermissionGranted) {
95-
UtilityLog.d("wx", "checkOverlayPerms start, storage granted")
96-
checkDrawOverlayPermission()
97-
} else {
98-
UtilityLog.d("wx", "checkOverlayPerms start, storage not granted")
99-
}
100-
}
101-
102-
private fun fireScreenCaptureIntent() {
103-
val manager = getSystemService(Context.MEDIA_PROJECTION_SERVICE) as MediaProjectionManager
104-
val intent = manager.createScreenCaptureIntent()
105-
startActivityForResult(intent, CREATE_SCREEN_CAPTURE)
85+
checkDrawOverlayPermission()
10686
}
10787

10888
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
10989
if (requestCode == REQUEST_CODE_PERM) {
11090
if (Settings.canDrawOverlays(this)) {
111-
fireScreenCaptureIntent()
112-
}
113-
}
114-
if (requestCode == CREATE_SCREEN_CAPTURE && resultCode == Activity.RESULT_OK) {
115-
if (Build.VERSION.SDK_INT > 31) { // was 32, Android 12L is showing in crash reports
116-
val intent = TelecineService.newIntent(this, 1, Intent())
117-
intent.putExtra("show_distance_tool", showDistanceTool)
118-
intent.putExtra("show_recording_tools", "false")
119-
startService(intent)
120-
} else {
121-
val intent = TelecineService.newIntent(applicationContext, resultCode, data)
122-
intent.putExtra("show_distance_tool", showDistanceTool)
123-
intent.putExtra("show_recording_tools", "true")
124-
startService(intent)
91+
telecineService = TelecineService()
92+
telecineService.start(this)
12593
}
126-
// draw tools only?
127-
// val intent = TelecineService.newIntent(this, 1, Intent())
128-
// intent.putExtra("show_distance_tool", showDistanceTool)
129-
// intent.putExtra("show_recording_tools", "false")
130-
// startService(intent)
13194
}
13295
}
13396

13497
private fun checkDrawOverlayPermission() {
135-
/** check if we already have permission to draw over other apps */
13698
if (!Settings.canDrawOverlays(this)) {
13799
UtilityLog.d("wx", "checkDrawOverlayPermission - perm check")
138-
/** if not construct intent to request permission */
139100
val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:$packageName"))
140-
/** request permission via start activity for result */
141101
startActivityForResult(intent, REQUEST_CODE_PERM)
142102
} else {
143-
UtilityLog.d("wx", "checkDrawOverlayPermission - fireScreenCaptureIntent")
144-
fireScreenCaptureIntent()
103+
telecineService = TelecineService()
104+
telecineService.start(this)
145105
}
146106
}
147107

148-
private val isStoragePermissionGranted: Boolean
149-
get() {
150-
if (Build.VERSION.SDK_INT >= 33) {
151-
return true
152-
}
153-
return if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
154-
true
155-
} else {
156-
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 1)
157-
false
158-
}
159-
}
160-
161-
// private val isStoragePermissionGranted: Boolean
162-
// get() {
163-
// return if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
164-
// true
165-
// } else {
166-
// ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 1)
167-
// false
168-
// }
169-
// }
170-
171108
// https://developer.android.com/training/permissions/requesting.html
172-
173109
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
174110
when (requestCode) {
175111
1 -> {
176112
// If request is cancelled, the result arrays are empty.
177113
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
178114
checkDrawOverlayPermission()
179-
// permission was granted, yay! Do the
180-
// contacts-related task you need to do.
181115
}
182116
}
183-
}// other 'case' lines to check for other
117+
}
184118
}
185119
}

app/src/main/java/joshuatee/wx/settings/SettingsRadarActivity.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import joshuatee.wx.objects.PolygonWarning
3535
import joshuatee.wx.objects.PolygonType
3636
import joshuatee.wx.objects.PolygonWarningType
3737
import joshuatee.wx.radar.RadarGeometry
38-
import joshuatee.wx.telecine.SettingsTelecineActivity
3938
import joshuatee.wx.ui.BaseActivity
4039
import joshuatee.wx.ui.CardText
4140
import joshuatee.wx.ui.NumberPicker
@@ -62,7 +61,6 @@ class SettingsRadarActivity : BaseActivity() {
6261
box.addWidget(CardText(this, "Colors", SettingsColorsActivity::class.java))
6362
box.addWidget(CardText(this, "Color Palettes (Beta)", SettingsColorPaletteListingActivity::class.java))
6463
box.addWidget(CardText(this, "Line / Marker sizes", SettingsRadarSizesActivity::class.java))
65-
box.addWidget(CardText(this, "Screen Recorder", SettingsTelecineActivity::class.java))
6664
}
6765

6866
private fun addSwitch1() {

app/src/main/java/joshuatee/wx/settings/UIPreferences.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import joshuatee.wx.util.UtilityFavorites
3737
object UIPreferences {
3838

3939
// These are set in myapp still
40-
const val TELECINE_SWITCH_SHOW_TOUCHES = false
40+
// const val TELECINE_SWITCH_SHOW_TOUCHES = false
4141
var telecineVideoSizePercentage = 0
4242
var telecineSwitchShowCountdown = false
4343
var telecineSwitchRecordingNotification = false
@@ -166,7 +166,7 @@ object UIPreferences {
166166
}
167167
tilesPerRow = Utility.readPrefInt(context, "UI_TILES_PER_ROW", tilesPerRowDefault)
168168
themeStr = Utility.readPref(context, "THEME_BLUE", "BlackAqua")
169-
themeInt = Utility.theme(themeStr)
169+
themeInt = UtilityUI.theme(themeStr)
170170
if (themeInt == R.style.MyCustomTheme_white_NOAB || themeInt == R.style.MyCustomTheme_whiter_NOAB || themeInt == R.style.MyCustomTheme_whitest_NOAB) {
171171
textSmallThemeColor = Color.GRAY
172172
textHighlightColor = Color.rgb(14, 71, 161)

app/src/main/java/joshuatee/wx/telecine/FlashView.kt

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)