cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Bowser <bows...@gmail.com>
Subject Re: [Android] Config.xml Android Preference Issues
Date Thu, 31 Jan 2013 18:34:26 GMT
So, right now I have this for the splashscreen:

    <preference name="splashscreen" value="splash" />

And I have this in Config.java for splashscreen prefs:

                        String value = xml.getAttributeValue(null, "value");

                        int resource = 0;

                        if (value != null)
                        {
                            value = "splash";
                        }

                        resource =
action.getResources().getIdentifier(value, "drawable",
action.getPackageName());

                        action.getIntent().putExtra(name, resource);

So, this way you can just specify the name.  We could add the
extension, but we'll just strip that off anyway, since it's not
relevant as long as it's one of the supported Android types.  We could
do error checking on that.


On Wed, Jan 30, 2013 at 9:29 PM, Joe Bowser <bowserj@gmail.com> wrote:
> You can get the ID at runtime.  That's actually how the config class works.
>
> Perhaps there should be some cross-platform settings for the
> splashscreen with all the orientations & resolutions.  I honestly
> think that we shouldn't have a splashscreen setting and that instead
> the user just has to copy them or use the CLI to do it.  That way they
> have less rope to hang themselves.
>
>
> On Wed, Jan 30, 2013 at 7:49 PM, Andrew Grieve <agrieve@chromium.org> wrote:
>> I think you can get the id at runtime via:
>> http://steven.bitsetters.com/2007/11/27/accessing-android-resources-by-name-at-runtime/
>>
>> Or, have a build step copies the file they list into
>> res/drawable/splash.png. Might be nice if there were x-platform config.xml
>> settings for the splashscreen with all orientations & resolutions, and have
>> CLI put them in the correct spot.
>>
>>
>> On Wed, Jan 30, 2013 at 10:38 PM, Simon MacDonald <simon.macdonald@gmail.com
>>> wrote:
>>
>>> I think we should make it a bit more smart. Would using reflection to
>>> determine the value of R.drawable.splash be out of the question?
>>>
>>> Simon Mac Donald
>>> http://hi.im/simonmacdonald
>>>
>>>
>>> On Wed, Jan 30, 2013 at 6:30 PM, Joe Bowser <bowserj@gmail.com> wrote:
>>>
>>> > BTW: This does technically work for displaying a splashscreen:
>>> >
>>> >     <preference name="splashscreen" value="0x7f020009" />
>>> >
>>> > That being said, you'd have to look in R.java to see what this value
>>> > should be.  We should make this a bit more smart.
>>> >
>>> > Thoughts???
>>> >
>>> > Joe
>>> >
>>> > On Wed, Jan 30, 2013 at 2:30 PM, Joe Bowser <bowserj@gmail.com> wrote:
>>> > > Hey
>>> > >
>>> > > I just went added some code to the config class, and I noticed that
>>> > > certain things don't make any sense.  For example, we currently have
>>> > > this in DroidGap.java:
>>> > >
>>> > >             super.setIntegerProperty("splashscreen",
>>> > > R.drawable.splash); // load splash.jpg image from the resource
>>> > > drawable directory
>>> > >
>>> > > Now, R.drawable.splash is an integer property, but I can't put that
in
>>> > > config.xml.   Instead it would be the integer value, however the
>>> > > integer value doesn't work.  Should we somehow make this
>>> > > non-configurable so that it always has to use splash.jpg?  I don't
>>> > > think that giving the users the choice on what resource to use in
>>> > > config.xml is worth the possible goofiness that could happen with
>>> > > this.
>>> > >
>>> > > Also, on another note.  Currently background colors are represented
in
>>> > > hex on Android, similar to HTML colors.  The first byte is the Alpha
>>> > > Levels, with the following bytes representing RGB values similar to
>>> > > the web. Is this fine for setBackgroundColor?  Or should we figure
out
>>> > > how to eliminate the alpha byte?
>>> > >
>>> > > Joe
>>> >
>>>

Mime
View raw message