mirror of
https://github.com/CatimaLoyalty/Android.git
synced 2026-01-29 09:11:48 -05:00
Merge pull request #259 from brarcher/setting-barcode-brightness
Configure brightening screen when display a barcode
This commit is contained in:
@@ -96,7 +96,7 @@ public class LoyaltyCardViewActivity extends AppCompatActivity
|
||||
// '1' is the brightest. We attempt to maximize the brightness
|
||||
// to help barcode readers scan the barcode.
|
||||
Window window = getWindow();
|
||||
if(window != null)
|
||||
if(window != null && settings.useMaxBrightnessDisplayingBarcode())
|
||||
{
|
||||
WindowManager.LayoutParams attributes = window.getAttributes();
|
||||
attributes.screenBrightness = 1F;
|
||||
|
||||
@@ -34,6 +34,11 @@ public class Settings
|
||||
return settings.getInt(getResString(keyId), getResInt(defaultId));
|
||||
}
|
||||
|
||||
private boolean getBoolean(@StringRes int keyId, boolean defaultValue)
|
||||
{
|
||||
return settings.getBoolean(getResString(keyId), defaultValue);
|
||||
}
|
||||
|
||||
public int getCardTitleListFontSize()
|
||||
{
|
||||
return getInt(R.string.settings_key_card_title_list_font_size, R.integer.settings_card_title_list_font_size_sp);
|
||||
@@ -58,4 +63,9 @@ public class Settings
|
||||
{
|
||||
return getInt(R.string.settings_key_card_note_font_size, R.integer.settings_card_note_font_size_sp);
|
||||
}
|
||||
|
||||
public boolean useMaxBrightnessDisplayingBarcode()
|
||||
{
|
||||
return getBoolean(R.string.settings_key_display_barcode_max_brightness, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,5 +119,6 @@
|
||||
<string name="settings_key_card_id_font_size" translatable="false">pref_card_id_font_size_sp</string>
|
||||
<string name="settings_card_note_font_size">Card note font size</string>
|
||||
<string name="settings_key_card_note_font_size" translatable="false">pref_card_note_font_size_sp</string>
|
||||
|
||||
<string name="settings_display_barcode_max_brightness">Brighten barcode view</string>
|
||||
<string name="settings_key_display_barcode_max_brightness" translatable="false">pref_display_card_max_brightness</string>
|
||||
</resources>
|
||||
|
||||
@@ -40,6 +40,10 @@
|
||||
android:defaultValue="@integer/settings_card_note_font_size_sp"
|
||||
app:vnt_maxValue="@integer/settings_card_note_max_font_size_sp"
|
||||
app:vnt_minValue="@integer/settings_card_note_min_font_size_sp" />
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/settings_key_display_barcode_max_brightness"
|
||||
android:title="@string/settings_display_barcode_max_brightness"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user