-
-
Notifications
You must be signed in to change notification settings - Fork 11
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 release-0.5.6
- Loading branch information
Showing
13 changed files
with
176 additions
and
10 deletions.
There are no files selected for viewing
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
62 changes: 62 additions & 0 deletions
62
app/src/main/java/com/forrestguice/suntimeswidget/views/Toast.java
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,62 @@ | ||
/** | ||
Copyright (C) 2022 Forrest Guice | ||
This file is part of SuntimesCalendars. | ||
SuntimesCalendars is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SuntimesCalendars is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with SuntimesCalendars. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.forrestguice.suntimeswidget.views; | ||
|
||
import android.annotation.SuppressLint; | ||
import android.content.Context; | ||
import android.os.Build; | ||
import android.view.View; | ||
import android.widget.TextView; | ||
|
||
import com.forrestguice.suntimescalendars.R; | ||
|
||
/** | ||
* Custom toast methods.. applies version specific bug-fixes to Toast messages. | ||
* bug: [Android 13 dark theme toasts white on white](https://issuetracker.google.com/issues/245108402) | ||
*/ | ||
public class Toast | ||
{ | ||
public static final int LENGTH_LONG = android.widget.Toast.LENGTH_LONG; | ||
public static final int LENGTH_SHORT = android.widget.Toast.LENGTH_SHORT; | ||
|
||
/** | ||
* Applies `backgroundResource` and `textAppearance` for api33+ (and targetSdk is under than 30). | ||
*/ | ||
@SuppressLint("ShowToast") | ||
public static android.widget.Toast makeText(Context context, CharSequence text, int duration) | ||
{ | ||
android.widget.Toast toast = android.widget.Toast.makeText(context, text, duration); | ||
if (context.getApplicationContext().getApplicationInfo().targetSdkVersion < 30) | ||
{ | ||
if (Build.VERSION.SDK_INT >= 33) | ||
{ | ||
View v = toast.getView(); // Toast.getView will return null for targetApi R+ | ||
if (v != null) | ||
{ | ||
v.setBackgroundResource(R.drawable.toast_frame); | ||
TextView message = (TextView) v.findViewById(android.R.id.message); | ||
if (message != null) { | ||
message.setTextAppearance(R.style.ToastTextAppearance); | ||
} | ||
} | ||
} | ||
} | ||
return toast; | ||
} | ||
} |
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,20 @@ | ||
<!--/* Copyright 2017, The Android Open Source Project | ||
** | ||
** Licensed under the Apache License, Version 2.0 (the "License"); | ||
** you may not use this file except in compliance with the License. | ||
** You may obtain a copy of the License at | ||
** | ||
** http://www.apache.org/licenses/LICENSE-2.0 | ||
** | ||
** Unless required by applicable law or agreed to in writing, software | ||
** distributed under the License is distributed on an "AS IS" BASIS, | ||
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
** See the License for the specific language governing permissions and | ||
** limitations under the License. | ||
*/ | ||
--> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="rectangle"> | ||
<solid android:color="?android:attr/colorControlNormal" /> | ||
<corners android:radius="28dp" /> | ||
</shape> |
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,4 @@ | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> | ||
<solid android:color="#FF424242" /> | ||
<corners android:radius="28dp" /> | ||
</shape> |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="hr">@color/hr_dark</color> | ||
<color name="text_accent">@color/text_accent_dark</color> | ||
<color name="text_disabled">@color/text_disabled_dark</color> | ||
</resources> |
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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<drawable name="ic_action_calendar_ref">@drawable/ic_action_calendar</drawable> | ||
<drawable name="ic_action_update_ref">@drawable/ic_action_update</drawable> | ||
<drawable name="ic_action_about_ref">@drawable/ic_action_about</drawable> | ||
<drawable name="ic_action_settings_ref">@drawable/ic_action_settings</drawable> | ||
<drawable name="ic_action_help_ref">@drawable/ic_action_help</drawable> | ||
</resources> |
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,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<style name="AppTheme.System" parent="AppTheme.System.Base"> | ||
<item name="toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item> | ||
<item name="bottomSheetDialogTheme">@style/Theme.Design.BottomSheetDialog</item> | ||
</style> | ||
</resources> |
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,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<style name="ToastTextAppearance"> | ||
<item name="android:textColor">?android:attr/textColorPrimary</item> | ||
<item name="android:textSize">14sp</item> | ||
<item name="android:fontFamily">sans-serif</item> | ||
</style> | ||
</resources> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<drawable name="ic_action_calendar_ref">@drawable/ic_action_calendar_light</drawable> | ||
<drawable name="ic_action_update_ref">@drawable/ic_action_update_light</drawable> | ||
<drawable name="ic_action_about_ref">@drawable/ic_action_about_light</drawable> | ||
<drawable name="ic_action_settings_ref">@drawable/ic_action_settings_light</drawable> | ||
<drawable name="ic_action_help_ref">@drawable/ic_action_help_light</drawable> | ||
</resources> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
#Sun Dec 09 20:25:10 MST 2018 | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-all.zip |