[GUIDE] Enhanced Brightness - Save Battery! - Android General

{
"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"
}
Enhanced Brightness​
Features:
Auto Brightness decreased to 2 (Better Battery Life)
Auto Brightness increased to 255 (Brighter Screen For Outdoors)
Brightness decreased to 1 (Better Battery Life)
Better Auto Brightness Levels (Better Battery Life)
Dim Brightness decreased to 1
​
Knowledge:
I am using CM10.1 for the example.
Before using this guide, you must understand few things:
Whats is Lux?
Lux is the SI unit of illuminance, equal to one lumen per square meter. For more info, see this
How does Lux affect your phone's brightness?
Your phone's light sensor's measure the lux and change brightness accordingly (if you're using auto-brightness). For more info, watch this
Understanding Lux Values:
Lighting condition From (lux)​ To (lux)
Pitch Black 0​ 10
Very Dark 11​ 50
Dark Indoors 51​ 200
Dim Indoors 201​ 400
Normal Indoors 401​ 1,000
Bright Indoors 1,001​ 5,000
Dim Outdoors 5,001​ 10,000
Cloudy Outdoors 10,001​ 30,000
Direct Sunlight 30,001​ 100,000
​

Files Edited:
framework-res\res\values\arrays.xml
framework-res\res\values\integers.xml
​
Steps:​
Changing Auto-Brightness Levels
Decompile framework-res.apk
Navigate to res\values\arrays.xml
Find:
Code:
<integer-array name="config_autoBrightnessLevels">
These contain the lux values
Find:
Code:
<integer-array name="config_autoBrightnessLcdBacklightValues">
These are the levels of Auto Brightness which adjust according to the lux values defined above
<integer-array name="config_autoBrightnessLcdBacklightValues"> should contain 1 more item than <integer-array name="config_autoBrightnessLevels">
Suppose <integer-array name="config_autoBrightnessLevels"> contains 5 items/values, then <integer-array name="config_autoBrightnessLcdBacklightValues"> will contain 6 items/values.
Now in <integer-array name="config_autoBrightnessLevels">, add, modify the values according to your need.
For reference, here is mine with the best values I could think of:
Code:
<integer-array name="config_autoBrightnessLevels">
<item>2</item>
<item>10</item>
<item>50</item>
<item>175</item>
<item>380</item>
<item>780</item>
<item>1150</item>
<item>1890</item>
<item>2465</item>
</integer-array>
Now in <integer-array name="config_autoBrightnessLcdBacklightValues">, add, modify the values according to your need. Remember it should have 1 more value than previous one.
For reference, here is mine:
Code:
<integer-array name="config_autoBrightnessLcdBacklightValues">
<item>2</item>
<item>8</item>
<item>20</item>
<item>40</item>
<item>75</item>
<item>135</item>
<item>180</item>
<item>210</item>
<item>230</item>
<item>255</item>
</integer-array>
How the lux values change Auto-Brightness level?
Taking the values from above:
When lux < 2, brightness = 2
When 2 < lux < 10, brightness = 8
When 10 < lux < 50, brightness = 20
When 50 < lux < 175, brightness = 40
When 175 < lux < 380, brightness = 75
When 380 < lux < 780, brightness = 135
When 780 < lux < 1150, brightness = 180
When 1150 < lux < 1890, brightness = 210
When 1890 < lux < 2465, brightness = 230
When lux > 2465, brightness = 255

Changing Minimum, Maximum, Dim Brightness
Navigate to res\values\integers.xml
Find:
Code:
<integer name="config_screenBrightnessSettingMinimum">
Change the value to set the minimum brightness achievable when not using Auto-Brightness. Value must be ≥ 1
Find:
Code:
<integer name="config_screenBrightnessSettingMaximum">
Change the value to set the maximum brightness achievable when not using Auto-Brightness. As far as I know, Value must be ≤ 255
Find:
Code:
<integer name="config_screenBrightnessDim">
Change the value to set the dim brightnesss. Value must be ≥ 1

TopDroid said:
Changing Minimum, Maximum, Dim Brightness
Navigate to res\values\integers.xml
Find:
Code:
<integer name="config_screenBrightnessSettingMinimum">
Change the value to set the minimum brightness achievable when not using Auto-Brightness. Value must be ≥ 1
Find:
Code:
<integer name="config_screenBrightnessSettingMaximum">
Change the value to set the maximum brightness achievable when not using Auto-Brightness. As far as I know, Value must be ≤ 255
Find:
Code:
<integer name="config_screenBrightnessDim">
Change the value to set the dim brightnesss. Value must be ≥ 1
Click to expand...
Click to collapse
Maybe you can help me? I am trying to set my default Dim level to 50% I was able to decompile my Framework-res.apk file and edit the array.xml but I can't seem to recompile the file.
I am using APKtool it will not recompile the framework-res.apk.
Thank you;
Raymond

supermax
Hi
can we force the so called "supermax" brightness on S6?
I like to always use this mode with my drone.
thanks

Related

[Guide] Permanent Disable of Ongoing Notifications

Are annoyed with ongoing notifications in pull-down menu and status bar UI?
If yes, then this tutorial is just for you :laugh:
In this tutorial, I will show you how to get rid of ongoing notifications in pull-down menu and the built-in ongoing notifications for status bar PERMANENTLY... This will not affect foreground ongoing activity..!! So here we go..
★ Disable Ongoing Notifications in Pull-down Menu ★
{
"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"
}
- Decompile SystemUI.apk.
- Navigate to res/layout folder and open tw_status_bar_expanded.xml file.
- Now, locate this section:
Code:
<LinearLayout android:orientation="vertical" android:id="@id/onGoingCart" android:background="#ff293945" android:focusable="true" android:visibility="gone" android:layout_width="[B][COLOR="Red"]fill_parent[/COLOR][/B]" android:layout_height="[B][COLOR="Red"]@dimen/status_bar_expanded_notification_category_height[/COLOR][/B]">
<TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textColor="@color/notification_category_color" android:gravity="left|center" android:id="@id/onGoingNotificationText" android:paddingLeft="11.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/status_bar_ongoing_events_title" />
</LinearLayout>
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/onGoingItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
- Change the red texts in the previous codes to the new green one bellow and add the new blue codes..
Code:
<LinearLayout android:orientation="vertical" android:id="@id/onGoingCart" android:background="#ff293945" android:focusable="true" android:visibility="gone" android:layout_width="[B][COLOR="Lime"]0.0dip[/COLOR][/B]" android:layout_height="[B][COLOR="Lime"]0.0dip[/COLOR][/B]">
<TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textColor="@color/notification_category_color" [B][COLOR="Blue"]android:visibility="gone"[/COLOR][/B] android:gravity="left|center" android:id="@id/onGoingNotificationText" android:paddingLeft="11.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/status_bar_ongoing_events_title" />
</LinearLayout>
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/onGoingItems" [B][COLOR="Blue"]android:visibility="gone"[/COLOR][/B] android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
- Save changes, recompile, push to phone, fix permissions (644) and reboot.
★ Disable Built-in Ongoing Notifications in Status Bar ★
Ok, this part is only for built-in ongoing notifications, since market apps ongoing notifications can be disabled from application manager settings..!!!
A. Disable USB Debugging Notification:
This is quiet simple. In your phone, go to /system partition folder and open build.prop file and add this line if it is not there or edit the pre-existent one to be like this one:
Code:
persist.adb.notify=[B][COLOR="Blue"]0[/COLOR][/B]
So.. 0 means disable and 1 means enable.
B. Disable Full Battery Notification:
- Baksmali SystemUI.apk.
- Go to classes/com/android/systemui/power/ folder and open PowerUI.smali.
- Search for this method ".method notifyFullBatteryNotification()V" and just add the following line (the blue line):
Code:
.method notifyFullBatteryNotification()V
.registers 12
.prologue
[B][COLOR="Blue"]return-void[/COLOR][/B]
const/4 v10, 0x0
.line 827
iget-object v7, p0, Lcom/android/systemui/SystemUI;->mContext:Landroid/content/Context;
const-string v8, "notification"
Explanation: the method will return to nothing (exit) as it is just void.
- Save changes.. smali (recompile).. push to phone.. fix permissions (644) and reboot.
C. Disable Keyboard Input Notification:
- Baksmali services.jar.
- Navigate to classout/com/android/server/ folder and open InputMethodManagerService.smali
- Search for this method ".method public setImeWindowStatus(Landroid/os/IBinder;II)V" and just add the following line (the blue line):
Code:
.method public setImeWindowStatus(Landroid/os/IBinder;II)V
.registers 23
.param p1, "token" # Landroid/os/IBinder;
.param p2, "vis" # I
.param p3, "backDisposition" # I
.prologue
[B][COLOR="Blue"]return-void[/COLOR][/B]
.line 1640
invoke-static {}, Landroid/os/Binder;->getCallingUid()I
Explanation: the method will return to nothing (exit) as it is just void.
- Save changes.. smali (recompile).. push to phone.. fix permissions (644) and reboot.
D. Disable USB Connection Notification:
This method is inspired by this thread here by @Didact74
- Decompile framework-res.apk.
- Go to res/values/ folder and open drawables.xml and add this line at the end before </resources> line:
Code:
<item type="drawable" name="stat_sys_data_usb">false</item>
- Now delete this image resource "stat_sys_data_usb.png" from both res/drawables-hdpi and drawables-xhdpi folders.
- Recompile, push to phone, fix permissions (644) and reboot.
And that's all folks for this tutorial,,, and until next tutorial,, please stay safe,,,
Yours,,
<< Adding toggle to switch on and off full battery notification and keyboard notification >>
Coming Soon....
See this thread:
http://forum.xda-developers.com/showthread.php?p=46565607#post46565607
Ho Ho Ho!
nokiamodeln91 said:
Ho Ho Ho!
Click to expand...
Click to collapse
lol.. Yei Yei
The first part., its going to disable all ongoing ones right? Not app specific.
I just want to remove the one that shows speed in the screenshot.
nokiamodeln91 said:
The first part., its going to disable all ongoing ones right? Not app specific.
Click to expand...
Click to collapse
Yes, all of whatever in pull-down menu
nokiamodeln91 said:
I just want to remove the one that shows speed in the screenshot.
Click to expand...
Click to collapse
If you want to remove that in both status bar and pull-down then uncheck show notification in application manager for that app
If you want only one of them, then you need to decompile the app and look to its smali method that invoke notification and you need to debug the <if :condition> for that method so you will have notification in status bar but not in pull-down. Yes it could be time consuming but if you are patient enough you will do it.
Thanks thats great! is there a way to stop the screen turning on and fully charged beep. the phone's screen lights up during the night when i am asleep and sometimes wakes me up!
Use xposed with gravitybox.
Fender9770 said:
Thanks thats great! is there a way to stop the screen turning on and fully charged beep. the phone's screen lights up during the night when i am asleep and sometimes wakes me up!
Click to expand...
Click to collapse
+1
how about power saving mode on??? can u guide how to hide it??? thanks.

[APP][2.1+][Make your calculator v.1.0.2] fully customizable calculator

Hi, everyone!
I developed no ordinary calculator, hope u would like it
Make your calc v.1.0.2​
{
"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"
}
​
A lot of tex:
Despite the fact that calculators should just calculate and nothing more - many don't like either inconvenient location of the buttons, or the absence of some or colors ... I offer you a fully customizable with percentages, the history of computing, the four main number systems and the ability to change the color of each element on the screen. Add to all this support profiles that are instantly switch flick and you will be able to create a calculator that will satisfy the most hardcore requirements.
Features:
Calculation expressions of infinite length highest difficulty.
[*]Four radix: HEX, DEC, OCT, BIN.
[*]73 buttons that can be located as you wish.
[*]Support profiles and wide opportunities to work with them! (As for PCs calculators have several types: standard, engineering, programmer\'s - you can do the same or even more.)
[*]Gesture support to save and switch profiles.
[*]Independence from each other portrait and landscape orientation.
[*]Wide opportunities customization: color, text size and style of each element can be adjusted separately or by default group.
[*]Support for unlimited count of your own formulas. Up to 14 variables for one formula.
[*]Support for unlimited count of own variables.
[*]Quick change settings by clicking on the appropriate area of the screen (see help).
[*]Rounding results.
[*]Customizable history and much more.
More details can be found in App's Help.
for example, you can do this crazy design:​ ​
or minimal design:​ ​
... or super minimal design for BINARY radix:​
You can calculate awesome expression like this one:
​
IMPORTANT: Advertising is only displayed on the secondary screen, but when you add buttons or watching history will hang on the top for 2 seconds! Also, ads are shown only when the Internet.​
Move/delete/add buttons availabel only for android version 3.0 an higher!​
List of available buttons: sin, cos, 1/x, tan, ctan, x^2, x^3, x^y, n!, sqrt(), +, -, *, /, +/-, asin, acos, atan, actan, C, MR, MS, M+, M-, div, mod, e, lg, ln, e^x, pi, round, A, B, C, D, E, F, NOT, XOR, OR, AND, sinh, cosh, tanh, ctanh, x, y, z, f(x), f1(x), f2(x).
coming soon:
- upload and download profiles;
- change buttons and fields size;
For open beta testing:
Join to google plus community "MakeYourCalc" (in search)​
FAQ
Profile - is:
[*]Background color.
[*]Color input / output fields.
[*]Text Style in I / O fields (size, color, bold, italic, underline).
[*]Radix (saved only when you explicitly switch to the settings menu, or when you save the profile gesture!).
[*]Countof fields with buttons and button layout.
[*]Color buttons.
[*]Text style buttons (size, color, bold, italic, underline, angle, offset horizontally and vertically).
Move, delete, configure the button:
To move, press the button and wait until the typical vibration, then you can move the button.
For delete / setup, you must move the button on the icon with the inscription at the top, which only appear when you move the buttons.
Percent:
10 + 20% = 10 + 10*20% = 12
10 - 20% = 10 - 10*20% = 8
10 * 20% = 2
10 / 20% = 50
Logarithm logX:
This calculator allows to calculate custom log.
In the calculation of binary expressions: - Sequence of clicks to calculate expression log6 (36) is as follows: 36, Log, 6 =.
In the calculation of expressions with lots of action. Supported recording logarithm logN(m), log(*)(*), where:
m, n - any number
* - any expression.
:
Working with the formulas:
After adding all of its formulas specify the unknown via ";".
For example, a sequence of keystrokes for the calculation of the formula "X * 3 - (25 + Y) / Z", where:
X=45*92,
Y=2,
Z=21-4%, next:
45, *, 92, ;, 2, ;, 21, -, 4, %, =
Settings menu​General​
Language
- Available: english, ukrainian, russian.
Display settings
- On/Off stand by mode. Work only on main display!
Automatically save profile
- When marked item profile will be saved automatically when you change any value that enters within the definition "profile - it ...". Otherwise, the profile will store its state before exiting the application.
- If not marked item profile should be maintained using hand gestures. (Default).
Clear input field
After calculating result, clean the input field by pressing the number buttons.
For example: you counted "1 +2" and press "=".
Now, in the "3." If you continue to press on "7" is the value in the field:
marked item - "7", not marked - "37"
Rounding settings
Setup rounding paramentres.
History
Setup history paramentres.
Vibrate
ON/OFF vibrate on click.
Serial calculation
The marked item: button sequence to calculate the expression "1+4-3" is as follows: "1 +, 4 -, 3 =".
If you are not marked item: button sequence to calculate the expression "1+4-3" is as follows: "1 + 4 = -, 3 =".
Trigonometric functions
Selecting argument radians / Degree / rad.
Limit the maximum value
1, 2, 4, 8 bytes. Only for HEX, OCT, BIN!
Radix
Select the current system value. When selecting automatically recorded in the current profile.
Ammended code
Show negative value in ammeded code. Only for HEX, OCT, BIN!
Qucik setup
"toggles" on main screen.
Available:
radix
trig. arguments
binary mode / expression mode
limit HEX,OC,BIN value (soon).
Formulas
Manage formulas.
Variables
Manage variables.
Calculation expressions
item checked: enabled the calculation expressions like: "2*4-(41!+32%-(4123.231 mod 21 + 2314%)-sqrt(213) * 2300) * 1% - sin(ln(4!*tan(31))
item not checked:<br> - enabled the calculation of binary expressions.
Customize​Buttons
Setup buttons
Fields
Setup fields
Saving color
item checked: on changing color in any of the orientations, the color change in both one;
item not checked: color settings are changed only in the current orientation
Saving text style
item checked: on changing text style in any of the orientations, the color change in both one;
item not checked:text style settings are changed only in the current orientation.
Input fields height
correction the height of input fields.
Buttons symbol
Select symbol for some buttons
Profile
tem checked: on the main screen the current profile name is displayed;
item not checked: profile name not shown.
Memory
Selecting the memory display on the main screen: the value of memory and/or a symbol of memory "MI"
Displaying text
item checked: the text in the text field appears on the right-to-left;
item not checked: the text in the input field is displayed from left to right.
Work with profiles​
Delete, copy, rename, create
Manage profile list: delete, rename, copy selected, create new default
Restore default
restore to default current profile
Download
Download more profiles...coming soon
Upload
Upload profile...coming soon
About​
Help
Changelog
Author
Version
Features
Download:
View attachment MakeYourCalc.apk
enjoy!
reserved
Fnot 7

Help me do a small modification of android

I have found the file to modify
/overlay/frameworks/base/core/res/res/values/config.xml
Code:
- <!-- Shutdown if the battery temperature exceeds (this value * 0.1) Celsius. -->
- <integer name="config_shutdownBatteryTemperature">600</integer>
BatteryService.java reads this value and compares with the temperature reading and issues a shutdown command.
Code:
private void shutdownIfOverTempLocked() {
// shut down gracefully if temperature is too high (> 68.0C by default)
// wait until the system has booted before attempting to display the
// shutdown dialog.
if (mBatteryProps.batteryTemperature > mShutdownBatteryTemperature) {
mHandler.post(new Runnable() {
@Override
public void run() {
if (ActivityManagerNative.isSystemReady()) {
Intent intent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
intent.putExtra(Intent.EXTRA_KEY_CONFIRM, false);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivityAsUser(intent, UserHandle.CURRENT);
}
}
});
How do I modify this value?

[App][Share][2.3+] LUX Auto Brightness

As everyone knows there is no Ambient Light Sensor on our Galaxy Core..for sensing the light in background to automatically adjust the screen brightness..
But here's an app by Cyb3rGlitch named LUX that is compatible with all android phones.
{
"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"
}
It uses the camera of the device to sense the light in the background.
If the device has Ambient Light Sensor it uses The sensor... But if it does not have a sensor it uses the camera of the device..to adjust the brightness of the screen..
LUX - The Original Android Auto-Brightness App developed by @Cyb3rGlitch
Link to original thread
http://forum.xda-developers.com/showthread.php?t=1944921
There are two version free & paid one
The link to download the free version :-
LUX LITE
https://play.google.com/store/apps/details?id=com.vitocassisi.luxlite
News
* Update to 1.51 released to Play Store!
- Profiles. Have different behaviour for day and night!
- Root plug-ins. Custom kernel with RGB control? Make a plug-in to utilise it!
- Improved notification
- Low pass filter
- Cubic interpolation
- Polish/French/Russian/German/Italian translation
- Manual sunrise location input
- Control Dashboard slider with vol. keys
- Fade duration/step
- Reduced battery usage
- Fixes
* Update to 1.06 released to Play Store!
- Automatic night mode (uses location for sunset/sunrise).
- Notification priority
- Enhanced dashboard and notification UI
- Enable/disable and refresh Lux via Tasker
- Bug fixes
* Update to 0.76 released to Play Store!
- Fixed brightness issues after call
* Update to 0.74 released to Play Store!
- Fixed max/phone brightness preferences swapped
- Added ignore 0 lux option
- Made static phone brightness optional
* Update to 0.70 released to Play Store!
- New 'ascending' automatic mode for zero jitter!
- Expandable notification for added control (Android 4.1+)
- Improved efficiency
- Install to OS functionality
- Set min/max brightness bounds
- Adjustable night mode
- Improved persistence (Android won't kill it!)
- Fixed Nexus 7 255 luma bug
- Fixed Tasker 'on wake' revert bug
- Compat. mode is now known as 'sleep mode'
- Night Mode now default Dashboard action (hold for Astro. mode)
- Misc. tweaks and fixes.
App Description
Lux isn't your ordinary brightness app. It intelligently adjusts the brightness of your display based on the environment you're in. If, for example, you step into a dimly lit room, Lux will automatically lower the brightness of your display to make it not only comfortable to read, but to also preserve battery power.
Lux provides the option to automatically adjust the backlight at fixed intervals (periodic mode), when a change in environment is detected (dynamic mode), or when the phone wakes from sleep. It's also possible to adjust the backlight manually. Simply disable automatic mode and you can use it like a traditional brightness tool!
Perhaps the best thing about Lux is that you can teach it how to behave. If the backlight is too bright or dim for your liking, simply open the provided Dashboard, adjust the brightness slider to the level you desire, then hold the link button. Lux will use this new 'link' as a reference in future.
Give it a go! I want you to test Lux for more than the 15 minute refund period offered by Google. I understand that some devices may not have the best quality light sensor, and that you may need more time to play around with settings. If you find that Lux doesn't suit you after the 15 minutes is up, you can request a refund at any time via e-mail - no questions asked.
★FEATURES★
■ Custom auto brightness.
■ Sub-zero brightness to make reading in the dark significantly less irritating.
■ Battery efficient
■ Handy brightness widget
■ Option to use the camera to read in ambient light.
■ Power-user settings such as choice of interpolation, sensor debugging, and linked sample editing.
■ Backup to SD.
■ 'Ascending' auto mode for phones with inaccurate light sensors.
■ Gradual fade for backlight adjustments.
■ Astronomer mode adds a red filter to the screen to preserve the eyesight of stargazers.
■ Jitter control to prevent constant small changes to the backlight.
■ Automatic night mode, to change the colour temperature of the display for comfortable night time viewing.
■ Add app specific exceptions via sleep mode
■ No ads, or other nuisances.
■ Tasker and Locale support!
Note: Please disable other brightness apps before using Lux. The author is not liable for any issues caused when using this app.
★PERMISSIONS★
TAKE PICTURES AND VIDEOS: Used to read in luma values, if camera input is selected.
DRAW OVER OTHER APPS: Required for night/astro mode.
READ PHONE STATE: Required to prevent Lux from interfering with phone controls in Android 4.1.
MODIFY SYSTEM SETTINGS: Brightness is a system setting, as is toggling the default auto brightness.
RETRIEVE RUNNING APPS: Required to make the 'sleep list' functionality work, so Lux can disable itself when certain apps are in the foreground.
COARSE LOCATION: Required to automatically calculate sunrise/sunset times.
IN APP BILLING: Required for purchasing future device specific root only plug-ins, to enhance functionality.
Sent from my GT-I8262 using XDA Premium 4 mobile app

Scrolling GridLayout and text that goes off the screen

I'm working on my first project where i am not following a book. I want to learn how to do this.
For this example, i am adding buttons and textviews to a gridlayout. To make it scroll, the layout is inside a scrollview:
Code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.sample"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2"
android:id="@+id/list">
</GridLayout>
</ScrollView>
The buttons are added and forced to be a specific size. The textviews are set to have large text, and given layoutparams to be centered vertically. Both are added via a for loop that works on an array holding all the data:
Code:
GridLayout layout = (GridLayout) findViewById(R.id.list);
// Calculate size of buttons in dips.
int button_dip = Math.round((float) 150 * getApplicationContext().getResources().getDisplayMetrics().density);
for(int i = 0; i < list.length; i++)
{
// Create button and set its properties.
ImageButton button = new ImageButton(this);
button.setId(i);
button.setOnClickListener(this);
button.setImageResource(list[i].image_off);
// Create textview and set its properties.
TextView title = new TextView(this);
title.setText(list[i].title);
title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 50);
// The textview's layout (parameters) requires its own object.
GridLayout.LayoutParams title_layout = new GridLayout.LayoutParams();
title_layout.setGravity(Gravity.CENTER_VERTICAL);
// Add the object to the layout.
layout.addView(button, button_dip, button_dip);
layout.addView(title, title_layout);
}
This all works, except that some longer text goes off the screen instead of wrapping. The longest text does wrap, but part of the first line does go off the screen.
1 ) Is there a better way to have a scrolling GridLayout?
2) How can the text be kept on the screen, other than by adding "\n" to the text?

Categories

Resources