DelphiFan Magazine

Top Menu

Main Menu

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS

logo

DelphiFan Magazine

  • DELPHI
  • CODE SAMPLES
  • FIREMONKEY
  • DATABASE
  • RELEASES
  • VIDEOS
  • REVIEW
  • TECH NEWS
  • How to add a server application written in UNIGUI to startup?

  • UniGUI Expiry Link Anonymizer

  • UniGUI Add CAPTCHA to the WEB project

  • UniGui. Unique hybrid of Delphi and JS

  • How to transform a blob field into string lines (varchar) in SQL Firebird?

CODE SAMPLESDELPHIFIREMONKEY
Home›CODE SAMPLES›Delphi changes Android brightness

Delphi changes Android brightness

By admin
December 10, 2020
207
0
Share:

When the screen turns black, it is usually impossible to read the application that reads the barcode displayed on the terminal.
In this case, a method of increasing the brightness of the application side device is performed.

Use WindowManager.Layoutparams to control the brightness in Delphi.

Sample code

Place a button on the form

Press the button to maximize brightness.

Press again to minimize brightness.

Describe the process. (Confirmed with Nexus 5 (Android 5.1.1))

unit Unit1;
interface
uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
  Androidapi.JNI.GraphicsContentViewText, FMX.Controls.Presentation,
  FMX.StdCtrls, Androidapi.Helpers, Androidapi.Jni, Androidapi.JNI.App
  ;
type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
  {private declaration}
    jp: JWindowManager_LayoutParams;  // WindowManager.LayoutParams
    sw: Boolean;  // Simply switch
  public
  {public declaration}
  end;
var
  Form1: TForm1;
implementation
{$R *.fmx}
procedure TForm1.Button1Click(Sender: TObject);
begin
  if sw then begin
   //Minimize brightness
    jp.screenBrightness := TJWindowManager_LayoutParams.JavaClass.BRIGHTNESS_OVERRIDE_OFF;
    sw := False;
  end else begin
    //Maximum brightness
    jp.screenBrightness := TJWindowManager_LayoutParams.JavaClass.BRIGHTNESS_OVERRIDE_FULL;
    sw := True;
  end;
  //Set reflection brightness
  TAndroidHelper.Activity.getWindow.setAttributes(jp);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
  jp := TAndroidHelper.Activity.getWindow.getAttributes; // Get the current brightness status
  sw :=True; //Initialization switch
end;
end.

 

Tagsandroidandroid brightnesschange brightnessdelphi
Previous Article

Using Android Vibration in Delphi

Next Article

Delphi recognizes the battery level of an ...

0
Shares
  • 0
  • +
  • 0
  • 0
  • 0
  • 0

admin

Related articles More from author

  • CODE SAMPLESDELPHIFIREMONKEY

    Delphi Firemonkey calls functions asynchronously in the main thread (delayed calls)

    November 3, 2020
    By admin
  • CODE SAMPLESDELPHI

    Work with External program or Files in Delphi

    November 26, 2020
    By admin
  • CODE SAMPLESDELPHI

    About memory data and JSON

    November 19, 2020
    By admin
  • CODE SAMPLESDELPHI

    UniGUI Expiry Link Anonymizer

    January 27, 2021
    By admin
  • CODE SAMPLESDELPHIFIREMONKEY

    Delphi recognizes the battery level of an Android device

    December 10, 2020
    By admin
  • CODE SAMPLESDELPHI

    TMS WEB CORE designed page layout directly from HTML&CSS

    December 9, 2020
    By admin

Leave a reply Cancel reply

You may interested

  • CODE SAMPLESDELPHI

    UniGui. Unique hybrid of Delphi and JS

  • CODE SAMPLESDELPHI

    Use LockBox does encryption and decryption

  • CODE SAMPLESDELPHI

    How to select multiple files with OpenDialog?

  • LATEST REVIEWS

  • TOP REVIEWS

Timeline

  • January 27, 2021

    How to add a server application written in UNIGUI to startup?

  • January 27, 2021

    UniGUI Expiry Link Anonymizer

  • January 26, 2021

    UniGUI Add CAPTCHA to the WEB project

  • January 26, 2021

    UniGui. Unique hybrid of Delphi and JS

  • January 13, 2021

    How to transform a blob field into string lines (varchar) in SQL Firebird?

Latest Comments

Find us on Facebook

Follow Us on Instagram

logo

Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.

About us

  • 660 Pennsylvania Avenue Southeast #100 Washington, DC 20003
  • 0123456789
  • adsdelphi@gmail.com
  • Recent

  • Popular

  • Comments

  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • UniGUI Expiry Link Anonymizer

    By admin
    January 27, 2021
  • UniGUI Add CAPTCHA to the WEB project

    By admin
    January 26, 2021
  • UniGui. Unique hybrid of Delphi and JS

    By admin
    January 26, 2021
  • How to add a server application written in UNIGUI to startup?

    By admin
    January 27, 2021
  • Amazing Cross Platform Email App Sample In Delphi 10.4.1 FireMonkey For Android And IOS

    By admin
    August 13, 2020
  • Critical Update Available For Delphi FireMonkey 10.4.1 On Android, IOS, OSX, Windows, And Linux

    By admin
    September 4, 2020
  • Setting up the IDE for your first Android Application in Delphi

    By admin
    September 7, 2020

Follow us

Find us on Facebook

© Copyright Delphifan Forum. All rights reserved.