I've been working on a remodel of the overall UI of the NST/G for awhile, but as usual I did the easy stuff first, got cocky, and then got caught.
Here is the stock status bar:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Here is the stock status bar in the stock Reader:
OK, just to be totally clear this is what the status bars look like after NookManager gets through with the device, with the "back" and "menu" buttons added in the main bar.
Now the problem. Here's what I've got:
So...the clock is missing. I'm pretty sure it's still there, but the text color is white and that won't show up against the white background. (none of my changes have any effect on the Reader status bar where, of course, the clock time is black. I don't want to do anything with the Reader status bar version).
All of my changes are really changes in icons. The clock is not an icon (a widget?). My reading suggests that the layout for the status bar should be in the framework-res.apk, specifically res/layout/status_bar.xml (attached zip), but unlike the many examples I've seen, there is no mention of the clock. In fact I'm not even sure the xml file attached is controlling the layout of the stock status bar.
I've gone through system apps and jars looking for references to the status bar clock. I skipped the B&N apps because I have a device with all the B&N apps removed and there is still a clock on the status bar.
There is no comparable layout file in the Reader app for the status bar, so no way to compare.
I'm still looking but if there is anyone with an insight into Android 2.1 and where something like the clock display might hide, I'd like to hear about it.
In framework-res.apk:
Code:
style/TextAppearance.StatusBarTitle
textColor = ?textColorPrimary
textColorPrimary = @color/primary_text_dark
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:color="@color/bright_foreground_dark" />
<item android:state_enabled="false" android:color="@color/bright_foreground_dark_disabled" />
</selector>
color/bright_foreground_dark = #ffffffff
Just change it directly in the style: #ff000000
Renate said:
In framework-res.apk:
Code:
style/TextAppearance.StatusBarTitle
textColor = ?textColorPrimary
textColorPrimary = @color/primary_text_dark
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:color="@color/bright_foreground_dark" />
<item android:state_enabled="false" android:color="@color/bright_foreground_dark_disabled" />
</selector>
color/bright_foreground_dark = #ffffffff
Just change it directly in the style: #ff000000
Click to expand...
Click to collapse
OK, I understand the concept but not the execution. There is currently no style "TextAppearance.StatusBarTitle." Am I to create that? If so, wouldn't I need to refer to it in the status_bar.xml?
I do not understand the <selector> statement at all (except at face value). I have that "xmlns:android="http://schemas.android.com/apk/res/android" business at the top of the status_bar.xml but no "selector" tag. Maybe that's the reference I just mentioned in the previous paragraph.
Or.....should I just go into the colors and change "bright_foreground_dark" to #ff000000. That seems risky. That would then apply to everything governed by the framework-res.apk. I think.
Edit: nope, that last idea apparently does nothing.
This is in 1.2.2 FWR res/values/styles.xml TextAppearance.StatusBarTitle
res/color/primary_text_dark.xml is a selector
Renate said:
This is in 1.2.2 FWR res/values/styles.xml TextAppearance.StatusBarTitle
res/color/primary_text_dark.xml is a selector
Click to expand...
Click to collapse
Wow... "Never use Windows Notepad for a search" appears to be the moral. Notepad++ went right to it. How embarrassing.
So this is the current entry:
Code:
<style name="TextAppearance.StatusBarTitle" parent="@style/TextAppearance">
<item name="textAppearance">?textAppearanceSmall</item>
<item name="textStyle">bold</item>
<item name="textColor">?textColorPrimary</item>
</style>
I've located color/primary_text_dark.xml and I see that it contains the selector. So far so good. I've changed colors/bright_foreground_dark to #ff000000.
Which leaves me with an extra puzzle piece:
Code:
textColorPrimary = @color/primary_text_dark
Is that substituted for "textColor"? Or is it an added line in the style?
There are four levels of indirection, each shown in its own chunk.
Renate said:
There are four levels of indirection, each shown in its own chunk.
Click to expand...
Click to collapse
Truer words were never typed.
Edit: I see.
Code:
textColorPrimary = @color/primary_text_dark
is in /res/values/styles.
Therefore it seems the only thing to do is change the color value res/values/colors/bright_foreground_dark which I've done.
....And, it doesn't work. So I have misunderstood.
Apparently it's not there.
Renate said:
Apparently it's not there.
Click to expand...
Click to collapse
No, the whole thing is wonky. The examples I've seen (admittedly only back as far as ICS) all have explicit "clock" statements in the status bar layout xml. This has none. The clock just magically appears in that upper right hand corner.
In any case, I don't see how changing any of the things I've tried would do any good as I can't find any references to the style "TextAppearance.StatusBarTitle." So if no layout xml is referring to it, what good is changing it?
I'm close to "Uncle", but the illogic and obfuscation of the whole thing has inflamed my ire, so I'll keep poking around for something, although I have no idea what.
Edit: Oh boy....Changing that text color did have an effect, it just took me awhile to find it. Any system stuff that has a black background, like the App Manager, used to have white text. Now it has black text or "no" text for practical purposes. Cast too large a net.
Would you settle for lime green?
services.jar, smali/com/android/server/status/StatusBarIcon.smali
Code:
const/high16 v6, 0x41800000 # 16.0f
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setTextSize(F)V
const v7, 0xff00ff00 # Line added for lime green
.line 46
invoke-virtual {v4, v7}, Landroid/widget/TextView;->setTextColor(I)V
Renate said:
Would you settle for lime green?
View attachment 5681603
services.jar, smali/com/android/server/status/StatusBarIcon.smali
Code:
const/high16 v6, 0x41800000 # 16.0f
invoke-virtual {v4, v6}, Landroid/widget/TextView;->setTextSize(F)V
const v7, 0xff00ff00 # Line added for lime green
.line 46
invoke-virtual {v4, v7}, Landroid/widget/TextView;->setTextColor(I)V
Click to expand...
Click to collapse
I think that phenolphthalein pink would be my choice if the screen were colored
Now see, I had services.jar in my sights and even looked at the smali file in question. But it was just too obscure for me. So thank you.
This works (but you knew that) and I am, once again, in your debt. Now I can finish my project instead of setting it aside. For the rest I am on ground I know well.
Yay !!!
another new project @nmyshkin ?
aiamuzz said:
Yay !!!
another new project @nmyshkin ?
Click to expand...
Click to collapse
Yep. I managed to score a pristine BNRV350 from ebay for $20. Totally blind purchase, no response from the seller, but something made me push that button...
It turned out to be a unit from near the end of the run when much of the "grayness" of the background had been addressed and there are no light diffusion artifacts! Like night and day compared to the first NSTG I got. This one's a keeper. It will become my principal reader.
So....I thought....the NSTG is 10 years old this year. Maybe time for a little "makeover"?
The status bar was the first step. I'm almost done with the last part. Just some complications in programming due the non-functional media scanner on the device.
You'll see. Soon.
nmyshkin said:
Yep. I managed to score a pristine BNRV350 from ebay for $20. Totally blind purchase, no response from the seller, but something made me push that button...
It turned out to be a unit from near the end of the run when much of the "grayness" of the background had been addressed and there are no light diffusion artifacts! Like night and day compared to the first NSTG I got. This one's a keeper. It will become my principal reader.
So....I thought....the NSTG is 10 years old this year. Maybe time for a little "makeover"?
The status bar was the first step. I'm almost done with the last part. Just some complications in programming due the non-functional media scanner on the device.
You'll see. Soon.
Click to expand...
Click to collapse
Congrats for the great deal.
Even after so many years, my attachment to this device has only gotten deeper, just can't let go, it's stood the test of time, throw any hack at it and it stands tall and strong ... The device may perish, but it's spirit stands unbroken and appealing, that's the reason I've always gone back to purchasing it.
Look forward to this redesign project ... @nmyshkin ... Were you managing the mods uptill now on a non glowlight NST ?
aiamuzz said:
Look forward to this redesign project ... @nmyshkin ... Were you managing the mods uptill now on a non glowlight NST ?
Click to expand...
Click to collapse
It's all the same except for working around the glowlight function if you want to reassign a long-press of the "n" button. I solved that problem back with QuickTiles by synthesizing the sequence that turns on and off the light as well as the sequence that changes the status bar icon.
I've since come full circle and decided it's easier to stay with the hardware on that issue and use NTMM to arrange things the way I want.
But, no, my development device has been the older NSTG running FW 1.2.1 for some time. I chose that option because 1) I didn't like the look of the really gray screen for reading and 2) it is necessary to re-sign Tasker to get it to install on FW 1.2.2, but if you do, then none of the plugin options function properly and that makes it difficult to debug routines before compiling the app (where the plugins will work just fine on any FW).
So the older NSTG still has a very important purpose.
Related
I've made a new small Today Plugin, which makes of XML Files like this
Code:
<?xml version="1.0" ?>
<today height="100">
<AnalogClock x="0" y="0" clockface="blueclockface100.bmp" />
<AnalogClock x="200" y="0" clockface="blueclockface40.bmp" />
<Text x="210" y="40" text="Korea">
<Font size="8" />
</Text>
<AnalogClock x="200" y="50" clockface="blueclockface40.bmp" />
<Text x="210" y="90" text="Mexiko">
<Font size="8" />
</Text>
<DigitalClock x="160" y="120" format="hh:mm" />
<Image x="110" y="3" source="ical.png" />
<Date x="130" y="23" format="d">
<Font size="20" weight="bold" font="Tahoma" />
</Date>
<Text x="90" y="85" text="(c) by Andre Adrian" />
</today>
a screen like this (the part with the analog clocks):
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I would like to here your ideas for such a thing.
sincerely,
Andre
Download Page at rotlaus.de
good work ! thanks
Fixed some Bugs, runs a lot more stable now. Skin is choosable in the INI File in the Program Directory. Settings Dialog is prepared.
I've put the actual Version in the First Post.
Very nice! For some reason it does not load for me, gotta play with it when I wake up today.
This plugin is what i have been looking for. And it is very customizeable too.
Thanks a lot Rotlaus.
EDIT: my xda mini's display hangs after a few minutes when i use the plugin.
oldsap said:
EDIT: my xda mini's display hangs after a few minutes when i use the plugin.
Click to expand...
Click to collapse
Yeah, should be fixed in the new version.
New:
Tap&Hold Menu with 2 choices:
- Options Dialog (Nothin there yet)
- Reload Skinfile (usefule while skinning)
Attachementt in the first post actualized.
Version 0.1.3 now available
Neu:
Transparency color can be freely choosen::
Code:
<today height="100" transparent="RGB(255,0,255)">
DigitalClock, Date and Text Elements can have their own color:
Code:
<DigitalClock x="160" y="20" format="hh:mm" color="RGB(0, 255 ,0)" />
<Date x="130" y="23" format="d.M.yyyy" color="RGB(128, 255 ,0)">
<Text x="90" y="85" text="(c) by Andre Adrian" color="RGB(0, 255 ,0)" />
The Hands of the AnalogClock can be coloured individually and can be switched on or off:
Code:
<AnalogClock x="0" y="0" clockface="blueclockface100.bmp">
<Hourhand color="RGB(255, 255 ,0)" />
<Minutehand color="RGB(255, 255 ,0)" />
<Secondhand show="false" />
</AnalogClock>
All these Parameters are optional.
Thanks for the new version Rotlaus
ive posted it on my blog
http://oldsap.blogspot.com/2006/06/rltoday-freeware-pocketpc.html
Thanks rotlaus, takes me back to my ms smartphone days = when I used to design my home screen through xml!! I still love my spv c500 . I will enjoy fiddling with this and getting it set up the way I like it - cheers!
EDIT This is what i managed to do :wink:
EDIT 2 It would be good if when you clicked on the plugin that one of the options be the clock\alarm settings screen - thanks
meschle said:
Thanks rotlaus, takes me back to my ms smartphone days = when I used to design my home screen through xml!! I still love my spv c500 .
Click to expand...
Click to collapse
Hi meschle & Rotlaus,
Will it work in VGA (Universal).
rmercado said:
meschle said:
Thanks rotlaus, takes me back to my ms smartphone days = when I used to design my home screen through xml!! I still love my spv c500 .
Click to expand...
Click to collapse
Hi meschle & Rotlaus,
Will it work in VGA (Universal).
Click to expand...
Click to collapse
I am pretty sure it will - you will probably have to edit the xml file so that the position of the clock etc.. is to your liking.
meschle said:
I am pretty sure it will - you will probably have to edit the xml file so that the position of the clock etc.. is to your liking.
Click to expand...
Click to collapse
meschle,
Thanks, it is working in VGA, the problem is the resedue of the pink background retains at the edge of the images. Unlike your attached image it is clear. Also I tried to reduce the font size (size=6) and it seems not working.
One more, Can I reduce the size of the Clock (let say 20), I am woried about the arm of the clock, it may not fit to the clock face.
Thanks,
rmercado said:
meschle said:
I am pretty sure it will - you will probably have to edit the xml file so that the position of the clock etc.. is to your liking.
Click to expand...
Click to collapse
meschle,
Thanks, it is working in VGA, the problem is the resedue of the pink background retains at the edge of the images. Unlike your attached image it is clear. Also I tried to reduce the font size (size=6) and it seems not working.
One more, Can I reduce the size of the Clock (let say 20), I am woried about the arm of the clock, it may not fit to the clock face.
Thanks,
Click to expand...
Click to collapse
Hi - I have edited the images to get rid of the purple\pink effect :wink:
I think size 6 font is a little small for the screen, try 7 or 8 - clock size 20 probably too small - the one on the left of the screen is 16 and wont allow the arms to show.
I have images 60, 40 and 16 which are all edited to remove the pink\purple effect - find them attached in the zip below.
Wow, it is clear now (how did you do that?). I still cant change the font size. I hve to do more reading I suppose.
Anyway thanks for your help, at least I have a descent clock now in may jasjar...
Oppps...! one more problem... the plug-in background is blur. it is supposed to be transparent like the others.
General comment: a litle bit enhancement and this software is great...
Cheers,
rmercado said:
Wow, it is clear now (how did you do that?). I still cant change the font size. I hve to do more reading I suppose.
Anyway thanks for your help, at least I have a descent clock now in may jasjar...
Oppps...! one more problem... the plug-in background is blur. it is supposed to be transparent like the others.
General comment: a litle bit enhancement and this software is great...
Cheers,
Click to expand...
Click to collapse
I edited bmp in photo editing software.
In mine its fully transparent.
Try my skin.xml - you may find it easier to edit as its simplified - attached
Sorry for the delay, i was very busy the last days.
New Version in the first Post.
Changes:
- no fiddling with the transparent color (pink), i support now real PNG Transparency
- also Alpha Blending is supported
- For the analog clock hands you can now use graphics (See the swiss skin attached to this post). This will look like this:
But beware, this graphic clockhands are very memory hungry...
cu,
Andre
Thanks rotlaus - will update my skin and images as necessary - cheers!
EDIT the dll for this has gone from 78kb to 429kb - how comes such a large increase??
meschle said:
EDIT the dll for this has gone from 78kb to 429kb - how comes such a large increase??
Click to expand...
Click to collapse
This is cause of the new graphics library which enables real transparency, alpha blending and the graphical clock hands.
Filesize has grown too big in my oppinion. I don`t want to waste huge amounts of space for something as simple as a today plugin. If you could reduce filesize or make a "light" version or something it'd be great.
Anyways, besides from the size, great work, thank you!
yoda_143 said:
Filesize has grown too big in my oppinion. I don`t want to waste huge amounts of space for something as simple as a today plugin. If you could reduce filesize or make a "light" version or something it'd be great.
Anyways, besides from the size, great work, thank you!
Click to expand...
Click to collapse
I could drop JPEG Support. I don't need it. Then the dll would get around 350Kb. But still big. It'll grow anyway cause of future features that i'm currently developing.
@all: Do you need JPEG Support?
Hi!!
I've released a prebeta of 0.9.4 version to public. This version has the posibility to include moveable widgets. I post this thread to show an example on how to build simple but powerfull widgets.
For example I've done in about 20 minutes this S2P widget:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The code is this one:
Code:
<?xml version="1.0" encoding="utf-8"?>
<panel name="S2PWidget" width="116" height="106">
<icon X="0" Y="0" path="widgets\S2PWidget\back.png"/>
<panel name="Cover" X="3" Y="3" width="70" height="70">
<icon path="widgets\S2PWidget\album.png" exec="#@S2PPath#" height="70" width="70">
<event type="MouseDown"><action execute=":Script" parameters="S2PWidget:Set(MoveLock,true)"/></event>
</icon>
<icon path="#$Registry,HKEY_CURRENT_USER\Software\A_C\S2P\CurrentAlbum#" exec="#@S2PPath#" height="70" width="70">
<event type="MouseDown"><action execute=":Script" parameters="S2PWidget:Set(MoveLock,true)"/></event>
</icon>
</panel>
<icon X="83" Y="5" name="Prev" exec="#$THROTTLE#\Util\S2PControl.exe" params="Previous" path="widgets\S2PWidget\previous.png"/>
<icon X="78" Y="35" name="Play" exec="#$THROTTLE#\Util\S2PControl.exe" params="PlayPause" path="widgets\S2PWidget\#$Registry,HKEY_CURRENT_USER\Software\A_C\S2P\Status,map,[0-pause|default-play]#.png"/>
<icon X="83" Y="75" name="Next" exec="#$THROTTLE#\Util\S2PControl.exe" params="Next" path="widgets\S2PWidget\next.png" />
<text name="Artist" X="3" Y="70" width="70" height="30" alignment="Near" fontcolor="255,255,255" fonttype="7,true" text="#$Registry,HKEY_CURRENT_USER\Software\A_C\S2P\CurrentTitle#" leftmargin="0" textheight="30" textwidth="70" topmargin="2" spacing="0" />
</panel>
As you see it's 16 lines of code for a realtively complex widget that controls S2P .
To install the widget just un compress the zip file to \Program Files\ThrottleLauncher\Widgets and it should now appear when you click the plus button of the widgets page.
If you include Mortscripts in the ecuation.... you can have almost anything done!! .
Hope you'll find this interesting and contribute if you develop cool widgets .
edit: I forgot. You can also include any widget in any page you want by adding <widget name="NAME"/> where name is the folder of the widget. This way you can design module based themes and you can reuse components from one theme to another!
Thanks!!
i'm gonna hardreset and start exploring your new beta.. try to write something of my own as well..
thanks man.
Thanks! I think I'm going to ditch M2D for this
-Arturo- said:
Thanks! I think I'm going to ditch M2D for this
Click to expand...
Click to collapse
nir36 said:
i'm gonna hardreset and start exploring your new beta.. try to write something of my own as well..
thanks man.
Click to expand...
Click to collapse
Thanks to both... . I know it's bad that I'm the one telling it.... but I really thing this is worth a try.
Nice work, keep it up!
made it little bigger and placed buttons under album image and placed on home tab?looks great?tnx
LeAdReW said:
made it little bigger and placed buttons under album image and placed on home tab?looks great?tnx
Click to expand...
Click to collapse
You mean that you've done that?... or is it a request? It's really eassy to do it , hope you've managed to do it...
I just installed the release and I can't find how to get the widgets, sry about the noob question
pgiuoco said:
I just installed the release and I can't find how to get the widgets, sry about the noob question
Click to expand...
Click to collapse
Widgets are in the last tab of the footer. You should see a page with a [+] icon on it... click on the [+] and a dialog must show with the available widgets. Select wichever you want and hit ok, they should appear after a little delay....
nice work mate, keep it up
lol i accidentally installed the old verson off my sdcard, thx again for for your help
Techie87 said:
nice work mate, keep it up
Click to expand...
Click to collapse
Thanks!!
pgiuoco said:
lol i accidentally installed the old verson off my sdcard, thx again for for your help
Click to expand...
Click to collapse
Hehehe, you have scared me for a moment . Glad it was such a simple thing .
!!!
Posted More Plz Thx And New Ideas
Gosh
Will you ever stop improving your software ?
Amazing job, this app just gets better with every release
I will try some tweaks myself asap
Thx for your job !
i have done it,its really easy to customize,tnx,now i delete album art to make it less in height,only track info and buttons
AP, can you describe some more Event types? I cant seem to find the documentation on that. Also can you describe the scripts as well that are mentioned in this line of code:
execute=":Script" parameters="S2PWidget:Set(MoveLock,true)
jdiperla said:
AP, can you describe some more Event types? I cant seem to find the documentation on that. Also can you describe the scripts as well that are mentioned in this line of code:
execute=":Script" parameters="S2PWidget:Set(MoveLock,true)
Click to expand...
Click to collapse
Sorry... I know this is not documented still... that's what the wiki on my web is for .
This is what I can give you right now....
You can specify event's inside Elements and inside pages. Inside each event you can specify as much actions as you want. Here you have an example you can place inside a Page to make it lauch an app:
Code:
<event type="PageShow">
<action execute="#$THROTTLE#\Util\PruebaMAPI\Message2Reg.e xe" parameters="#@SMSAccount# Refresh"/>
</event>
Possible events are:
- For pages: PageLoad,PageUnload,PageShow,PageHide,UpDownGesture,DownUpGesture,LeftRightGesture,RightLeftGesture,ChangeToLandscape,ChangeToPortraitvalid for pages.
- For elements: Click,ElementUpdate
- For elements inside rows with advancedevents="true" (like the widgets page): MouseDown,MouseOver,MouseUp.
Possible actions are (the same that for icons and texts)
- Any executable file with params
- age (parameter is the page name to load)
- :Exit
- :Apps2Cat (parameter is the category to assign)
- :Reload
- :OthersPage (parameter is the page number)
- :Minimize
- :Config
- :ConfigSetup
- :Script: this is the most complicated. execute=":Script" and the param must match this pattern XXXXXX:YYYY(args). for example: <action execute=":Script" parameters="Battery:Refresh()"/>
XXXXXX is the name of the element to change
YYYY is the method to call. Methods supported are:
o Set: Set(Property,value) will set the property to the target value. Valid properties are Name,X,Y,Width,Height,Visible. LocketState is also valid, if set to true the element will follow the finger arround the screen and inside it's containing row until it's released.
o Refresh: supports:
+ (). Will update the whole XXXXXX element
+ (num) will update the XXXXX and the num pixels arround it.
+ (numX,numY) numX means margin in X and numY means margin Y.
+ (x,Y,Width,Height) all the numbers represent margin. To update an especific area watch the next command.
o RefreshRectangle: suports (X,Y,Width,Height)
o Add. Supports (Property,number) will set the property to the property value plus number. Only valid for numeric properties.
o Complement. Supports (property). Only valid for boolean properties (Visible). Will complement it.
WOW!
This totally makes ThrottleLauncher very customizable, especially with MortScript!
Thanks for the help.
jdiperla said:
WOW!
This totally makes ThrottleLauncher very customizable, especially with MortScript!
Thanks for the help.
Click to expand...
Click to collapse
That's the target .
Thank you for your interest!
Hello
I'm just starting out learning Android, and i only have basic C/C++ programming knowledge, but i've decided to make an app related to my school (just to test Android programming).
I have a UI such as this:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
And i want to add 1 line between each menu selection. I can do this easily with a <View> and width=match parent and height=1dp in the .xml file (as i've done on the picture showed above), but the problem is that i have around 30-40 xml files where i need this in (Really big menu selection )
Is there any way to simplify this?
I have tried to add my own xml file in the /res/drawable/ folder and that worked out fine with adding the android:background="@xx", but i only want the line inbetween the menu selections, not an entire frame around it.
I tried with the android:shape="line", but i couldn't figure out a way to move it up and down, it was always right in the center of the button.
I hope someone can help me out
- Moon
OK, I guess you want to do it in xml, because you could also add it programatically in a for loop to your list view.
The idea with an own xml file is not bad, though normally you'd want to extend a custom View. This means you create a new xml file with a single text view in your layout folder and then add it to your activity layout via
Code:
<com.example.app.custom_view
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
I don't think you can go shorter using xml. If it is only a list view, you might want to look at some custom list views or at this question here.
Thanks for the reply
I'm still very new to this, so "extend a custom View" says little to me i'm afraid (i'll try and google it and get a better understanding though)
I can easily make a new xml file with a android:shape="line" and set the width to 1dp, but then it ends up like this:
(Just talking about the 1st line)
I don't see any way of forcing it to move further down
I'm currently simply using <LinearLayout> with 7x <Button>. It can most likely be done in 47 other ways, all much smarter, but this currently works for my skill level and for what i need
Would really like to simply create 1 xml file with the properties of the line and then be able to call that xml file whenever i need to input a line in my UI. So if i ever need to change the line width, color or something, i can just change it 1 place and it'll do it all over my app.
I've done this with the actionbar dropdown in the .java files with Extend, but not sure how to go about doing it with xml (prefer xml for the UI)
It's probably extremely easy, but.. ye.. :/
- Moon
Moonbloom said:
Thanks for the reply
I'm still very new to this, so "extend a custom View" says little to me i'm afraid (i'll try and google it and get a better understanding though)
I can easily make a new xml file with a android:shape="line" and set the width to 1dp, but then it ends up like this:
(Just talking about the 1st line)
I don't see any way of forcing it to move further down
I'm currently simply using <LinearLayout> with 7x <Button>. It can most likely be done in 47 other ways, all much smarter, but this currently works for my skill level and for what i need
Would really like to simply create 1 xml file with the properties of the line and then be able to call that xml file whenever i need to input a line in my UI. So if i ever need to change the line width, color or something, i can just change it 1 place and it'll do it all over my app.
I've done this with the actionbar dropdown in the .java files with Extend, but not sure how to go about doing it with xml (prefer xml for the UI)
It's probably extremely easy, but.. ye.. :/
- Moon
Click to expand...
Click to collapse
OK so I googled a bit and it seems to be much easier using a ListView, consider this artcle for how to use it. Then customize the deviders as asked here.
If you really want to stay with the LinearLayout (don't do it!), do it like this:
For the Buttons (not necessarily):
1. create a new xml file (something like "mybutton.xml") in the layout folder.
2. copy your Button code in a single <Button ... /> but leave out the id (and text probably).
3. in your LinearLayout, insert Buttons like this (com.example.app is your appname):
Code:
<com.example.app.mybutton
android:id="@+id/whatever
android:text="@string/thiscanbedoneprogrammaticallyalso"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
For the seperators:
1. same as above ("mydevider.xml")
2. something like this:
Code:
<TextView
android:background = "#FFFFFF"
android:height= "1px"
android:width = "match_parent"
(use 1px and not dp!)
3. same as above (with .mydevider and no text )
I fiddled around with it a bit before seeing your latest post, and got it to work
Added an xml file named "button_divider" and added this code into it:
Code:
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@android:color/white"
/>
then i simply added
Code:
<include layout="@drawable/button_divider" />
where ever i wanted to draw a line, and it works exactly how i wanted it to
(i know it should probably be in the layout folder, but just added it in drawables to test it out, can always move it, not like it does anything differently)
I'll definately look into ListView, seems like it's build exactly for what i need ^^
But now i at least have a working'ish version of what i needed
Thanks alot for the help, i might be back here on these forums again at some point
- Moon
Shouldn't you just use a listview?
SimplicityApks said:
OK so I googled a bit and it seems to be much easier using a ListView, consider this artcle for how to use it. Then customize the deviders as asked here.
If you really want to stay with the LinearLayout (don't do it!), do it like this:
For the Buttons (not necessarily):
1. create a new xml file (something like "mybutton.xml") in the layout folder.
2. copy your Button code in a single <Button ... /> but leave out the id (and text probably).
3. in your LinearLayout, insert Buttons like this (com.example.app is your appname):
Code:
<com.example.app.mybutton
android:id="@+id/whatever
android:text="@string/thiscanbedoneprogrammaticallyalso"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
For the seperators:
1. same as above ("mydevider.xml")
2. something like this:
Code:
<TextView
android:background = "#FFFFFF"
android:height= "1px"
android:width = "match_parent"
(use 1px and not dp!)
3. same as above (with .mydevider and no text )
Click to expand...
Click to collapse
Tried to get this to work, while im working on figuring out how to use ListView instead as it seems (according to the two of you) that it's much better
I ran into a problem though.. I made a new xml file in the layout folder named "master_button", pasted this code in there:
Code:
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:textSize="25sp"
android:textColor="@color/Blue"
android:background="@android:color/transparent" />
Then i tried using your solution with <com.example.app.mybutton> (i ofc changed to the real name) but nothing would show up at all.. It seemed to need a class (java file) to be able to do it, but that just went horribly wrong when i tried adding it..
Then i tried to use <Include layout="xx"> as i did with the line earlier.. I can set the android:id="xx" easily, but it seems i cant set the android:text="xx".
Off to try out some more stuff and see if i can get anything working ^^
I think that is because you use the weight in the Button. If you set the width to 0 and it's ignoring the weight you will not see anything Try removing the weight(and probably width and height as well) in the Button and put it in your LinearLayout, where you insert your Button.
Found an easier solution for your Seperators:
I added this to my styles:
Code:
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?android:attr/listDivider</item>
</style>
Then in my layouts is less code and simpler to read.
Code:
<View style="@style/Divider"/>
Click to expand...
Click to collapse
here's the link: linklinklink
Should really just use listview next time. it does it automagically.
If you need to display graphs and/or charts in your application in a stylish, holo-compliant way, this is your go-to library.
I especially needed the BarGraph view for a project I am preparing for the Samsung Smart App Challenge 2013, but unfortunately, the base library by Daniel Nadeau was hardcoding the prepended $ unit, while my project requires several different other units to be displayed.
So I forked the library and added a couple features (I will be adding more over time), so I thought I would share:
Defining the unit programmatically, using BarGraph.setUnit(String unit)
Code:
// Example
BarGraph bg = (BarGraph) findViewById(R.id.bargraph);
bg.setUnit("m");
Appending or prepending the unit programmatically using #BarGraph.appendUnit(Boolean doAppend)
Code:
// Example
BarGraph bg = (BarGraph) findViewById(R.id.bargraph);
bg.appendUnit(true);
==> The result would be :
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Additionnally, I converted the library for proper compatibility with Gradle & Android Studio (IntelliJ).
You can find my fork on Github at the following url: https://github.com/Androguide/HoloGraphLibrary
If you haven't heard of this library before, it currently offers the following views:
You can use them in your project as follows:
LineGraph:
XML
Code:
<com.echo.holographlibrary.LineGraph
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/graph" />
Java
Code:
Line l = new Line();
LinePoint p = new LinePoint();
p.setX(0);
p.setY(5);
l.addPoint(p);
p = new LinePoint();
p.setX(8);
p.setY(8);
l.addPoint(p);
p = new LinePoint();
p.setX(10);
p.setY(4);
l.addPoint(p);
l.setColor(Color.parseColor("#FFBB33"));
LineGraph li = (LineGraph)findViewById(R.id.graph);
li.addLine(l);
li.setRangeY(0, 10);
li.setLineToFill(0);
BarGraph:
XML
Code:
<com.echo.holographlibrary.BarGraph
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/graph" />
Java
Code:
ArrayList<Bar> points = new ArrayList<Bar>();
Bar d = new Bar();
d.setColor(Color.parseColor("#99CC00"));
d.setName("Test1");
d.setValue(10);
Bar d2 = new Bar();
d2.setColor(Color.parseColor("#FFBB33"));
d2.setName("Test2");
d2.setValue(20);
points.add(d);
points.add(d2);
BarGraph g = (BarGraph)findViewById(R.id.graph);
g.setBars(points);
g.setUnit("$");
g.appendUnit(true);
PieGraph:
XML
Code:
<com.echo.holographlibrary.PieGraph
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/graph" />
Java
Code:
PieGraph pg = (PieGraph)findViewById(R.id.graph);
PieSlice slice = new PieSlice();
slice.setColor(Color.parseColor("#99CC00"));
slice.setValue(2);
pg.addSlice(slice);
slice = new PieSlice();
slice.setColor(Color.parseColor("#FFBB33"));
slice.setValue(3);
pg.addSlice(slice);
slice = new PieSlice();
slice.setColor(Color.parseColor("#AA66CC"));
slice.setValue(8);
pg.addSlice(slice);
If you guys have ideas or feature requests, please share. Pull-requests are obviously welcome.
BTW, anyone else participating in the SSAC this year? The $800k prize-money is mindblowing.
1st place is $200k. Considering the fact that it's Samsung, I would expect a higher prize, but I guess it's a specific contest with the Chord SDK. The venture capital pitch and marketing promotion are equally valuable imo.
This is very cool! Thank you for sharing!
Hi this is a cool library. As you asked for feature requests. How about stacked bar charts. So one is able to show a distribution of values in a group over time or categories?
Gesendet von meinem Nexus 7 mit Tapatalk 4 Beta
mickru said:
Hi this is a cool library. As you asked for feature requests. How about stacked bar charts. So one is able to show a distribution of values in a group over time or categories?
Gesendet von meinem Nexus 7 mit Tapatalk 4 Beta
Click to expand...
Click to collapse
That's a very good idea, I'll try to implement it as soon as I have some time. Thanks.
I'll also soon add the possibility to add a dynamic line chart, updated every X milliseconds cleanly in a separate thread
I've added this library to one of my apps that I'm working on. Here is a quick screenshot.
I've had to modify the LineGraph to be able to show the range lines between max and min.
I see a lot more apps and even infographics using the pie graph format. I personally think it looks more clean and easier to digest. I was looking at the challenge you're looking into, and it sounds interesting enough. It might be a perfect opportunity to enter, and just to learn about the whole process of bringing an app to market. We haven't integrated the Chord SDK, but I think it can be easily implemented since our game concept is related to live interactions. I'm more interested in the Venture Capital pitch with Samsung VC - that company has ridiculous amounts of money - it's ridiculous!
Great post!:good:
H3R3T1C said:
I've added this library to one of my apps that I'm working on. Here is a quick screenshot.
I've had to modify the LineGraph to be able to show the range lines between max and min.
Click to expand...
Click to collapse
Nice, very clean UI.
If you feel like submitting a pull-request for your LIneGraph modifications please do so.
Androguide.fr said:
Nice, very clean UI.
If you feel like submitting a pull-request for your LIneGraph modifications please do so.
Click to expand...
Click to collapse
I plan on sharing my code for the graph as soon as I clean up the code and add some more stuff !
Edit: pull request sent!
This looks great - don't have the need for it at the moment but have favourited it for future use! Thanks!
I there anyone figured out how to add bars to barGraph in a loop ? I click on a item from a listview in left slidingmenu, then retrieve data by this dateItem from database and put values in to arrays. than in a loop, I add bar data to points, and eventually setting this points as bars. But graph doesn't changes. anyone got idea ?
Wow, I have been using this lib and I had to do what you have done for showing some other units.
But this lib has a strange behavior in some devices, it's like it doesn't get the screen sizes or layout sizes correctly and shows out of scale characters and wierd shapes on pie charts sometimes (I'm talking about the original HoloGraph lib).
Someone has an a idea of why this happens?
Help using your lib
Hi,
I downloaded your library and sample project from Github but when I'm not able to see the jar file under the library folder. Can you please tell me how to use your library?
Thanks
is there is any onclick listner or event trigrring on click
Hi,
This is realy looking very clean and nice UI graph presentation, i am going to use it in my next project, but before that want ot confirm that,
does it supports events, i mean i want to give an option like drill down for detail reports.
so like on home page, just bar or pie chart with data, and on click of any of the bar, i can open the other activity with Detail information on the selected bar. is it possible to do that using this Lib ???
anyway i will be trying by myself in some time and post my findings.
yogi.306 said:
Hi,
This is realy looking very clean and nice UI graph presentation, i am going to use it in my next project, but before that want ot confirm that,
does it supports events, i mean i want to give an option like drill down for detail reports.
so like on home page, just bar or pie chart with data, and on click of any of the bar, i can open the other activity with Detail information on the selected bar. is it possible to do that using this Lib ???
anyway i will be trying by myself in some time and post my findings.
Click to expand...
Click to collapse
Amazing library, anyone knows how many "lines" its the max to draw? im using LineGraph, but seems dont draw all the lines i need, so what should i do? Thanks
Thanks
Nice job! Very nice
I'll try it soon
Nice very good library
Can I use it for commercial useage?
I am new to Android programming. How do I import this library to a new sample project in Android Studio?
Hi, can I ask if its possible to add a feature where you can click on the individual bars on a Bar Graph? A simple click listener for the bars will do, I just need to display more detail per point in the bar.
Thanks a lot for your library.
Hey guys this is the image which I would like to set at the top of every layout below the action bar...I dont want to include and set it in each and every layout.
So any alternatives for the same. I want this image to be displayed in all oof my application.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
coolbud012 said:
Hey guys this is the image which I would like to set at the top of every layout below the action bar...I dont want to include and set it in each and every layout.
So any alternatives for the same. I want this image to be displayed in all oof my application.
Click to expand...
Click to collapse
If it is just one view, you can do it similar to the dividers in the third answer to this question. Have a style for the list heading (probably referencing the system or support library resources, depending on the lowest API you use) and then just add the small view wherever you want it. There is also another way using the <include> tag, so you can use a separate xml file to declare your header layout.
SimplicityApks said:
If it is just one view, you can do it similar to the dividers in the third answer to this question. Have a style for the list heading (probably referencing the system or support library resources, depending on the lowest API you use) and then just add the small view wherever you want it. There is also another way using the <include> tag, so you can use a separate xml file to declare your header layout.
Click to expand...
Click to collapse
I dont want to go with include even that way I would have to put the include in every layout.
Should I go with and put this into BaseActivity.java so that it would be loaded with each activity.
Code:
View view = new View(this);
view.setLayoutParams(new LayoutParams(2,LayoutParams.FILL_PARENT));
view.setBackgroundColor(Color.BLACK);
layout.add(view);
Or should I go with this only :
Code:
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?android:attr/listDivider</item>
</style>
Then in my layouts is less code and simpler to read.
<View style="@style/Divider"/>
But the main issues with using the style is that I am using 1 style for layouts in which I am repeating the layout...and I cant use 2 styles for 1 ViewGroup...
I want to know the most optimized way...
coolbud012 said:
I dont want to go with include even that way I would have to put the include in every layout.
Should I go with and put this into BaseActivity.java so that it would be loaded with each activity.
Code:
View view = new View(this);
view.setLayoutParams(new LayoutParams(2,LayoutParams.FILL_PARENT));
view.setBackgroundColor(Color.BLACK);
layout.add(view);
Or should I go with this only :
Code:
<style name="Divider">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">1dp</item>
<item name="android:background">?android:attr/listDivider</item>
</style>
Then in my layouts is less code and simpler to read.
<View style="@style/Divider"/>
But the main issues with using the style is that I am using 1 style for layouts in which I am repeating the layout...and I cant use 2 styles for 1 ViewGroup...
I want to know the most optimized way...
Click to expand...
Click to collapse
Well I don't think there is an easy way to get around putting one line in every layout. So I assume that you want to use a single ImageView to show the image, so create a
Code:
<style name="header">
<item name="android:scr">@drawable/yourimage</item>
<!-- additional information like scale Type and such -->
</style>
And then in each layout, just add
<ImageView style="header"/>
Wherever you need it. I think that's the simplest way to do it.
SimplicityApks said:
Well I don't think there is an easy way to get around putting one line in every layout. So I assume that you want to use a single ImageView to show the image, so create a
Code:
<style name="header">
<item name="android:scr">@drawable/yourimage</item>
<!-- additional information like scale Type and such -->
</style>
And then in each layout, just add
<ImageView style="header"/>
Wherever you need it. I think that's the simplest way to do it.
Click to expand...
Click to collapse
Ok thanks for the suggestion...what about the first way I have described above?
else will follow what you have instructed...
coolbud012 said:
Ok thanks for the suggestion...what about the first way I have described above?
else will follow what you have instructed...
Click to expand...
Click to collapse
Ah you're right, you could also do it programmatically. Not sure what the best way would be, but you could create an abstract class HeaderActivity that would contain the code in the onCreate() so all your activities could extend that class instead of Activity or FragmentActivity. You would need to have one ID for all your top level layout, to call findViewById(R.id.top_view).addView(imageView, 0);
In the HeaderActivity. And you could also set your layout directly in its onCreate with an abstract method getLayoutId.
SimplicityApks said:
Ah you're right, you could also do it programmatically. Not sure what the best way would be, but you could create an abstract class HeaderActivity that would contain the code in the onCreate() so all your activities could extend that class instead of Activity or FragmentActivity. You would need to have one ID for all your top level layout, to call findViewById(R.id.top_view).addView(imageView, 0);
In the HeaderActivity. And you could also set your layout directly in its onCreate with an abstract method getLayoutId.
Click to expand...
Click to collapse
seems to be a great idea but...I had dropped out the idea of header and instead simplified the app header a bit...
Have a look at https://play.google.com/store/apps/details?id=com.droidacid.apticalc
U can create one Base Activity which extends "FragmentActivity" or "SherlockFragmentActivity"(if u use it) and then put that header on the top...below it create a fragment and in the whole app just replace that fragment and stay in one activity only..then u just need to have only one layout for the header and you can do the rest very easily....