Skip to content

Commit

Permalink
android app: workaround for $<colors> and $<colors_light>
Browse files Browse the repository at this point in the history
bro I thought that those 3 lines at the end were some sorts of bug by (idk), but instead it was the android HTML implementation that doesn't understand what a double space is

it can be ready to merge now, maybe
  • Loading branch information
Toni500github committed Dec 11, 2024
1 parent 353fd00 commit 7e12aba
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import android.widget.RemoteViews
import androidx.core.text.HtmlCompat
import org.toni.customfetch_android.R


/**
* Implementation of App Widget functionality.
* App Widget Configuration implemented in [customfetchConfigureActivity]
Expand Down Expand Up @@ -52,7 +53,7 @@ class customfetch : AppWidgetProvider() {
val width = (widgetSize.getWidgetsSize(appWidgetId).first * 0.237f) // getWidgetSize(minWidthDp, maxWidthDp, context)
Log.d("widthTesting", "width = $width")
Log.d("wrappingTest", "disableLineWrap = $disableLineWrap")

val parsedContent = SpannableStringBuilder()
val arguments = loadTitlePref(context, appWidgetId)
val htmlContent = customfetchConfigureActivity().mainAndroid("customfetch $arguments")
Expand Down Expand Up @@ -131,8 +132,7 @@ class WidgetSizeProvider(
internal fun updateAppWidget(
context: Context,
appWidgetManager: AppWidgetManager,
appWidgetId: Int,
initConfigureActivity: Boolean = false
appWidgetId: Int
) {
// Construct the RemoteViews object
val views = RemoteViews(context.packageName, R.layout.customfetch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class customfetchConfigureActivity : Activity() {

// It is the responsibility of the configuration activity to update the app widget
val appWidgetManager = AppWidgetManager.getInstance(context)
updateAppWidget(context, appWidgetManager, appWidgetId, true)
updateAppWidget(context, appWidgetManager, appWidgetId)

// Make sure we pass back the original appWidgetId
val resultValue = Intent()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<string name="configure">Configure (insert command line options)</string>
<string name="add_widget">Add widget</string>
<string name="app_widget_description">This is an app widget description</string>
<string name="modules_list">display modules list</string>
<string name="disable_wrap_lines">disable wrapping (truncate) text (may be unstable)</string>
<string name="modules_list">Display modules list</string>
<string name="disable_wrap_lines">Truncate text (may be unstable)</string>
</resources>
8 changes: 8 additions & 0 deletions src/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,11 @@ void addValueFromModule(const std::string& moduleName, parse_args_t& parse_args)

if (sysInfo.at(moduleName).find(moduleMemberName) == sysInfo.at(moduleName).end())
{
#if !ANDROID_APP
SYSINFO_INSERT(parse("${\033[40m} ${\033[41m} ${\033[42m} ${\033[43m} ${\033[44m} ${\033[45m} ${\033[46m} ${\033[47m} ${0}", _, parse_args));
#else // bruh why the android HTML implementation gotta be so dumb
SYSINFO_INSERT(parse("${\033[40m}&nbsp;&nbsp;&nbsp;${\033[41m}&nbsp;&nbsp;&nbsp;${\033[42m}&nbsp;&nbsp;&nbsp;${\033[43m}&nbsp;&nbsp;&nbsp;${\033[44m}&nbsp;&nbsp;&nbsp;${\033[45m}&nbsp;&nbsp;&nbsp;${\033[46m}&nbsp;&nbsp;&nbsp;${\033[47m}&nbsp;&nbsp;&nbsp;${0}", _, parse_args));
#endif
}
}

Expand All @@ -1789,7 +1793,11 @@ void addValueFromModule(const std::string& moduleName, parse_args_t& parse_args)

if (sysInfo.at(moduleName).find(moduleMemberName) == sysInfo.at(moduleName).end())
{
#if !ANDROID_APP
SYSINFO_INSERT(parse("${\033[100m} ${\033[101m} ${\033[102m} ${\033[103m} ${\033[104m} ${\033[105m} ${\033[106m} ${\033[107m} ${0}", _, parse_args));
#else
SYSINFO_INSERT(parse("${\033[100m}&nbsp;&nbsp;&nbsp;${\033[101m}&nbsp;&nbsp;&nbsp;${\033[102m}&nbsp;&nbsp;&nbsp;${\033[103m}&nbsp;&nbsp;&nbsp;${\033[104m}&nbsp;&nbsp;&nbsp;${\033[105m}&nbsp;&nbsp;&nbsp;${\033[106m}&nbsp;&nbsp;&nbsp;${\033[107m}&nbsp;&nbsp;&nbsp;${0}", _, parse_args));
#endif
}
}

Expand Down

0 comments on commit 7e12aba

Please sign in to comment.