Skip to content

Commit

Permalink
fix: some widget sting newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
rebelonion committed Mar 28, 2024
1 parent ea678ef commit 7951c2c
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 24 deletions.
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
android:resource="@xml/upcoming_widget_info" />
</receiver>
<activity
android:name=".widgets.upcoming.UpcomingWidgetConfigureActivity"
android:name=".widgets.upcoming.UpcomingWidgetConfigure"
android:exported="true">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ class ProfileStatsConfigure : AppCompatActivity(),
extras.getInt(SimpleColorDialog.COLOR)
)
.apply()
(binding.topBackgroundButton as MaterialButton).iconTint =
ColorStateList.valueOf(extras.getInt(SimpleColorDialog.COLOR))
}

ProfileStatsWidget.PREF_BACKGROUND_FADE -> {
Expand All @@ -227,6 +229,8 @@ class ProfileStatsConfigure : AppCompatActivity(),
extras.getInt(SimpleColorDialog.COLOR)
)
.apply()
(binding.bottomBackgroundButton as MaterialButton).iconTint =
ColorStateList.valueOf(extras.getInt(SimpleColorDialog.COLOR))
}

ProfileStatsWidget.PREF_TITLE_TEXT_COLOR -> {
Expand All @@ -239,6 +243,8 @@ class ProfileStatsConfigure : AppCompatActivity(),
extras.getInt(SimpleColorDialog.COLOR)
)
.apply()
(binding.titleColorButton as MaterialButton).iconTint =
ColorStateList.valueOf(extras.getInt(SimpleColorDialog.COLOR))
}

ProfileStatsWidget.PREF_STATS_TEXT_COLOR -> {
Expand All @@ -251,6 +257,8 @@ class ProfileStatsConfigure : AppCompatActivity(),
extras.getInt(SimpleColorDialog.COLOR)
)
.apply()
(binding.statsColorButton as MaterialButton).iconTint =
ColorStateList.valueOf(extras.getInt(SimpleColorDialog.COLOR))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class ProfileStatsWidget : AppWidgetProvider() {
)
setTextViewText(
R.id.topRightLabel,
context.getString(R.string.episodes_watched)
context.getString(R.string.episodes_watched_n)
)

setTextViewText(
Expand All @@ -191,7 +191,7 @@ class ProfileStatsWidget : AppWidgetProvider() {
)
setTextViewText(
R.id.bottomRightLabel,
context.getString(R.string.chapters_read)
context.getString(R.string.chapters_read_n)
)

val intent = Intent(context, ProfileActivity::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import android.graphics.drawable.GradientDrawable
import android.net.Uri
import android.os.Bundle
import android.widget.RemoteViews
import androidx.core.content.ContextCompat
import androidx.core.content.res.ResourcesCompat
import ani.dantotsu.MainActivity
import ani.dantotsu.R
Expand All @@ -19,7 +18,7 @@ import ani.dantotsu.widgets.WidgetSizeProvider

/**
* Implementation of App Widget functionality.
* App Widget Configuration implemented in [UpcomingWidgetConfigureActivity]
* App Widget Configuration implemented in [UpcomingWidgetConfigure]
*/
class UpcomingWidget : AppWidgetProvider() {
override fun onUpdate(
Expand Down Expand Up @@ -118,7 +117,7 @@ class UpcomingWidget : AppWidgetProvider() {
PendingIntent.getActivity(
context,
1,
Intent(context, UpcomingWidgetConfigureActivity::class.java).apply {
Intent(context, UpcomingWidgetConfigure::class.java).apply {
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
},
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import eltos.simpledialogfragment.color.SimpleColorDialog
/**
* The configuration screen for the [UpcomingWidget] AppWidget.
*/
class UpcomingWidgetConfigureActivity : AppCompatActivity(),
class UpcomingWidgetConfigure : AppCompatActivity(),
SimpleDialog.OnDialogResultListener {
private var appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID
private var isMonetEnabled = false
private var onClickListener = View.OnClickListener {
val context = this@UpcomingWidgetConfigureActivity
val context = this@UpcomingWidgetConfigure
val appWidgetManager = AppWidgetManager.getInstance(context)

updateAppWidget(
Expand Down Expand Up @@ -55,7 +55,7 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
SimpleColorDialog().title(R.string.custom_theme)
.colorPreset(topBackground)
.colors(
this@UpcomingWidgetConfigureActivity,
this@UpcomingWidgetConfigure,
SimpleColorDialog.MATERIAL_COLOR_PALLET
)
.setupColorWheelAlpha(true)
Expand All @@ -64,7 +64,7 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
.gridNumColumn(5)
.choiceMode(SimpleColorDialog.SINGLE_CHOICE)
.neg()
.show(this@UpcomingWidgetConfigureActivity, tag)
.show(this@UpcomingWidgetConfigure, tag)
}
val bottomBackground = prefs.getInt(UpcomingWidget.PREF_BACKGROUND_FADE, Color.parseColor("#00000000"))
(binding.bottomBackgroundButton as MaterialButton).iconTint = ColorStateList.valueOf(bottomBackground)
Expand All @@ -73,7 +73,7 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
SimpleColorDialog().title(R.string.custom_theme)
.colorPreset(bottomBackground)
.colors(
this@UpcomingWidgetConfigureActivity,
this@UpcomingWidgetConfigure,
SimpleColorDialog.MATERIAL_COLOR_PALLET
)
.setupColorWheelAlpha(true)
Expand All @@ -82,7 +82,7 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
.gridNumColumn(5)
.choiceMode(SimpleColorDialog.SINGLE_CHOICE)
.neg()
.show(this@UpcomingWidgetConfigureActivity, tag)
.show(this@UpcomingWidgetConfigure, tag)
}
val titleTextColor = prefs.getInt(UpcomingWidget.PREF_TITLE_TEXT_COLOR, Color.WHITE)
(binding.titleColorButton as MaterialButton).iconTint = ColorStateList.valueOf(titleTextColor)
Expand All @@ -91,15 +91,15 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
SimpleColorDialog().title(R.string.custom_theme)
.colorPreset(titleTextColor)
.colors(
this@UpcomingWidgetConfigureActivity,
this@UpcomingWidgetConfigure,
SimpleColorDialog.MATERIAL_COLOR_PALLET
)
.allowCustom(true)
.showOutline(0x46000000)
.gridNumColumn(5)
.choiceMode(SimpleColorDialog.SINGLE_CHOICE)
.neg()
.show(this@UpcomingWidgetConfigureActivity, tag)
.show(this@UpcomingWidgetConfigure, tag)
}
val countdownTextColor = prefs.getInt(UpcomingWidget.PREF_COUNTDOWN_TEXT_COLOR, Color.WHITE)
(binding.countdownColorButton as MaterialButton).iconTint = ColorStateList.valueOf(countdownTextColor)
Expand All @@ -108,15 +108,15 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
SimpleColorDialog().title(R.string.custom_theme)
.colorPreset(countdownTextColor)
.colors(
this@UpcomingWidgetConfigureActivity,
this@UpcomingWidgetConfigure,
SimpleColorDialog.MATERIAL_COLOR_PALLET
)
.allowCustom(true)
.showOutline(0x46000000)
.gridNumColumn(5)
.choiceMode(SimpleColorDialog.SINGLE_CHOICE)
.neg()
.show(this@UpcomingWidgetConfigureActivity, tag)
.show(this@UpcomingWidgetConfigure, tag)
}
binding.useAppTheme.setOnCheckedChangeListener { _, isChecked ->
isMonetEnabled = isChecked
Expand Down Expand Up @@ -186,6 +186,8 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
extras.getInt(SimpleColorDialog.COLOR)
)
.apply()
(binding.topBackgroundButton as MaterialButton).iconTint =
ColorStateList.valueOf(extras.getInt(SimpleColorDialog.COLOR))
}

UpcomingWidget.PREF_BACKGROUND_FADE -> {
Expand All @@ -198,6 +200,8 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
extras.getInt(SimpleColorDialog.COLOR)
)
.apply()
(binding.bottomBackgroundButton as MaterialButton).iconTint =
ColorStateList.valueOf(extras.getInt(SimpleColorDialog.COLOR))
}

UpcomingWidget.PREF_TITLE_TEXT_COLOR -> {
Expand All @@ -210,6 +214,8 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
extras.getInt(SimpleColorDialog.COLOR)
)
.apply()
(binding.titleColorButton as MaterialButton).iconTint =
ColorStateList.valueOf(extras.getInt(SimpleColorDialog.COLOR))
}

UpcomingWidget.PREF_COUNTDOWN_TEXT_COLOR -> {
Expand All @@ -222,6 +228,8 @@ class UpcomingWidgetConfigureActivity : AppCompatActivity(),
extras.getInt(SimpleColorDialog.COLOR)
)
.apply()
(binding.countdownColorButton as MaterialButton).iconTint =
ColorStateList.valueOf(extras.getInt(SimpleColorDialog.COLOR))
}

}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/widget_stats_rounded.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</shape>
</item>
<item
android:left="-2dp"
android:right="-2dp"
android:left="-3dp"
android:right="-3dp"
android:bottom="-50dp">
<shape>
<stroke android:width="2dp" android:color="@color/bg_white" />
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/statistics_widget.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
android:layout_gravity="center"
android:gravity="center"
android:fontFamily="@font/poppins_semi_bold"
android:text="@string/episodes_watched"/>
android:text="@string/episodes_watched_n"/>
</LinearLayout>
</LinearLayout>

Expand Down Expand Up @@ -181,7 +181,7 @@
android:layout_gravity="center"
android:gravity="center"
android:fontFamily="@font/poppins_semi_bold"
android:text="@string/chapters_read"/>
android:text="@string/chapters_read_n"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@

<string name="username">Username</string>
<string name="chapters_read">"Chapters Read "</string>
<string name="chapters_read_n">"Chapters\nRead "</string>
<string name="episodes_watched">"Episodes Watched "</string>
<string name="episodes_watched_n">"Episodes\nWatched "</string>
<string name="continue_reading">Continue Reading</string>
<string name="continue_watching">Continue Watching</string>
<string name="recommended">Recommended</string>
Expand Down Expand Up @@ -822,8 +824,8 @@ Non quae tempore quo provident laudantium qui illo dolor vel quia dolor et exerc
<string name="password">Password</string>

<string name="profile_stats_widget">Track progress directly from your home screen</string>
<string name="anime_watched">Anime Watched</string>
<string name="manga_read">Manga Read</string>
<string name="anime_watched">Anime\nWatched</string>
<string name="manga_read">Manga\nRead</string>
<string name="loading">Loading…</string>
<string name="user_stats">%1$s\'s Stats</string>

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml-v31/upcoming_widget_info.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/upcoming_anime"
android:configure="ani.dantotsu.widgets.upcoming.UpcomingWidgetConfigureActivity"
android:configure="ani.dantotsu.widgets.upcoming.UpcomingWidgetConfigure"
android:initialKeyguardLayout="@layout/upcoming_widget"
android:initialLayout="@layout/upcoming_widget"
android:minWidth="160dp"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/xml/upcoming_widget_info.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/upcoming_anime"
android:configure="ani.dantotsu.widgets.upcoming.UpcomingWidgetConfigureActivity"
android:configure="ani.dantotsu.widgets.upcoming.UpcomingWidgetConfigure"
android:initialKeyguardLayout="@layout/upcoming_widget"
android:initialLayout="@layout/upcoming_widget"
android:minWidth="160dp"
Expand Down

2 comments on commit 7951c2c

@rebelonion
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly it doesn't look too bad with 2 lines.
and there was extra space.

@rebelonion
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try the shorter version too

Please sign in to comment.