Android graphics - Android Studio

I wonder if anyone can help me. I've been programming for some time but I'm new to Android development and am struggling a bit with the graphics and canvas systems on Android Studio.
This is what I want to do:
1. Draw some background graphics on screen (have done this in the onDraw function)
2. Have an 'interrupt' function run every x seconds (have done this with Handler)
3. Use this function to add graphical elements to the screen (i.e. a circle in a random position)
Step 3 is where I'm struggling. I can draw a circle and call invalidate to update the screen but what it seems to do is draw the circle, blank the screen then draw the onDraw elements again. I want it to add a circle so that I get an extra one on the screen every time the function runs.
Not sure if I've explained this properly but can anyone suggest a solution?
TIA

Related

[APP] LUMOS v1.0 *FINAL* (Complete HTC Auto-Backlight replacement) [UPD.:08-02-2011]

. . . .
{
"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"
}
. . . . (current version 1.0 FINAL)
More control. More battery. More comfort.
Lumos is fully customizable automatic backlight level changer developed as a complete replacement for stock HTC auto-backlight service. A wide range of HTC branded devices is supported starting from HTC Diamond/Touch Pro up to the current WM flagship HD2.
Lumos focuses on minimal CPU usage, maximum battery saving, low memory footprint while maintaining maximum backlight change smoothness and responsiveness. Lumos combines the best from all available auto-backlight solutions and adds many extras for your tweaking needs
Features:
- simple and clean installation and uninstalation
- extremely low CPU usage when working, 0.05-0.3% on polling
- NO battery and CPU overhead (drainage) unless you actively use your device's display
- low memory profile considering all the options
- simple and reliable configuration GUI with easy step-by-step calibration process
- many options that let you change every aspect of how your backlight works
- program exceptions to set different backlight for any application
- relative excaptions allow you to amplify/attenuate the automatic backlight for specific applications
- ability to force display ALWAYS ON for certain application
- integrated tool to detect all active application names, leave it running in the background and it will log all application names you use
- configuration failsafe. No matter what you do, Lumos won't crash, just tell you what is wrong and use defaults.
- supports vast majority of HTC branded devices since HTC Diamond
- many supported languages
Just install the CAB, start LumosWizard from programs or soft reset and you're all set!
- Lumos always installs to the device (no matter what you chose)
- Installer will create auto-start entry (Lumos will start after a soft-reset)
- Installer will create a shortcut to LumosWizard in your programs
- should any problem arise after first installation, try to soft-reset your device before consulting our FAQ below
Program installs to \Program Files\Lumos\
Lumos.exe = starts/stops auto backlight service, accepts commandline switches
LumosWizard.exe = graphical tool to configure all aspects of Lumos
settings.txt = configuration file is not included in the package, it will be automatically generated by LumosWizard after successful calibration, you can edit it manually in your PC or by using LumosWizard, text edits in device are probably no longer possible because of unicode encoding.
LumosStarter.exe = (re)starts Lumos service without any visual feedback (used for startup after soft-reset and for special issues)
TROUBLESHOOTING:
You can take these simple steps to troubleshoot any problem, perform both steps and if your device reacts differently than described try fixes marked ">" one by one starting from the top. Please restart your device before you start, your problem might fix itself.
1) Run LumosWizard, start Calibration and proceed to second step (max sensor), Lumos should report positive values as you move the device near to light source.
> move the damn finger! xD
> another application exclusively locked the sensor, try to disable other apps using light sensor
> sensor drivers or sensor SDK is missing, try if different application like G-Light works, report the problem if it does, update your ROM if it doesn't
> your sensor may be defective, try some 100% compatible ROM like Energy just in case and consider RMA if unsuccessful
2) Run LumosWizard, start Calibration and proceed to third step (minimum and maximum backlight setting). The backlight should actually change as a preview when you move the slider.
> check if windows built-in auto backlight is disabled in power settings
> another application may be forcing the backlight level, try to soft reset and disable other apps that can change backlight level or manage backlight in user profiles
> original HTC backlight utility DLLs may be missing in certain early WM6.5 ROMs, try to install BacklightHotfix.CAB attached to this post and reboot. If it just won't work, try another program like G-light, if you're still out of luck, try to contact your ROM chef about this.
Click to expand...
Click to collapse
You can send a symbolic DONATION if you with to reward me for my efforts.
Show that you care
There have been over 22500 downloads for RC2 version - just from XDA.
Donations will be used solely to buy muffins and pizza for late-night coding sessions... mmm
READ THE FAQ IN POST #2 BEFORE ASKING QUESTIONS
New files in additional languages pack:
none
DOWNLOAD:
FAQ:
What exactly is the calibration for, backlight is still the same after calibration?
The calibration ensures Lumos can detect the detection range of your light sensor properly and lets you set minimum and maximum possible backlight easily.
It has 4 steps:
1) Minimum value the sensor can read (probably 0 on all devices)
2) Maximum value the sensor can read (expect this to be something around 1400), you need to use a light bulb tor this step.
3) Minimum brightness you want. Lumos will calculate everything with minimum value reported by your device, but it will not let the backlight go below this value. (like if you want to have backlight 2 in shade because 1 is too dark for you)
4) Maximum brightness you want. Lumos will calculate everything with maximum value reported by your device, but it will not let the backlight go above this value. (You may notice that backlight level 7 and 10 is a little difference and can be both read in direct light, however if you limit the maximum to only 7 here, you will save a lot of battery)
5) After you are done with the calibration, you can review your setting on the settings tab and click 'Apply+Save' to exit LumosWizard and actually start Lumos service. There is no auto-backlight while the configuration Wizard is open, it defaults at level 6!
How program exceptions work?
- Switch to the Windows tab and start for example TomTom, leave TT and click it's name in the window list, then specify the backlight you want for this app and tap Add.
- If you disable "Exc. for active window only" on settings tab, you need to specify exact window name and exception will be triggered even for inactive application (minimized for example).
- If you activate "Exc. for active window only" on settings tab, you only need to specify part of the window name in exception settings (useful in case part of the window name changes). If the window name is "AdobeReader - document.pdf", only add exception "AdobeReader -". Be aware enabling this option increases CPU requirements of Lumos by about 20% (means roughly 0.06% total for slow diamonds).
Note that you will probably need to enable "Exc. for active window only" on settings tab for exceptions to work on WM6.5.
How to set a program exception step by step?
1. run lumos wizard
2. switch to the tab "windows" (the last one) and let the wizard run in background
3. run your program(s) you want to add
4. close the program(s)
5. switch back to lumos wizard -- voila, all the window names you visited are there!
6. tap the program name you want in the window list, it will switch you to the "exceptions" tab and fill the form for you
7. set the backlight level you want (1-10) and tap add to exceptions
What is a Relative Exception?
- relative exception does not force one specific level but rather amplifies and attenuates normal auto-backlight behaviour for the application in question.
Consider this scenario:
Code:
- my allowed backlight ranges in levels 2-7
- I want to use a navigation app in car and it is kind of difficult to see on sunlight, shades in car would read for level 3 or 4 and that is not bright enough
- I can either create an exception and force backlight all the way to 7, but that might not be optimal on battery
- therefore I create a Relative Exception of +2
- for the navigation application if the backlight would normally be set to 3 by Lumos, it will be amplified by two to 5. What would normally be level 6 will get amplified to 7, since that is my maximum level.
- You can also use negative values in Relative Exception to decrease the backlight for certain app by certain amount to save battery for example.
How backlight modes work?
- Backlight modes are individual equations used to determine proper backlight level from current sensor value.
- Linear - this mode is equally sensitive in dark and light environment.
- Root - this mode is more sensitive in dark environment and is best suitable for human eye and therefore default.
- Quadratic - this mode is more sensitive in light environment.
- Custom - this mode features customizable graph, you can draw a graph yourself with stylus or click on the blue area under each level number to input border sensor value manually.
Levels outside your min-max boundaries are hidden.
- Note that using custom mode do not affect CPU requirements in any way.
Commandline switches?
- There are 4 switches that can be used
"+" will increase backlight by one
"-" will decrease backlight by one
"s" will run normal Lumos operation without restart prompt after +/- tasks are completed
"q" will quit Lumos after +/- tasks are completed
Example to increase backlight by 3 and disable automatic:
Code:
"...iles/Lumos.exe" +++q
My *insert a game using G-sensor* is lagging strangely, can I fix it?
- guys from HTC thought it would be a cool idea to tie all sensors together in a framework, unfortunatelly it appears that when one program locks a sensor for read, other sensors may get locked as well on some devices. There is only one solution that will de-lag such game - not to use the sensor while it runs.
- Create a non-relative exception for the game in question and your lag should go away.
Backlight is not changing at all, it's the same all the time?
1) go to Start - Settings - System tab - Power - Backlight tab and DISABLE the 'Auto adjust backlight' feature.
2) close the configuration Wizard with "Save+Apply" button, auto-backlight service is disabled when you are configuring Lumos or when there is no configuration specified.
Program won't start at all?
You NEED .NET 3.5 Compact Framework Redistributable. It is faster and more stable and offers more stuff for developers than the 2.0 you probably have. It is rumored it may even make your device work faster (or at least .NET based apps).
Download it HERE (only about 3MB on device, don't be scared by the installer size as it contains support for more processors)
LUMOS CHANGES TRACKER:
(changes prior to RC1 version dropped)
! non linear backlight in the GLight style for people all over the net who are demanding this
! exceptions now need only part of the window name in "detect only active windows" mode
! recalibrated sensor readings for more sensitivity
! fixed bug in custom graph mode
! faster loading
! dropped DIM_TO_MINIMUM_PLUS_ONE_BELOW option
(below only in RC2 version)
! fixed custom mode alignment
(below in 1.0 Final)
! add support for relative level in exceptions
! add support to keep alive only as exception
! add command line support (change level & quit, +, -)
(below ideas for future development)
- add support for alternative backlight handling (WM default without HTC drivers)
WIZARD CHANGES TRACKER:
(changes prior to RC1 version dropped)
! support for setting linear, quadratic and root/logaritmic backlight
! support for custom backlight mode with interactive graph
! support for changing keyboard backlight delay on RAPH
! improved max/min detection in wizard
! forcing consistency between settings and graph plotting
! switching language in flight
! faster loading times
! support for language packs
! smaller text to allow better translations
! bigger tabs for better finger friendliness
! dropped DIM_TO_MINIMUM_PLUS_ONE_BELOW option
! fixed minor flaws from beta2 connected with translations
! improved settings tab scrolling redraw speed
! settings tab will back off from deploying soft keyboard
! added new languages: Bulgarian, Czech, Francais, Japanese, Nederlands
(below only in RC2 version)
! fixed Window detector taking you to the Mode tab instead of Exceptions
! fixed settings tab layout width
! added another failsafe mechanism against saving invalid min/max backlight and polling interval
! added warning message for options with potentially negative effect on battery
! added new languages - currently Bulgarian, Czech, French, German, Greek, Japanese, Dutch, Polish, Russian, Sim./Trad. Chinese
(below in 1.0 Final)
! set "BL=1 below" option to be relative to the sensor minimum
! set calibration to disregard sensor minimum 0 until the driver is initialized
! add support to release sensors on active exception
! add wizard warning if built-in auto backlight currently overrides Lumos control
! ability to recognize missing sensor drivers and the need for Backlight Hotfix package
! add support for relative level in exceptions
! add support to keep alive only as exception
(below ideas for future development)
- support for forced "on wakeup" backlight level
- = bug / missing part
? = possible bug/not able to reproduce/not verified/idea
* = in development
+ = fixed bug / completed part
! = fix/feature included in released version
NOTES:
Please disregard the hacks from previous versions and always set your sensor minimum and maximum to real values (0-xxxx)! Some sensors might have different minimum than 0 - this is a hardware defect and you need to use the defected value for Lumos to work correctly.
To admit it, I haven't installed it yet, but I'm tempted. Just one question which might also be of interest for others:
What's the advantage of your app compared with G-Light?
And not to forget:
Thank you for your work! I still find it amazing that many xda-devs are building programs for free just for a "thank you" by the community.
Well I tried G-Light and LevelSight but will only compare it to G-Light as LevelSight does things a bit differently IMO. I set G light to 3s polling interval to make the comparsion accurate. I don't like to put dirt on someone elses app, G-Light is a fine piece of software and I encourage the developer to implement some of my ideas to match mine and make it even better
- G-Light can behave competely unpredictably, it pumps up the backlight when you're in shade (this is because of the luminosity spikes)
- Lumos eliminates any spikes by the 4-read interpolation keeping your backlight more comfortable and smooth
- Lumos uses a tolerance which further prevents the backlight to unexpectedly changing (and causing a CPU spike)
-G-light rarely reaches below 1% of CPU usage (1-7%usage is common) which can drain your battery as a side effect
- Lumos rarely crosses above 0.5% CPU usage on default settings (0.05-3% usage is common) (NOTE: this will even improve in future versions)
- in G-Light You cannot change how fast the luminance values are read from sensors, they are read on change = further battery drain. You can only change how often to set backlight
- In Lumos you can set sensor read interval and backlight change in its multiplies to save CPU and power while retaining smoothness.
- Memory usage: GLightRunner 595.43KB , Lumos 311.53KB (but this will get a bit more later)
- No noticable memory leak in either applicaiton
- G-Light has a frontend app to set up
- Lumos has none yet but you can change the configuration file
- Neither Lumos nor GLightRunner can be completely shut down without using task manager (Lumos will once it has frontend GUI).
- G-Light can exclude applications
- Lumos can't yet
-G-Light settings is pretty much still limited compared to Lumos
To sum up it's definitely worth trying
nik3r said:
To sum up it's definitely worth trying
Click to expand...
Click to collapse
Thank you for your long and precise answer, You definitely convinced me!
I'll try it right away!
Lumos v02
Lumos Version 02 has been released, all the changes are logged as (!) in the bug tracker above.
Default settings response time is shorten to 2s, while CPU usage is pretty much the same as v01 with 3s refresh.
Memory usage: 339.53KB
CPU usage: 0.05-0.25% on scan, 3.15% on backlight change
Power consumption is 2mA better than v01
If you want to achieve more sensitivity of backlight transition without CPU overhead, set tolerance to 0 (CPU usage bug is fixed now).
Configuration file is now idiot-proof, program will tell you what is wrong on syntax/logical error
EDIT: 02b contains one more bugfix, the auto backlight range cap finally works 100%
Enjoy
nik3r
Quick question; does you app let the backlight go to 0% in full darkness, like LevelSight?
Yes it in fact goes to 1 (backlight disable) as lowest on default. You may want to increase it to 2 in the config file if it's too dark for you.
The point of this app is YOU set how it should behave, there are virtually no limitations unless you enter a complete nonsense to the config. And even then the program should just notify you about the incorrect settings and not crash, so don't worry and edit!
The program needs to be restarted in order to apply new settings. Either kill it via process/task manager or soft reset if you don't have one. Note that this acts like a program, it won't start again automatically if you kill it or soft reset. And also it won't store anything in your registry or enywhere else on the device, so it's perfectly safe to "just try". I will make a manager app later that will let you setup and control this underlying process.
But FIRST we need to make sure the service is bug free and does everything we need before I even start building the front-end app
Also you may share your custom settings you find best with me and if it's performing well I can select that one as default for future.
Thank you Niker! V2 is working great for me. Only one thing:
The lightlevel changes linear as you've explained and that's basically working fine (and much more smoothly than G-Light for example). But it tends to get to dark. I've now changed the minimum setting to "3" to get the average backlight-level I prefer. BUT: I like to read late at night in bed and it would than be nice to have the backlight at level "1". So would it be possible to exclude light level 1 & 2 from the linear alignment and to only use those levels if it's "really dark"?
PS
Just to give you a bit more information about my personal preferences and what I want to achieve:
I actually like the default HTC auto-backlight. It more tends to bright than to dark backlight and it's making the level changes very smoothly so you almost don't notice them.
The only thing i don't like about it is that the minimum level is hardcoded to level 3 which is too bright for me when I read in bed with no additional light in the room.
Of course those are my personal preferences and that of course doesn't necessarily mean that your app is meant to handle that way!
Well I have an idea, I wonder if .NET CF 3.5 supports external scripting as the PC version does. Basically that might allow you to replace the backlight algoritm without compiling the program yourself. You could quite easily make exceptions binded to really low lumen values or time of day with just 2-3 lines of code.
EDIT: I fear this is not possible, System.CodeDom.Compiler is awfully stripped down, I would have to make up my own scripting language for this to work and that would be very difficult.
But I think I can add this as a setting to the configuration file.
DIM_TO_MINIMUM_BELOW = 0
- disabled (default)
DIM_TO_MINIMUM_BELOW = 25
- below 25/750 lumens
very simple and I think this would do about what you want
Expect this in the new version.
nik3r said:
I'll report back whether this is possible in mobile version...
Click to expand...
Click to collapse
Thank you mate, I really appreciate it!
Thanks for your suggestions.
Lumos v02c is out, it contains your 2 desired options (for backlight 1 and 2 separately). You will however be disappointed by the sensitivity of raphael sensor, it reports 0 like all the time.
This change theoretically lets you set lumen values for the 2 lowest values manually and once the sensor reads larger values, the MIN/MAX_BACKLIGHT kicks in. It's possible to have 4-8 auto and dim to 1 or 2 on low light, so you can kinda simulate the behaviour of LevelSight if you want to.
Oh and as the cherry on top I disabled tolerance by default, for more smoothness, the impact on CPU and battery should be minimal < 0.05%
The next version should include a tool to easily restart Lumos to apply settings, it will be needed for the graphical user interface later.
Enjoy
Major version released:
Lumos v03
- all bugs connected with dynamic backlight should be fixed now
- changing settings.txt is even safer (program should never crash, just tell you where is problem and use defaults)
- includes LumosKiller.exe that can start/restart/shutdown Lumos easily
In case no bugs are found until friday, I will start building GUI.
Could you integrate special brightness normally only used when starting the camera? You'd probably need to debug the camera application to find out about the special ICOTLs for that. I did that with my Magician back in the days.
Program-specific exceptions will be added after the GUI is done, I still need to figure out how to list running windows by name. If you have any experience with this using C# or C++ I'd be happy if you PM me, but I guess uncle google knows how to do this, just refuses to share it with me right now
Uz to testujem, zatial to vali krasne a v pohode ;-)
I just wrote that I'm currently testing it, no problems so far.
Thank you and please keep up the good work ;-)
Great application Nik3r!!
i like so much, because don´t touch my registry, It´s light,and also have minimal resources consumption
But, i need your help with the configuration file,
i have htc diamond, and the battery of this device drain fast
how can set the settings to obtain best battery duration?
Thanks a lot!!
You can increase the polling interval, enable some tolerance and lower the maximum brightness.
Try to make these changes:
MIN_BACKLIGHT = 1
MAX_BACKLIGHT = 6
POLLING_INTERVAL = 1500
EXTRA_POLLS_BEFORE_SET = 1
BACKLIGHT_TOLERANCE = 1
set minimum backlight to whatever is reasonably visible in shade
.. this will set your polling interval to 1,5s and make your brightness change every 3s instead of 2. The tolerance prevents brightness changess less than 2 units. It's the brightness change that eats most CPU (up to 3% spike) and thus battery and the tolerance makes sure it's not changing until a larger change is required.
And make sure you killed the old v01/02x version or soft reset before using 03 because older versions can't be killed by LumosKiller and two of them running may ruin your battery.
... hmm by the way I wonder why I didn't call it "Nox" instead of LumosKiller (any similarity with HP books is completely unintentional )
Good luck
Thanks for your quick and detailed reply!! i did those changes you suggest,
I´m really fan of your app!!

[APP] Native screen rotate applications

i wrote two applications that provide screen rotations in different scenarios.
the first one (rotexec) rotates the screen in a particularly orientation and executes an application, then restores the orientation on exit.
the second one (devomon) polls the accelerometer and updates the screen orientation.
i know there are already applications out there that handle these tasks, but the ones i found all ran on the .net vm.
my goal here was to minimize the memory footprint, something not possible with managed languages.
for devomon.. with 4 filtered applications, it consumes about 52 KB of heap space.
the new version of devomon (with a gui):
http://www.megaupload.com/?d=LCOWUDF4
rotexec and devomon w/o a gui (don't use it):
http://www.megaupload.com/?d=DL58WVU4
project is hosted at SourceForge.. i haven't committed the newer changes though.
----
rotexec is intended for use with shortcuts, although if you use it more than once you might have a hard time distinguishing when all have the same damn icon.
the command-line format is...:
Code:
rotexec <direction>|<full_path_to_exe>[|<args]
<direction> indicates the side the top of the window touches and can be either N, S, E, or W
you can quote the individual items (i.e., "N" vs. N), but not the entire string.
* the orientation is set for the duration of the program, regardless of whether or not it owns the foreground window.
example shortcut:
Code:
88#"\Storage Card\rotexec.exe" W|\Storage Card\Program Files\Navigator\TomTom Navigator.exe
----
devomon reads the output of the accelerometer using htcsensorsdk.dll.
* the screen orientation is changed for all applications except those in the filter list.
* if the keyboard is out, no orientation changes are made.
* filters cannot be persisted at this time.
devomon now has a gui.
I'd just like to say a TON of thanks to this program. It works GREAT. I use it for Remote Desktop. I always want it rotated portrait, without the keyboard open, and now it does!
In addition, I would like to add a recommendation for modifying the shortcut icons. This app that I have attached is called Shortcut Creator, and it allows you to pull up any shortcut, and specify an icon from any .EXE on the device!

[APP] My simple screenlock

Hello.
I developed for myself screenlock app,I want to share it.
It is with simple graphics,minimum informations,but it has something,what I cannot found in other lockers:
- minimal system requirements
- instant unlock available(others after power-on I have to wait few seconds until I can move the unlock thingie)
- as I am also Android user,my Hero lockscreen requires vertical slide,so I do this same way
- most important feature: it will suspend after 5 secs when you don't unlock(saves lot of power in your pocket)
Please share your opinions.
Unpack to your device and execute.
Sounds interesting. Any screenshots?
Screen unlock
Not yet. Just try that and you'll see.
Screenshot...
Well,some update...
Now I am working on version like this:
http://www.tokyoflash.com/blog/2010/08/high-definition-concept-watch-design/
with shutoff effect,lock etc.
There are no bitmaps to load from resources,just system rectangles,that means it will be even more a bit faster to start. However I designed it for Samsung i780,which has square 320x320 display,so the squares are in order 4x4,not 3x5. The 4 rows,whose actualy displays minutes will be used for unlocking.

NoRefresh enabler

Hi,
I am trying to put a code together to control the refresh behavior of the e-ink screen. The final goal is to have a drop-in library for app developers to help making their app more e-ink friendly.
The code works already for the PRS-T1, but needs a different driver for the Nook Touch (N2EpdController included).
My one and only beta tester gets the famous "There is a problem parsing the package" error. Pls find enclosed the sources.
I would be grateful if someone could fix possible Eclipse setting or other errors.
Hi,
I have some interest in adapting apps to the eink screen, so I will try to help with this. Unfortunately, I cannot post in the dev forums yet.
When you get error installing apps via android UI, it is useful to do via "adb install" to be able to know the error cause. The message was "INSTALL_FAILED_OLDER_SDK", which I solved by lowering the android:minSdkVersion parameter in Manifest. Then, the app installed and ran fine, but didn't do the desired effect yet. I will check the code now...
---------- Post added at 02:41 AM ---------- Previous post was at 01:53 AM ----------
I see that you're trying to use enterA2Mode() for the nook (btw, there is a typo at NoRefreshEnablerActivity.java:29, it should read EINK_NOOK). I've been playing around with this some time ago when I started developing a fast e-ink drawing app for the NST, you can see it here: https://github.com/marspeople/E-Paper (WIP).
With few testing I've done, I guess the 1-bit mode (A2) setting is not applied globally: it should take effect only in the View from which it is called. I haven't investigated further to try to use it globally.
Hi marspeople,
Thanks for pointing out the type, it should read
} else if (DeviceInfo.EINK_NOOK)
Regarding the global value of mode setting. From what I understand, A2 is a permanent mode, so whatever function or app is setting the updatemode, it is kept. With the PRS-T1, it is reset by calling any stock (Sony) app. For the Nook I don't know..
Good luck in compiling, hopefully we come to a version which works on both devices. Then I can proceed to dynamically change the updatemode within an app.
Yes, the A2 mode is kept until any process resets the EPD. Using logcat, I noticed several epd_reset_region messages appearing automatically when I close your app to go back to the launcher. It seems the system overrides the EPD setting, making impossible to use A2 system-wide (at least by this method).
However, if you want A2 just for an app, calling enterA2mode() will probably work, as I used in my own app above.
Can you send me your apk?
salsichad2 said:
Can you send me your apk?
Click to expand...
Click to collapse
You mean the apk for "NoRefresh" or my drawing app?
Hi marspeople,
I would be most interested to know why the initial source code does compile ok, works on the PRS-T1 and does not install on the Nook Touch + the fixes.
With this knowledge I can write either an app to set refresh modes or within apps.
Did you succeed to compile and install on Nook?
Hi again,
in your N2EpdController.java
Code:
83: mtSetRegion.invoke(null, "aarddict", enumsRegion[region], regionParams, enumsMode[mode]);
I would like to replace the hardcoded "aarddict" by something dynamic.
What would be the correct function to infer the wanted name?
Code:
activity.class.getName()
this.getClass().toString()
.. ?
bardo8430 said:
Hi marspeople,
I would be most interested to know why the initial source code does compile ok, works on the PRS-T1 and does not install on the Nook Touch + the fixes.
With this knowledge I can write either an app to set refresh modes or within apps.
Did you succeed to compile and install on Nook?
Click to expand...
Click to collapse
Yes, sorry about the confusion, but I managed to do it, despite the A2 mode didn't work. What I did was just edit the AndroidManifest.xml, changing the android:minSdkVersion parameter to 7 (since the NST runs Android 2.1).
Good luck finding out how to set A2 mode permanently. I guess you don't have a Nook, so feel free to ask me for testing purposes.
Since the Nook A2 mode seems to be overridden when switching foreground activity, I've tried another approach with a background service which toggles A2 mode when requested by user. This way, the foreground activity isn't switched and "fast refreshing" mode works (until you change activity).
This fast refresh mode (called A2) is only possible because it uses only 1-bit depth, i.e, just black on white, meaning you can't see grayscale pictures but it's good enough for black text on white background and scrolling. I have not "created it", it is built-in from the device (you can test using the stock reader, it is activated when holding a page button). What I implemented is a way to activate and deactivate it at user will from inside any app.
Thanks to dairyknight for his N2EpdController class, which made this possible.
Thanks to bardo8430 for bringing the idea.
Thanks to AndroSS source code for screenshots used in automatic contrast.
Changelog:
01/Mar: Now when you launch the app and it is already running, it will activate NoRefresh mode. So you can also use an activation shortcut to the app using NookTouchTools (i.e. B&N's book icon at top left corner).
02/Mar: Improve activation shortcut to perform toggle between modes. Tap gestures aren't needed anymore (use "-noGestures" apk version if you don't want them).
04/Mar: Got rid of initial ghosting by redrawing the screen after activating A2.
04/Mar (2): Minor improvement of removing ghosting at screen edges.
12/Mar (Beta): Now you can adjust contrast in A2 mode. Images shouldn't be dark or black anymore if you raise the contrast a bit.
22/May: Completely redesigned version 2.0:
- Several options can be customized via settings screen.
- NoRefresh can be toggled by manual app shortcut, tap gestures or automatically according to screen animation (new).
- New App Whitelist to avoid unwanted activation in specific apps (except for manual mode).
- Background service can be launched at boot.
- Small improvements and tweaks.
- Custom app icon (finally )
06/Jun: Fix crash on empty whitelist
08/Jul: (Version 2.1)
- Automatic contrast when activating NoRefresh, according to total "brightness" of the screen (simple algorithm). This should ask you for root permission.
- Also supports manual setting in specific situations (customizable).
- Fix possible crash at startup.
26/Jul: (Version 2.2)
- Fix contrast setting behaviour
06/Dec:
- Alternative version with fixed compatibility for FW 1.2.0 available at https://github.com/marspeople/NoRefreshToggle/downloads
First Video: http://youtu.be/6pBPsyno5PY
Other Video: http://youtu.be/kBbl6egyPsQ
Another demo: http://youtu.be/5b7JjllImjM
Repository: https://github.com/marspeople/NoRefreshToggle
Great to see that it works on the Nook! Good job.
When I try to compile on Eclipse, I have to remove the below Override:
//@Override
public boolean onTouch(View v, MotionEvent event) {
otherwise I get an error: The method onTouch(View, MotionEvent) of type A2Service must override a superclass method
When I compile with this mod and run the app, nothing happens after using your gestures. Except that I tap on other icons which then try to launch other apps.
Should NoRefreshToggle keep the focus?
I have a suspicion: The PRS-T1 needs to call a function of the Sony library with extended parameters to pass the updatemode. ANY function carrying the mUpdateMode parameter would do - but it must be called. Which might be the problem here. In the used EinkListView.java, a lot of "injection" functions like below are defined.
Code:
@Override
public void scrollTo(int x, int y) {
try {
Method invalidateMethod = super.getClass().getMethod("scrollTo",
int.class, int.class, int.class);
invalidateMethod.invoke(this, x, y , mUpdateMode);
} catch(Exception e) {
e.printStackTrace();
}
But your code has neither a Listview, nor would any injection function trigger. I am afraid you would have to make the app use a ListView (or WebView).
Can you?
bardo8430 said:
Great to see that it works on the Nook! Good job.
When I try to compile on Eclipse, I have to remove the below Override:
//@Override
public boolean onTouch(View v, MotionEvent event) {
otherwise I get an error: The method onTouch(View, MotionEvent) of type A2Service must override a superclass method
When I compile with this mod and run the app, nothing happens after using your gestures. Except that I tap on other icons which then try to launch other apps.
Should NoRefreshToggle keep the focus?
Click to expand...
Click to collapse
Well, I noticed that problem of accidentally tapping unwanted widgets, I would recommend tapping on a free area of the screen. I could use an overlay button, but it would occasionally get in the way too. What do you mean by "keep the focus"?
---------- Post added at 09:13 PM ---------- Previous post was at 09:05 PM ----------
bardo8430 said:
I have a suspicion: The PRS-T1 needs to call a function of the Sony library with extended parameters to pass the updatemode. ANY function carrying the mUpdateMode parameter would do - but it must be called. Which might be the problem here. In the used EinkListView.java, a lot of "injection" functions like below are defined.
Code:
@Override
public void scrollTo(int x, int y) {
try {
Method invalidateMethod = super.getClass().getMethod("scrollTo",
int.class, int.class, int.class);
invalidateMethod.invoke(this, x, y , mUpdateMode);
} catch(Exception e) {
e.printStackTrace();
}
But your code has neither a Listview, nor would any injection function trigger. I am afraid you would have to make the app use a ListView (or WebView).
Can you?
Click to expand...
Click to collapse
Well, to capture touch events I've used a dummy View which is added to an overlay (see A2Service.java:43). Despite being an android Service instead of Activity, maybe you can instantiate your ListView there and hopefully it will work.
Thanks for the hint on the dummy view, will try.
"keep the focus"?: window manager speak, I mean that a tap stays within your app and does not act on the icons below.
bardo8430 said:
Thanks for the hint on the dummy view, will try.
"keep the focus"?: window manager speak, I mean that a tap stays within your app and does not act on the icons below.
Click to expand...
Click to collapse
Since I'm using a transparent overlay, I have to let touch events pass through, otherwise only my app would see them.
PS: I've added a demo video at a previous post.
I've been trying to improve the functionality of the app by changing from this manual toggle approach to something like: fast mode is triggered (a bit after) when user starts dragging his finger on the screen and restored when released.
However, I've been searching how to do this with no success so far. The invisible overlay that detects touch events currently is only able to capture MotionEvent.ACTION_OUTSIDE event type, which is useful to detect a tap, but can't deal with a drag. I also need that the drag is passed normally to the app below (to perform scrolling or whatever).
I've found this page (http://stackoverflow.com/questions/8073803/android-multi-touch-and-type-system-overlay) in which is proposed a solution that can detect a drag but can't pass it to the app below.
The code is now here: https://github.com/marspeople/NoRefreshToggle . I would appreciate any help from developers.
Maybe it can be run every 1 second when screen is on. I mean nook is not locked. I don't think that changing one parameter would eat battery. Is it worth a try?
Hi marspeople,
thanks again for taking this. My initial intention was to help app developers with no e-ink experience to easily adapt their code. Doing these things inside an app is much easier but needs access to the source.
See the related question on stackoverflow:
http://stackoverflow.com/questions/9391710/adapt-scrolling-swiping-to-e-ink-screens
The external app was used as a mere demonstrator to have it work on the NST and PRS-T1. Good to have a repository for it now.
marspeople said:
Ok, I think I've got it.
Since the Nook A2 mode seems to be overridden when switching foreground activity, I've tried another approach with a background service which toggles A2 mode when requested by user via a touch gesture. This way, the foreground activity isn't switched and "fast refreshing" mode works (until you change activity).
The activation gestures I'm currently using (unfortunately, it seems you can't use hardware keys using this approach) are:
- 4 "downward-right" taps (each tap must be done to the right and below the previous one) to activate (A2 mode)
- 4 "upward-left" taps to deactivate (Normal mode)
Video: http://youtu.be/6pBPsyno5PY
Here is the source code and a apk. bardo8430, I believe it would be easy to port this to the PRS-T1.
Click to expand...
Click to collapse
Noob question.
So I just install the apk and run it and I have Norefresh.
dark_hawk said:
Noob question.
So I just install the apk and run it and I have Norefresh.
Click to expand...
Click to collapse
yes, just open the norefresh app, and like the youtube video tap the screen from top left to bottom right 4 point
but i think the trade off is the screen go black&white with no grayscale (at lease for me)

Mod Android Auto GUI to show large clock on bottom command bar

I own a Mazda CX-5 and recently paid for the upgrade of the infotainment to add Android Auto.
The main issue is that once AA is running the clock becomes almost unreadable! it's too small an overlaid on the app (mostly Waze for my purposes).
I would like to be able to move the clock to the bottom bar of AA in order to ensure it's always there and way bigger then now.
I started by decompiling the AA APK etc... but then come to the conclusion that probably someone else already tried something like that and that in general here in the forum there will surely be some kind of guide on how to decompile/repackage the AA and which layouts/bundles to edit for which result: unfortunately I didn't find any such guide
So my questions:
1 - is already out there any AA rebuild which puts a large clock in the bottom bar?
2 - if not: is there any guide on how to open and repackage AA and which are the main requirements to make it work again after repackaging?
3 - if not: at least some steps on how to mod some layouts and repackage in a way which allows it to work?
4 - if not: anyone willing to share suggestions on issues I'll meet (i.e. google signature required for AA, special permissions etc...) ?
5 - if not: anyone out there who already tried (and failed) willing to share his experience so that I don't start the try-fail process from scratch?
thanks everyone for helping!
p.s.: no Xposed at current stage since I'm using the company's phone and I'm not willing to root it, thanks!
Hi, i know this a old post and i'm sorry if my English is a little bad. You resolve the clock problem? I buy a CX 5 too and have same problem and question.
There's an option to do just so with Substratum and the theme Extras For AA
Having the same problem I made a small application which gives the time all the time:
[CLOCK] 0.2 Always displayed
-Some car radios do not display the time when an app is in full screen (waze). So I developed a small application that displays the time permanently. Usage: install the app and start. The position can be modified by sliding, it will be memorized...
forum.xda-developers.com

Categories

Resources