Indeterminate Progress in DarkActionBar

Showing 1-13 of 13 messages
Indeterminate Progress in DarkActionBar Mark Andrachek, Jr. 3/7/12 10:30 PM
The default Indeterminate Progress indicator is, IMHO, too large. I much prefer the small one.

I figured out how to override this, and use Widget.Holo.ProgressBar.Small for v14+, but it appears there's no Widget.Sherlock.ProgressBar.Small.
So I copied the necessary assets from the SDK into my project, and created a values/styles.xml that looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<resources>

<style name="Light" parent="@style/Theme.Sherlock.Light.DarkActionBar">

    <item name="android:actionBarStyle">@style/ActionBarIPS</item>

</style>

<style name="IndeterminateProgress" parent="@style/Widget.Sherlock.ProgressBar">

    <item name="android:indeterminateDrawable">@drawable/progress_small_holo</item>

</style>

<style name="ActionBarIPS" parent="@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse">

    <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item>

</style>

</resources>


And a values-v14/styles.xml that looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<resources>

<style name="Light" parent="@android:style/Theme.Holo.Light.DarkActionBar">

    <item name="android:actionBarStyle">@style/ActionBarIPS</item>

</style>

<style name="IndeterminateProgress" parent="@android:style/Widget.ProgressBar.Small"/>

<style name="ActionBarIPS" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">

    <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item>

</style>

</resources>


This gives me the small progress drawable on ICS, but the emulator running 2.3.1, doesn't seem to pick up on the change. In fact, I tried changing out the drawable, so I could see if it was doing anything, and it doesn't appear to be.


So, question is, how can I get the small indeterminate progressbar in pre-ICS with the Light.DarkActionBar theme?


FWIW, I'm using ABS 4.0RC1, with support plugin.


Thanks,

Mark 

Re: Indeterminate Progress in DarkActionBar Shaversport 3/8/12 9:03 PM
Looks good, just override the styles that ABS uses when it's running, for example:

<style name="Light" parent="@style/Theme.Sherlock.Light.DarkActionBar">

    <item name="android:actionBarStyle">@style/ActionBarIPS</item>
    <item name="actionBarStyle">@style/ActionBarIPS</item>

</style>
Re: Indeterminate Progress in DarkActionBar Jake Wharton 3/8/12 9:04 PM
What he said. You just need to apply it to a non-prefixed version of the theme attribute so the compatibility action bar picks it up.

---
Jake Wharton
http://about.me/jakewharton
Re: Indeterminate Progress in DarkActionBar Mark Andrachek, Jr. 3/14/12 5:15 PM
Ok. I've tried this. It's now using my images! Thanks!

But the scaling is messed up. I have the hdpi and mdpi spinner_16_inner/outer_holo pngs from sdk 15 in their respective folders. And I copied the progress_small_holo.xml file for the layer list, from the sdk to my drawable directory.

It seems like it's always blowing the image up to fill the actionbar.  Or, rather, it's scaling the image to match some expected size.

The actionbar icon guideline docs state that icons should be 36x36 @ hdpi here http://developer.android.com/guide/practices/ui_guidelines/icon_design_action_bar.html, however the design site says they should be 32dp (32px @mdpi, 48px @hdpi). 

The indeterminateProgressDrawable isn't an icon, and doesn't appear to follow these rules in the native actionbar on  ICS, but it seems like this is what is happening with ABS.

Which size should I use at hdpi for ABS - 36x36, 48x48, or some other config?


Thanks,
Mark

PS, my working styles.xml now looks like:.

<?xml version="1.0" encoding="UTF-8"?>

<resources>

<style name="Light" parent="@style/Theme.Sherlock.Light.DarkActionBar">

    <item name="actionBarStyle">@style/ActionBarIPS</item>

    <item name="android:actionBarStyle">@style/ActionBarIPS</item>

</style>

<style name="ActionBarIPS" parent="@style/Widget.Sherlock.Light.ActionBar.Solid.Inverse">

    <item name="indeterminateProgressStyle">@style/IndeterminateProgress</item>

    <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item>

</style>

<style name="IndeterminateProgress" parent="@style/Widget.Sherlock.ProgressBar">

    <item name="android:indeterminateDrawable">@drawable/smallprogress</item>

</style>

</resources>

Re: Indeterminate Progress in DarkActionBar Thomas Bouron 3/22/12 1:35 AM
Hi!

I found this post through https://github.com/JakeWharton/ActionBarSherlock/issues/387 and i got the same issue here. It seems impossible to change the indeterminate progressbar size as it scales to fit the area.
Is there any solution/suggestion to fix this issue?

Thanks!

PS: I didn't create a ticket on GitHut as i don't have an account there.
Re: Indeterminate Progress in DarkActionBar Jake Wharton 3/28/12 9:12 AM
Try something like this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:addStatesFromChildren="true"
              android:focusable="true"
              android:paddingLeft="4dp"
              android:paddingRight="4dp"
              android:gravity="center"
              style="?attr/actionButtonStyle">
    <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:focusable="true"
            style="@android:style/Widget.ProgressBar.Small"/>
</LinearLayout>

---
Jake Wharton
http://about.me/jakewharton


Re: Indeterminate Progress in DarkActionBar Emanuel Moecklin 3/28/12 9:32 AM
Or take this from the Android sources:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center">
    <ProgressBar android:layout_width="32dp"
        android:layout_height="32dp"
        android:layout_marginLeft="12dp"
        android:layout_marginRight="12dp"
        android:layout_gravity="center"
        style="?android:attr/indeterminateProgressStyle" />
</FrameLayout>

Works nicely on 2.x, 3.x and 4.x.
Re: Indeterminate Progress in DarkActionBar Michael Ritchie 3/30/12 4:02 PM

You could do something like this (modifying your code for dark theme).  This uses the progress_small_holo.xml and associated images from the Android SDK (15):

    <style name="Dark" parent="Theme.Sherlock">

        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>

        <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>

    </style>

    <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar">

        <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item> 

    </style>

    <style name="IndeterminateProgress" parent="@android:style/Widget.ProgressBar.Small"> 

    <item name="android:indeterminateDrawable">@drawable/progress_small_holo</item> 

</style> 

Re: Indeterminate Progress in DarkActionBar Michael Ritchie 3/30/12 5:10 PM
Forgot one detail for non-prefixed versions:

<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar">

        <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item> 

        <item name="indeterminateProgressStyle">@style/IndeterminateProgress</item> 

    </style>

Re: Indeterminate Progress in DarkActionBar Michael Vogt 4/14/12 3:33 AM
Hi.

I followed your blog entry on this ( http://thanksmister.com/2012/03/30/change-default-progress-actionbarsherlock/ ), but the progress circle still shows up large and not small. I set the theme in the manifest to Theme.Sherlock. Is there anything else I need to set?

Thanks
Re: Indeterminate Progress in DarkActionBar Michael Vogt 5/28/12 3:05 PM
This is still not working for me. 

I put progress_small_holo.xml in the /drawable folder. I put the two PNG files in the various drawable folders (/drawable-*). My manifest has android:theme="@style/Theme.Sherlock" included in the application section. Yet still, my indeterminate progressbar is not small. when running version 8 (2.2) or 14 (ICS) Any idea what I'm missing?
Re: Indeterminate Progress in DarkActionBar Jake Wharton 5/28/12 3:21 PM
You need a custom progress style which inherits from Widget.Sherlock.ProgressBar and sets the drawable to your custom XML. Then you need to refer to that style in the indeterminateProgressStyle attribute of a custom action bar style. You can then specify that custom action bar style in a theme which extends a sherlock theme and update your manifest to use it.

Make sure you are using both android prefixed and unprefixed attributes in both the theme and action bar style so that it's picked up on both pre-ICS and post-ICS.


---
Jake Wharton
http://about.me/jakewharton


Re: Indeterminate Progress in DarkActionBar Michael Vogt 5/28/12 7:33 PM
Thank you for your reply.  I *think* I am doing this already, but it's still not working for me.

<resources>


    <style name="Dark" parent="Theme.Sherlock">
        <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
        <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
    </style>

    <style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar">
        <item name="android:indeterminateProgressStyle">@style/IndeterminateProgress</item>
        <item name="indeterminateProgressStyle">@style/IndeterminateProgress</item>
    </style>

    <style name="IndeterminateProgress" parent="Widget.Sherlock.ProgressBar">

       <item name="android:indeterminateDrawable">@drawable/progress_small_holo</item>
   </style>
</resources>