Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added: Add support for using image as background #3079

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Commits on May 3, 2023

  1. Added: Add generic method startActivityForResult() to ActivityUtils

     This method allows to launch an Activity for result.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    80b5a3c View commit details
    Browse the repository at this point in the history
  2. Added: Add the ImageUtils class for images

    The `ImageUtils` class includes utility functions for image manipulation and storage.
    It provides functions for loading bitmap or drawable, storing, resizing and compressing images.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    4d80d11 View commit details
    Browse the repository at this point in the history
  3. Added: Add getIntColorFromString() and swap() into the DataUtils

    `getIntColorFromString()` can be used to get an int color by parsing the string color. Color can be in the form of `#AARRGGBB` or `#RRGGBB`.
    
    `swap()` can be used to exchange x and y value present in `Point`.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    8a4b165 View commit details
    Browse the repository at this point in the history
  4. Added: Add support to use the image as a background

    This change allows the user to use an image as the terminal's background.
    
    Add option to select or remove the background image in the context menu -> style.
    
    `TermuxBackgroundManager` holds the responsibility of making background changes. It provides functionalities:
    - Change the background color.
    - Set or remove the background image.
    - Selecting an image from the gallery.
    - Restore the image if available.
    - Notify about the changes made to the background.
    
    `updateBackgroundColor()` is moved from `TermuxTerminalSessionActivityClient` to `TermuxBackgroundManager`.
    
    Images are stored in the termux data home directory. The image is resized corresponding to the display resolution and compressed before saving.
    
    Background overlay color is read from the `termux.properties` file with the key `background-overlay-color`. The default value is set to `#59000000`.
    
    To change the background overlay color, add `background-overlay-color=<color>` to `termux.properties` file. Supported color formats are `#AARRGGBB` or `#RRGGBB`.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    7cc8a79 View commit details
    Browse the repository at this point in the history
  5. Added: Add setting to enable or disable background image loading

    The user can enable or disable background image loading from the termux setting available in `Termux Style` preferences with this commit.
    If some malformed image is stored as background, disable image loading in the setting.
    Disabling the image from the setting will not delete image files and can be restored.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    4dc3bf6 View commit details
    Browse the repository at this point in the history
  6. Fixed: Fix default background landscape path comment

    Change comment for landscape background from `background.jpeg` to `background_landscape.jpeg`.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    5f4d6ef View commit details
    Browse the repository at this point in the history
  7. Changed: Change background of the Extra Keys Toolbar corresponding to…

    … the preference
    
    Set overlay color to the `TerminalToolbarViewPager` background when the image is background. And set the `ExtraKeysView` button to transparent.
    
    If the background is color, then set it to the default value.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    b933cba View commit details
    Browse the repository at this point in the history
  8. Fixed: Fix ImageUtils log tag value FileUtils to ImageUtils

    Co-authored-by: Susko3 <[email protected]>
    2 people authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    0b2322d View commit details
    Browse the repository at this point in the history
  9. Added|Changed: Create background directory and keep original image

    Add `TERMUX_BACKGROUND_DIR_PATH` and `TERMUX_BACKGROUND_DIR` to store background images.
    Use `TERMUX_BACKGROUND_IMAGE_PATH` and `TERMUX_BACKGROUND_IMAGE_FILE` to store original compressed image.
    Change `TERMUX_BACKGROUND_IMAGE_PORTRAIT_PATH` and `TERMUX_BACKGROUND_IMAGE_PORTRAIT_FILE` to store portrait image.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    49f8a9f View commit details
    Browse the repository at this point in the history
  10. Fixed: Fix image resizing by regenerating image files

    Compress to jpeg and store original image to `TERMUX_BACKGROUND_DIR`.
    
    Use `Activity` size instead of display size.
    
    If portrait and landcape files are deleted or `Activity` size is changed, then regenerate images using original image.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    ad77748 View commit details
    Browse the repository at this point in the history
  11. Fixed: Fix overlay color filter messing up screen on API <=28

    For Android <= 9, `PorterDuff.Mode.MULTIPLY` causing unusable screen lag. Change to `PorterDuff.Mode.DARKEN`.
    Kruna1Pate1 authored and Leonid P committed May 3, 2023
    Configuration menu
    Copy the full SHA
    6aa99e7 View commit details
    Browse the repository at this point in the history