Skip to content

Commit

Permalink
55880-elys
Browse files Browse the repository at this point in the history
  • Loading branch information
U-METAL103\103 authored and U-METAL103\103 committed Apr 5, 2024
1 parent 865c495 commit b0b67df
Show file tree
Hide file tree
Showing 61 changed files with 997 additions and 792 deletions.
18 changes: 2 additions & 16 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<!-- modded by ELY M. -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="55878"
android:versionName="55878-elys">
android:versionCode="55880"
android:versionName="55880-elys">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Expand Down Expand Up @@ -509,20 +509,6 @@
android:resource="@xml/filepaths" />
</provider>

<!-- Telecine -->
<activity
android:name=".telecine.SettingsTelecineActivity"
android:label="Screen Recorder Settings"
android:parentActivityName="WX"
android:taskAffinity=""
android:exported="true" />

<service
android:name="joshuatee.wx.telecine.TelecineService"
android:foregroundServiceType="mediaProjection" />

<receiver android:name="joshuatee.wx.telecine.RecordingSession$DeleteRecordingBroadcastReceiver" />

<!-- The widget provider android:icon="@drawable/widgetsevenday" -->
<receiver
android:name="WeatherWidgetProvider"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/joshuatee/wx/WeatherWidgetService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ internal class StackRemoteViewsFactory(private val context: Context) : RemoteVie

override fun getViewAt(position: Int): RemoteViews {
var day = "Unknown Day"
var temp = 0
// var temp = 0
if (cursor!!.moveToPosition(position)) {
val dayColIndex = cursor!!.getColumnIndex(WeatherDataProvider.Columns.DAY)
val tempColIndex = cursor!!.getColumnIndex(WeatherDataProvider.Columns.TEMPERATURE)
// val tempColIndex = cursor!!.getColumnIndex(WeatherDataProvider.Columns.TEMPERATURE)
day = cursor!!.getString(dayColIndex)
temp = cursor!!.getInt(tempColIndex)
// temp = cursor!!.getInt(tempColIndex)
}
var t1 = ""
var t2 = ""
Expand Down
26 changes: 14 additions & 12 deletions app/src/main/java/joshuatee/wx/audio/AudioPlayActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@

package joshuatee.wx.audio

import android.Manifest
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.core.app.ActivityCompat
import joshuatee.wx.R
import joshuatee.wx.settings.UIPreferences
import joshuatee.wx.common.GlobalVariables
Expand Down Expand Up @@ -147,17 +144,22 @@ abstract class AudioPlayActivity : AppCompatActivity() {

private val isStoragePermissionGranted: Boolean
get() {
if (Build.VERSION.SDK_INT >= 33) {
return true
}
return if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
true
} else {
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 1)
false
}
return true
}

// private val isStoragePermissionGranted: Boolean
// get() {
// if (Build.VERSION.SDK_INT >= 33) {
// return true
// }
// return if (checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
// true
// } else {
// ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 1)
// false
// }
// }

override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
when (requestCode) {
1 -> {
Expand Down
65 changes: 42 additions & 23 deletions app/src/main/java/joshuatee/wx/audio/UtilityTTS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@

package joshuatee.wx.audio

import java.io.File
import java.util.HashMap
import java.util.Locale
import android.content.Context
import android.media.MediaPlayer
import android.net.Uri
import android.os.Environment
import android.os.Bundle
import android.speech.tts.TextToSpeech
import android.speech.tts.UtteranceProgressListener
import joshuatee.wx.settings.UIPreferences
import joshuatee.wx.common.GlobalVariables
import joshuatee.wx.settings.NotificationPreferences
import joshuatee.wx.settings.UIPreferences
import joshuatee.wx.util.Utility
import joshuatee.wx.util.UtilityLog
import java.io.File
import java.io.IOException
import java.util.Locale
import kotlin.math.min


object UtilityTts {

private var ttsInit = false
Expand Down Expand Up @@ -131,7 +131,13 @@ object UtilityTts {
}
}

override fun onError(utteranceId: String) {}
@Deprecated(
message = "This method was deprecated in API level 21.",
replaceWith = ReplaceWith("nothing"),
level = DeprecationLevel.WARNING
)
override fun onError(utteranceId: String) {
}

override fun onStart(utteranceId: String) {}
})
Expand All @@ -158,7 +164,13 @@ object UtilityTts {
}
}

override fun onError(utteranceId: String) {}
@Deprecated(
message = "This method was deprecated in API level 21.",
replaceWith = ReplaceWith("nothing"),
level = DeprecationLevel.WARNING
)
override fun onError(utteranceId: String) {
}

override fun onStart(utteranceId: String) {}
})
Expand All @@ -169,19 +181,25 @@ object UtilityTts {
mediaPlayer!!.stop()
}
val txt = UtilityTtsTranslations.translateAbbreviation(txtF)
val myHashRender = HashMap<String, String>()
val musicDir = context.getExternalFilesDir(Environment.DIRECTORY_MUSIC)
val wxDir = File(musicDir, GlobalVariables.PACKAGE_NAME)
if (!wxDir.exists() && !wxDir.mkdirs()) {
return
}
// val myHashRender = HashMap<String, String>()
// val musicDir = context.getExternalFilesDir(Environment.DIRECTORY_MUSIC)
// val wxDir = File(musicDir, GlobalVariables.PACKAGE_NAME)
// if (!wxDir.exists() && !wxDir.mkdirs()) {
// return
// }
val chunks = splitInChunks(Utility.fromHtml(txt))
fileCount = chunks.size
(0 until fileCount).forEach {
myHashRender.clear()
myHashRender[TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID] = it.toString() + prod
val fileName = File(wxDir, FILENAME + it.toString()).absolutePath
ttobjGlobal!!.synthesizeToFile(chunks[it], myHashRender, fileName)
// myHashRender.clear()
// myHashRender[TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID] = it.toString() + prod
// val fileName = File(wxDir, FILENAME + it.toString()).absolutePath
// val fileName = File(context.filesDir, FILENAME + it.toString()).absolutePath
val fileName = File(context.filesDir, FILENAME + it.toString())

// ttobjGlobal!!.synthesizeToFile(chunks[it], myHashRender, fileName)
val bundle = Bundle()
bundle.putString(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, it.toString() + prod)
ttobjGlobal!!.synthesizeToFile(chunks[it], bundle, fileName, it.toString() + prod)
}
}

Expand All @@ -201,13 +219,14 @@ object UtilityTts {
}

private fun playMediaPlayerFile(context: Context, fileNum: Int) {
val musicDir = context.getExternalFilesDir(Environment.DIRECTORY_MUSIC)
val wxDir = File(musicDir, GlobalVariables.PACKAGE_NAME)
if (!wxDir.exists() && !wxDir.mkdirs()) {
return
}
// val musicDir = context.getExternalFilesDir(Environment.DIRECTORY_MUSIC)
// val wxDir = File(musicDir, GlobalVariables.PACKAGE_NAME)
// if (!wxDir.exists() && !wxDir.mkdirs()) {
// return
// }
mediaPlayer?.reset()
val fileName = File(wxDir, FILENAME + fileNum.toString()).absolutePath
// val fileName = File(wxDir, FILENAME + fileNum.toString()).absolutePath
val fileName = File(context.filesDir, FILENAME + fileNum.toString()).absolutePath
val uri = Uri.parse("file://$fileName")
try {
mediaPlayer?.setDataSource(context, uri)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ protected void drawGraphElements(Canvas canvas) {
protected void onDraw(Canvas canvas) {
if (isInEditMode()) {
canvas.drawColor(Color.rgb(200, 200, 200));
canvas.drawText("GraphView: No Preview available", canvas.getWidth() / 2, canvas.getHeight() / 2, mPreviewPaint);
canvas.drawText("GraphView: No Preview available", getWidth() / 2, getHeight() / 2, mPreviewPaint);
} else {
drawGraphElements(canvas);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ public class GraphViewXML extends GraphView {
/**
* creates the graphview object with data and
* other options from xml attributes.
*
* @param context
* @param attrs
*/
public GraphViewXML(Context context, AttributeSet attrs) {
super(context, attrs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ public abstract class BaseSeries<E extends DataPointInterface> implements Series
private final List<WeakReference<GraphView>> mGraphViews;
private Boolean mIsCursorModeCache;

/**
* creates series without data
*/
public BaseSeries() {
mGraphViews = new ArrayList<>();
}

/**
* creates series with data
*
Expand Down Expand Up @@ -182,7 +175,7 @@ public Iterator<E> getValues(final double from, final double until) {
if (from <= getLowestValueX() && until >= getHighestValueX()) {
return mData.iterator();
} else {
return new Iterator<E>() {
return new Iterator<>() {
final Iterator<E> org = mData.iterator();
E nextValue = null;
E nextNextValue = null;
Expand Down Expand Up @@ -276,8 +269,6 @@ public int getColor() {
* set the color of the series. This will be used in
* plotting (depends on the series implementation) and
* is used in the legend.
*
* @param mColor
*/
public void setColor(int mColor) {
this.mColor = mColor;
Expand Down Expand Up @@ -343,9 +334,7 @@ public E findDataPointAtX(float x) {
E shortest = null;
for (Map.Entry<PointF, E> entry : mDataPoints.entrySet()) {
float x1 = entry.getKey().x;
float x2 = x;

float distance = Math.abs(x1 - x2);
float distance = Math.abs(x1 - x);
if (shortest == null || distance < shortestDistance) {
shortestDistance = distance;
shortest = entry.getValue();
Expand Down
17 changes: 10 additions & 7 deletions app/src/main/java/joshuatee/wx/fingerdraw/DrawView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ This class is used for the drawing tool accessible from the screen recording too

package joshuatee.wx.fingerdraw

import android.content.Context
import android.app.Activity
import android.graphics.Canvas
import android.graphics.Paint
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import android.widget.Button
Expand All @@ -37,12 +36,14 @@ class DrawView : View {
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
setMeasuredDimension(
MyApplication.dm.widthPixels,
MyApplication.dm.heightPixels - UtilityUI.statusBarHeight(context) - UIPreferences.actionBarHeight
MyApplication.dm.heightPixels - UtilityUI.statusBarHeight(activity) - UIPreferences.actionBarHeight
)
}

private val undoButton: Button? = null

private val activity: Activity

/** the paint holds the draw options like colors */
private val paint = Paint()

Expand All @@ -57,12 +58,14 @@ class DrawView : View {
private val drawListener = DrawListener()

/** this constructor allows us to use this in an xml layout */
constructor(context: Context, attribs: AttributeSet) : super(context, attribs) {
setup()
}
// constructor(activity: Activity, attribs: AttributeSet) : super(activity, attribs) {
// this.activity = activity
// setup()
// }

/** default constructor */
constructor(context: Context) : super(context) {
constructor(activity: Activity) : super(activity) {
this.activity = activity
setup()
}

Expand Down
38 changes: 18 additions & 20 deletions app/src/main/java/joshuatee/wx/radar/NexradStatePane.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ package joshuatee.wx.radar

import android.content.Context
import android.view.View
import joshuatee.wx.MyApplication
import joshuatee.wx.objects.LatLon
import joshuatee.wx.settings.RadarPreferences
import joshuatee.wx.settings.UIPreferences
import joshuatee.wx.settings.UtilityLocation
import joshuatee.wx.ui.UtilityUI
import joshuatee.wx.util.Utility
import joshuatee.wx.util.UtilityLog

class NexradStatePane(
val activity: VideoRecordActivity,
Expand Down Expand Up @@ -61,23 +57,25 @@ class NexradStatePane(
relativeLayouts.add(activity.findViewById(relativeLayoutResIdList[it]))
relativeLayouts.last().addView(wxglSurfaceViews[it])
//
// setup special sizing for multipane
// setup special sizing for quad
//
if (numberOfPanes == 4) {
val params = relativeLayouts[it].layoutParams
if (UIPreferences.radarImmersiveMode || UIPreferences.radarToolbarTransparent)
params.height = MyApplication.dm.heightPixels / 2 + UtilityUI.statusBarHeight(activity)
else
params.height = MyApplication.dm.heightPixels /
2 - UIPreferences.actionBarHeight /
2 - UtilityUI.statusBarHeight(activity) / 2 -
(UtilityUI.navigationBarHeight(activity) / 2.0).toInt()
if (UIPreferences.radarToolbarTransparent && !UIPreferences.radarImmersiveMode) {
UtilityLog.d("wxsize", MyApplication.dm.heightPixels.toString())
params.height = MyApplication.dm.heightPixels / 2
}
params.width = MyApplication.dm.widthPixels / 2
}

// disabled Apr 2024 after changes in layout xml
// if (numberOfPanes == 4) {
// val params = relativeLayouts[it].layoutParams
// if (UIPreferences.radarImmersiveMode || UIPreferences.radarToolbarTransparent)
// params.height = MyApplication.dm.heightPixels / 2 + UtilityUI.statusBarHeight(activity)
// else
// params.height = MyApplication.dm.heightPixels /
// 2 - UIPreferences.actionBarHeight /
// 2 - UtilityUI.statusBarHeight(activity) / 2 -
// (UtilityUI.navigationBarHeight(activity) / 2.0).toInt()
// if (UIPreferences.radarToolbarTransparent && !UIPreferences.radarImmersiveMode) {
// // UtilityLog.d("wxsize", MyApplication.dm.heightPixels.toString())
// params.height = MyApplication.dm.heightPixels / 2
// }
// params.width = MyApplication.dm.widthPixels / 2
// }
}
wxglSurfaceViews.indices.forEach {
wxglTextObjects.add(NexradRenderTextObject(activity,
Expand Down
Loading

0 comments on commit b0b67df

Please sign in to comment.