Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
android:resource="@xml/date_temp_widget_info" />
</receiver>

<activity android:name=".clockDateWidgetConfigActivity"
<activity android:name=".ClockDateWidgetConfigActivity"
android:theme="@style/Theme.widgetsThemeConfigs"
android:exported="true">
</activity>
<receiver android:name=".clockDateWidgetProvider" android:exported="true" android:label="Glance">
<receiver android:name=".ClockDateWidgetProvider" android:exported="true" android:label="Glance">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class ClockHourlyWidgetProvider : AppWidgetProvider() {
val temp = prefs.getString("temperatureCurrentPill", "--")
val code = prefs.getString("weather_codeCurrentPill", "--")
val conditionName = prefs.getString("locationCurrentConditon", "--")
val locationName = prefs.getString("locationNameWidget", "--")

val rawIsDay = prefs.all["isDayWidget"]
val isDay = when (rawIsDay) {
Expand All @@ -49,12 +48,7 @@ class ClockHourlyWidgetProvider : AppWidgetProvider() {
else -> "1"
}

val max = prefs.getString("todayMax", "--")
val min = prefs.getString("todayMin", "--")

views.setTextViewText(R.id.current_widget_temp_cast_clock_hourly, "$temp°")
// views.setTextViewText(R.id.temp_high_cast_clock_hourly, "$max° •")
// views.setTextViewText(R.id.temp_low_cast_clock_hourly, " $min°")

val iconRes = WeatherIconMapper.getIconResource(code, isDay)
views.setImageViewResource(R.id.widget_icon_hourly_cast_clock_hourly, iconRes)
Expand All @@ -72,20 +66,12 @@ class ClockHourlyWidgetProvider : AppWidgetProvider() {
}

when (widgetSize) {
WidgetSize.LARGE -> {
views.setTextViewText(R.id.weather_condition_current_clock_hourly, conditionName)
// views.setTextViewText(R.id.current_widget_locationName, locationName)
views.setViewVisibility(R.id.weather_condition_current_clock_hourly, View.VISIBLE)
// views.setViewVisibility(R.id.current_widget_locationName, View.VISIBLE)
}
WidgetSize.MEDIUM -> {
WidgetSize.LARGE, WidgetSize.MEDIUM -> {
views.setTextViewText(R.id.weather_condition_current_clock_hourly, conditionName)
views.setViewVisibility(R.id.weather_condition_current_clock_hourly, View.VISIBLE)
// views.setViewVisibility(R.id.current_widget_locationName, View.GONE)
}
WidgetSize.SMALL -> {
views.setViewVisibility(R.id.weather_condition_current_clock_hourly, View.GONE)
// views.setViewVisibility(R.id.current_widget_locationName, View.GONE)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ package com.pranshulgg.weather_master_app

import android.content.Context
import android.location.Geocoder
import android.location.Geocoder.GeocodeListener
import android.os.Build
import android.os.Handler
import android.os.Looper
import androidx.annotation.RequiresApi
import java.util.*

object GeocodeHelper {

Expand All @@ -33,7 +27,7 @@ object GeocodeHelper {
}

// Back to main thread so Flutter doesn't cry
Handler(Looper.getMainLooper()).post {
android.os.Handler(android.os.Looper.getMainLooper()).post {
callback(result) // pass it back to whoever asked for it
}
}.start()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import android.content.pm.PackageManager
import android.location.Location
import android.location.LocationListener
import android.location.LocationManager
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
Expand Down Expand Up @@ -78,25 +77,23 @@ class LocationHelper(private val activity: Activity) {
return
}

listener = object : LocationListener {
val locationListener = object : LocationListener {
override fun onLocationChanged(location: Location) {
Log.d("LocationHelper", "Location received: ${location.latitude}, ${location.longitude}")
pendingCallback?.onSuccess(location.latitude, location.longitude)
removeUpdates()
}

override fun onProviderEnabled(provider: String) {}
override fun onProviderDisabled(provider: String) {}
override fun onStatusChanged(provider: String?, status: Int, extras: Bundle?) {}
}

listener = locationListener

providersToUse.forEach { provider ->
try {
locationManager.requestLocationUpdates(
provider,
1000L,
0f,
listener!!
locationListener
)
} catch (e: SecurityException) {
Log.e("LocationHelper", "Permission issue for $provider: $e")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.pranshulgg.weather_master_app
import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.util.Log
import androidx.annotation.RequiresApi
import androidx.work.*
import io.flutter.embedding.android.FlutterActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class PillWidgetProvider : AppWidgetProvider() {
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
views.setOnClickPendingIntent(R.id.widget_root_pill, pendingIntent)
// views.setOnClickPendingIntent(R.id.widget_root_glance, pendingIntent)

manager.updateAppWidget(id, views)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.util.Log
import androidx.core.app.NotificationCompat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import android.view.View
import android.widget.RemoteViews
import android.app.PendingIntent
import android.content.Intent
import android.util.Log
import com.pranshulgg.weather_master_app.util.WeatherIconMapper
import java.time.LocalDate
import java.time.format.DateTimeFormatter
Expand Down Expand Up @@ -40,19 +39,13 @@ class WeatherWidgetCastProvider : AppWidgetProvider() {
) {
val options = newOptions ?: manager.getAppWidgetOptions(id)


val reservedTopDp = 200
val perDailyItemDp = 70

val minHeightDp = options.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT, 0)


val optionsCast = manager.getAppWidgetOptions(id)
val minHeight = optionsCast.getInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT)

val heightDp = getWidgetHeightDp(options)
val availableDp = (heightDp - reservedTopDp).coerceAtLeast(0)
val numDailyItems = (availableDp / perDailyItemDp).coerceIn(0, 4)

val layoutIdDaily = if (numDailyItems > 0) {
R.layout.widget_hourly_current_daily
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import android.content.Context
import android.widget.RemoteViews
import android.app.PendingIntent
import android.content.Intent
import android.os.Bundle
import android.util.TypedValue
import com.pranshulgg.weather_master_app.util.WeatherIconMapper


Expand Down Expand Up @@ -39,8 +37,6 @@ class WeatherWidgetProvider : AppWidgetProvider() {
val iconRes = WeatherIconMapper.getIconResource(code, isDay)
views.setImageViewResource(R.id.widget_icon_current_pill, iconRes)

views.setImageViewResource(R.id.widget_icon_current_pill, iconRes)


val intent = context.packageManager.getLaunchIntentForPackage(context.packageName)?.apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ import android.content.Context
import androidx.work.WorkManager
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import java.text.SimpleDateFormat
import java.util.*
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter
import java.util.Locale

class WorkInfoPlugin(private val context: Context) {

Expand Down Expand Up @@ -52,8 +54,10 @@ private fun getWorkInfoSummary(uniqueWorkName: String, intervalMinutes: Long): M
// Select time format based on preference
val timePattern = if (selectedTimeUnit == "24 hr") "yyyy-MM-dd HH:mm" else "yyyy-MM-dd hh:mm a"

val sdf = SimpleDateFormat(timePattern, Locale.getDefault())
val nextRunFormatted = sdf.format(Date(nextRunMillis))
val formatter = DateTimeFormatter.ofPattern(timePattern).withLocale(Locale.getDefault())
val nextRunFormatted = Instant.ofEpochMilli(nextRunMillis)
.atZone(ZoneId.systemDefault())
.format(formatter)


return mapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,25 @@ import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.CheckBox
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextClock
import android.widget.TextView
import com.google.android.material.slider.Slider

class clockDateWidgetConfigActivity : Activity() {
class ClockDateWidgetConfigActivity : Activity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

setContentView(R.layout.widget_config_activity)


val previewLayout = findViewById<LinearLayout>(R.id.widget_preview)



val previewClock = findViewById<TextClock>(R.id.preview_text_clock)
val previewDate = findViewById<TextView>(R.id.preview_date)
val previewTemp = findViewById<TextView>(R.id.preview_temp)
val previewCondition = findViewById<TextView>(R.id.preview_condition)
val previewIcon = findViewById<ImageView>(R.id.preview_weather_icon)

val showClockCheck = findViewById<CheckBox>(R.id.showClockCheck)
val sizeSlider = findViewById<Slider>(R.id.clockSizeSeek)
val sizeText = findViewById<TextView>(R.id.clockSizeText)
val saveButton = findViewById<Button>(R.id.saveWidgetBtn)


Expand Down Expand Up @@ -67,7 +59,7 @@ class clockDateWidgetConfigActivity : Activity() {


val manager = AppWidgetManager.getInstance(this)
clockDateWidgetProvider().onUpdate(this, manager, intArrayOf(appWidgetId))
ClockDateWidgetProvider().onUpdate(this, manager, intArrayOf(appWidgetId))

val result = Intent().apply { putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId) }
setResult(RESULT_OK, result)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import android.provider.AlarmClock
import android.provider.CalendarContract
import com.pranshulgg.weather_master_app.util.WeatherIconMapper

class clockDateWidgetProvider : AppWidgetProvider() {
class ClockDateWidgetProvider : AppWidgetProvider() {

override fun onUpdate(context: Context, manager: AppWidgetManager, ids: IntArray) {
val prefs = context.getSharedPreferences("HomeWidgetPreferences", Context.MODE_PRIVATE)
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/xml/clockdate_widget_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
android:initialLayout="@layout/glance_widget"
android:resizeMode="horizontal|vertical"
android:label="Glance"
android:configure="com.pranshulgg.weather_master_app.clockDateWidgetConfigActivity"
android:configure="com.pranshulgg.weather_master_app.ClockDateWidgetConfigActivity"
android:widgetCategory="home_screen" />
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-all.zip
2 changes: 1 addition & 1 deletion android/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pluginManagement {

plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.7.3" apply false
id("com.android.application") version "8.9.3" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ class _ExpressiveLoadingIndicatorState extends State<ExpressiveLoadingIndicator>
static const double _fullRotation = 360.0;

static const double _quarterRotation = _fullRotation / 4;
static const double _activeSize = 48; // based on source spec

late final List<Morph> _morphSequence;

Expand Down
28 changes: 17 additions & 11 deletions lib/controllers/froggy_img.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,22 @@ class WeatherFrogIconWidget extends StatelessWidget {

final isShowFrog = context.read<UnitSettingsNotifier>().showFrog;

return isShowFrog
? iconUrl!.startsWith('http')
? Image.network(
iconUrl!,
loadingBuilder: (context, child, loadingProgress) {
if (loadingProgress == null) return child;
return Text("loading_text".tr());
},
)
: Image.asset(iconUrl!)
: SizedBox.shrink();
if (!isShowFrog) {
return const SizedBox.shrink();
}

final url = iconUrl!;

if (url.startsWith('http')) {
return Image.network(
url,
loadingBuilder: (context, child, loadingProgress) {
if (loadingProgress == null) return child;
return Text("loading_text".tr());
},
);
}

return Image.asset(url);
}
}
36 changes: 20 additions & 16 deletions lib/controllers/gradient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,30 @@ class _ScrollReactiveGradientState extends State<ScrollReactiveGradient> {
AnimatedOpacity(
duration: const Duration(milliseconds: 300),
opacity: _isScrolled ? 0 : 1,
child: Container(
decoration: !useFullMaterialScheme
? BoxDecoration(
gradient: widget.baseGradient,
)
: BoxDecoration(
color:
Theme.of(context).colorScheme.surfaceContainerLow)),
child: RepaintBoundary(
child: Container(
decoration: !useFullMaterialScheme
? BoxDecoration(
gradient: widget.baseGradient,
)
: BoxDecoration(
color:
Theme.of(context).colorScheme.surfaceContainerLow)),
),
),
AnimatedOpacity(
duration: const Duration(milliseconds: 300),
opacity: _isScrolled ? 1 : 0,
child: Container(
decoration: !useFullMaterialScheme
? BoxDecoration(
gradient: widget.scrolledGradient,
)
: BoxDecoration(
color:
Theme.of(context).colorScheme.surfaceContainerLow)),
child: RepaintBoundary(
child: Container(
decoration: !useFullMaterialScheme
? BoxDecoration(
gradient: widget.scrolledGradient,
)
: BoxDecoration(
color:
Theme.of(context).colorScheme.surfaceContainerLow)),
),
),
],
);
Expand Down
Loading