Skip to content

Commit

Permalink
Widgets: Remove option to create StackWidgets
Browse files Browse the repository at this point in the history
StackWidgets have been unfortunately been very unreliable on multiple phones,
and fixing it does not appear to be simple. This commit removes the ability
to create new StackWidgets, but existing ones should remain functional.
  • Loading branch information
iSoron committed May 1, 2023
1 parent b76da35 commit 1df9cc7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import android.appwidget.AppWidgetManager.EXTRA_APPWIDGET_ID
import android.appwidget.AppWidgetManager.INVALID_APPWIDGET_ID
import android.content.Intent
import android.os.Bundle
import android.widget.AbsListView.CHOICE_MODE_MULTIPLE
import android.widget.ArrayAdapter
import android.widget.Button
import android.widget.ListView
Expand All @@ -34,7 +33,6 @@ import org.isoron.uhabits.R
import org.isoron.uhabits.activities.AndroidThemeSwitcher
import org.isoron.uhabits.core.preferences.WidgetPreferences
import org.isoron.uhabits.widgets.WidgetUpdater
import java.util.ArrayList

class BooleanHabitPickerDialog : HabitPickerDialog() {
override fun shouldHideNumerical() = true
Expand Down Expand Up @@ -88,20 +86,12 @@ open class HabitPickerDialog : Activity() {
with(listView) {
adapter = ArrayAdapter(
context,
android.R.layout.simple_list_item_multiple_choice,
android.R.layout.simple_list_item_1,
habitNames
)
choiceMode = CHOICE_MODE_MULTIPLE
itemsCanFocus = false
}
saveButton.setOnClickListener {
val selectedIds = mutableListOf<Long>()
for (i in 0..listView.count) {
if (listView.isItemChecked(i)) {
selectedIds.add(habitIds[i])
}
setOnItemClickListener { parent, view, position, id ->
confirm(mutableListOf(habitIds[position]))
}
confirm(selectedIds)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,4 @@
android:layout_weight="1">
</ListView>

<Button
android:id="@+id/buttonSave"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="@string/save"/>

</LinearLayout>

4 comments on commit 1df9cc7

@fillwithjoy1
Copy link

Choose a reason for hiding this comment

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

Hey @iSoron
Will stacked widgets ever be making a comeback? Or will it be removed forever?
Thanks

@Spiralo-Idioide
Copy link

Choose a reason for hiding this comment

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

Hey @iSoron Will stacked widgets ever be making a comeback? Or will it be removed forever? Thanks

Same question here. It allows to have a better usage of space on the home screen.

@iSoron
Copy link
Owner Author

@iSoron iSoron commented on 1df9cc7 Feb 26, 2024

Choose a reason for hiding this comment

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

@fillwithjoy1 @Spiralo-Idioide I spent significant amount of time trying to make stack widgets stable across multiple phones, but I haven't been successful, so I won't be working on this feature anymore. If someone is willing to fix these issues and submit a pull request, I will consider re-adding the feature.

@20manas
Copy link

@20manas 20manas commented on 1df9cc7 Apr 5, 2024

Choose a reason for hiding this comment

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

Hi @iSoron, perhaps the better approach here would be to re-enable the feature and mention that the widget may not work as expected (perhaps it can be marked as beta?). For example, the problem that I encountered was: in my device I switched to a new launcher, but I'm unable to create a new stacked widget even though the stacked widget works perfectly fine on my device. Re-enabling the stacked widget will allow most users (assuming most users have devices which supports the functionality of the widget) to use the widget.

Please sign in to comment.