Initial commit.
This commit is contained in:
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
buy_me_a_coffee: HeCodes2Much
|
||||
liberapay: HeCodes2Much
|
||||
github: [HeCodes2Much,DroidWorksStudio]
|
||||
132
.github/ISSUE_TEMPLATE/BUG_REPORT.yml
vendored
Normal file
132
.github/ISSUE_TEMPLATE/BUG_REPORT.yml
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
name: Bug report
|
||||
description: Create a bug report
|
||||
labels: ['Type: Bug Report']
|
||||
title: '[Bug Report] add text here'
|
||||
assignees: ['HeCodes2Much']
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for helping we to make mLauncher better by reporting a bug. :hugs:
|
||||
Please fill in as much information as possible about your bug so that we can fix it faster.
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: "Checklist"
|
||||
options:
|
||||
- label: "I will make sure to have the issue written in English with an English title."
|
||||
required: true
|
||||
- label: "I made sure that there are **no existing issues** - [open](https://github.com/HeCodes2MuchDroidWorksStudio/mLauncher/issues) or [closed](https://github.com/HeCodes2MuchDroidWorksStudio/mLauncher/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
|
||||
required: true
|
||||
- label: "I've verified that this issue hasn't been addressed in the [changelogs](https://github.com/DroidWorksStudio/mLauncher/blob/main/CHANGELOG.md)."
|
||||
required: true
|
||||
- label: "I have taken the time to fill in all the required details. I understand that the bug report will be dismissed otherwise."
|
||||
required: true
|
||||
- label: "This issue contains only one bug."
|
||||
required: true
|
||||
- label: "I optionally [donated](https://www.buymeacoffee.com/HeCodes2Much) to support the mLauncher mission."
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
id: app-version
|
||||
attributes:
|
||||
label: App version
|
||||
description: "In which version did you encounter the bug?"
|
||||
placeholder: "xx.xx - Can be seen in the app from the 'Settings' section"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: device-os-info
|
||||
attributes:
|
||||
label: Android version
|
||||
description: |
|
||||
With what operating system (+ version) did you encounter the bug?
|
||||
placeholder: "Example: Android 10"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: download
|
||||
attributes:
|
||||
label: How did you download the software?
|
||||
options:
|
||||
- F-Droid
|
||||
- Github (Release)
|
||||
- Github (Action)
|
||||
- Built from Source
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: bug-description
|
||||
attributes:
|
||||
label: Bug description
|
||||
description: |
|
||||
Please give us a description of what the bug is about.
|
||||
placeholder: |
|
||||
When I try to set the language to english, the app crashes.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: steps-to-reproduce
|
||||
attributes:
|
||||
label: Steps to reproduce the bug
|
||||
description: |
|
||||
What did you do for the bug to show up?
|
||||
If you can't cause the bug to show up again reliably (and hence don't have a proper set of steps to give us), please still try to give as many details as possible on how you think you encountered the bug.
|
||||
placeholder: |
|
||||
1. Go to '...'
|
||||
2. Press on '....'
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: |
|
||||
Tell us what you expect to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: screen-media
|
||||
attributes:
|
||||
label: Screenshots/Screen recordings
|
||||
description: |
|
||||
A picture or video is worth a thousand words.
|
||||
If applicable, share screenshots or a screen recording to help explain your problem.
|
||||
placeholder: |
|
||||
<details>
|
||||
<summary>Context</summary>
|
||||
|
||||
screenshots go in here
|
||||
|
||||
</details>
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs
|
||||
description: |
|
||||
If you could catch the log of the bug, don't forget to share it. This is the best way to point out any bug.
|
||||
|
||||
- type: textarea
|
||||
id: additional-information
|
||||
attributes:
|
||||
label: Additional information
|
||||
description: |
|
||||
Any other information you'd like to include.
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist-accept
|
||||
attributes:
|
||||
label: "Terms and Conditions"
|
||||
options:
|
||||
- label: "I have read all the rules above and filled in the requiered fields to the best of my ability."
|
||||
required: true
|
||||
- label: "I accept that if I fail to follow the rules listed above that i will be blocked from interactions with this project."
|
||||
required: true
|
||||
128
.github/ISSUE_TEMPLATE/CRASH_REPORT.yml
vendored
Normal file
128
.github/ISSUE_TEMPLATE/CRASH_REPORT.yml
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
name: Crash Report
|
||||
description: Create a report with a generated crash log attached (if possible) to help mLauncher improve
|
||||
labels: ['Type: Crash Report']
|
||||
title: '[Crash Report] add text here'
|
||||
assignees: ['HeCodes2Much']
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for helping me to make mLauncher better by reporting a crash. :hugs:
|
||||
Please fill in as much information as possible about your crash so that I can fix it immediately.
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: "Checklist"
|
||||
options:
|
||||
- label: "I will make sure to have the issue written in English with an English title."
|
||||
required: true
|
||||
- label: "I've verified that this issue hasn't been addressed in the [changelogs](https://github.com/DroidWorksStudio/mLauncher/blob/main/CHANGELOG.md)."
|
||||
required: true
|
||||
- label: "I have created the title to best match the issue."
|
||||
required: true
|
||||
- label: "I optionally [donated](https://www.buymeacoffee.com/HeCodes2Much) to support the mLauncher mission."
|
||||
required: false
|
||||
|
||||
- type: input
|
||||
id: app-version
|
||||
attributes:
|
||||
label: App version
|
||||
description: "In which version did you encounter the crash?"
|
||||
placeholder: "xx.xx - Can be seen in the app from the 'Settings' section"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: device-os-info
|
||||
attributes:
|
||||
label: Android version
|
||||
description: |
|
||||
With what operating system (+ version) did you encounter the crash?
|
||||
placeholder: "Example: Android 10"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: download
|
||||
attributes:
|
||||
label: How did you download the software?
|
||||
options:
|
||||
- F-Droid
|
||||
- Github (Release)
|
||||
- Github (Action)
|
||||
- Built from Source
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: crash-description
|
||||
attributes:
|
||||
label: Crash description
|
||||
description: |
|
||||
Please give us a description of what the crash is about.
|
||||
placeholder: |
|
||||
When I try to set the language to english, the app crashes.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: steps-to-reproduce
|
||||
attributes:
|
||||
label: Steps to reproduce the crash
|
||||
description: |
|
||||
What did you do for the crash to show up?
|
||||
If you can't cause the crash to show up again reliably (and hence don't have a proper set of steps to give us), please still try to give as many details as possible on how you think you encountered the crash.
|
||||
placeholder: |
|
||||
1. Go to '...'
|
||||
2. Press on '....'
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
attributes:
|
||||
label: Expected behavior
|
||||
description: |
|
||||
Tell us what you expect to happen.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: screen-media
|
||||
attributes:
|
||||
label: Screenshots/Screen recordings
|
||||
description: |
|
||||
A picture or video is worth a thousand words.
|
||||
If applicable, share screenshots or a screen recording to help explain your problem.
|
||||
placeholder: |
|
||||
<details>
|
||||
<summary>Context</summary>
|
||||
|
||||
screenshots go in here
|
||||
|
||||
</details>
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Logs
|
||||
description: |
|
||||
If you could catch the log of the crash, don't forget to share it. This is the best way to point out any crash.
|
||||
|
||||
- type: textarea
|
||||
id: additional-information
|
||||
attributes:
|
||||
label: Additional information
|
||||
description: |
|
||||
Any other information you'd like to include.
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist-accept
|
||||
attributes:
|
||||
label: "Terms and Conditions"
|
||||
options:
|
||||
- label: "I have read all the rules above and filled in the requiered fields to the best of my ability."
|
||||
required: true
|
||||
- label: "I accept that if I fail to follow the rules listed above that i will be blocked from interactions with this project."
|
||||
required: true
|
||||
56
.github/ISSUE_TEMPLATE/ENHANCEMENT.yml
vendored
Normal file
56
.github/ISSUE_TEMPLATE/ENHANCEMENT.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
name: Feature request
|
||||
description: Suggest an idea for this project
|
||||
labels: ['Type: Enhancement']
|
||||
title: '[Enhancement] add text here'
|
||||
assignees: ['HeCodes2Much']
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thank you for helping to make mLauncher better by suggesting a feature. :hugs:
|
||||
Your ideas are highly welcome!
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: "Checklist"
|
||||
options:
|
||||
- label: "I will make sure to have the issue written in English with an English title."
|
||||
required: true
|
||||
- label: "I made sure that there are **no existing issues** - [open](https://github.com/HeCodes2MuchDroidWorksStudio/mLauncher/issues) or [closed](https://github.com/HeCodes2MuchDroidWorksStudio/mLauncher/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
|
||||
required: true
|
||||
- label: "I have already checked the [WIKI](https://github.com/HeCodes2MuchDroidWorksStudio/mLauncher/wiki) pages and made sure that the feature isn't already exist."
|
||||
required: true
|
||||
- label: "I've verified that this issue hasn't been addressed in the [changelogs](https://github.com/DroidWorksStudio/mLauncher/blob/main/CHANGELOG.md)."
|
||||
required: true
|
||||
- label: "I have taken the time to fill in all the required details. I understand that the feature request will be dismissed otherwise."
|
||||
required: true
|
||||
- label: "This issue contains only one feature request."
|
||||
required: true
|
||||
- label: "I optionally [donated](https://www.buymeacoffee.com/HeCodes2Much) to support the mLauncher mission."
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
attributes:
|
||||
label: Feature description
|
||||
description: |
|
||||
Explain how you want the app's look or behavior to change to suit your needs.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: additional-information
|
||||
attributes:
|
||||
label: Additional information
|
||||
description: Any other information you'd like to include.
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist-accept
|
||||
attributes:
|
||||
label: "Terms and Conditions"
|
||||
options:
|
||||
- label: "I have read all the rules above and filled in the requiered fields to the best of my ability."
|
||||
required: true
|
||||
- label: "I accept that if I fail to follow the rules listed above that i will be blocked from interactions with this project."
|
||||
required: true
|
||||
51
.github/ISSUE_TEMPLATE/QUESTION.yml
vendored
Normal file
51
.github/ISSUE_TEMPLATE/QUESTION.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Question
|
||||
description: Ask about anything related
|
||||
labels: ['Type: Question']
|
||||
title: '[Question] add text here'
|
||||
assignees: ['HeCodes2Much']
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this issue! :hugs:
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist
|
||||
attributes:
|
||||
label: "Checklist"
|
||||
options:
|
||||
- label: "I will make sure to have the issue written in English with an English title."
|
||||
required: true
|
||||
- label: "I made sure that there are **no existing issues** - [open](https://github.com/HeCodes2MuchDroidWorksStudio/mLauncher/issues) or [closed](https://github.com/HeCodes2MuchDroidWorksStudio/mLauncher/issues?q=is%3Aissue+is%3Aclosed) - which I could contribute my information to."
|
||||
required: true
|
||||
- label: "I have already checked the [WIKI](https://github.com/HeCodes2MuchDroidWorksStudio/mLauncher/wiki) pages."
|
||||
required: true
|
||||
- label: "I've verified that this issue hasn't been addressed in the [changelogs](https://github.com/DroidWorksStudio/mLauncher/blob/main/CHANGELOG.md)."
|
||||
required: true
|
||||
- label: "I have taken the time to fill in all the required details. I understand that the question will be dismissed otherwise."
|
||||
required: true
|
||||
- label: "I optionally [donated](https://www.buymeacoffee.com/HeCodes2Much) to support the mLauncher mission."
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: what-is-the-question
|
||||
attributes:
|
||||
label: What is/are your question(s)?
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: additional-information
|
||||
attributes:
|
||||
label: Additional information
|
||||
description: Any other information you'd like to include.
|
||||
|
||||
- type: checkboxes
|
||||
id: checklist-accept
|
||||
attributes:
|
||||
label: "Terms and Conditions"
|
||||
options:
|
||||
- label: "I have read all the rules above and filled in the requiered fields to the best of my ability."
|
||||
required: true
|
||||
- label: "I accept that if I fail to follow the rules listed above that i will be blocked from interactions with this project."
|
||||
required: true
|
||||
14
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
14
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: GitHub Community Support
|
||||
url: https://github.com/orgs/community/discussions
|
||||
about: Please ask and answer questions here.
|
||||
- name: Organization wide discussions
|
||||
url: https://github.com/orgs/HeAndroids2Much/discussions
|
||||
about: For any discussion within our community
|
||||
- name: GitHub Security Bug Bounty
|
||||
url: https://bounty.github.com/
|
||||
about: Please report security vulnerabilities here.
|
||||
- name: Email Me
|
||||
url: mailto://wayne6324@proton.me
|
||||
about: Contact me via sending email
|
||||
50
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
50
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
### Type of Change <!-- Required -->
|
||||
|
||||
<!-- Select the applicable option(s) by placing an 'X' inside the square brackets, and remove any options that are not relevant. -->
|
||||
|
||||
- [ ] Bug Fix (user-facing) <!-- Non-breaking change which fixes an issue -->
|
||||
- [ ] Feature Request (user-facing) <!-- Non-breaking change which adds functionality -->
|
||||
- [ ] Codebase Improvement (developer-facing) <!-- Non-breaking change which refines the codebase -->
|
||||
- [ ] Breaking Change (developer/user-facing) <!-- Fix or feature that would cause existing functionality to not work as expected -->
|
||||
- [ ] Release (user-facing) <!-- New release for mLauncher -->
|
||||
- [ ] This change requires a documentation update
|
||||
|
||||
### All Submissions <!-- Check all applicable options -->
|
||||
|
||||
- [ ] Checked for existing [Pull Requests](../../../pulls) for the same update/change <!-- Required -->
|
||||
- [ ] Descriptive commit message with a short title <!-- Required -->
|
||||
- [ ] Self-reviewed code <!-- Required -->
|
||||
- [ ] Code comments, especially in complex areas <!-- Required -->
|
||||
- [ ] No new warnings or errors introduced <!-- Required -->
|
||||
- [ ] Changes made in a separate branch <!-- Required -->
|
||||
- [ ] Branch named with appropriate prefix (e.g., 'bug/', 'feat/', 'clean/', 'release/') <!-- Required -->
|
||||
<!-- Examples: 'bug/signin-issue', 'feat/issue-templates', 'clean/code-change-to-app-draw'. -->
|
||||
|
||||
### Before Opening Pull Request
|
||||
|
||||
- [ ] Descriptive title for your PR <!-- Required -->
|
||||
- [ ] Detailed description of changes <!-- Required -->
|
||||
- [ ] Include 'closes/fixes #XXXX' in the comment to auto-close relevant issues <!-- Delete if not relevant -->
|
||||
|
||||
### Description of Changes
|
||||
|
||||
<!--
|
||||
Include a summary of changes, related issues, motivation, context, and dependencies.
|
||||
-->
|
||||
|
||||
#### Changes Description <!-- Provide a brief description of each new feature or issue fix. -->
|
||||
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### Test Device: <!-- Required -->
|
||||
- mLauncher version:
|
||||
- Device name:
|
||||
- Android version:
|
||||
- Other information:
|
||||
|
||||
<!--
|
||||
Please ensure compliance with these guidelines to facilitate smoother handling of your submission.
|
||||
Non-compliance may result in delays or rejection of your pull request.
|
||||
-->
|
||||
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "gradle" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
30
.github/workflows/add-comment-for-help-wanted_ci.yml
vendored
Normal file
30
.github/workflows/add-comment-for-help-wanted_ci.yml
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
# GitHub recommends pinning actions to a commit SHA.
|
||||
# To get a newer version, you will need to update the SHA.
|
||||
# You can also reference a tag or branch, but the action may change without warning.
|
||||
|
||||
name: Create Comment When Help wanted
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- labeled
|
||||
|
||||
jobs:
|
||||
add-comment:
|
||||
if: contains(github.event.label.name, 'Help Wanted')
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
steps:
|
||||
- name: Create comment
|
||||
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043
|
||||
with:
|
||||
token: ${{ secrets.GIT_BOT_TOKEN }}
|
||||
issue-number: ${{ github.event.issue.number }}
|
||||
body: |
|
||||
This issue is available for anyone to work on. **Make sure to reference this issue in your pull request.** :sparkles: Thank you for your contribution! :sparkles:
|
||||
49
.github/workflows/android-branch_ci.yml
vendored
Normal file
49
.github/workflows/android-branch_ci.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
# Builds the project
|
||||
name: Android Feature Branch CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
- '*/**'
|
||||
- '!*main'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build, Sign & Upload
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GIT_BOT_TOKEN }}
|
||||
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew clean && ./gradlew assembleDebug
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Signed app bundle
|
||||
path: app/build/outputs/apk/debug/*.apk
|
||||
retention-days: 3
|
||||
47
.github/workflows/android-main_ci.yml
vendored
Normal file
47
.github/workflows/android-main_ci.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# Builds the project, signs an API, and then uploads it
|
||||
name: Android Main Branch CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build, Sign & Upload
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GIT_BOT_TOKEN }}
|
||||
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew clean && ./gradlew assembleDebug
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Signed app bundle
|
||||
path: app/build/outputs/apk/debug/*.apk
|
||||
retention-days: 3
|
||||
47
.github/workflows/android-pr_ci.yml
vendored
Normal file
47
.github/workflows/android-pr_ci.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# Builds the project and uploads a debug APK
|
||||
name: Android PR CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build, Sign & Upload
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew clean && ./gradlew assembleDebug
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Signed app bundle
|
||||
path: app/build/outputs/apk/debug/*.apk
|
||||
retention-days: 3
|
||||
60
.github/workflows/android-release_ci.yml
vendored
Normal file
60
.github/workflows/android-release_ci.yml
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
# Builds the project
|
||||
name: Android Release CI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build, Sign & Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GIT_BOT_TOKEN }}
|
||||
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
|
||||
- name: Build
|
||||
run: ./gradlew clean && ./gradlew assembleRelease
|
||||
|
||||
- name: Sign APK
|
||||
uses: ilharp/sign-android-release@v1
|
||||
# ID used to access action output
|
||||
id: sign_app
|
||||
with:
|
||||
releaseDir: app/build/outputs/apk/release
|
||||
signingKey: ${{ secrets.SIGNINGKEY_BASE64 }}
|
||||
keyAlias: ${{ secrets.KEY_ALIAS }}
|
||||
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||
keyPassword: ${{ secrets.KEY_PASSWORD }}
|
||||
buildToolsVersion: 33.0.0
|
||||
|
||||
- name: Release to GitHub
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
with:
|
||||
repo_token: ${{ secrets.GIT_BOT_TOKEN }}
|
||||
file: ${{steps.sign_app.outputs.signedFile}}
|
||||
asset_name: mLauncher-${{ github.ref_name }}-Signed.apk
|
||||
tag: ${{ github.ref }}
|
||||
overwrite: true
|
||||
55
.github/workflows/changelog.yml
vendored
Normal file
55
.github/workflows/changelog.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
name: Update CHANGELOG.md
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
branches:
|
||||
- 'main'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
changelog:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GIT_BOT_TOKEN }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate a changelog
|
||||
uses: orhun/git-cliff-action@v3
|
||||
with:
|
||||
config: cliff.toml
|
||||
args: --verbose
|
||||
env:
|
||||
OUTPUT: CHANGELOG.md
|
||||
|
||||
- name: Import GPG key
|
||||
id: import_gpg
|
||||
uses: crazy-max/ghaction-import-gpg@v2
|
||||
with:
|
||||
git_user_signingkey: true
|
||||
git_commit_gpgsign: true
|
||||
env:
|
||||
GPG_PRIVATE_KEY: ${{ secrets.GIT_ACTIONS_GPG_KEY }}
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
if [[ `git status --porcelain` ]]; then
|
||||
COMMIT_AUTHOR=$(git log -1 --pretty=%an)
|
||||
if [[ "$COMMIT_AUTHOR" != "HeCodes2Much-Bot" ]]; then
|
||||
git config --global user.name ${{ secrets.GIT_NAME }}
|
||||
git config --global user.email ${{ secrets.GIT_EMAIL }}
|
||||
|
||||
git add -A
|
||||
git commit -m "chore(changelog): Update CHANGELOG.md"
|
||||
git push origin main
|
||||
else
|
||||
echo "WARNING: $COMMIT_AUTHOR last committed."
|
||||
fi
|
||||
else
|
||||
echo "WARNING: No changes were detected."
|
||||
fi
|
||||
shell: bash
|
||||
31
.github/workflows/close-inactive-issues_ci.yml
vendored
Normal file
31
.github/workflows/close-inactive-issues_ci.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
name: Close Inactive Issues & Pull Requests
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 1 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
close-issues:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
days-before-issue-stale: 30
|
||||
days-before-issue-close: 14
|
||||
stale-issue-label: "Status: Stale"
|
||||
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
|
||||
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
|
||||
exempt-issue-labels: "Status: Help wanted, Status: Work In Progress, Status: Waiting For a Response, Status: Todo"
|
||||
days-before-pr-stale: 90
|
||||
days-before-pr-close: 30
|
||||
close-issue-reason: "not_planned"
|
||||
stale-pr-label: "Status: Stale"
|
||||
close-pr-label: "Status: Stale"
|
||||
stale-pr-message: "This pull request is stale because it has been open for 30 days with no activity."
|
||||
close-pr-message: "This pull request was closed because it has been inactive for 14 days since being marked as stale."
|
||||
exempt-pr-labels: "Status: Help wanted, Status: Work In Progress, Status: Waiting For a Response, Status: Todo"
|
||||
repo-token: ${{ secrets.GIT_BOT_TOKEN }}
|
||||
16
.github/workflows/delete-unused-caches_ci.yml
vendored
Normal file
16
.github/workflows/delete-unused-caches_ci.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
name: Delete Unused Caches
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 1 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
delete:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Do other steps like checkout, install, compile, etc.
|
||||
- uses: MyAlbum/purge-cache@master
|
||||
with:
|
||||
max-age: 1800 # Cache max 7 days since last use (this is the default)
|
||||
debug: true # Set to true to output debug info
|
||||
21
.github/workflows/gitguardian.yaml
vendored
Normal file
21
.github/workflows/gitguardian.yaml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: GitGuardian scan
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
scanning:
|
||||
name: GitGuardian scan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # fetch all history so multiple commits can be scanned
|
||||
- name: GitGuardian scan
|
||||
uses: GitGuardian/ggshield/actions/secret@v1.26.0
|
||||
env:
|
||||
GITHUB_PUSH_BEFORE_SHA: ${{ github.event.before }}
|
||||
GITHUB_PUSH_BASE_SHA: ${{ github.event.base }}
|
||||
GITHUB_PULL_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
GITHUB_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
||||
GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }}
|
||||
24
.github/workflows/thank-you-issue_ci.yml
vendored
Normal file
24
.github/workflows/thank-you-issue_ci.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Thank New Reporters
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- reopened
|
||||
- opened
|
||||
|
||||
jobs:
|
||||
comment:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{ secrets.GIT_BOT_TOKEN }}
|
||||
script: |
|
||||
github.rest.issues.createComment({
|
||||
issue_number: context.issue.number,
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
body: `👋 Thanks for reporting!
|
||||
|
||||
We will get back to you soon about this issue.`
|
||||
})
|
||||
20
.github/workflows/validate-gradle-wrapper.yml
vendored
Normal file
20
.github/workflows/validate-gradle-wrapper.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: Validate Gradle Wrapper
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
- '!translate_main'
|
||||
pull_request:
|
||||
branches:
|
||||
- 'main'
|
||||
|
||||
jobs:
|
||||
validation:
|
||||
name: Validation
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- uses: gradle/wrapper-validation-action@v1
|
||||
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/*
|
||||
/build
|
||||
/pages
|
||||
/wiki
|
||||
/app/release
|
||||
/app/build
|
||||
/app/debug
|
||||
diff.*
|
||||
17
CHANGELOG.md
Normal file
17
CHANGELOG.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [unreleased]
|
||||
|
||||
### ⚙️ Miscellaneous Tasks
|
||||
|
||||
- *(changelog)* Update CHANGELOG.md
|
||||
- *(changelog)* Update CHANGELOG.md
|
||||
|
||||
### Fix
|
||||
|
||||
- Fixed App Icon
|
||||
- Updated Strings
|
||||
|
||||
<!-- generated by git-cliff -->
|
||||
112
CODE_OF_CONDUCT.md
Normal file
112
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,112 @@
|
||||
# Contributor Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
- Using welcoming and inclusive language
|
||||
- Demonstrating empathy and kindness toward other people
|
||||
- Being respectful of differing opinions, viewpoints, and experiences
|
||||
- Gracefully accepting constructive criticism
|
||||
- Attempting collaboration before conflict
|
||||
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
- Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
- Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
- Violence, threats of violence, or inciting others to commit self-harm
|
||||
- The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
- Trolling, intentionally spreading misinformation, insulting/derogatory
|
||||
comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
- Abuse of the reporting process to intentionally harass or exclude others
|
||||
- Advocating for, or encouraging, any of the above behavior
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting us anonymously at wayne6324@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
If you are unsure whether an incident is a violation, or whether the space where the incident took place is covered by our Code of Conduct, **we encourage you to still report it**. We would prefer to have a few extra reports where we decide to take no action, than to leave an incident go unnoticed and unresolved that may result in an individual or group to feel like they can no longer participate in the community. Reports deemed as not a violation will also allow us to improve our Code of Conduct and processes surrounding it. If you witness a dangerous situation or someone in distress, we encourage you to report even if you are only an observer.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Project maintainers will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from project maintainers, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), [version 1.4](https://www.contributor-covenant.org/version/1/4/code-of-conduct.html).
|
||||
95
CONTRIBUTING.md
Normal file
95
CONTRIBUTING.md
Normal file
@@ -0,0 +1,95 @@
|
||||
# Contributing to mLauncher
|
||||
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
|
||||
|
||||
- Reporting a bug
|
||||
- Discussing the current state of the code
|
||||
- Submitting a fix
|
||||
- Proposing new features
|
||||
- Becoming a maintainer
|
||||
|
||||
Reading and following these guidelines will help us make the contribution process easy and effective for everyone involved. It also communicates that you agree to respect the time of the developers managing and developing these open source projects. In return, we will reciprocate that respect by addressing your issue, assessing changes, and helping you finalize your pull requests.
|
||||
|
||||
## Quicklinks
|
||||
|
||||
* [Code of Conduct](#code-of-conduct)
|
||||
* [Getting Started](#getting-started)
|
||||
* [We Develop with Github](#we-develop-with-github)
|
||||
* [Pull Requests](#pull-requests)
|
||||
* [Issues](#issues)
|
||||
* [Code Style](#code-style)
|
||||
* [License](#license)
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
We take our open source community seriously and hold ourselves and other contributors to high standards of communication. By participating and contributing to this project, you agree to uphold our [Code of Conduct](CODE-OF-CONDUCT.md).
|
||||
|
||||
## Getting Started
|
||||
|
||||
Contributions are made to this repo via Issues and Pull Requests (PRs). A few general guidelines that cover both:
|
||||
|
||||
- Search for existing Issues and PRs before creating your own.
|
||||
- We work hard to makes sure issues are handled in a timely manner but, depending on the impact, it could take a while to investigate the root cause. A friendly ping in the comment thread to the submitter or a contributor can help draw attention if your issue is blocking.
|
||||
|
||||
|
||||
### We Develop with Github
|
||||
We use github to host code, to track issues and feature requests, as well as accept pull requests.
|
||||
|
||||
### Pull Requests
|
||||
|
||||
**We Use ["fork-and-pull" Git workflow](FAPRW.md), So All Code Changes Happen Through Pull Requests**
|
||||
|
||||
Pull requests are the best way to propose changes to the codebase (In general, we follow the ["fork-and-pull" Git workflow](FAPRW.md)). We actively welcome your pull requests:
|
||||
|
||||
1. Fork the repository to your own Github account
|
||||
2. Clone the project to your machine
|
||||
3. Create a branch locally with a succinct but descriptive name
|
||||
4. Commit changes to the branch
|
||||
5. Following any formatting and testing guidelines specific to this repo
|
||||
6. Push changes to your fork
|
||||
7. Open a PR in our repository and follow the PR template so that we can efficiently review the changes.
|
||||
|
||||
In general, PRs should:
|
||||
|
||||
- Only fix/add the functionality in question **OR** address wide-spread whitespace/style issues, not both.
|
||||
- Address a single concern in the least number of changed lines as possible.
|
||||
- Be accompanied by a complete Pull Request template (loaded automatically when a PR is created).
|
||||
|
||||
For changes that address core functionality or would require breaking changes (e.g. a major release), it's best to open an Issue to discuss your proposal first. This is not required but can save time creating and reviewing changes.
|
||||
|
||||
### Issues
|
||||
|
||||
Issues should be used to report problems with the project, request a new feature, or to discuss potential changes before a PR is created. When you create a new Issue, a template will be loaded that will guide you through collecting and providing the information we need to investigate.
|
||||
|
||||
If you find an Issue that addresses the problem you're having, please add your own reproduction information to the existing issue rather than creating a new one. Adding a [reaction](https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) can also help be indicating to our maintainers that a particular problem is affecting more than just the reporter.
|
||||
|
||||
**Report bugs using Github's [issues](https://github.com/HeCodes2Much/mLauncher/issues)**
|
||||
|
||||
We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/HeCodes2Much/mLauncher/issues/new/choose); it's that easy!
|
||||
|
||||
Write bug reports with detail, background, and sample code
|
||||
|
||||
**Great Bug Reports** tend to have:
|
||||
|
||||
- A quick summary and/or background
|
||||
- Steps to reproduce
|
||||
- Be specific!
|
||||
- Give sample code if you can.
|
||||
- What you expected would happen
|
||||
- What actually happens
|
||||
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
|
||||
|
||||
People *love* thorough bug reports. I'm not even kidding.
|
||||
|
||||
### Code Style
|
||||
|
||||
**Use a Consistent Coding Style**
|
||||
|
||||
* 4 spaces for indentation rather than tabs
|
||||
|
||||
## License
|
||||
|
||||
**Any contributions you make will be under the GPL-3.0 License**
|
||||
|
||||
In short, when you submit code changes, your submissions are understood to be under the same [GPL-3.0 License]([http://choosealicense.com/licenses/mit/](https://choosealicense.com/licenses/gpl-3.0/)) that covers the project. Feel free to contact the maintainers if that's a concern.
|
||||
|
||||
By contributing, you agree that your contributions will be licensed under its GPL-3.0 License.
|
||||
728
FAPRW.md
Normal file
728
FAPRW.md
Normal file
@@ -0,0 +1,728 @@
|
||||
Fork and Pull Request Workflow
|
||||
==============================
|
||||
|
||||
This document describes how developers may contribute pull requests to
|
||||
an upstream repository and how upstream owners may merge pull requests
|
||||
from contributors according to the very popular fork and pull request
|
||||
workflow followed in many projects on GitHub.
|
||||
|
||||
Contents
|
||||
--------
|
||||
|
||||
* [Introduction](#introduction)
|
||||
* [Quick Reference](#quick-reference)
|
||||
* [Create Pull Request](#create-pull-request)
|
||||
* [Fork and Clone](#fork-and-clone)
|
||||
* [Work on Pull Request](#work-on-pull-request)
|
||||
* [Keep Your Fork Updated](#keep-your-fork-updated)
|
||||
* [Amend Last Commit](#amend-last-commit)
|
||||
* [Rebase Commits](#rebase-commits)
|
||||
* [Edit Commits](#edit-commits)
|
||||
* [Force Push](#force-push)
|
||||
* [Delete Branch](#delete-branch)
|
||||
* [Merge Pull Request](#merge-pull-request)
|
||||
* [Without Merge Commit](#without-merge-commit)
|
||||
* [With Merge Commit](#with-merge-commit)
|
||||
* [Nifty Commands](#nifty-commands)
|
||||
* [Pretty Log](#pretty-log)
|
||||
* [Staged Diff](#staged-diff)
|
||||
* [Branch Listing](#branch-listing)
|
||||
* [More Aliases](#more-aliases)
|
||||
* [Merge Base](#merge-base)
|
||||
* [Commit Partial Changes](#commit-partial-changes)
|
||||
* [Some Git Wisdom](#some-git-wisdom)
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
Every project has a main development branch where the developers push
|
||||
commits on a day-to-day basis. Usually, the main development branch is
|
||||
`master` but some projects choose to have `develop` or `trunk` or
|
||||
another branch for day-to-day development activities. We refer to this
|
||||
main development branch as the *main development branch* throughout this
|
||||
document to keep the text general. However in the command examples and
|
||||
ASCII-diagrams, we use `master` as an example of the main development
|
||||
branch.
|
||||
|
||||
We use the following placeholders in the command examples and
|
||||
ASCII-diagrams in this document:
|
||||
|
||||
- `GITHUB`: [`github.com`](https://github.com/) or domain
|
||||
name/hostname of your private GitHub Enterprise system.
|
||||
- `USER` or `CONTRIBUTOR`: The user that forks an upstream repository,
|
||||
creates pull requests, and sends them to the upstream repository.
|
||||
- `UPSTREAM-OWNER`: Owner of the upstream repository. This is the name
|
||||
of the user or organization that merges pull requests into the
|
||||
upstream repository.
|
||||
- `REPO`: Repository name.
|
||||
- `FILES`: One or more filenames to be staged for a commit.
|
||||
- `TOPIC-BRANCH`: Feature-specific or bug-specific branch where a
|
||||
contributor develops her or his contribution. This is referred to as
|
||||
the *topic branch* in the text.
|
||||
|
||||
These placeholders should be substituted with appropriate values while
|
||||
executing the commands presented in this document.
|
||||
|
||||
Beginners to this workflow should always remember that a Git branch is
|
||||
not a container of commits, but rather a lightweight moving pointer that
|
||||
points to a commit in the commit history.
|
||||
|
||||
A---B---C
|
||||
↑
|
||||
(master)
|
||||
|
||||
When a new commit is made in a branch, its branch pointer simply moves
|
||||
to point to the last commit in the branch.
|
||||
|
||||
A---B---C---D
|
||||
↑
|
||||
(master)
|
||||
|
||||
A branch is merely a pointer to the tip of a series of commits. With
|
||||
this little thing in mind, seemingly complex operations like rebase and
|
||||
fast-forward merges become easy to understand and use.
|
||||
|
||||
The next section, *[Quick Reference](#quick-reference)*, provides a brief
|
||||
summary of all the frequently used commands involved in creating and merging
|
||||
pull requests.
|
||||
|
||||
Quick Reference
|
||||
---------------
|
||||
|
||||
Here is a brief summary of all the commands used to create and merge
|
||||
pull requests in this document. This section serves as a quick
|
||||
reference.
|
||||
|
||||
# CREATE PULL REQUEST
|
||||
# ===================
|
||||
# Fork upstream and clone your fork.
|
||||
git clone https://GITHUB/USER/REPO.git
|
||||
cd REPO
|
||||
git remote add upstream https://GITHUB/UPSTREAM-OWNER/REPO.git
|
||||
git remote -v
|
||||
|
||||
# Work on pull request in a new topic branch.
|
||||
git checkout -b TOPIC-BRANCH
|
||||
git add FILES
|
||||
git commit
|
||||
git push origin TOPIC-BRANCH
|
||||
|
||||
# Go to your fork on GitHub, switch to the topic branch, and
|
||||
# click *Compare & pull request*.
|
||||
|
||||
# Keep your fork's main development branch updated with upstream's.
|
||||
git checkout master
|
||||
git pull upstream master
|
||||
git push origin master
|
||||
|
||||
# Amend last commit (optional).
|
||||
git add FILES
|
||||
git commit --amend
|
||||
|
||||
# Rebase topic branch on the main development branch (optional).
|
||||
git checkout TOPIC-BRANCH
|
||||
git rebase master
|
||||
|
||||
# Edit commits, e.g., last 3 commits in topic branch (optional).
|
||||
git checkout TOPIC-BRANCH
|
||||
git rebase -i HEAD~3
|
||||
|
||||
# Force push rebased/edited commits to the pull request (optional).
|
||||
git push -f origin TOPIC-BRANCH
|
||||
|
||||
# Delete topic branch branch after pull request is merged.
|
||||
git checkout master
|
||||
git branch -D TOPIC-BRANCH
|
||||
git push -d origin TOPIC-BRANCH
|
||||
|
||||
|
||||
# MERGE PULL REQUEST (WITHOUT MERGE COMMIT)
|
||||
# =========================================
|
||||
# Clone upstream repo.
|
||||
git clone https://GITHUB/UPSTREAM-OWNER/REPO.git
|
||||
cd REPO
|
||||
|
||||
# Keep the local main development branch up-to-date.
|
||||
git checkout master
|
||||
git pull
|
||||
|
||||
# Pull changes in pull request into a temporary branch.
|
||||
git checkout -b pr
|
||||
git pull https://GITHUB/CONTRIBUTOR/REPO.git TOPIC-BRANCH
|
||||
|
||||
# If the above command does not create a new merge commit, ignore
|
||||
# this comment and follow the remaining commands after this comment.
|
||||
#
|
||||
# If the above command creates a new merge commit, first consider
|
||||
# that it is okay to have a merge commit. However, if you want to
|
||||
# get rid of it, choose exactly one of the following three options:
|
||||
#
|
||||
# - Request the contributor to rebase the topic branch on the main
|
||||
# development branch. After the contributor has done so, delete
|
||||
# the temporary branch, start over, and pull the changes again.
|
||||
# (Commands: git checkout master; git branch -D pr)
|
||||
#
|
||||
# - Go to the pull request page on GitHub, click on the dropdown
|
||||
# menu next to 'Merge pull request', select 'Rebase and merge',
|
||||
# and click 'Rebase and merge'.
|
||||
#
|
||||
# - Rebase the topic branch on the main development branch. Then
|
||||
# follow the commands below. Finally close the pull request on
|
||||
# GitHub manually. (Command: git rebase master)
|
||||
|
||||
# Merge pull request and delete temporary branch.
|
||||
git checkout master
|
||||
git merge pr
|
||||
git branch -d pr
|
||||
|
||||
# Push the updated main development branch to upstream repo.
|
||||
git push origin master
|
||||
|
||||
# MERGE PULL REQUEST (WITH MERGE COMMIT)
|
||||
# ======================================
|
||||
# Clone upstream repo.
|
||||
git clone https://GITHUB/UPSTREAM-OWNER/REPO.git
|
||||
cd REPO
|
||||
|
||||
# Keep the local main development branch up-to-date.
|
||||
git checkout master
|
||||
git pull
|
||||
|
||||
# Pull changes in pull request into a temporary branch.
|
||||
git checkout -b pr
|
||||
git pull https://GITHUB/CONTRIBUTOR/REPO.git TOPIC-BRANCH
|
||||
|
||||
# Merge pull request and delete temporary branch.
|
||||
git checkout master
|
||||
git merge --no-ff pr
|
||||
git branch -d pr
|
||||
|
||||
# Push the updated main development branch to upstream repo.
|
||||
git push origin master
|
||||
|
||||
The next two sections, *[Create Pull Request](#create-pull-request)*
|
||||
and *[Merge Pull Request](#merge-pull-request)*, elaborate these
|
||||
commands in detail.
|
||||
|
||||
Create Pull Request
|
||||
-------------------
|
||||
|
||||
This section is meant for developers who contribute new commits to the
|
||||
upstream repository from their personal fork.
|
||||
|
||||
|
||||
### Fork and Clone
|
||||
|
||||
On GitHub, fork the upstream repository to your personal user account.
|
||||
|
||||
Then clone your fork from your personal GitHub user account to your
|
||||
local system and set the upstream repository URL as a remote named
|
||||
`upstream`.
|
||||
|
||||
git clone https://GITHUB/USER/REPO.git
|
||||
cd REPO
|
||||
git remote add upstream https://GITHUB/UPSTREAM-OWNER/REPO.git
|
||||
git remote -v
|
||||
|
||||
Now the remote named `upstream` points to the upstream repository and
|
||||
the remote named `origin` points to your fork.
|
||||
|
||||
|
||||
### Work on Pull Request
|
||||
|
||||
Work on a new pull request in a new topic branch and commit it to your
|
||||
fork. Remember to use a meaningful name instead of `TOPIC-BRANCH` in the
|
||||
commands below.
|
||||
|
||||
git checkout -b TOPIC-BRANCH
|
||||
git add FILES
|
||||
git commit
|
||||
git push origin TOPIC-BRANCH
|
||||
|
||||
Create pull request via GitHub web interface as per the following steps:
|
||||
|
||||
- Go to your fork on GitHub.
|
||||
- Switch to the topic branch.
|
||||
- Click *Compare & pull request*.
|
||||
- Click *Create pull request*.
|
||||
|
||||
Wait for an upstream developer to review and merge your pull request.
|
||||
|
||||
If there are review comments to be addressed, continue working on your
|
||||
branch, commiting, optionally rebasing, amending, squashing, and
|
||||
dropping them, and pushing them to the topic branch of `origin` (your
|
||||
fork). Any changes to the topic branch automatically become available in
|
||||
the pull request.
|
||||
|
||||
In the fork and pull request workflow, a contributor should never commit
|
||||
anything to the main development branch of personal fork. This makes it
|
||||
very easy to keep the main development branch of your fork in sync with
|
||||
that of the upstream repository. This is explained in the next
|
||||
subsection.
|
||||
|
||||
### Keep Your Fork Updated
|
||||
|
||||
As new pull requests get merged into the upstream's main development
|
||||
branch, the main development branch of your fork begins falling behind
|
||||
it.
|
||||
|
||||
The commands below show how to update your fork's main development
|
||||
branch with the new commits in the upstream's main development branch.
|
||||
|
||||
git checkout master
|
||||
git pull upstream master
|
||||
git push origin master
|
||||
|
||||
The `git pull` command above simply fast-forwards the main development
|
||||
branch from an earlier commit to the last commit in the upstream's main
|
||||
development branch.
|
||||
|
||||
When your main development branch falls behind the upstream's main
|
||||
development branch, the upstream's main development branch extends
|
||||
linearly from the last commit in your main development branch, provided
|
||||
that there are no additional commits to your main development branch
|
||||
that has caused it to diverge.
|
||||
|
||||
E---F---G (TOPIC-BRANCH)
|
||||
/
|
||||
A---B---C---D (master)
|
||||
\
|
||||
H---I---J (upstream/master)
|
||||
|
||||
|
||||
With such a commit history, when the upstream's main development branch
|
||||
is merged into your main development branch, the merge is done by simply
|
||||
fast-forwarding the pointer of your main development branch to the last
|
||||
commit in the upstream's main development branch.
|
||||
|
||||
E---F---G (TOPIC-BRANCH)
|
||||
/
|
||||
A---B---C---D
|
||||
\
|
||||
H---I---J (upstream/master, master)
|
||||
|
||||
After the merge is complete, the upstream's main development branch and
|
||||
your main development branch point to the same commit.
|
||||
|
||||
### Amend Last Commit
|
||||
|
||||
This is an optional step to rework on the last commit. After commiting
|
||||
some work, one may realize that some files need to be modified or the
|
||||
commit message needs to updated.
|
||||
|
||||
E---F---G (TOPIC-BRANCH)
|
||||
/
|
||||
A---B---C---D (master)
|
||||
|
||||
Git allows us to pick the last commit, modify the changes made in that
|
||||
commit including the commit message, and reapply the changes along with
|
||||
the modifications as a new commit that replaces the last commit.
|
||||
|
||||
E---F---G' (TOPIC-BRANCH)
|
||||
/
|
||||
A---B---C---D (master)
|
||||
|
||||
To do so, first rework on the files and make the necessary changes. Then
|
||||
add, remove, move, or rename files to stage them for commiting. Finally,
|
||||
amend the last commit. The commit message may be modified when the
|
||||
editor comes up to show the commit message.
|
||||
|
||||
git add FILES
|
||||
git commit --amend
|
||||
|
||||
Although the above example shows only the `git add` command to add new
|
||||
or modified files for commiting, one may amend the last commit by
|
||||
removing, moving, and renaming files with the `git rm` and `git mv`
|
||||
commands before amending the last commit.
|
||||
|
||||
To update only the commit message without changing files, run only `git
|
||||
commit --amend`.
|
||||
|
||||
|
||||
### Rebase Commits
|
||||
|
||||
This is an optional step to keep the commit history as linear as possible.
|
||||
|
||||
The main development branch may have diverged since the topic branch was
|
||||
created.
|
||||
|
||||
E---F---G (TOPIC-BRANCH)
|
||||
/
|
||||
A---B---C---D (master)
|
||||
|
||||
It may be a good idea to move the commits in the topic branch and place
|
||||
them on top of the main development branch, so that the topic branch
|
||||
extends linearly from the last commit in the main development branch.
|
||||
|
||||
E'--F'--G' (TOPIC-BRANCH)
|
||||
/
|
||||
A---B---C---D (master)
|
||||
|
||||
The following commands show how to rebase the topic branch on the main
|
||||
development branch.
|
||||
|
||||
git checkout TOPIC-BRANCH
|
||||
git rebase master
|
||||
|
||||
|
||||
### Edit Commits
|
||||
|
||||
This is an optional step to keep the commit history clean and concise.
|
||||
|
||||
A pull request may contain multiple commits. Sometimes one may need to
|
||||
amend a commit that is not the last commit in the pull request. Commits
|
||||
prior to the last commit can be amended with the interactive rebase
|
||||
command.
|
||||
|
||||
After developing the required feature or bug-fix in a topic branch, the
|
||||
developer or a reviewer may notice issues in the work that need to be
|
||||
addressed before the pull request can be merged into the upstream
|
||||
repository. This may lead to multiple new commits in the topic branch
|
||||
that should ideally have been part of the first commit that implemented
|
||||
that feature or bug-fix.
|
||||
|
||||
E---F---G (TOPIC-BRANCH)
|
||||
/
|
||||
A---B---C---D (master)
|
||||
|
||||
In such cases, it may be a good idea to squash multiple commits in the
|
||||
topic branch into a single coherent commit with all changes for the
|
||||
feature or bug-fix being developed.
|
||||
|
||||
E' (TOPIC-BRANCH)
|
||||
/
|
||||
A---B---C---D (master)
|
||||
|
||||
The following example shows how to amend the last 3 commits.
|
||||
|
||||
git checkout TOPIC-BRANCH
|
||||
git rebase -i HEAD~3
|
||||
|
||||
This brings up an editor with three lines for the last 3 commits ordered
|
||||
from earliest to last followed by instructions on how to edit these
|
||||
lines to amend the commits.
|
||||
|
||||
For example, to squash all three commits into one, leave the first
|
||||
commit untouched, replace `pick` with `squash` in the next two lines,
|
||||
save, and quit the editor. This brings up the editor again. Clean up the
|
||||
commit message, save, and quit the editor.
|
||||
|
||||
Apart from `pick` and `squash`, there are other operations such as
|
||||
`reword`, `edit`, `drop`, etc. to amend or drop commits. Follow the
|
||||
instructions that appear in the editor to use them. When a rebase
|
||||
operation involves multiple steps, Git walks you through each step by
|
||||
offering suggestions and commands that you need to use in each step.
|
||||
|
||||
### Force Push
|
||||
|
||||
The steps in the last three sections overwrite the history of the
|
||||
branch. If these steps are performed after the pull request branch has
|
||||
already been pushed to GitHub, then it is necessary to use the `-f` or
|
||||
`--force` option to push the overwritten history to GitHub.
|
||||
|
||||
git push -f origin TOPIC-BRANCH
|
||||
|
||||
The `-f` (force) option in the `git push` command is necessary only if
|
||||
you are pushing to an already existing pull request branch because doing
|
||||
so overwrites the history of the branch. Normally, overwriting history
|
||||
is strictly discouraged but this is one of the rare scenarios where it
|
||||
is safe to overwrite the commit history because the commits are being
|
||||
pushed to a personal branch in a personal fork without affecting the
|
||||
upstream repository.
|
||||
|
||||
|
||||
### Delete Branch
|
||||
|
||||
Once the upstream developer merges your pull request, you may delete the
|
||||
topic branch from your local system as well as from your fork.
|
||||
|
||||
git checkout master
|
||||
git branch -D TOPIC-BRANCH
|
||||
git push -d origin TOPIC-BRANCH
|
||||
|
||||
The next section, *[Merge Pull Request](#merge-pull-request)*, explains how an
|
||||
upstream owner can merge pull request from contributors into the upstream
|
||||
repository.
|
||||
|
||||
Merge Pull Request
|
||||
------------------
|
||||
|
||||
This section is meant for lead developers who own the upstream
|
||||
repository and merge pull requests from contributors to it.
|
||||
|
||||
There are two popular methods to merge commits: one that does not
|
||||
introduce an additional merge commit, and another that does. Both are
|
||||
perfectly acceptable. Both are discussed below.
|
||||
|
||||
Which method you choose depends on whether you want to maintain a
|
||||
concise commit history consisting only of development commits or if you
|
||||
want to introduce additional merge commits for every merge into your
|
||||
commit history.
|
||||
|
||||
|
||||
### Without Merge Commit
|
||||
|
||||
Clone the upstream repository to your local system.
|
||||
|
||||
git clone https://GITHUB/UPSTREAM-OWNER/REPO.git
|
||||
cd REPO
|
||||
|
||||
If the repository was already cloned to the local system earlier, then
|
||||
ensure that the local main development branch is up-to-date with that in
|
||||
the upstream repository.
|
||||
|
||||
git checkout master
|
||||
git pull
|
||||
|
||||
Create a temporary branch (`pr` for example) to pull the contribution
|
||||
(pull request) from the CONTRIBUTOR's branch in it.
|
||||
|
||||
git checkout -b pr
|
||||
git pull https://GITHUB/CONTRIBUTOR/REPO.git TOPIC-BRANCH
|
||||
|
||||
If the main development branch has diverged from the branch in the pull
|
||||
request, the above command creates a new merge commit to merge the pull
|
||||
request into the temporary branch.
|
||||
|
||||
Note: It is okay to have a merge commit while merging pull requests.
|
||||
There is nothing wrong about it. If you are comfortable having a merge
|
||||
commit for the pull request, skip the list of three points below and
|
||||
continue with merging the pull request.
|
||||
|
||||
If you really want to get rid of the additional merge commit, follow
|
||||
exactly one of these options:
|
||||
|
||||
- Request the contributor to rebase the topic branch on the main
|
||||
development branch. See the *[Rebase Commits](#rebase-commits)*
|
||||
section for more details. After the contributor has rebased the
|
||||
topic branch on the main development branch, delete the temporary
|
||||
branch.
|
||||
|
||||
git checkout master
|
||||
git branch -D pr
|
||||
|
||||
Then start over and pull the pull request again. In fact, if at any
|
||||
time the contributor rebases the pull request, or edits, squashes,
|
||||
amends, or drops commits in the pull request, delete the temporary
|
||||
branch and start over, and pull the pull request again.
|
||||
|
||||
- Go to the pull request page on GitHub, click on the dropdown menu
|
||||
next to the *Merge pull request* button, select *Rebase and merge*,
|
||||
and click *Rebase and merge*.
|
||||
|
||||
Caveat: The rebase operation rewrites the commit history of the pull
|
||||
request submitted by the contributor. As a result, it modifies the
|
||||
commit hash, committer, and commit date of each change in the pull
|
||||
request. The committer and commit date fields are separate from the
|
||||
author and author date fields. Use `git log --format=fuller` to see
|
||||
all four fields.
|
||||
|
||||
This caveat is usually not a major problem because the author and
|
||||
author date still remain intact. Further since the rebase and merge
|
||||
is done via GitHub, it closes the pull request successfully and sets
|
||||
its status to *Merged*.
|
||||
|
||||
However if you are not comfortable with the committer details
|
||||
changing, then do not choose this option and choose the previous
|
||||
option instead.
|
||||
|
||||
- Rebase the pull request on the main development branch as explained
|
||||
in the *[Rebase Commits](#rebase-commits)* section.
|
||||
|
||||
Caveat: In addition to the caveat mentioned in the previous point,
|
||||
in this case, GitHub remains oblivious of the changed commit hashes
|
||||
because the rebase operation is done locally, not via GitHub.
|
||||
Therefore after the merged pull request is pushed to the upstream
|
||||
repository, GitHub does not close the pull request.
|
||||
|
||||
The pull request on GitHub can then be closed manually but its
|
||||
status would not appear as *Merged*. It would appear as *Closed*
|
||||
instead. This can be confusing and misleading. Therefore this option
|
||||
is not recommended. Choose one of the previous two options instead.
|
||||
|
||||
After sufficient testing, merge the commits in the pull request into the
|
||||
main development branch and remove the pull request branch.
|
||||
|
||||
git checkout master
|
||||
git merge pr
|
||||
git branch -d pr
|
||||
|
||||
Finally, push the current state of the main development branch to the
|
||||
upstream repository.
|
||||
|
||||
git push origin master
|
||||
|
||||
The `git merge` command above simply fast-forwards the main development
|
||||
branch from an earlier commit to the last commit in the pull request
|
||||
thereby making both the main development branch and the pull request
|
||||
branch point to the same commit. This achieves the merge from the pull
|
||||
request branch into the main development branch without creating a new
|
||||
merge commit.
|
||||
|
||||
After a pull request branch is rebased on the main development branch,
|
||||
the pull request branch becomes a linear extension of the main
|
||||
development branch.
|
||||
|
||||
E'---F'---G' (pr)
|
||||
/
|
||||
A---B---C---D (master)
|
||||
|
||||
With such a commit history, when the pull request branch is now merged
|
||||
into the main development branch, the merge is done by simply
|
||||
fast-forwarding the pointer of the main development branch to the last
|
||||
commit in the pull request branch.
|
||||
|
||||
E'---F'---G' (pr, master)
|
||||
/
|
||||
A---B---C---D
|
||||
|
||||
### With Merge Commit
|
||||
|
||||
Clone the upstream repository to your local system.
|
||||
|
||||
git clone https://GITHUB/UPSTREAM-OWNER/REPO.git
|
||||
cd REPO
|
||||
|
||||
If the repository was already cloned to the local system earlier, then
|
||||
ensure that the local main development branch is up-to-date with that in
|
||||
the upstream repository.
|
||||
|
||||
git checkout
|
||||
git pull
|
||||
|
||||
Create a temporary branch (`pr` for example) to pull the contribution
|
||||
(pull request) from the CONTRIBUTOR's branch in it.
|
||||
|
||||
git checkout -b pr
|
||||
git pull https://GITHUB/CONTRIBUTOR/REPO.git TOPIC-BRANCH
|
||||
|
||||
If the contributor adds new commits to the pull request later, then run
|
||||
these commands again to pull the new commits.
|
||||
|
||||
After sufficient testing, merge the commits in the pull request into the
|
||||
main development branch.
|
||||
|
||||
git checkout master
|
||||
git merge --no-ff pr
|
||||
git branch -d pr
|
||||
|
||||
Finally, push the current state of the main development branch (with the
|
||||
commits from the pull request in it) to the upstream repository.
|
||||
|
||||
git push origin master
|
||||
|
||||
The `--no-ff` (no fast-forward) option in the `git merge` command
|
||||
ensures that a merge commit is always created even when a fast-forward
|
||||
merge is possible.
|
||||
|
||||
E'---F'---G' (pr)
|
||||
/ \
|
||||
A---B---C---D-------------H (master)
|
||||
|
||||
Nifty Commands
|
||||
--------------
|
||||
|
||||
This is a bonus section that describes a few aliases and commands that
|
||||
may be useful during day-to-day development activities.
|
||||
|
||||
|
||||
### Pretty Log
|
||||
|
||||
The following commands create aliases to run `git log` with various subsets of
|
||||
{`--pretty`, `--graph`, `--all`} options to display commit logs in a compact
|
||||
form, i.e., one line per log.
|
||||
|
||||
# Define aliases.
|
||||
git config --global pretty.fmt '%C(auto)%h %C(magenta)%ad %C(cyan)%an%C(auto)%d %s'
|
||||
git config --global alias.lga 'log --pretty=fmt --date=short --graph --all'
|
||||
git config --global alias.lg 'log --pretty=fmt --date=short --graph'
|
||||
git config --global alias.la 'log --pretty=fmt --date=short --all'
|
||||
git config --global alias.ll 'log --pretty=fmt --date=short'
|
||||
git config --global alias.lf 'log --pretty=fuller --stat'
|
||||
|
||||
# Use aliases.
|
||||
git lga
|
||||
git lg
|
||||
git la
|
||||
git ll
|
||||
git lf
|
||||
|
||||
|
||||
### Staged Diff
|
||||
|
||||
While `git diff` shows the unstaged changes in the working directory, it
|
||||
is necessary to use the `--cached` option with `git diff` to see the
|
||||
changes staged for the next commit. The following commands create
|
||||
convenient aliases for this option.
|
||||
|
||||
# Define aliases.
|
||||
git config --global alias.diffc "diff --cached"
|
||||
git config --global alias.dc "diff --cached"
|
||||
|
||||
# Use aliases.
|
||||
git diffc
|
||||
git dc
|
||||
|
||||
### Branch Listing
|
||||
|
||||
The following commands provides aliases to list branches with verbose
|
||||
information. The second alias includes remote branches too in the
|
||||
output.
|
||||
|
||||
# Define aliases.
|
||||
git config --global alias.br "branch -vv"
|
||||
git config --global alias.brr "branch -vva"
|
||||
|
||||
# Use aliases.
|
||||
git br
|
||||
git brr
|
||||
|
||||
|
||||
### More Aliases
|
||||
|
||||
Here are a few more commands to define aliases for very frequently used
|
||||
commands.
|
||||
|
||||
# Define aliases.
|
||||
git config --global alias.co "checkout"
|
||||
git config --global alias.cob "checkout -b"
|
||||
git config --global alias.ca "commit --amend"
|
||||
|
||||
# Use aliases.
|
||||
git co
|
||||
git cob
|
||||
git ca
|
||||
|
||||
|
||||
### Merge Base
|
||||
|
||||
Find a common ancestor of two branches with this command. It helps to
|
||||
find the commit after which two branches began diverging.
|
||||
|
||||
git merge-base upstream/master TOPIC-BRANCH
|
||||
|
||||
|
||||
### Commit Partial Changes
|
||||
|
||||
Sometimes when you are in the zone, you may make large sweeping changes
|
||||
to a file. However it is a good practice to create separate and small
|
||||
commits for separate concerns. To select some changes in a file while
|
||||
ignoring other changes in the same file for the next commit, stage the
|
||||
changes interactively with this command.
|
||||
|
||||
git add -p
|
||||
|
||||
This command shows every change hunk one by one. Enter `y` to stage a
|
||||
hunk for the next commit, `n` to ignore it, and `s` to split the hunk
|
||||
into multiple smaller hunks. Enter `?` to print help message about each
|
||||
interactive option that can be entered.
|
||||
|
||||
|
||||
### Some Git Wisdom
|
||||
|
||||
Enter one of the commands below in your command shell depending on your
|
||||
operating system, or just open the URL with your web browser.
|
||||
|
||||
open https://xkcd.com/1597/
|
||||
xdg-open https://xkcd.com/1597/
|
||||
start https://xkcd.com/1597/
|
||||
218
Gemfile.lock
Normal file
218
Gemfile.lock
Normal file
@@ -0,0 +1,218 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.5)
|
||||
rexml
|
||||
addressable (2.8.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
artifactory (3.0.15)
|
||||
atomos (0.1.3)
|
||||
aws-eventstream (1.2.0)
|
||||
aws-partitions (1.578.0)
|
||||
aws-sdk-core (3.130.1)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
aws-partitions (~> 1, >= 1.525.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
jmespath (~> 1.0)
|
||||
aws-sdk-kms (1.56.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sigv4 (~> 1.1)
|
||||
aws-sdk-s3 (1.113.0)
|
||||
aws-sdk-core (~> 3, >= 3.127.0)
|
||||
aws-sdk-kms (~> 1)
|
||||
aws-sigv4 (~> 1.4)
|
||||
aws-sigv4 (1.4.0)
|
||||
aws-eventstream (~> 1, >= 1.0.2)
|
||||
babosa (1.0.4)
|
||||
claide (1.1.0)
|
||||
colored (1.2)
|
||||
colored2 (3.1.2)
|
||||
commander (4.6.0)
|
||||
highline (~> 2.0.0)
|
||||
declarative (0.0.20)
|
||||
digest-crc (0.6.4)
|
||||
rake (>= 12.0.0, < 14.0.0)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
dotenv (2.7.6)
|
||||
emoji_regex (3.2.3)
|
||||
excon (0.92.2)
|
||||
faraday (1.10.0)
|
||||
faraday-em_http (~> 1.0)
|
||||
faraday-em_synchrony (~> 1.0)
|
||||
faraday-excon (~> 1.1)
|
||||
faraday-httpclient (~> 1.0)
|
||||
faraday-multipart (~> 1.0)
|
||||
faraday-net_http (~> 1.0)
|
||||
faraday-net_http_persistent (~> 1.0)
|
||||
faraday-patron (~> 1.0)
|
||||
faraday-rack (~> 1.0)
|
||||
faraday-retry (~> 1.0)
|
||||
ruby2_keywords (>= 0.0.4)
|
||||
faraday-cookie_jar (0.0.7)
|
||||
faraday (>= 0.8.0)
|
||||
http-cookie (~> 1.0.0)
|
||||
faraday-em_http (1.0.0)
|
||||
faraday-em_synchrony (1.0.0)
|
||||
faraday-excon (1.1.0)
|
||||
faraday-httpclient (1.0.1)
|
||||
faraday-multipart (1.0.3)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-net_http (1.0.1)
|
||||
faraday-net_http_persistent (1.2.0)
|
||||
faraday-patron (1.0.0)
|
||||
faraday-rack (1.0.0)
|
||||
faraday-retry (1.0.3)
|
||||
faraday_middleware (1.2.0)
|
||||
faraday (~> 1.0)
|
||||
fastimage (2.2.6)
|
||||
fastlane (2.205.1)
|
||||
CFPropertyList (>= 2.3, < 4.0.0)
|
||||
addressable (>= 2.8, < 3.0.0)
|
||||
artifactory (~> 3.0)
|
||||
aws-sdk-s3 (~> 1.0)
|
||||
babosa (>= 1.0.3, < 2.0.0)
|
||||
bundler (>= 1.12.0, < 3.0.0)
|
||||
colored
|
||||
commander (~> 4.6)
|
||||
dotenv (>= 2.1.1, < 3.0.0)
|
||||
emoji_regex (>= 0.1, < 4.0)
|
||||
excon (>= 0.71.0, < 1.0.0)
|
||||
faraday (~> 1.0)
|
||||
faraday-cookie_jar (~> 0.0.6)
|
||||
faraday_middleware (~> 1.0)
|
||||
fastimage (>= 2.1.0, < 3.0.0)
|
||||
gh_inspector (>= 1.1.2, < 2.0.0)
|
||||
google-apis-androidpublisher_v3 (~> 0.3)
|
||||
google-apis-playcustomapp_v1 (~> 0.1)
|
||||
google-cloud-storage (~> 1.31)
|
||||
highline (~> 2.0)
|
||||
json (< 3.0.0)
|
||||
jwt (>= 2.1.0, < 3)
|
||||
mini_magick (>= 4.9.4, < 5.0.0)
|
||||
multipart-post (~> 2.0.0)
|
||||
naturally (~> 2.2)
|
||||
optparse (~> 0.1.1)
|
||||
plist (>= 3.1.0, < 4.0.0)
|
||||
rubyzip (>= 2.0.0, < 3.0.0)
|
||||
security (= 0.1.3)
|
||||
simctl (~> 1.6.3)
|
||||
terminal-notifier (>= 2.0.0, < 3.0.0)
|
||||
terminal-table (>= 1.4.5, < 2.0.0)
|
||||
tty-screen (>= 0.6.3, < 1.0.0)
|
||||
tty-spinner (>= 0.8.0, < 1.0.0)
|
||||
word_wrap (~> 1.0.0)
|
||||
xcodeproj (>= 1.13.0, < 2.0.0)
|
||||
xcpretty (~> 0.3.0)
|
||||
xcpretty-travis-formatter (>= 0.0.3)
|
||||
gh_inspector (1.1.3)
|
||||
google-apis-androidpublisher_v3 (0.19.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-apis-core (0.4.2)
|
||||
addressable (~> 2.5, >= 2.5.1)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
httpclient (>= 2.8.1, < 3.a)
|
||||
mini_mime (~> 1.0)
|
||||
representable (~> 3.0)
|
||||
retriable (>= 2.0, < 4.a)
|
||||
rexml
|
||||
webrick
|
||||
google-apis-iamcredentials_v1 (0.10.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-apis-playcustomapp_v1 (0.7.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-apis-storage_v1 (0.13.0)
|
||||
google-apis-core (>= 0.4, < 2.a)
|
||||
google-cloud-core (1.6.0)
|
||||
google-cloud-env (~> 1.0)
|
||||
google-cloud-errors (~> 1.0)
|
||||
google-cloud-env (1.6.0)
|
||||
faraday (>= 0.17.3, < 3.0)
|
||||
google-cloud-errors (1.2.0)
|
||||
google-cloud-storage (1.36.2)
|
||||
addressable (~> 2.8)
|
||||
digest-crc (~> 0.4)
|
||||
google-apis-iamcredentials_v1 (~> 0.1)
|
||||
google-apis-storage_v1 (~> 0.1)
|
||||
google-cloud-core (~> 1.6)
|
||||
googleauth (>= 0.16.2, < 2.a)
|
||||
mini_mime (~> 1.0)
|
||||
googleauth (1.1.2)
|
||||
faraday (>= 0.17.3, < 3.a)
|
||||
jwt (>= 1.4, < 3.0)
|
||||
memoist (~> 0.16)
|
||||
multi_json (~> 1.11)
|
||||
os (>= 0.9, < 2.0)
|
||||
signet (>= 0.16, < 2.a)
|
||||
highline (2.0.3)
|
||||
http-cookie (1.0.4)
|
||||
domain_name (~> 0.5)
|
||||
httpclient (2.8.3)
|
||||
jmespath (1.6.1)
|
||||
json (2.6.1)
|
||||
jwt (2.3.0)
|
||||
memoist (0.16.2)
|
||||
mini_magick (4.11.0)
|
||||
mini_mime (1.1.2)
|
||||
multi_json (1.15.0)
|
||||
multipart-post (2.0.0)
|
||||
nanaimo (0.3.0)
|
||||
naturally (2.2.1)
|
||||
optparse (0.1.1)
|
||||
os (1.1.4)
|
||||
plist (3.6.0)
|
||||
public_suffix (4.0.7)
|
||||
rake (13.0.6)
|
||||
representable (3.1.1)
|
||||
declarative (< 0.1.0)
|
||||
trailblazer-option (>= 0.1.1, < 0.2.0)
|
||||
uber (< 0.2.0)
|
||||
retriable (3.1.2)
|
||||
rexml (3.2.5)
|
||||
rouge (2.0.7)
|
||||
ruby2_keywords (0.0.5)
|
||||
rubyzip (2.3.2)
|
||||
security (0.1.3)
|
||||
signet (0.16.1)
|
||||
addressable (~> 2.8)
|
||||
faraday (>= 0.17.5, < 3.0)
|
||||
jwt (>= 1.5, < 3.0)
|
||||
multi_json (~> 1.10)
|
||||
simctl (1.6.8)
|
||||
CFPropertyList
|
||||
naturally
|
||||
terminal-notifier (2.0.0)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
trailblazer-option (0.1.2)
|
||||
tty-cursor (0.7.1)
|
||||
tty-screen (0.8.1)
|
||||
tty-spinner (0.9.3)
|
||||
tty-cursor (~> 0.7)
|
||||
uber (0.1.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.8.1)
|
||||
unicode-display_width (1.8.0)
|
||||
webrick (1.7.0)
|
||||
word_wrap (1.0.0)
|
||||
xcodeproj (1.21.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.3.0)
|
||||
rexml (~> 3.2.4)
|
||||
xcpretty (0.3.0)
|
||||
rouge (~> 2.0.7)
|
||||
xcpretty-travis-formatter (1.0.1)
|
||||
xcpretty (~> 0.2, >= 0.0.7)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
fastlane
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
674
LICENSE
Normal file
674
LICENSE
Normal file
@@ -0,0 +1,674 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
mLauncher Copyright (C) 2022 HeCodes2Much wayne6324@gmail.com
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
||||
26
README.md
Normal file
26
README.md
Normal file
@@ -0,0 +1,26 @@
|
||||
<div align='center'>
|
||||
<h2>EasyLauncher - Minimal and Clutter Free Android launcher</h2>
|
||||
<table align='center'>
|
||||
Click on any image to enlarge it. To know more, explore and see for yourself.
|
||||
<tr>
|
||||
<td><img src='fastlane/metadata/android/en-US/images/phoneScreenshots/0.png' width='150' alt=""></td>
|
||||
<td><img src='fastlane/metadata/android/en-US/images/phoneScreenshots/1.png' width='150' alt=""></td>
|
||||
<td><img src='fastlane/metadata/android/en-US/images/phoneScreenshots/2.png' width='150' alt=""></td>
|
||||
<td><img src='fastlane/metadata/android/en-US/images/phoneScreenshots/3.png' width='150' alt=""></td>
|
||||
<td><img src='fastlane/metadata/android/en-US/images/phoneScreenshots/4.png' width='150' alt=""></td>
|
||||
<td><img src='fastlane/metadata/android/en-US/images/phoneScreenshots/5.png' width='150' alt=""></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
<a href='https://f-droid.org/packages/app.easy.launcher'><img src='https://github.com/DroidWorksStudio/mLauncher/assets/9284733/a1e7c86f-1c76-46c0-9193-8fde9c9f531c' width="150" alt="fDroid"></a>
|
||||
<a href='http://apps.obtainium.imranr.dev/redirect.html?r=obtainium://add/https://github.com/DroidWorksStudio/EasyLauncher'><img src='https://github.com/DroidWorksStudio/mLauncher/assets/9284733/071cccfa-207b-45fb-8be4-7e668eeec4e5' width="150" alt="Obtanium"></a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
------------
|
||||
**About**
|
||||
------------
|
||||
**Easy Launcher - the minimalist productivity launcher for focus, productivity, keep your focus on what really counts.**
|
||||
------------
|
||||
[](https://play.google.com/store/apps/details?id=com.github.droidworksstudio.easylauncher)
|
||||
[](https://www.gnu.org/licenses/gpl-3.0)
|
||||
111
app/build.gradle.kts
Normal file
111
app/build.gradle.kts
Normal file
@@ -0,0 +1,111 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("kotlin-android")
|
||||
id("kotlin-kapt")
|
||||
id("kotlin-parcelize")
|
||||
id("com.google.dagger.hilt.android")
|
||||
id("dagger.hilt.android.plugin")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.github.droidworksstudio.launcher"
|
||||
compileSdk = 34
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "app.easy.launcher"
|
||||
minSdk = 24
|
||||
targetSdk = 34
|
||||
versionCode = 1
|
||||
versionName = "0.0.1"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
getByName("debug") {
|
||||
isMinifyEnabled = false
|
||||
isShrinkResources = false
|
||||
isDebuggable = true
|
||||
applicationIdSuffix = ".debug"
|
||||
proguardFiles (getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
resValue("string", "app_name", "EasyLauncher Debug")
|
||||
}
|
||||
|
||||
getByName("release") {
|
||||
isMinifyEnabled = false
|
||||
isShrinkResources = false
|
||||
proguardFiles (getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
resValue("string", "app_name", "EasyLauncher")
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_17.toString()
|
||||
}
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
}
|
||||
|
||||
applicationVariants.all {
|
||||
if (buildType.name == "release") {
|
||||
outputs.all {
|
||||
val output = this as? com.android.build.gradle.internal.api.BaseVariantOutputImpl
|
||||
if (output?.outputFileName?.endsWith(".apk") == true) {
|
||||
output.outputFileName =
|
||||
"${defaultConfig.applicationId}_v${defaultConfig.versionName}-Signed.apk"
|
||||
}
|
||||
}
|
||||
}
|
||||
if (buildType.name == "debug") {
|
||||
outputs.all {
|
||||
val output = this as? com.android.build.gradle.internal.api.BaseVariantOutputImpl
|
||||
if (output?.outputFileName?.endsWith(".apk") == true) {
|
||||
output.outputFileName =
|
||||
"${defaultConfig.applicationId}_v${defaultConfig.versionName}-Debug.apk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.core:core-ktx:1.13.1")
|
||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
|
||||
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
|
||||
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
|
||||
implementation("com.google.android.material:material:1.12.0")
|
||||
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
|
||||
implementation("androidx.lifecycle:lifecycle-process:2.7.0")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
|
||||
implementation("androidx.work:work-runtime-ktx:2.9.0")
|
||||
implementation("androidx.recyclerview:recyclerview:1.3.2")
|
||||
implementation("androidx.viewpager2:viewpager2:1.1.0-rc01")
|
||||
debugImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.1.5")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
|
||||
|
||||
//room
|
||||
val roomVersion = "2.6.1"
|
||||
implementation("androidx.room:room-runtime:$roomVersion")
|
||||
implementation("androidx.room:room-ktx:$roomVersion")
|
||||
//noinspection KaptUsageInsteadOfKsp
|
||||
kapt("androidx.room:room-compiler:$roomVersion")
|
||||
|
||||
//hilt
|
||||
val hiltVersion = "2.51.1"
|
||||
implementation("com.google.dagger:hilt-android:$hiltVersion")
|
||||
kapt("com.google.dagger:hilt-compiler:$hiltVersion")
|
||||
|
||||
//biometric
|
||||
implementation("androidx.biometric:biometric-ktx:1.2.0-alpha05")
|
||||
|
||||
//color picker
|
||||
implementation("net.mm2d.color-chooser:color-chooser:0.7.3")
|
||||
}
|
||||
21
app/proguard-rules.pro
vendored
Normal file
21
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.kts.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
114
app/src/main/AndroidManifest.xml
Normal file
114
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||
<uses-permission
|
||||
android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
tools:ignore="QueryAllPackagesPermission" />
|
||||
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<application
|
||||
android:name=".Application"
|
||||
android:allowBackup="false"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@drawable/app_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Launcher"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ui.activities.SettingsActivity"
|
||||
android:exported="false" />
|
||||
|
||||
<activity
|
||||
android:name=".ui.activities.LauncherActivity"
|
||||
android:enabled="false"
|
||||
android:excludeFromRecents="true"
|
||||
android:exported="false"
|
||||
android:launchMode="singleTask">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
|
||||
<activity
|
||||
android:name=".ui.activities.MainActivity"
|
||||
android:configChanges="uiMode"
|
||||
android:excludeFromRecents="true"
|
||||
android:launchMode="singleTask"
|
||||
android:taskAffinity=""
|
||||
android:windowSoftInputMode="stateHidden"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".ui.activities.FakeHomeActivity"
|
||||
android:enabled="false"
|
||||
android:launchMode="singleTask"
|
||||
android:windowSoftInputMode="stateHidden"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.HOME" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name=".listener.DeviceAdmin"
|
||||
android:permission="android.permission.BIND_DEVICE_ADMIN"
|
||||
android:exported="false">
|
||||
<meta-data
|
||||
android:name="android.app.device_admin"
|
||||
android:resource="@xml/policies" />
|
||||
<intent-filter>
|
||||
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".accessibility.MyAccessibilityService"
|
||||
android:exported="false"
|
||||
android:label="@string/app_name"
|
||||
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
||||
<meta-data
|
||||
android:name="android.accessibilityservice"
|
||||
android:resource="@xml/accessibility_service" />
|
||||
<intent-filter>
|
||||
<action android:name="android.accessibilityservice.AccessibilityService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.github.droidworksstudio.launcher
|
||||
|
||||
import android.app.Application
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
|
||||
@HiltAndroidApp
|
||||
class Application: Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.github.droidworksstudio.launcher
|
||||
|
||||
object Constants {
|
||||
const val PACKAGE_NAME = "com.github.droidworksstudio.launcher"
|
||||
|
||||
const val PREFS_FILENAME = "droidworksstudioLauncher.pref"
|
||||
const val FIRST_LAUNCH = "FIRST_LAUNCH"
|
||||
const val SHOW_DATE = "SHOW_DATE"
|
||||
const val SHOW_TIME = "SHOW_TIME"
|
||||
const val SHOW_DAILY_WORD = "SHOW_DAILY_WORD"
|
||||
const val SHOW_BATTERY = "SHOW_BATTERY"
|
||||
const val SHOW_STATUS_BAR = "SHOW_STATUS_BAR"
|
||||
const val DOUBLE_TAP_LOCK = "DOUBLE_TAP_LOCK"
|
||||
|
||||
const val DATE_COLOR = "DATE_COLOR"
|
||||
const val TIME_COLOR = "TIME_COLOR"
|
||||
const val BATTERY_COLOR = "BATTERY_COLOR"
|
||||
const val DAILY_WORD_COLOR = "DAILY_WORD_COLOR"
|
||||
const val APP_COLOR = "APP_COLOR"
|
||||
|
||||
const val DATE_TEXT_SIZE = "DATE_TEXT_SIZE"
|
||||
const val TIME_TEXT_SIZE = "TIME_TEXT_SIZE"
|
||||
const val APP_TEXT_SIZE = "APP_TEXT_SIZE"
|
||||
|
||||
const val SHOW_APP_ICON = "SHOW_APP_ICON"
|
||||
|
||||
const val AUTOMATIC_KEYBOARD = "AUTOMATIC_KEYBOARD"
|
||||
const val AUTOMATIC_OPEN_APP = "AUTOMATIC_OPEN_APP"
|
||||
|
||||
const val HOME_DATE_ALIGNMENT = "HOME_DATE_ALIGNMENT"
|
||||
const val HOME_TIME_ALIGNMENT = "HOME_TIME_ALIGNMENT"
|
||||
const val HOME_APP_ALIGNMENT = "HOME_APP_ALIGNMENT"
|
||||
const val HOME_DAILY_WORD_ALIGNMENT = "HOME_DAILY_WORD_ALIGNMENT"
|
||||
const val HOME_DRAW_ALIGNMENT = "HOME_DRAW_ALIGNMENT"
|
||||
const val HOME_BATTERY_ALIGNMENT = "HOME_BATTERY_ALIGNMENT"
|
||||
|
||||
const val NOTIFICATION_SERVICE = "statusbar"
|
||||
const val NOTIFICATION_MANAGER = "android.app.StatusBarManager"
|
||||
const val NOTIFICATION_METHOD = "expandNotificationsPanel"
|
||||
|
||||
const val QUICKSETTINGS_SERVICE = "statusbar"
|
||||
const val QUICKSETTINGS_MANAGER = "android.app.StatusBarManager"
|
||||
const val QUICKSETTINGS_METHOD = "expandSettingsPanel"
|
||||
|
||||
const val REQUEST_CODE_ENABLE_ADMIN = 123
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.github.droidworksstudio.launcher.accessibility
|
||||
|
||||
import android.accessibilityservice.AccessibilityService
|
||||
import android.accessibilityservice.AccessibilityServiceInfo
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.view.accessibility.AccessibilityEvent
|
||||
import androidx.annotation.RequiresApi
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
class MyAccessibilityService : AccessibilityService() {
|
||||
|
||||
private var info: AccessibilityServiceInfo = AccessibilityServiceInfo()
|
||||
|
||||
override fun onServiceConnected() {
|
||||
mInstance = WeakReference(this)
|
||||
|
||||
info.apply {
|
||||
eventTypes = AccessibilityEvent.TYPE_VIEW_CLICKED or AccessibilityEvent.TYPE_VIEW_FOCUSED
|
||||
|
||||
feedbackType = AccessibilityServiceInfo.FEEDBACK_GENERIC
|
||||
|
||||
notificationTimeout = 100
|
||||
}
|
||||
|
||||
this.serviceInfo = info
|
||||
}
|
||||
|
||||
override fun onUnbind(intent: Intent?): Boolean {
|
||||
mInstance = WeakReference(null)
|
||||
|
||||
return super.onUnbind(intent)
|
||||
}
|
||||
|
||||
override fun onInterrupt() {}
|
||||
|
||||
override fun onAccessibilityEvent(event: AccessibilityEvent?) {}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.P)
|
||||
fun lockScreen(): Boolean = performGlobalAction(GLOBAL_ACTION_LOCK_SCREEN)
|
||||
|
||||
companion object {
|
||||
private var mInstance: WeakReference<MyAccessibilityService> = WeakReference(null)
|
||||
fun instance(): MyAccessibilityService? {
|
||||
return mInstance.get()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.github.droidworksstudio.launcher.data
|
||||
|
||||
|
||||
import androidx.room.Database
|
||||
import androidx.room.RoomDatabase
|
||||
import com.github.droidworksstudio.launcher.data.dao.AppInfoDAO
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
|
||||
@Database(entities = [AppInfo::class], version = 1)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
abstract fun appDao(): AppInfoDAO
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.github.droidworksstudio.launcher.data.dao
|
||||
|
||||
|
||||
import android.util.Log
|
||||
import androidx.room.*
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
@Dao
|
||||
interface AppInfoDAO {
|
||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||
suspend fun insert(app: AppInfo)
|
||||
@Insert(onConflict = OnConflictStrategy.IGNORE)
|
||||
suspend fun insertAll(apps: List<AppInfo>)
|
||||
@Update
|
||||
suspend fun update(app: AppInfo)
|
||||
@Delete
|
||||
suspend fun delete(app: AppInfo)
|
||||
|
||||
@Query("SELECT * FROM app ORDER BY app_name ASC")
|
||||
fun getAllApps(): List<AppInfo>
|
||||
|
||||
@Query("SELECT * FROM app ORDER BY app_name ASC")
|
||||
fun getAllAppsFlow(): Flow<List<AppInfo>>
|
||||
|
||||
@Query("SELECT * FROM app WHERE is_hidden = 0 ORDER BY app_name ASC")
|
||||
fun getDrawAppsFlow(): Flow<List<AppInfo>>
|
||||
|
||||
@Query("SELECT * FROM app WHERE is_favorite = 1 ORDER BY app_order ASC, id ASC")
|
||||
fun getFavoriteAppsFlow(): Flow<List<AppInfo>>
|
||||
|
||||
@Query("SELECT * FROM app WHERE is_hidden = 1 ORDER BY id ASC")
|
||||
fun getHiddenAppsFlow(): Flow<List<AppInfo>>
|
||||
|
||||
@Query("SELECT * FROM app WHERE is_lock = 1 ORDER BY app_order ASC")
|
||||
fun getLockAppsFlow(): Flow<List<AppInfo>>
|
||||
|
||||
@Query("SELECT * FROM app WHERE app_name LIKE :query AND is_hidden = 0")
|
||||
fun searchApps(query: String?): Flow<List<AppInfo>>
|
||||
|
||||
@Update
|
||||
fun updateAppInfo(appInfo: AppInfo)
|
||||
|
||||
@Update
|
||||
suspend fun updateAppOrder(appInfo: List<AppInfo>)
|
||||
|
||||
@Transaction
|
||||
suspend fun updateAppName(appInfo: AppInfo, newAppName: String) {
|
||||
appInfo.appName = newAppName
|
||||
update(appInfo)
|
||||
Log.d("Tag", "${appInfo.appName} : Repo Order: ${appInfo.appOrder}")
|
||||
}
|
||||
|
||||
@Transaction
|
||||
suspend fun updateAppHidden(appInfo: AppInfo, appHidden: Boolean) {
|
||||
appInfo.hidden = appHidden
|
||||
update(appInfo)
|
||||
Log.d("Tag", "${appInfo.appName} : Repo Order: ${appInfo.hidden}")
|
||||
}
|
||||
|
||||
@Transaction
|
||||
suspend fun updateLockApp(appInfo: AppInfo, appLock: Boolean) {
|
||||
appInfo.lock = appLock
|
||||
update(appInfo)
|
||||
Log.d("Tag", "${appInfo.appName} : Repo Order: ${appInfo.lock}")
|
||||
}
|
||||
|
||||
@Query("SELECT MAX(`app_order`) FROM app")
|
||||
fun getMaxOrder(): Int
|
||||
|
||||
@Query("SELECT * FROM app WHERE is_favorite = 1")
|
||||
fun getFavoriteAppInfo(): List<AppInfo>
|
||||
|
||||
@Query("SELECT * FROM app WHERE package_name = :packageName")
|
||||
suspend fun getAppByPackageName(packageName: String): AppInfo?
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.github.droidworksstudio.launcher.data.entities
|
||||
|
||||
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Entity(tableName = "app")
|
||||
data class AppInfo(
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@field:ColumnInfo(name = "id")
|
||||
var id: Int = 0,
|
||||
|
||||
@field:ColumnInfo(name = "app_name")
|
||||
var appName: String,
|
||||
|
||||
@field:ColumnInfo(name = "package_name")
|
||||
var packageName: String,
|
||||
|
||||
@field:ColumnInfo(name = "is_favorite")
|
||||
var favorite: Boolean,
|
||||
|
||||
@field:ColumnInfo(name = "is_hidden")
|
||||
var hidden: Boolean,
|
||||
|
||||
@ColumnInfo(name = "is_lock")
|
||||
var lock: Boolean,
|
||||
|
||||
@ColumnInfo(name = "create_time")
|
||||
var createTime: String = "",
|
||||
|
||||
@ColumnInfo(name = "app_order")
|
||||
var appOrder: Int = -1
|
||||
)
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.github.droidworksstudio.launcher.di
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import androidx.room.Room
|
||||
import com.github.droidworksstudio.launcher.data.AppDatabase
|
||||
import com.github.droidworksstudio.launcher.data.dao.AppInfoDAO
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.BottomDialogHelper
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.android.components.ViewModelComponent
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import dagger.hilt.android.scopes.ViewModelScoped
|
||||
|
||||
@Module
|
||||
@InstallIn(ViewModelComponent::class)
|
||||
object DatabaseModule {
|
||||
@Provides
|
||||
@ViewModelScoped
|
||||
fun provideLocalDatabase(
|
||||
@ApplicationContext context: Context
|
||||
): AppDatabase =
|
||||
Room.databaseBuilder(
|
||||
context,
|
||||
AppDatabase::class.java,
|
||||
"app_database"
|
||||
).build()
|
||||
|
||||
@Provides
|
||||
@ViewModelScoped
|
||||
fun provideAppDao(appDatabase: AppDatabase): AppInfoDAO = appDatabase.appDao()
|
||||
|
||||
@Provides
|
||||
@ViewModelScoped
|
||||
fun providePackageManager(@ApplicationContext context: Context): PackageManager {
|
||||
return context.packageManager
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ViewModelScoped
|
||||
fun providePreferenceHelper(@ApplicationContext context: Context): PreferenceHelper {
|
||||
return PreferenceHelper(context)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ViewModelScoped
|
||||
fun provideContext(@ApplicationContext context: Context): Context {
|
||||
return context
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ViewModelScoped
|
||||
fun provideAppHelper(): AppHelper {
|
||||
return AppHelper()
|
||||
}
|
||||
|
||||
@Provides
|
||||
@ViewModelScoped
|
||||
fun provideBottomDialogHelper(): BottomDialogHelper {
|
||||
return BottomDialogHelper()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
package com.github.droidworksstudio.launcher.helper
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.SearchManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Configuration
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.provider.AlarmClock
|
||||
import android.provider.CalendarContract
|
||||
import android.provider.Settings
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.view.Window
|
||||
import android.view.WindowInsets
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.github.droidworksstudio.launcher.Constants
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.accessibility.MyAccessibilityService
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.ui.activities.FakeHomeActivity
|
||||
import javax.inject.Inject
|
||||
|
||||
class AppHelper @Inject constructor() {
|
||||
|
||||
fun resetDefaultLauncher(context: Context) {
|
||||
try {
|
||||
val packageManager = context.packageManager
|
||||
val componentName = ComponentName(context, FakeHomeActivity::class.java)
|
||||
packageManager.setComponentEnabledSetting(
|
||||
componentName,
|
||||
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
|
||||
PackageManager.DONT_KILL_APP
|
||||
)
|
||||
val selector = Intent(Intent.ACTION_MAIN)
|
||||
selector.addCategory(Intent.CATEGORY_HOME)
|
||||
context.startActivity(selector)
|
||||
packageManager.setComponentEnabledSetting(
|
||||
componentName,
|
||||
PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
|
||||
PackageManager.DONT_KILL_APP
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("WrongConstant", "PrivateApi")
|
||||
fun expandNotificationDrawer(context: Context) {
|
||||
try {
|
||||
val statusBarService = context.getSystemService(Constants.NOTIFICATION_SERVICE)
|
||||
val statusBarManager = Class.forName(Constants.NOTIFICATION_MANAGER)
|
||||
val method = statusBarManager.getMethod(Constants.NOTIFICATION_METHOD)
|
||||
method.invoke(statusBarService)
|
||||
} catch (exception: Exception) {
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
// initActionService(context)?.openNotifications()
|
||||
// }
|
||||
exception.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("WrongConstant", "PrivateApi")
|
||||
private fun expandQuickSettings(context: Context) {
|
||||
try {
|
||||
val statusBarService = context.getSystemService(Constants.QUICKSETTINGS_SERVICE)
|
||||
val statusBarManager = Class.forName(Constants.QUICKSETTINGS_MANAGER)
|
||||
val method = statusBarManager.getMethod(Constants.QUICKSETTINGS_METHOD)
|
||||
method.invoke(statusBarService)
|
||||
} catch (exception: Exception) {
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
// initActionService(context)?.openQuickSettings()
|
||||
// }
|
||||
exception.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
fun searchView(context: Context) {
|
||||
val intent = Intent(Intent.ACTION_WEB_SEARCH)
|
||||
intent.putExtra(SearchManager.QUERY, "")
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
fun dayNightMod(context: Context, view: View) {
|
||||
when (context.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
|
||||
Configuration.UI_MODE_NIGHT_YES -> {
|
||||
view.setBackgroundColor(context.resources.getColor(R.color.whiteTrans25))
|
||||
}
|
||||
|
||||
Configuration.UI_MODE_NIGHT_NO -> {
|
||||
view.setBackgroundColor(context.resources.getColor(R.color.blackTrans50))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateUI(view: View, gravity: Int, selectColor: Int, textSize: Float, isVisible: Boolean) {
|
||||
val layoutParams = view.layoutParams as LinearLayoutCompat.LayoutParams
|
||||
layoutParams.gravity = gravity
|
||||
view.layoutParams = layoutParams
|
||||
|
||||
if (view is TextView) {
|
||||
view.setTextColor(selectColor)
|
||||
view.textSize = textSize
|
||||
view.visibility = if (isVisible) View.VISIBLE else View.INVISIBLE
|
||||
view.isClickable = if (isVisible) view.isClickable else !view.isClickable
|
||||
}
|
||||
}
|
||||
|
||||
fun launchApp(context: Context, appInfo: AppInfo) {
|
||||
val intent = context.packageManager.getLaunchIntentForPackage(appInfo.packageName)
|
||||
if (intent != null) {
|
||||
context.startActivity(intent)
|
||||
} else {
|
||||
showToast(context, "Failed to open the application")
|
||||
}
|
||||
}
|
||||
fun launchClock(context: Context) {
|
||||
try {
|
||||
val intent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
|
||||
context.startActivity(intent)
|
||||
} catch (e: Exception) {
|
||||
Log.e("launchClock", "Error launching clock app: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
fun launchCalendar(context: Context) {
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
intent.data = CalendarContract.CONTENT_URI
|
||||
try {
|
||||
context.startActivity(intent)
|
||||
} catch (e: Exception) {
|
||||
val pickerIntent = Intent(Intent.ACTION_MAIN)
|
||||
pickerIntent.addCategory(Intent.CATEGORY_APP_CALENDAR)
|
||||
try {
|
||||
context.startActivity(pickerIntent)
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun unInstallApp(context: Context, appInfo: AppInfo) {
|
||||
val intent = Intent(Intent.ACTION_DELETE)
|
||||
intent.data = Uri.parse("package:${appInfo.packageName}")
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
fun appInfo(context: Context, appInfo: AppInfo) {
|
||||
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
|
||||
intent.data = Uri.fromParts("package", appInfo.packageName, null)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
fun gravityToString(gravity: Int): String? {
|
||||
return when (gravity) {
|
||||
Gravity.CENTER -> "CENTER"
|
||||
Gravity.START -> "LEFT"
|
||||
Gravity.END -> "RIGHT"
|
||||
Gravity.TOP -> "TOP"
|
||||
Gravity.BOTTOM -> "BOTTOM"
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
fun getGravityFromSelectedItem(selectedItem: String): Int {
|
||||
return when (selectedItem) {
|
||||
"Left" -> Gravity.START
|
||||
"Center" -> Gravity.CENTER
|
||||
"Right" -> Gravity.END
|
||||
else -> Gravity.START
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun showToast(context: Context,message: String) {
|
||||
Toast.makeText(context, message, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
fun showStatusBar(window: Window) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
window.insetsController?.show(WindowInsets.Type.statusBars())
|
||||
} else
|
||||
@Suppress("DEPRECATION", "InlinedApi")
|
||||
window.decorView.apply {
|
||||
systemUiVisibility =
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
}
|
||||
}
|
||||
|
||||
fun hideStatusBar(window: Window) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
|
||||
window.insetsController?.hide(WindowInsets.Type.statusBars())
|
||||
else {
|
||||
@Suppress("DEPRECATION")
|
||||
window.decorView.apply {
|
||||
systemUiVisibility =
|
||||
View.SYSTEM_UI_FLAG_IMMERSIVE or View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun showSoftKeyboard(context: Context, view: View) {
|
||||
if (view.requestFocus()) {
|
||||
val inputMethodManager: InputMethodManager =
|
||||
context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
inputMethodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
}
|
||||
|
||||
fun hideKeyboard(context: Context, view: View) {
|
||||
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.hideSoftInputFromWindow(view.windowToken, 0)
|
||||
}
|
||||
|
||||
fun View.hideKeyboard() {
|
||||
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
imm.hideSoftInputFromWindow(this.windowToken, 0)
|
||||
}
|
||||
fun enableAppAsAccessibilityService(context: Context, accessibilityState: Boolean) {
|
||||
|
||||
val myAccessibilityService = MyAccessibilityService.instance()
|
||||
|
||||
val state: String = if (myAccessibilityService != null) {
|
||||
context.getString(R.string.accessibility_settings_disable)
|
||||
}else{
|
||||
context.getString(R.string.accessibility_settings_enable)
|
||||
}
|
||||
|
||||
val builder = MaterialAlertDialogBuilder(context)
|
||||
|
||||
builder.setTitle(R.string.accessibility_settings_title)
|
||||
builder.setMessage(R.string.accessibility_service_desc)
|
||||
builder.setPositiveButton(state) { _, _ ->
|
||||
val intent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
.setNegativeButton(android.R.string.cancel) { dialog, _ -> dialog.dismiss() }
|
||||
.show()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.github.droidworksstudio.launcher.helper
|
||||
|
||||
import android.app.Dialog
|
||||
import android.graphics.Color
|
||||
import android.text.Spannable
|
||||
import android.text.SpannableString
|
||||
import android.text.style.ForegroundColorSpan
|
||||
import android.view.WindowManager
|
||||
import javax.inject.Inject
|
||||
|
||||
class BottomDialogHelper @Inject constructor() {
|
||||
|
||||
fun setupDialogStyle(dialog: Dialog?) {
|
||||
|
||||
val window = dialog?.window
|
||||
if (window != null) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||
window.statusBarColor = Color.TRANSPARENT
|
||||
}
|
||||
}
|
||||
|
||||
fun getColorText(color: Int): SpannableString {
|
||||
val colorText = "#${Integer.toHexString(color)}"
|
||||
val spannableString = SpannableString(colorText)
|
||||
spannableString.setSpan(
|
||||
ForegroundColorSpan(color),
|
||||
0,
|
||||
colorText.length,
|
||||
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
|
||||
)
|
||||
return spannableString
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.github.droidworksstudio.launcher.helper
|
||||
|
||||
import androidx.biometric.BiometricManager
|
||||
import androidx.biometric.BiometricPrompt
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import javax.inject.Inject
|
||||
|
||||
class FingerprintHelper @Inject constructor(private val fragment: Fragment) {
|
||||
|
||||
private lateinit var callback: Callback
|
||||
|
||||
interface Callback {
|
||||
fun onAuthenticationSucceeded(appInfo: AppInfo)
|
||||
fun onAuthenticationFailed()
|
||||
fun onAuthenticationError(errorCode: Int, errorMessage: CharSequence?)
|
||||
}
|
||||
|
||||
fun startFingerprintAuth(appInfo: AppInfo, callback: Callback) {
|
||||
this.callback = callback
|
||||
|
||||
val authenticationCallback = object : BiometricPrompt.AuthenticationCallback() {
|
||||
override fun onAuthenticationSucceeded(result: BiometricPrompt.AuthenticationResult) {
|
||||
callback.onAuthenticationSucceeded(appInfo)
|
||||
}
|
||||
|
||||
override fun onAuthenticationFailed() {
|
||||
callback.onAuthenticationFailed()
|
||||
}
|
||||
|
||||
override fun onAuthenticationError(errorCode: Int, errorMessage: CharSequence) {
|
||||
callback.onAuthenticationError(errorCode, errorMessage)
|
||||
}
|
||||
}
|
||||
|
||||
val executor = ContextCompat.getMainExecutor(fragment.requireContext())
|
||||
val biometricPrompt = BiometricPrompt(fragment, executor, authenticationCallback)
|
||||
|
||||
val promptInfo = BiometricPrompt.PromptInfo.Builder()
|
||||
.setTitle(fragment.getString(R.string.authentication_title))
|
||||
.setNegativeButtonText(fragment.getString(R.string.authentication_cancel))
|
||||
.build()
|
||||
|
||||
val canAuthenticate = BiometricManager.from(fragment.requireContext())
|
||||
.canAuthenticate(BiometricManager.Authenticators.BIOMETRIC_STRONG)
|
||||
if (canAuthenticate == BiometricManager.BIOMETRIC_SUCCESS) {
|
||||
biometricPrompt.authenticate(promptInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.github.droidworksstudio.launcher.helper
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.view.Gravity
|
||||
import com.github.droidworksstudio.launcher.Constants
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
|
||||
class PreferenceHelper @Inject constructor(@ApplicationContext context: Context) {
|
||||
|
||||
private val prefs: SharedPreferences = context.getSharedPreferences(Constants.PREFS_FILENAME, 0)
|
||||
|
||||
var firstLaunch: Boolean
|
||||
get() = prefs.getBoolean(Constants.FIRST_LAUNCH, true)
|
||||
set(value) = prefs.edit().putBoolean(Constants.FIRST_LAUNCH, value).apply()
|
||||
|
||||
var showStatusBar: Boolean
|
||||
get() = prefs.getBoolean(Constants.SHOW_STATUS_BAR, true)
|
||||
set(value) = prefs.edit().putBoolean(Constants.SHOW_STATUS_BAR, value).apply()
|
||||
var showTime: Boolean
|
||||
get() = prefs.getBoolean(Constants.SHOW_TIME, true)
|
||||
set(value) = prefs.edit().putBoolean(Constants.SHOW_TIME, value).apply()
|
||||
|
||||
var showDate: Boolean
|
||||
get() = prefs.getBoolean(Constants.SHOW_DATE, true)
|
||||
set(value) = prefs.edit().putBoolean(Constants.SHOW_DATE, value).apply()
|
||||
|
||||
var showBattery: Boolean
|
||||
get() = prefs.getBoolean(Constants.SHOW_BATTERY, true)
|
||||
set(value) = prefs.edit().putBoolean(Constants.SHOW_BATTERY, value).apply()
|
||||
|
||||
var showDailyWord: Boolean
|
||||
get() = prefs.getBoolean(Constants.SHOW_DAILY_WORD, true)
|
||||
set(value) = prefs.edit().putBoolean(Constants.SHOW_DAILY_WORD, value).apply()
|
||||
|
||||
var dateColor: Int
|
||||
get() = prefs.getInt(Constants.DATE_COLOR, 0xFFFFFFFF.toInt())
|
||||
set(value) = prefs.edit().putInt(Constants.DATE_COLOR, value).apply()
|
||||
|
||||
var timeColor: Int
|
||||
get() = prefs.getInt(Constants.TIME_COLOR, 0xFFFFFFFF.toInt())
|
||||
set(value) = prefs.edit().putInt(Constants.TIME_COLOR, value).apply()
|
||||
|
||||
var batteryColor: Int
|
||||
get() = prefs.getInt(Constants.BATTERY_COLOR, 0xFFFFFFFF.toInt())
|
||||
set(value) = prefs.edit().putInt(Constants.BATTERY_COLOR, value).apply()
|
||||
var dailyWordColor: Int
|
||||
get() = prefs.getInt(Constants.DAILY_WORD_COLOR, 0xFFFFFFFF.toInt())
|
||||
set(value) = prefs.edit().putInt(Constants.DAILY_WORD_COLOR, value).apply()
|
||||
|
||||
var appColor: Int
|
||||
get() = prefs.getInt(Constants.APP_COLOR, 0xFFFFFFFF.toInt())
|
||||
set(value) = prefs.edit().putInt(Constants.APP_COLOR, value).apply()
|
||||
|
||||
var showAppIcon: Boolean
|
||||
get() = prefs.getBoolean(Constants.SHOW_APP_ICON, true)
|
||||
set(value) = prefs.edit().putBoolean(Constants.SHOW_APP_ICON, value).apply()
|
||||
|
||||
var automaticKeyboard: Boolean
|
||||
get() = prefs.getBoolean(Constants.AUTOMATIC_KEYBOARD, true)
|
||||
set(value) = prefs.edit().putBoolean(Constants.AUTOMATIC_KEYBOARD, value).apply()
|
||||
|
||||
var automaticOpenApp: Boolean
|
||||
get() = prefs.getBoolean(Constants.AUTOMATIC_OPEN_APP, false)
|
||||
set(value) = prefs.edit().putBoolean(Constants.AUTOMATIC_OPEN_APP, value).apply()
|
||||
|
||||
var homeAppAlignment: Int
|
||||
get() = prefs.getInt(Constants.HOME_APP_ALIGNMENT, Gravity.START)
|
||||
set(value) = prefs.edit().putInt(Constants.HOME_APP_ALIGNMENT, value).apply()
|
||||
|
||||
var homeDateAlignment: Int
|
||||
get() = prefs.getInt(Constants.HOME_DATE_ALIGNMENT, Gravity.START)
|
||||
set(value) = prefs.edit().putInt(Constants.HOME_DATE_ALIGNMENT, value).apply()
|
||||
|
||||
var homeTimeAlignment: Int
|
||||
get() = prefs.getInt(Constants.HOME_TIME_ALIGNMENT, Gravity.START)
|
||||
set(value) = prefs.edit().putInt(Constants.HOME_TIME_ALIGNMENT, value).apply()
|
||||
|
||||
var homeDailyWordAlignment: Int
|
||||
get() = prefs.getInt(Constants.HOME_DAILY_WORD_ALIGNMENT, Gravity.START)
|
||||
set(value) = prefs.edit().putInt(Constants.HOME_DAILY_WORD_ALIGNMENT,value).apply()
|
||||
|
||||
var dateTextSize: Float
|
||||
get() = prefs.getFloat(Constants.DATE_TEXT_SIZE, 32f)
|
||||
set(value) = prefs.edit().putFloat(Constants.DATE_TEXT_SIZE, value).apply()
|
||||
|
||||
var timeTextSize: Float
|
||||
get() = prefs.getFloat(Constants.TIME_TEXT_SIZE, 48f)
|
||||
set(value) = prefs.edit().putFloat(Constants.TIME_TEXT_SIZE, value).apply()
|
||||
|
||||
var appTextSize: Float
|
||||
get() = prefs.getFloat(Constants.APP_TEXT_SIZE, 24f)
|
||||
set(value) = prefs.edit().putFloat(Constants.APP_TEXT_SIZE, value).apply()
|
||||
|
||||
var tapLockScreen: Boolean
|
||||
get() = prefs.getBoolean(Constants.DOUBLE_TAP_LOCK, false)
|
||||
set(value) = prefs.edit().putBoolean(Constants.DOUBLE_TAP_LOCK, value).apply()
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.github.droidworksstudio.launcher.listener
|
||||
|
||||
import android.app.admin.DeviceAdminReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.widget.Toast
|
||||
|
||||
class DeviceAdmin : DeviceAdminReceiver() {
|
||||
override fun onEnabled(context: Context, intent: Intent) {
|
||||
super.onEnabled(context, intent)
|
||||
Toast.makeText(context, "Enabled", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
|
||||
override fun onDisabled(context: Context, intent: Intent) {
|
||||
super.onDisabled(context, intent)
|
||||
Toast.makeText(context, "Disabled", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.github.droidworksstudio.launcher.listener
|
||||
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
|
||||
class OnItemClickedListener {
|
||||
|
||||
interface OnAppsClickedListener{
|
||||
fun onAppClicked(appInfo: AppInfo)
|
||||
}
|
||||
|
||||
interface OnAppLongClickedListener{
|
||||
fun onAppLongClicked(appInfo: AppInfo)
|
||||
}
|
||||
|
||||
interface BottomSheetDismissListener {
|
||||
fun onBottomSheetDismissed()
|
||||
}
|
||||
|
||||
interface OnAppStateClickListener{
|
||||
fun onAppStateClicked(appInfo: AppInfo)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.github.droidworksstudio.launcher.listener
|
||||
|
||||
class OnItemMoveListener {
|
||||
interface OnItemActionListener {
|
||||
fun onViewMoved(oldPosition: Int, newPosition: Int): Boolean
|
||||
fun onViewSwiped(position: Int)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.github.droidworksstudio.launcher.listener
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.view.GestureDetector
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
internal open class OnSwipeTouchListener(c: Context?) : View.OnTouchListener {
|
||||
private var longPressOn = false
|
||||
|
||||
private val gestureDetector: GestureDetector
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onTouch(view: View, motionEvent: MotionEvent): Boolean {
|
||||
if (motionEvent.action == MotionEvent.ACTION_UP)
|
||||
longPressOn = false
|
||||
return gestureDetector.onTouchEvent(motionEvent)
|
||||
}
|
||||
|
||||
private inner class GestureListener : GestureDetector.SimpleOnGestureListener() {
|
||||
private val swipeThreshold: Int = 100
|
||||
private val swipeVelocityThreshold: Int = 100
|
||||
|
||||
override fun onDown(e: MotionEvent): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onDoubleTap(e: MotionEvent): Boolean {
|
||||
onDoubleClick()
|
||||
return super.onDoubleTap(e)
|
||||
}
|
||||
|
||||
override fun onLongPress(e: MotionEvent) {
|
||||
longPressOn = true
|
||||
val scope = CoroutineScope(Dispatchers.Main)
|
||||
scope.launch {
|
||||
if (longPressOn) {
|
||||
onLongClick()
|
||||
}
|
||||
}
|
||||
super.onLongPress(e)
|
||||
}
|
||||
|
||||
override fun onFling(
|
||||
e1: MotionEvent?,
|
||||
event1: MotionEvent,
|
||||
velocityX: Float,
|
||||
velocityY: Float
|
||||
): Boolean {
|
||||
try {
|
||||
val diffY = event1.y - event1.y
|
||||
val diffX = event1.x - event1.x
|
||||
if (kotlin.math.abs(diffX) > kotlin.math.abs(diffY)) {
|
||||
if (kotlin.math.abs(diffX) > swipeThreshold && kotlin.math.abs(velocityX) > swipeVelocityThreshold) {
|
||||
if (diffX > 0) onSwipeRight() else onSwipeLeft()
|
||||
}
|
||||
} else {
|
||||
if (kotlin.math.abs(diffY) > swipeThreshold && kotlin.math.abs(velocityY) > swipeVelocityThreshold) {
|
||||
if (diffY < 0) onSwipeUp() else onSwipeDown()
|
||||
}
|
||||
}
|
||||
} catch (exception: Exception) {
|
||||
exception.printStackTrace()
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
open fun onSwipeRight() {}
|
||||
open fun onSwipeLeft() {}
|
||||
open fun onSwipeUp() {}
|
||||
open fun onSwipeDown() {}
|
||||
open fun onLongClick() {}
|
||||
open fun onDoubleClick() {}
|
||||
|
||||
init {
|
||||
gestureDetector = GestureDetector(c, GestureListener())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.github.droidworksstudio.launcher.listener
|
||||
|
||||
interface ScrollEventListener {
|
||||
fun onTopReached()
|
||||
fun onBottomReached()
|
||||
fun onScroll(isTopReached: Boolean, isBottomReached: Boolean)
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package com.github.droidworksstudio.launcher.repository
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.LauncherApps
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.UserManager
|
||||
import android.util.Log
|
||||
import com.github.droidworksstudio.launcher.Constants
|
||||
import com.github.droidworksstudio.launcher.data.dao.AppInfoDAO
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.firstOrNull
|
||||
import kotlinx.coroutines.withContext
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
class AppInfoRepository @Inject constructor(
|
||||
private val appDao: AppInfoDAO
|
||||
) {
|
||||
|
||||
@Inject
|
||||
lateinit var packageManager: PackageManager
|
||||
|
||||
fun getDrawApps(): Flow<List<AppInfo>> {
|
||||
return appDao.getDrawAppsFlow()
|
||||
}
|
||||
|
||||
fun getFavoriteApps(): Flow<List<AppInfo>> {
|
||||
return appDao.getFavoriteAppsFlow()
|
||||
}
|
||||
|
||||
fun getHiddenApps(): Flow<List<AppInfo>> {
|
||||
return appDao.getHiddenAppsFlow()
|
||||
}
|
||||
|
||||
suspend fun updateInfo(appInfo: AppInfo) {
|
||||
appDao.update(appInfo)
|
||||
}
|
||||
|
||||
suspend fun updateAppOrder(appInfoList: List<AppInfo>) {
|
||||
withContext(Dispatchers.IO) {
|
||||
appDao.updateAppOrder(appInfoList)
|
||||
}
|
||||
}
|
||||
|
||||
fun searchNote(query: String?): Flow<List<AppInfo>> {
|
||||
return appDao.searchApps(query)
|
||||
}
|
||||
|
||||
suspend fun updateFavoriteAppInfo(appInfo: AppInfo) = withContext(Dispatchers.IO) {
|
||||
|
||||
if (appInfo.favorite) {
|
||||
val maxOrder = appDao.getMaxOrder()
|
||||
val newOrder = maxOrder + 1
|
||||
appInfo.appOrder = newOrder
|
||||
appDao.updateAppInfo(appInfo)
|
||||
Log.d("Tag", "${appInfo.appName} : DAO Order: ${appInfo.appOrder}")
|
||||
Log.d("Tag", "${appInfo.appName} : DAO Favorite: ${appInfo.favorite}")
|
||||
} else {
|
||||
appInfo.appOrder = -1
|
||||
appDao.updateAppInfo(appInfo)
|
||||
Log.d("Tag", "${appInfo.appName} : DAO Order Remove: ${appInfo.appOrder}")
|
||||
Log.d("Tag", "${appInfo.appName} : DAO Favorite Remove: ${appInfo.favorite}")
|
||||
}
|
||||
|
||||
val favoriteAppInfos = appDao.getFavoriteAppInfo().sortedBy { it.appOrder }
|
||||
|
||||
for ((index, info) in favoriteAppInfos.withIndex()) {
|
||||
info.appOrder = index
|
||||
appDao.updateAppInfo(info)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun updateAppName(appInfo: AppInfo, newAppName: String) = withContext(Dispatchers.IO) {
|
||||
appInfo.appName = newAppName
|
||||
appDao.updateAppName(appInfo, newAppName)
|
||||
}
|
||||
|
||||
suspend fun updateAppHidden(appInfo: AppInfo, appHidden: Boolean) =
|
||||
withContext(Dispatchers.IO) {
|
||||
appInfo.hidden = appHidden
|
||||
appDao.updateAppHidden(appInfo, appHidden)
|
||||
}
|
||||
|
||||
suspend fun updateAppLock(appInfo: AppInfo, appLock: Boolean) = withContext(Dispatchers.IO) {
|
||||
appInfo.lock = appLock
|
||||
appDao.updateLockApp(appInfo, appLock)
|
||||
}
|
||||
|
||||
private suspend fun getInstalledPackages(): Set<String> = withContext(Dispatchers.IO) {
|
||||
|
||||
val packages = HashSet<String>()
|
||||
val apps = packageManager.getInstalledApplications(PackageManager.GET_META_DATA)
|
||||
for (app in apps) {
|
||||
packages.add(app.packageName)
|
||||
}
|
||||
packages
|
||||
}
|
||||
|
||||
suspend fun initInstalledAppInfo(context: Context): List<AppInfo> = withContext(Dispatchers.IO) {
|
||||
val appList: MutableList<AppInfo> = mutableListOf()
|
||||
|
||||
val allApps = appDao.getAllAppsFlow().firstOrNull()
|
||||
|
||||
val existingPackageNames = allApps?.map { it.packageName } ?: emptyList()
|
||||
|
||||
val userManager = context.getSystemService(Context.USER_SERVICE) as UserManager
|
||||
val launcherApps =
|
||||
context.getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||
|
||||
val excludedPackageName = Constants.PACKAGE_NAME
|
||||
|
||||
val newAppList: List<AppInfo> = userManager.userProfiles
|
||||
.flatMap { profile ->
|
||||
launcherApps.getActivityList(null, profile)
|
||||
.mapNotNull { app ->
|
||||
val packageName = app.applicationInfo.packageName
|
||||
if (packageName !in existingPackageNames && packageName != excludedPackageName) {
|
||||
AppInfo(
|
||||
appName = app.label.toString(),
|
||||
packageName = packageName,
|
||||
favorite = false,
|
||||
hidden = false,
|
||||
lock = false
|
||||
)
|
||||
} else {
|
||||
val existingApp = getAppByPackageName(packageName)
|
||||
existingApp?.let { appList.add(it) }
|
||||
existingApp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
appDao.insertAll(newAppList.sortedBy { it.appName })
|
||||
Log.d("Tag", "State: ${newAppList.sortedBy { it.appName }}")
|
||||
|
||||
val deletedApps = allApps?.filter { it.packageName !in existingPackageNames }
|
||||
deletedApps?.forEach { appDao.delete(it) }
|
||||
|
||||
appList.sortBy { it.appName }
|
||||
appList
|
||||
}
|
||||
|
||||
suspend fun compareInstalledApp(): List<AppInfo> = withContext(Dispatchers.IO) {
|
||||
val installedPackages = getInstalledPackages()
|
||||
val uninstalledApps = mutableListOf<AppInfo>()
|
||||
|
||||
val allApps = appDao.getAllApps()
|
||||
|
||||
val newApps = mutableListOf<AppInfo>()
|
||||
|
||||
for (app in allApps) {
|
||||
val packageName = app.packageName
|
||||
if (!installedPackages.contains(packageName)) {
|
||||
appDao.delete(app)
|
||||
uninstalledApps.add(app)
|
||||
}
|
||||
}
|
||||
|
||||
val newPackageNames = installedPackages.filterNot { packageName ->
|
||||
allApps.any { app -> app.packageName == packageName }
|
||||
}
|
||||
|
||||
for (packageName in newPackageNames) {
|
||||
val app = appDao.getAppByPackageName(packageName)
|
||||
app?.let {
|
||||
newApps.add(app)
|
||||
}
|
||||
}
|
||||
|
||||
appDao.insertAll(newApps)
|
||||
uninstalledApps
|
||||
}
|
||||
|
||||
private suspend fun getAppByPackageName(packageName: String): AppInfo? {
|
||||
return appDao.getAppByPackageName(packageName)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.github.droidworksstudio.launcher.ui.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
|
||||
class FakeHomeActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_fake_home)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.github.droidworksstudio.launcher.ui.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
|
||||
class LauncherActivity : AppCompatActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_mock)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.github.droidworksstudio.launcher.ui.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import androidx.navigation.ui.AppBarConfiguration
|
||||
import androidx.navigation.ui.navigateUp
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.databinding.ActivityMainBinding
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.ui.drawer.DrawFragment
|
||||
import com.github.droidworksstudio.launcher.ui.viewpager.ViewPagerAdapter
|
||||
import com.github.droidworksstudio.launcher.viewmodel.AppViewModel
|
||||
import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||
private lateinit var binding: ActivityMainBinding
|
||||
|
||||
private val viewModel: AppViewModel by viewModels()
|
||||
private val preferenceViewModel: PreferenceViewModel by viewModels()
|
||||
|
||||
private lateinit var navController: NavController
|
||||
|
||||
@Inject
|
||||
lateinit var preferenceHelper: PreferenceHelper
|
||||
|
||||
@Inject
|
||||
lateinit var appHelper: AppHelper
|
||||
|
||||
private val viewPagerAdapter: ViewPagerAdapter by lazy { ViewPagerAdapter(supportFragmentManager, lifecycle) }
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = ActivityMainBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
initializeDependencies()
|
||||
setupNavController()
|
||||
setupViewPagerAdapter()
|
||||
}
|
||||
|
||||
private fun initializeDependencies() {
|
||||
|
||||
preferenceViewModel.setShowStatusBar(preferenceHelper.showStatusBar)
|
||||
preferenceViewModel.setFirstLaunch(preferenceHelper.firstLaunch)
|
||||
|
||||
window.addFlags(FLAG_LAYOUT_NO_LIMITS)
|
||||
|
||||
}
|
||||
|
||||
private fun setupDataBase() {
|
||||
lifecycleScope.launch {
|
||||
viewModel.initializeInstalledAppInfo(this@MainActivity)
|
||||
}
|
||||
//GlobalScope.launch { }
|
||||
preferenceHelper.firstLaunch = false
|
||||
}
|
||||
|
||||
private fun observeUI() {
|
||||
preferenceViewModel.setShowStatusBar(preferenceHelper.showStatusBar)
|
||||
preferenceViewModel.showStatusBarLiveData.observe(this) {
|
||||
if (it) appHelper.showStatusBar(this.window)
|
||||
else appHelper.hideStatusBar(this.window) }
|
||||
}
|
||||
|
||||
private fun setupNavController() {
|
||||
navController = findNavController(R.id.nav_host_fragment_content_main)
|
||||
appBarConfiguration = AppBarConfiguration(navController.graph)
|
||||
//setupActionBarWithNavController(navController, appBarConfiguration)
|
||||
}
|
||||
|
||||
private fun setupViewPagerAdapter() {
|
||||
binding.pager.apply {
|
||||
adapter = viewPagerAdapter
|
||||
offscreenPageLimit = 1
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_main, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
return when (item.itemId) {
|
||||
R.id.action_settings -> true
|
||||
else -> super.onOptionsItemSelected(item)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSupportNavigateUp(): Boolean {
|
||||
val navController = findNavController(R.id.nav_host_fragment_content_main)
|
||||
return navController.navigateUp(appBarConfiguration)
|
||||
|| super.onSupportNavigateUp()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setupDataBase()
|
||||
observeUI()
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
backToHomeScreen()
|
||||
super.onStop()
|
||||
}
|
||||
|
||||
override fun onUserLeaveHint() {
|
||||
backToHomeScreen()
|
||||
super.onUserLeaveHint()
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onBackPressed() {
|
||||
val currentItem = binding.pager.currentItem
|
||||
val navHostFragment =
|
||||
supportFragmentManager.findFragmentById(R.id.nav_host_fragment_content_main) as NavHostFragment
|
||||
val currentFragment = navHostFragment.childFragmentManager.fragments[0]
|
||||
|
||||
if (currentFragment is DrawFragment) {
|
||||
@Suppress("DEPRECATION")
|
||||
super.onBackPressed()
|
||||
} else {
|
||||
binding.pager.currentItem = currentItem - 1
|
||||
}
|
||||
}
|
||||
|
||||
private fun backToHomeScreen() {
|
||||
if (navController.currentDestination?.id != R.id.HomeFragment)
|
||||
navController.popBackStack(R.id.HomeFragment, false)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.github.droidworksstudio.launcher.ui.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.WindowManager
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.ui.AppBarConfiguration
|
||||
import androidx.navigation.ui.navigateUp
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.databinding.ActivitySettingsBinding
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class SettingsActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var binding: ActivitySettingsBinding
|
||||
|
||||
private lateinit var appBarConfiguration: AppBarConfiguration
|
||||
private lateinit var navController: NavController
|
||||
|
||||
private val preferenceViewModel: PreferenceViewModel by viewModels()
|
||||
|
||||
@Inject
|
||||
lateinit var preferenceHelper: PreferenceHelper
|
||||
|
||||
@Inject
|
||||
lateinit var appHelper: AppHelper
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = ActivitySettingsBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
navController = findNavController(R.id.nav_host_fragment_content_settings)
|
||||
appBarConfiguration = AppBarConfiguration(navController.graph)
|
||||
|
||||
initializeDependencies()
|
||||
|
||||
}
|
||||
|
||||
override fun onSupportNavigateUp(): Boolean {
|
||||
val navController = findNavController(R.id.nav_host_fragment_content_settings)
|
||||
return navController.navigateUp(appBarConfiguration)
|
||||
|| super.onSupportNavigateUp()
|
||||
}
|
||||
|
||||
private fun initializeDependencies() {
|
||||
|
||||
preferenceViewModel.setShowStatusBar(preferenceHelper.showStatusBar)
|
||||
}
|
||||
private fun observeUI(){
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
|
||||
|
||||
preferenceViewModel.setShowStatusBar(preferenceHelper.showStatusBar)
|
||||
preferenceViewModel.showStatusBarLiveData.observe(this) {
|
||||
if (it) appHelper.showStatusBar(this.window)
|
||||
else appHelper.hideStatusBar(this.window) }
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
observeUI()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
package com.github.droidworksstudio.launcher.ui.bottomsheetdialog
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogAlignmentSettingsBinding
|
||||
import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogColorSettingsBinding
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.BottomDialogHelper
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class AlignmentBottomSheetDialogFragment(context: Context) : BottomSheetDialogFragment() {
|
||||
|
||||
private var _binding: BottomsheetdialogAlignmentSettingsBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
@Inject
|
||||
lateinit var preferenceHelper: PreferenceHelper
|
||||
|
||||
@Inject
|
||||
lateinit var appHelper: AppHelper
|
||||
|
||||
@Inject
|
||||
lateinit var bottomDialogHelper: BottomDialogHelper
|
||||
|
||||
private val preferenceViewModel: PreferenceViewModel by viewModels()
|
||||
|
||||
private var selectedAlignment: String = ""
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = BottomsheetdialogAlignmentSettingsBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
initView()
|
||||
observeClickListener()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
bottomDialogHelper.setupDialogStyle(dialog)
|
||||
|
||||
binding.selectDateTextSize.apply {
|
||||
text = appHelper.gravityToString(preferenceHelper.homeDateAlignment)
|
||||
}
|
||||
|
||||
binding.selectTimeTextSize.apply {
|
||||
text = appHelper.gravityToString(preferenceHelper.homeTimeAlignment)
|
||||
}
|
||||
|
||||
binding.selectAppTextSize.apply {
|
||||
text = appHelper.gravityToString(preferenceHelper.homeAppAlignment)
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeClickListener(){
|
||||
binding.bottomAlignmentDateView.setOnClickListener {
|
||||
selectedAlignment = REQUEST_KEY_DATE_ALIGNMENT
|
||||
showListDialog(selectedAlignment)
|
||||
}
|
||||
|
||||
binding.bottomAlignmentTimeView.setOnClickListener {
|
||||
selectedAlignment = REQUEST_KEY_TIME_ALIGNMENT
|
||||
showListDialog(selectedAlignment)
|
||||
}
|
||||
|
||||
binding.bottomAlignmentAppView.setOnClickListener {
|
||||
selectedAlignment = REQUEST_KEY_APP_ALIGNMENT
|
||||
showListDialog(selectedAlignment)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun showListDialog(selectedAlignment: String) {
|
||||
val items = resources.getStringArray(R.array.alignment_options)
|
||||
|
||||
val dialog = MaterialAlertDialogBuilder(requireContext())
|
||||
|
||||
dialog.setTitle(DIALOG_TITLE)
|
||||
dialog.setItems(items) { _, which ->
|
||||
val selectedItem = items[which]
|
||||
val gravity = appHelper.getGravityFromSelectedItem(selectedItem)
|
||||
|
||||
when (selectedAlignment) {
|
||||
REQUEST_KEY_APP_ALIGNMENT -> {
|
||||
setAlignment(
|
||||
selectedAlignment,
|
||||
selectedItem,
|
||||
gravity,
|
||||
binding.selectAppTextSize
|
||||
)
|
||||
}
|
||||
|
||||
REQUEST_KEY_TIME_ALIGNMENT -> {
|
||||
setAlignment(
|
||||
selectedAlignment,
|
||||
selectedItem,
|
||||
gravity,
|
||||
binding.selectTimeTextSize
|
||||
)
|
||||
}
|
||||
|
||||
REQUEST_KEY_DATE_ALIGNMENT -> {
|
||||
setAlignment(
|
||||
selectedAlignment,
|
||||
selectedItem,
|
||||
gravity,
|
||||
binding.selectDateTextSize
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
dialog.show()
|
||||
}
|
||||
|
||||
private fun setAlignment(
|
||||
alignmentType: String,
|
||||
selectedItem: String,
|
||||
gravity: Int,
|
||||
textView: TextView
|
||||
) {
|
||||
val alignmentPreference: (Int) -> Unit
|
||||
val alignmentGetter: () -> Int
|
||||
|
||||
when (alignmentType) {
|
||||
REQUEST_KEY_APP_ALIGNMENT -> {
|
||||
alignmentPreference = { preferenceViewModel.setHomeAppAlignment(it) }
|
||||
alignmentGetter = { preferenceHelper.homeAppAlignment }
|
||||
}
|
||||
|
||||
REQUEST_KEY_TIME_ALIGNMENT -> {
|
||||
alignmentPreference = { preferenceViewModel.setHomeTimeAppAlignment(it) }
|
||||
alignmentGetter = { preferenceHelper.homeTimeAlignment }
|
||||
}
|
||||
|
||||
REQUEST_KEY_DATE_ALIGNMENT -> {
|
||||
alignmentPreference = { preferenceViewModel.setHomeDateAlignment(it) }
|
||||
alignmentGetter = { preferenceHelper.homeDateAlignment }
|
||||
}
|
||||
|
||||
else -> return
|
||||
}
|
||||
|
||||
alignmentPreference(gravity)
|
||||
textView.text = appHelper.gravityToString(alignmentGetter())
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val DIALOG_TITLE = "Select Alignment"
|
||||
private const val REQUEST_KEY_DATE_ALIGNMENT = "REQUEST_KEY_DATE_ALIGNMENT"
|
||||
private const val REQUEST_KEY_TIME_ALIGNMENT = "REQUEST_KEY_TIME_ALIGNMENT"
|
||||
private const val REQUEST_KEY_APP_ALIGNMENT = "REQUEST_KEY_APP_ALIGNMENT"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.github.droidworksstudio.launcher.ui.bottomsheetdialog
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.BottomsheetDialogBinding
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.BottomDialogHelper
|
||||
import com.github.droidworksstudio.launcher.helper.FingerprintHelper
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
import com.github.droidworksstudio.launcher.viewmodel.AppViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class AppInfoBottomSheetFragment(private val appInfo: AppInfo) : BottomSheetDialogFragment(),
|
||||
FingerprintHelper.Callback {
|
||||
|
||||
private var _binding: BottomsheetDialogBinding? = null
|
||||
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val viewModel: AppViewModel by viewModels()
|
||||
|
||||
@Inject
|
||||
lateinit var appHelper: AppHelper
|
||||
|
||||
@Inject
|
||||
lateinit var bottomDialogHelper: BottomDialogHelper
|
||||
|
||||
@Inject
|
||||
lateinit var fingerHelper: FingerprintHelper
|
||||
|
||||
private var appStateClickListener: OnItemClickedListener.OnAppStateClickListener? = null
|
||||
|
||||
private var dismissListener: OnItemClickedListener.BottomSheetDismissListener? = null
|
||||
|
||||
fun setOnAppStateClickListener(listener: OnItemClickedListener.OnAppStateClickListener) {
|
||||
appStateClickListener = listener
|
||||
}
|
||||
|
||||
fun setOnBottomSheetDismissedListener(listener: OnItemClickedListener.BottomSheetDismissListener) {
|
||||
dismissListener = listener
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = BottomsheetDialogBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
initView()
|
||||
observeClickListener()
|
||||
}
|
||||
|
||||
private fun initView() {
|
||||
bottomDialogHelper.setupDialogStyle(dialog)
|
||||
|
||||
binding.run {
|
||||
bottomSheetFavHidden.text = getString(if (!appInfo.favorite) R.string.bottom_dialog_add_to_home else R.string.bottom_dialog_remove_from_home)
|
||||
bottomSheetHidden.text = getString(if (!appInfo.hidden) R.string.bottom_dialog_add_to_hidden else R.string.bottom_dialog_remove_to_hidden)
|
||||
bottomSheetLock.text = getString(if (!appInfo.lock) R.string.bottom_dialog_add_to_lock else R.string.bottom_dialog_remove_to_unlock)
|
||||
bottomSheetRename.setText(appInfo.appName)
|
||||
bottomSheetOrder.text = appInfo.appOrder.toString()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun observeClickListener() {
|
||||
val packageName = appInfo.packageName
|
||||
|
||||
val packageManager = context?.packageManager
|
||||
val applicationInfo = packageManager?.getApplicationInfo(packageName, 0)
|
||||
val appName = applicationInfo?.let { packageManager.getApplicationLabel(it).toString() }
|
||||
|
||||
binding.bottomSheetFavHidden.setOnClickListener {
|
||||
appStateClickListener?.onAppStateClicked(appInfo)
|
||||
|
||||
appInfo.favorite = !appInfo.favorite
|
||||
|
||||
viewModel.updateAppInfoFavorite(appInfo)
|
||||
|
||||
Log.d("Tag", "${appInfo.appName} : Bottom Favorite: ${appInfo.favorite}")
|
||||
Log.d("Tag", "${appInfo.appName} : Bottom Order: ${appInfo.appOrder}")
|
||||
|
||||
dismiss()
|
||||
}
|
||||
|
||||
binding.bottomSheetRename.addTextChangedListener(object : TextWatcher {
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
appInfo.appName = s.toString()
|
||||
|
||||
if (s.isNullOrEmpty()) {
|
||||
viewModel.updateAppInfoAppName(appInfo, appName.toString())
|
||||
} else {
|
||||
viewModel.updateAppInfoAppName(appInfo, s.toString())
|
||||
}
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
if (s.isNullOrEmpty()) {
|
||||
binding.bottomSheetRename.setHintTextColor(ContextCompat.getColor(requireContext(), R.color.white))
|
||||
binding.bottomSheetRename.hint = appName
|
||||
appInfo.appName = appName ?: ""
|
||||
} else {
|
||||
appInfo.appName = s.toString()
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
binding.bottomSheetRenameDone.setOnClickListener {
|
||||
appStateClickListener?.onAppStateClicked(appInfo)
|
||||
viewModel.updateAppInfoAppName(appInfo, appInfo.appName)
|
||||
dismiss()
|
||||
Log.d("Tag", "${appInfo.appName} Bottom State: ${appInfo.appName}")
|
||||
}
|
||||
|
||||
binding.bottomSheetHidden.setOnClickListener {
|
||||
appStateClickListener?.onAppStateClicked(appInfo)
|
||||
appInfo.hidden = !appInfo.hidden
|
||||
|
||||
viewModel.updateAppHidden(appInfo, appInfo.hidden)
|
||||
dismiss()
|
||||
}
|
||||
|
||||
binding.bottomSheetLock.setOnClickListener {
|
||||
if (appInfo.lock) {
|
||||
fingerHelper.startFingerprintAuth(appInfo, this)
|
||||
}
|
||||
else {
|
||||
appInfo.lock = true
|
||||
viewModel.updateAppLock(appInfo, appInfo.lock)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
binding.bottomSheetUninstall.setOnClickListener {
|
||||
appStateClickListener?.onAppStateClicked(appInfo)
|
||||
appHelper.unInstallApp(requireContext(), appInfo)
|
||||
dismiss()
|
||||
}
|
||||
|
||||
binding.bottomSheetInfo.setOnClickListener {
|
||||
appHelper.appInfo(requireContext(), appInfo)
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAuthenticationSucceeded(appInfo: AppInfo) {
|
||||
appInfo.lock = false
|
||||
|
||||
viewModel.updateAppLock(appInfo, appInfo.lock)
|
||||
dismiss()
|
||||
|
||||
appHelper.showToast(requireContext(), getString(R.string.authentication_succeeded))
|
||||
}
|
||||
|
||||
override fun onAuthenticationFailed() {
|
||||
appHelper.showToast(requireContext(), getString(R.string.authentication_failed))
|
||||
}
|
||||
|
||||
override fun onAuthenticationError(errorCode: Int, errorMessage: CharSequence?) {
|
||||
appHelper.showToast(requireContext(), getString(R.string.authentication_error))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package com.github.droidworksstudio.launcher.ui.bottomsheetdialog
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogColorSettingsBinding
|
||||
import com.github.droidworksstudio.launcher.helper.BottomDialogHelper
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import net.mm2d.color.chooser.ColorChooserDialog
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class ColorBottomSheetDialogFragment(context: Context) : BottomSheetDialogFragment() {
|
||||
|
||||
private var _binding: BottomsheetdialogColorSettingsBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
@Inject
|
||||
lateinit var preferenceHelper: PreferenceHelper
|
||||
|
||||
@Inject
|
||||
lateinit var bottomDialogHelper: BottomDialogHelper
|
||||
|
||||
private val preferenceViewModel: PreferenceViewModel by viewModels()
|
||||
|
||||
private var color: Int = Color.WHITE
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = BottomsheetdialogColorSettingsBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
initView()
|
||||
observeClickListener()
|
||||
}
|
||||
|
||||
private fun initView(){
|
||||
bottomDialogHelper.setupDialogStyle(dialog)
|
||||
|
||||
binding.selectDateTextColor.apply {
|
||||
text = bottomDialogHelper.getColorText(preferenceHelper.dateColor)
|
||||
setTextColor(preferenceHelper.dateColor)
|
||||
}
|
||||
|
||||
binding.selectTimeTextColor.apply {
|
||||
text = bottomDialogHelper.getColorText(preferenceHelper.timeColor)
|
||||
setTextColor(preferenceHelper.timeColor)
|
||||
}
|
||||
|
||||
binding.selectAppTextColor.apply {
|
||||
text = bottomDialogHelper.getColorText(preferenceHelper.appColor)
|
||||
setTextColor(preferenceHelper.appColor)
|
||||
}
|
||||
|
||||
binding.selectBatteryTextColor.apply {
|
||||
text = bottomDialogHelper.getColorText(preferenceHelper.batteryColor)
|
||||
setTextColor(preferenceHelper.batteryColor)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun observeClickListener(){
|
||||
binding.bottomColorDateView.setOnClickListener {
|
||||
showColorPickerDialog(
|
||||
binding.selectDateTextColor,
|
||||
REQUEST_KEY_DATE_COLOR,
|
||||
preferenceHelper.dateColor
|
||||
)
|
||||
}
|
||||
|
||||
binding.bottomColorTimeView.setOnClickListener {
|
||||
showColorPickerDialog(
|
||||
binding.selectTimeTextColor,
|
||||
REQUEST_KEY_TIME_COLOR,
|
||||
preferenceHelper.timeColor
|
||||
)
|
||||
}
|
||||
|
||||
binding.bottomColorAppView.setOnClickListener {
|
||||
showColorPickerDialog(
|
||||
binding.selectAppTextColor,
|
||||
REQUEST_KEY_APP_COLOR,
|
||||
preferenceHelper.appColor
|
||||
)
|
||||
}
|
||||
|
||||
binding.bottomColorBatteryView.setOnClickListener {
|
||||
showColorPickerDialog(
|
||||
binding.selectBatteryTextColor,
|
||||
REQUEST_KEY_BATTERY_COLOR,
|
||||
preferenceHelper.batteryColor
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showColorPickerDialog(view: View, requestCode: String, color: Int) {
|
||||
ColorChooserDialog.show(
|
||||
this, requestCode, color, true, tabs = intArrayOf(
|
||||
ColorChooserDialog.TAB_HSV,
|
||||
ColorChooserDialog.TAB_PALETTE
|
||||
)
|
||||
)
|
||||
|
||||
ColorChooserDialog.registerListener(this, requestCode, { pickedColor ->
|
||||
this.color = pickedColor
|
||||
(view as TextView).apply {
|
||||
//text = getColorText(pickedColor)
|
||||
text = bottomDialogHelper.getColorText(pickedColor)
|
||||
setTextColor(pickedColor)
|
||||
}
|
||||
when (requestCode) {
|
||||
REQUEST_KEY_DAILY_WORD_COLOR -> {
|
||||
preferenceViewModel.setDailyWordColor(pickedColor)
|
||||
Log.d("Tag", "Settings Daily Color: ${Integer.toHexString(pickedColor)}")
|
||||
}
|
||||
|
||||
REQUEST_KEY_BATTERY_COLOR -> {
|
||||
preferenceViewModel.setBatteryColor(pickedColor)
|
||||
Log.d("Tag", "Settings Battery Color: ${Integer.toHexString(pickedColor)}")
|
||||
}
|
||||
|
||||
REQUEST_KEY_APP_COLOR -> {
|
||||
preferenceViewModel.setAppColor(pickedColor)
|
||||
Log.d("Tag", "Settings Daily Color: ${Integer.toHexString(pickedColor)}")
|
||||
}
|
||||
|
||||
REQUEST_KEY_DATE_COLOR -> {
|
||||
preferenceViewModel.setDateColor(pickedColor)
|
||||
Log.d("Tag", "Settings Date Color: ${Integer.toHexString(pickedColor)}")
|
||||
}
|
||||
|
||||
REQUEST_KEY_TIME_COLOR -> {
|
||||
preferenceViewModel.setTimeColor(pickedColor)
|
||||
Log.d("Tag", "Settings Time Color: ${Integer.toHexString(color)}")
|
||||
}
|
||||
}
|
||||
}) {
|
||||
Toast.makeText(context, "onCancel", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val REQUEST_KEY_DATE_COLOR = "REQUEST_DATE_COLOR"
|
||||
private const val REQUEST_KEY_TIME_COLOR = "REQUEST_TIME_COLOR"
|
||||
private const val REQUEST_KEY_DAILY_WORD_COLOR = "REQUEST_DAILY_WORD_COLOR"
|
||||
private const val REQUEST_KEY_APP_COLOR = "REQUEST_APP_COLOR"
|
||||
private const val REQUEST_KEY_BATTERY_COLOR = "REQUEST_BATTERY_COLOR"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.github.droidworksstudio.launcher.ui.bottomsheetdialog
|
||||
|
||||
import android.content.Context
|
||||
import android.content.DialogInterface
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import com.github.droidworksstudio.launcher.databinding.BottomsheetdialogTextSettingsBinding
|
||||
import com.github.droidworksstudio.launcher.helper.BottomDialogHelper
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
@AndroidEntryPoint
|
||||
class TextBottomSheetDialogFragment(context: Context) : BottomSheetDialogFragment() {
|
||||
|
||||
private var _binding: BottomsheetdialogTextSettingsBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
@Inject
|
||||
lateinit var preferenceHelper: PreferenceHelper
|
||||
|
||||
@Inject
|
||||
lateinit var bottomDialogHelper: BottomDialogHelper
|
||||
|
||||
private val preferenceViewModel: PreferenceViewModel by viewModels()
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = BottomsheetdialogTextSettingsBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
initView()
|
||||
}
|
||||
|
||||
private fun initView(){
|
||||
bottomDialogHelper.setupDialogStyle(dialog)
|
||||
|
||||
binding.selectDateTextSize.setText(preferenceHelper.dateTextSize.toString())
|
||||
binding.selectTimeTextSize.setText(preferenceHelper.timeTextSize.toString())
|
||||
binding.selectAppTextSize.setText(preferenceHelper.appTextSize.toString())
|
||||
}
|
||||
|
||||
private fun observeValueChange(){
|
||||
val dateValue = binding.selectDateTextSize.text.toString()
|
||||
val timeValue = binding.selectTimeTextSize.text.toString()
|
||||
val appValue = binding.selectAppTextSize.text.toString()
|
||||
|
||||
val dateFloatValue = parseFloatValue(dateValue, preferenceHelper.dateTextSize)
|
||||
val timeFloatValue = parseFloatValue(timeValue, preferenceHelper.timeTextSize)
|
||||
val appFloatValue = parseFloatValue(appValue, preferenceHelper.appTextSize)
|
||||
dismiss()
|
||||
|
||||
preferenceViewModel.setDateTextSize(dateFloatValue)
|
||||
preferenceViewModel.setTimeTextSize(timeFloatValue)
|
||||
preferenceViewModel.setAppTextSize(appFloatValue)
|
||||
}
|
||||
|
||||
private fun parseFloatValue(text: String, defaultValue: Float): Float {
|
||||
if (text.isEmpty() || text == "0") {
|
||||
return defaultValue
|
||||
}
|
||||
return text.toFloat()
|
||||
}
|
||||
|
||||
override fun onDismiss(dialog: DialogInterface) {
|
||||
super.onDismiss(dialog)
|
||||
|
||||
observeValueChange()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.github.droidworksstudio.launcher.ui.drawer
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.ItemDrawBinding
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
|
||||
class DrawAdapter(private val onAppClickedListener: OnItemClickedListener.OnAppsClickedListener,
|
||||
private val onAppLongClickedListener: OnItemClickedListener.OnAppLongClickedListener) :
|
||||
ListAdapter<AppInfo, RecyclerView.ViewHolder>(DiffCallback()) {
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: android.view.ViewGroup,
|
||||
viewType: Int
|
||||
): RecyclerView.ViewHolder {
|
||||
val binding = ItemDrawBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
return DrawViewHolder(binding, onAppClickedListener, onAppLongClickedListener)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
|
||||
val appInfo = getItem(position)
|
||||
(holder as DrawViewHolder).bind(appInfo)
|
||||
}
|
||||
|
||||
class DiffCallback : DiffUtil.ItemCallback<AppInfo>() {
|
||||
override fun areItemsTheSame(oldItem: AppInfo, newItem: AppInfo) =
|
||||
oldItem.id == newItem.id
|
||||
|
||||
override fun areContentsTheSame(oldItem: AppInfo, newItem: AppInfo) =
|
||||
oldItem == newItem
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun updateDataWithStateFlow(newData: List<AppInfo>) {
|
||||
submitList(newData.toMutableList())
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package com.github.droidworksstudio.launcher.ui.drawer
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.coroutineScope
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.FragmentDrawBinding
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.FingerprintHelper
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.AppInfoBottomSheetFragment
|
||||
import com.github.droidworksstudio.launcher.viewmodel.AppViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
/**
|
||||
* A simple [Fragment] subclass as the second destination in the navigation.
|
||||
*/
|
||||
@AndroidEntryPoint
|
||||
class DrawFragment : Fragment(), OnItemClickedListener.OnAppsClickedListener,
|
||||
OnItemClickedListener.OnAppLongClickedListener,
|
||||
OnItemClickedListener.BottomSheetDismissListener,
|
||||
OnItemClickedListener.OnAppStateClickListener,
|
||||
FingerprintHelper.Callback{
|
||||
private var _binding: FragmentDrawBinding? = null
|
||||
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val viewModel: AppViewModel by viewModels()
|
||||
|
||||
private val drawAdapter: DrawAdapter by lazy { DrawAdapter(this, this) }
|
||||
|
||||
@Inject
|
||||
lateinit var appHelper: AppHelper
|
||||
|
||||
@Inject
|
||||
lateinit var fingerHelper: FingerprintHelper
|
||||
|
||||
private lateinit var context: Context
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
|
||||
_binding = FragmentDrawBinding.inflate(inflater, container, false)
|
||||
|
||||
return binding.root
|
||||
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
appHelper.dayNightMod(requireContext(), binding.drawBackground)
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
context = requireContext()
|
||||
|
||||
setupRecyclerView()
|
||||
setupSearch()
|
||||
observeClickListener()
|
||||
}
|
||||
|
||||
private fun setupRecyclerView() {
|
||||
|
||||
binding.drawAdapter.apply {
|
||||
adapter = drawAdapter
|
||||
layoutManager = StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
|
||||
setHasFixedSize(false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeDrawerApps() {
|
||||
viewModel.compareInstalledAppInfo()
|
||||
|
||||
viewLifecycleOwner.lifecycleScope.launchWhenCreated {
|
||||
viewModel.drawApps.collect{
|
||||
drawAdapter.submitList(it)
|
||||
drawAdapter.updateDataWithStateFlow(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupSearch() {
|
||||
binding.searchView1.addTextChangedListener(object: TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
// Do Nothing
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
searchApp(s.toString())
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
// Do Nothing
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun observeClickListener(){
|
||||
binding.drawSearchButton.setOnClickListener {appHelper.showSoftKeyboard(context, binding.searchView1)}
|
||||
}
|
||||
|
||||
private fun searchApp(query: String?) {
|
||||
|
||||
val searchQuery = "%$query%"
|
||||
viewLifecycleOwner.lifecycle.coroutineScope.launchWhenCreated {
|
||||
viewModel.searchAppInfo(searchQuery).collect { drawAdapter.submitList(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSelectedApp(appInfo: AppInfo) {
|
||||
binding.searchView1.text?.clear()
|
||||
|
||||
val bottomSheetFragment = AppInfoBottomSheetFragment(appInfo)
|
||||
bottomSheetFragment.setOnBottomSheetDismissedListener(this)
|
||||
bottomSheetFragment.setOnAppStateClickListener(this)
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
binding.searchView1.text?.clear()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
observeDrawerApps()
|
||||
binding.drawAdapter.scrollToPosition(0)
|
||||
appHelper.hideKeyboard(context, binding.searchView1)
|
||||
}
|
||||
|
||||
override fun onStop() {
|
||||
super.onStop()
|
||||
}
|
||||
|
||||
override fun onAppClicked(appInfo: AppInfo) {
|
||||
observeBioAuthCheck(appInfo)
|
||||
}
|
||||
|
||||
override fun onAppLongClicked(appInfo: AppInfo) {
|
||||
showSelectedApp(appInfo)
|
||||
}
|
||||
|
||||
override fun onBottomSheetDismissed() {
|
||||
}
|
||||
|
||||
override fun onAppStateClicked(appInfo: AppInfo) {
|
||||
viewModel.update(appInfo)
|
||||
Log.d("Tag", "${appInfo.appName} : Draw Favorite: ${appInfo.favorite}")
|
||||
}
|
||||
|
||||
private fun observeBioAuthCheck(appInfo: AppInfo) {
|
||||
if (!appInfo.lock) {
|
||||
appHelper.launchApp(context, appInfo)
|
||||
} else {
|
||||
fingerHelper.startFingerprintAuth(appInfo,this)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAuthenticationSucceeded(appInfo: AppInfo) {
|
||||
Toast.makeText(context, getString(R.string.authentication_succeeded), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
appHelper.launchApp(context, appInfo)
|
||||
}
|
||||
|
||||
override fun onAuthenticationFailed() {
|
||||
Toast.makeText(context, getString(R.string.authentication_failed), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun onAuthenticationError(errorCode: Int, errorMessage: CharSequence?) {
|
||||
Toast.makeText(context, getString(R.string.authentication_error), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.github.droidworksstudio.launcher.ui.drawer
|
||||
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.ItemDrawBinding
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
|
||||
class DrawViewHolder(private val binding: ItemDrawBinding,
|
||||
private val onAppClickedListener: OnItemClickedListener.OnAppsClickedListener,
|
||||
private val onAppLongClickedListener: OnItemClickedListener.OnAppLongClickedListener) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(appInfo: AppInfo) {
|
||||
binding.apply {
|
||||
appDrawName.text = appInfo.appName
|
||||
Log.d("Tag", "Draw Adapter: ${appInfo.appName + appInfo.id}")
|
||||
}
|
||||
|
||||
itemView.setOnClickListener {
|
||||
onAppClickedListener.onAppClicked(appInfo)
|
||||
}
|
||||
|
||||
itemView.setOnLongClickListener {
|
||||
onAppLongClickedListener.onAppLongClicked(appInfo)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.github.droidworksstudio.launcher.ui.favorite
|
||||
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.ItemFavoriteBinding
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemMoveListener
|
||||
|
||||
class FavoriteAdapter(private val onAppClickedListener: OnItemClickedListener.OnAppsClickedListener,
|
||||
) : ListAdapter<AppInfo, RecyclerView.ViewHolder>(DiffCallback()) ,OnItemMoveListener.OnItemActionListener{
|
||||
|
||||
private lateinit var touchHelper: ItemTouchHelper
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: android.view.ViewGroup,
|
||||
viewType: Int
|
||||
): RecyclerView.ViewHolder {
|
||||
val binding = ItemFavoriteBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
return FavoriteViewHolder(binding, onAppClickedListener, touchHelper)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
val currentItem = getItem(position)
|
||||
when (holder) {
|
||||
is FavoriteViewHolder -> {
|
||||
holder.bind(currentItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DiffCallback : androidx.recyclerview.widget.DiffUtil.ItemCallback<AppInfo>() {
|
||||
override fun areItemsTheSame(oldItem: AppInfo, newItem: AppInfo) =
|
||||
oldItem.id == newItem.id
|
||||
|
||||
override fun areContentsTheSame(oldItem: AppInfo, newItem: AppInfo) =
|
||||
oldItem == newItem
|
||||
}
|
||||
|
||||
fun setItemTouchHelper(touchHelper: ItemTouchHelper) {
|
||||
this.touchHelper = touchHelper
|
||||
}
|
||||
|
||||
override fun onViewMoved(oldPosition: Int, newPosition: Int): Boolean {
|
||||
Log.d("Tag", "List Adapter$newPosition")
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onViewSwiped(position: Int) {
|
||||
Log.d("Tag", "onViewMoved")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
package com.github.droidworksstudio.launcher.ui.favorite
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.FragmentFavoriteBinding
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.FingerprintHelper
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemMoveListener
|
||||
import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.AppInfoBottomSheetFragment
|
||||
import com.github.droidworksstudio.launcher.viewmodel.AppViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
import java.util.Collections
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
class FavoriteFragment : Fragment(), OnItemClickedListener.OnAppsClickedListener,
|
||||
OnItemClickedListener.BottomSheetDismissListener,
|
||||
OnItemClickedListener.OnAppStateClickListener,
|
||||
FingerprintHelper.Callback,OnItemMoveListener.OnItemActionListener{
|
||||
private var _binding: FragmentFavoriteBinding? = null
|
||||
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val viewModel: AppViewModel by viewModels()
|
||||
|
||||
private lateinit var context: Context
|
||||
|
||||
@Inject
|
||||
lateinit var preferenceHelper: PreferenceHelper
|
||||
|
||||
@Inject
|
||||
lateinit var fingerHelper: FingerprintHelper
|
||||
|
||||
@Inject
|
||||
lateinit var appHelper: AppHelper
|
||||
|
||||
private val favoriteAdapter: FavoriteAdapter by lazy { FavoriteAdapter(this) }
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
|
||||
_binding = FragmentFavoriteBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
appHelper.dayNightMod(requireContext(), binding.favoriteView)
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
context = requireContext()
|
||||
|
||||
setupRecyclerView()
|
||||
observeFavorite()
|
||||
observeHomeAppOrder()
|
||||
}
|
||||
|
||||
private fun setupRecyclerView() {
|
||||
|
||||
binding.favoriteAdapter.apply {
|
||||
adapter = favoriteAdapter
|
||||
layoutManager = StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
|
||||
setHasFixedSize(false)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleDragAndDrop(oldPosition: Int, newPosition: Int) {
|
||||
val items = favoriteAdapter.currentList.toMutableList()
|
||||
Collections.swap(items, oldPosition, newPosition)
|
||||
|
||||
items.forEachIndexed { index, appInfo ->
|
||||
appInfo.appOrder = index
|
||||
}
|
||||
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
viewModel.updateAppOrder(items)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun observeHomeAppOrder() {
|
||||
//binding.favoriteAdapter.adapter = favoriteAdapter
|
||||
val listener: OnItemMoveListener.OnItemActionListener = favoriteAdapter
|
||||
|
||||
val simpleItemTouchCallback = object : ItemTouchHelper.Callback() {
|
||||
|
||||
override fun onChildDraw(
|
||||
canvas: Canvas, recyclerView: RecyclerView,
|
||||
viewHolder: RecyclerView.ViewHolder, dX: Float,
|
||||
dY: Float, actionState: Int, isCurrentlyActive: Boolean
|
||||
) {
|
||||
if (isCurrentlyActive) {
|
||||
viewHolder.itemView.alpha = 0.5f
|
||||
} else {
|
||||
viewHolder.itemView.alpha = 1f
|
||||
}
|
||||
super.onChildDraw(
|
||||
canvas, recyclerView, viewHolder,
|
||||
dX, dY,
|
||||
actionState, isCurrentlyActive
|
||||
)
|
||||
}
|
||||
|
||||
override fun getMovementFlags(
|
||||
recyclerView: RecyclerView,
|
||||
viewHolder: RecyclerView.ViewHolder
|
||||
): Int {
|
||||
val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN
|
||||
val swipeFlags = 0
|
||||
return makeMovementFlags(dragFlags, swipeFlags)
|
||||
}
|
||||
|
||||
override fun onMove(
|
||||
recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder,
|
||||
target: RecyclerView.ViewHolder
|
||||
): Boolean {
|
||||
|
||||
val oldPosition = viewHolder.bindingAdapterPosition
|
||||
val newPosition = target.bindingAdapterPosition
|
||||
|
||||
handleDragAndDrop(oldPosition, newPosition)
|
||||
|
||||
return listener.onViewMoved(
|
||||
viewHolder.bindingAdapterPosition,
|
||||
target.bindingAdapterPosition
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
||||
listener.onViewSwiped(viewHolder.adapterPosition)
|
||||
}
|
||||
|
||||
override fun isLongPressDragEnabled() = false
|
||||
}
|
||||
|
||||
val itemTouchHelper = ItemTouchHelper(simpleItemTouchCallback)
|
||||
|
||||
favoriteAdapter.setItemTouchHelper(itemTouchHelper)
|
||||
itemTouchHelper.attachToRecyclerView(binding.favoriteAdapter)
|
||||
}
|
||||
|
||||
private fun observeFavorite() {
|
||||
viewModel.compareInstalledAppInfo()
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
viewModel.favoriteApps.collect {
|
||||
favoriteAdapter.submitList(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeBioAuthCheck(appInfo: AppInfo) {
|
||||
if (!appInfo.lock) {
|
||||
appHelper.launchApp(context, appInfo)
|
||||
} else {
|
||||
fingerHelper.startFingerprintAuth(appInfo, this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSelectedApp(appInfo: AppInfo) {
|
||||
val bottomSheetFragment = AppInfoBottomSheetFragment(appInfo)
|
||||
bottomSheetFragment.setOnBottomSheetDismissedListener(this)
|
||||
bottomSheetFragment.setOnAppStateClickListener(this)
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
|
||||
}
|
||||
|
||||
override fun onBottomSheetDismissed() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onAppStateClicked(appInfo: AppInfo) {
|
||||
viewModel.update(appInfo)
|
||||
}
|
||||
|
||||
override fun onAppClicked(appInfo: AppInfo) {
|
||||
observeBioAuthCheck(appInfo)
|
||||
}
|
||||
|
||||
override fun onAuthenticationSucceeded(appInfo: AppInfo) {
|
||||
Toast.makeText(context, getString(R.string.authentication_succeeded), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
appHelper.launchApp(context, appInfo)
|
||||
}
|
||||
|
||||
override fun onAuthenticationFailed() {
|
||||
Toast.makeText(context, getString(R.string.authentication_failed), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun onAuthenticationError(errorCode: Int, errorMessage: CharSequence?) {
|
||||
Toast.makeText(context, getString(R.string.authentication_error), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun onViewMoved(oldPosition: Int, newPosition: Int): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onViewSwiped(position: Int) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.github.droidworksstudio.launcher.ui.favorite
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.util.Log
|
||||
import android.view.MotionEvent
|
||||
import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.ItemFavoriteBinding
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
class FavoriteViewHolder(private val binding: ItemFavoriteBinding,
|
||||
private val onAppClickedListener: OnItemClickedListener.OnAppsClickedListener,
|
||||
private val touchHelper: ItemTouchHelper,
|
||||
) :
|
||||
RecyclerView.ViewHolder(binding.root){
|
||||
|
||||
init {
|
||||
binding.appFavoriteDragIcon.setOnTouchListener { _, event ->
|
||||
if (event.actionMasked == MotionEvent.ACTION_DOWN) {
|
||||
touchHelper.startDrag(this)
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
fun bind(appInfo: AppInfo) {
|
||||
binding.apply {
|
||||
appFavoriteName.text = appInfo.appName
|
||||
//appFavoriteDragIcon.visibility = View.GONE
|
||||
Log.d("Tag", "Draw Adapter: ${appInfo.appName}")
|
||||
}
|
||||
|
||||
itemView.setOnClickListener {
|
||||
onAppClickedListener.onAppClicked(appInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.github.droidworksstudio.launcher.ui.hidden
|
||||
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.ItemHiddenBinding
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
|
||||
class HiddenAdapter(
|
||||
private val onAppClickedListener: OnItemClickedListener.OnAppsClickedListener,
|
||||
private val onAppLongClickedListener: OnItemClickedListener.OnAppLongClickedListener
|
||||
) : ListAdapter<AppInfo, RecyclerView.ViewHolder>(DiffCallback()) {
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: android.view.ViewGroup,
|
||||
viewType: Int
|
||||
): RecyclerView.ViewHolder {
|
||||
val binding = ItemHiddenBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
return HiddenViewHolder(binding, onAppClickedListener, onAppLongClickedListener)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
getItem(position)
|
||||
when (holder) {
|
||||
is HiddenViewHolder -> {
|
||||
|
||||
val appInfo = getItem(position) as AppInfo
|
||||
holder.bind(appInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class DiffCallback : DiffUtil.ItemCallback<AppInfo>() {
|
||||
override fun areItemsTheSame(oldItem: AppInfo, newItem: AppInfo) =
|
||||
oldItem.id == newItem.id
|
||||
|
||||
override fun areContentsTheSame(oldItem: AppInfo, newItem: AppInfo) =
|
||||
oldItem == newItem
|
||||
}
|
||||
|
||||
fun updateData(newData: List<AppInfo>) {
|
||||
notifyItemChanged(newData.size)
|
||||
submitList(newData)
|
||||
Log.d("Tag", "Collected Hidden Adapter : $newData")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.github.droidworksstudio.launcher.ui.hidden
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.FragmentHiddenBinding
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.FingerprintHelper
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.AppInfoBottomSheetFragment
|
||||
import com.github.droidworksstudio.launcher.viewmodel.AppViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class HiddenFragment : Fragment(), OnItemClickedListener.OnAppsClickedListener,
|
||||
OnItemClickedListener.OnAppLongClickedListener,
|
||||
OnItemClickedListener.BottomSheetDismissListener,
|
||||
OnItemClickedListener.OnAppStateClickListener,
|
||||
FingerprintHelper.Callback{
|
||||
private var _binding: FragmentHiddenBinding? = null
|
||||
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val hiddenAdapter: HiddenAdapter by lazy { HiddenAdapter(this, this) }
|
||||
|
||||
private val viewModel: AppViewModel by viewModels()
|
||||
|
||||
private lateinit var context: Context
|
||||
|
||||
@Inject
|
||||
lateinit var fingerHelper: FingerprintHelper
|
||||
|
||||
@Inject
|
||||
lateinit var appHelper: AppHelper
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
|
||||
_binding = FragmentHiddenBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
appHelper.dayNightMod(requireContext(), binding.hiddenView)
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
context = requireContext()
|
||||
|
||||
setupRecyclerView()
|
||||
observeHiddenApps()
|
||||
}
|
||||
|
||||
private fun setupRecyclerView() {
|
||||
binding.hiddenAdapter.apply {
|
||||
adapter = hiddenAdapter
|
||||
layoutManager = StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
|
||||
setHasFixedSize(false)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun observeHiddenApps() {
|
||||
viewModel.compareInstalledAppInfo()
|
||||
viewLifecycleOwner.lifecycleScope.launchWhenCreated {
|
||||
viewModel.hiddenApps.collect {
|
||||
hiddenAdapter.updateData(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeBioAuthCheck(appInfo: AppInfo) {
|
||||
if (!appInfo.lock) {
|
||||
appHelper.launchApp(context, appInfo)
|
||||
} else {
|
||||
fingerHelper.startFingerprintAuth(appInfo,this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSelectedApp(appInfo: AppInfo) {
|
||||
val bottomSheetFragment = AppInfoBottomSheetFragment(appInfo)
|
||||
bottomSheetFragment.setOnBottomSheetDismissedListener(this)
|
||||
bottomSheetFragment.setOnAppStateClickListener(this)
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
binding.hiddenAdapter.scrollToPosition(0)
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
observeHiddenApps()
|
||||
}
|
||||
|
||||
override fun onAppLongClicked(appInfo: AppInfo) {
|
||||
showSelectedApp(appInfo)
|
||||
}
|
||||
|
||||
override fun onBottomSheetDismissed() {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onAppStateClicked(appInfo: AppInfo) {
|
||||
viewModel.update(appInfo)
|
||||
}
|
||||
|
||||
override fun onAppClicked(appInfo: AppInfo) {
|
||||
observeBioAuthCheck(appInfo)
|
||||
}
|
||||
|
||||
override fun onAuthenticationSucceeded(appInfo: AppInfo) {
|
||||
Toast.makeText(context, getString(R.string.authentication_succeeded), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
appHelper.launchApp(context, appInfo)
|
||||
}
|
||||
|
||||
override fun onAuthenticationFailed() {
|
||||
Toast.makeText(context, getString(R.string.authentication_failed), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
|
||||
override fun onAuthenticationError(errorCode: Int, errorMessage: CharSequence?) {
|
||||
Toast.makeText(context, getString(R.string.authentication_error), Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.github.droidworksstudio.launcher.ui.hidden
|
||||
|
||||
import android.util.Log
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.ItemHiddenBinding
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
|
||||
class HiddenViewHolder(private val binding: ItemHiddenBinding,
|
||||
private val onAppClickedListener: OnItemClickedListener.OnAppsClickedListener,
|
||||
private val onAppLongClickedListener: OnItemClickedListener.OnAppLongClickedListener) :
|
||||
RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(appInfo: AppInfo) {
|
||||
binding.apply {
|
||||
appHiddenName.text = appInfo.appName
|
||||
Log.d("Tag", "Draw Adapter: ${appInfo.appName}")
|
||||
}
|
||||
|
||||
itemView.setOnClickListener {
|
||||
onAppClickedListener.onAppClicked(appInfo)
|
||||
}
|
||||
|
||||
itemView.setOnLongClickListener {
|
||||
onAppLongClickedListener.onAppLongClicked(appInfo)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.github.droidworksstudio.launcher.ui.home
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.ItemHomeBinding
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
import javax.inject.Inject
|
||||
|
||||
class HomeAdapter @Inject constructor(private val onAppClickedListener: OnItemClickedListener.OnAppsClickedListener,
|
||||
private val onAppLongClickedListener: OnItemClickedListener.OnAppLongClickedListener,
|
||||
private val preferenceHelperProvider: PreferenceHelper
|
||||
) :
|
||||
ListAdapter<AppInfo,RecyclerView.ViewHolder>(DiffCallback()) {
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: android.view.ViewGroup,
|
||||
viewType: Int
|
||||
): RecyclerView.ViewHolder {
|
||||
val binding = ItemHomeBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
val preferenceHelper = preferenceHelperProvider
|
||||
|
||||
return HomeViewHolder(binding, onAppClickedListener, onAppLongClickedListener, preferenceHelper)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
|
||||
val appInfo = getItem(position)
|
||||
(holder as HomeViewHolder).bind(appInfo)
|
||||
}
|
||||
|
||||
class DiffCallback : DiffUtil.ItemCallback<AppInfo>() {
|
||||
override fun areItemsTheSame(oldItem: AppInfo, newItem: AppInfo) =
|
||||
oldItem.id == newItem.id
|
||||
|
||||
override fun areContentsTheSame(oldItem: AppInfo, newItem: AppInfo) =
|
||||
oldItem == newItem
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun updateDataWithStateFlow(newData: List<AppInfo>) {
|
||||
submitList(newData.toMutableList())
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
package com.github.droidworksstudio.launcher.ui.home
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.BatteryManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.format.DateFormat
|
||||
import android.util.Log
|
||||
import android.view.*
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.accessibility.MyAccessibilityService
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.FragmentHomeBinding
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.FingerprintHelper
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
import com.github.droidworksstudio.launcher.listener.OnSwipeTouchListener
|
||||
import com.github.droidworksstudio.launcher.listener.ScrollEventListener
|
||||
import com.github.droidworksstudio.launcher.ui.activities.SettingsActivity
|
||||
import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.AppInfoBottomSheetFragment
|
||||
import com.github.droidworksstudio.launcher.viewmodel.AppViewModel
|
||||
import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.flowOn
|
||||
import java.util.Locale
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
/**
|
||||
* A simple [Fragment] subclass as the default destination in the navigation.
|
||||
*/
|
||||
@AndroidEntryPoint
|
||||
class HomeFragment : Fragment(), OnItemClickedListener.OnAppsClickedListener,
|
||||
OnItemClickedListener.OnAppLongClickedListener,
|
||||
OnItemClickedListener.BottomSheetDismissListener,
|
||||
OnItemClickedListener.OnAppStateClickListener,
|
||||
FingerprintHelper.Callback, ScrollEventListener {
|
||||
|
||||
private var _binding: FragmentHomeBinding? = null
|
||||
|
||||
private val binding get() = _binding!!
|
||||
|
||||
@Inject
|
||||
lateinit var preferenceHelper: PreferenceHelper
|
||||
|
||||
@Inject
|
||||
lateinit var appHelper: AppHelper
|
||||
|
||||
@Inject
|
||||
lateinit var fingerHelper: FingerprintHelper
|
||||
|
||||
private val viewModel: AppViewModel by viewModels()
|
||||
private val preferenceViewModel: PreferenceViewModel by viewModels()
|
||||
|
||||
private val homeAdapter: HomeAdapter by lazy { HomeAdapter(this, this, preferenceHelper) }
|
||||
|
||||
private lateinit var batteryReceiver: BroadcastReceiver
|
||||
|
||||
private lateinit var context: Context
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
|
||||
_binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
initializeInjectedDependencies()
|
||||
setupBattery()
|
||||
setupRecyclerView()
|
||||
observeUserInterfaceSettings()
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private fun initializeInjectedDependencies() {
|
||||
context = requireContext()
|
||||
|
||||
binding.nestScrollView.scrollEventListener = this
|
||||
|
||||
binding.nestScrollView.registerRecyclerView(binding.appListAdapter, this)
|
||||
|
||||
preferenceViewModel.setShowTime(preferenceHelper.showTime)
|
||||
preferenceViewModel.setShowDate(preferenceHelper.showDate)
|
||||
preferenceViewModel.setShowDailyWord(preferenceHelper.showDailyWord)
|
||||
|
||||
binding.mainView.setOnTouchListener(getSwipeGestureListener(context))
|
||||
|
||||
binding.clock.setOnClickListener { appHelper.launchClock(context) }
|
||||
binding.date.setOnClickListener { appHelper.launchCalendar(context) }
|
||||
}
|
||||
|
||||
private fun setupBattery() {
|
||||
batteryReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val level: Int = intent.getIntExtra(BatteryManager.EXTRA_LEVEL, -1)
|
||||
val scale: Int = intent.getIntExtra(BatteryManager.EXTRA_SCALE, -1)
|
||||
|
||||
val batteryLevel = level * 100 / scale.toFloat()
|
||||
val batteryLevelText = getString(R.string.battery_level, batteryLevel.toString())
|
||||
binding.battery.text = batteryLevelText
|
||||
}
|
||||
}
|
||||
|
||||
val batteryIntentFilter = IntentFilter(Intent.ACTION_BATTERY_CHANGED)
|
||||
requireActivity().registerReceiver(batteryReceiver, batteryIntentFilter)
|
||||
}
|
||||
|
||||
private fun setupRecyclerView() {
|
||||
val marginTopInPixels = 128
|
||||
val params: ViewGroup.MarginLayoutParams = binding.appListAdapter.layoutParams as ViewGroup.MarginLayoutParams
|
||||
params.topMargin = marginTopInPixels
|
||||
binding.appListAdapter.layoutParams = params
|
||||
|
||||
binding.appListAdapter.apply {
|
||||
adapter = homeAdapter
|
||||
setHasFixedSize(false)
|
||||
layoutManager = StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL)
|
||||
//itemAnimator = false
|
||||
isNestedScrollingEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeFavoriteAppList() {
|
||||
viewModel.compareInstalledAppInfo()
|
||||
|
||||
viewLifecycleOwner.lifecycleScope.launchWhenCreated {
|
||||
viewModel.favoriteApps.flowOn(Dispatchers.Main).collect {
|
||||
homeAdapter.submitList(it)
|
||||
homeAdapter.updateDataWithStateFlow(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun observeUserInterfaceSettings() {
|
||||
preferenceViewModel.setShowTime(preferenceHelper.showTime)
|
||||
preferenceViewModel.setShowDate(preferenceHelper.showDate)
|
||||
preferenceViewModel.setShowDailyWord(preferenceHelper.showDailyWord)
|
||||
preferenceViewModel.setShowBattery(preferenceHelper.showBattery)
|
||||
|
||||
preferenceViewModel.showTimeLiveData.observe(viewLifecycleOwner) {
|
||||
Log.d("Tag", "ShowTime Home: $it")
|
||||
//updateViewVisibility(binding.clock, showTime)
|
||||
appHelper.updateUI(binding.clock,
|
||||
preferenceHelper.homeTimeAlignment,
|
||||
preferenceHelper.timeColor,
|
||||
preferenceHelper.timeTextSize,
|
||||
preferenceHelper.showTime
|
||||
)
|
||||
}
|
||||
|
||||
preferenceViewModel.showDateLiveData.observe(viewLifecycleOwner) {
|
||||
appHelper.updateUI(binding.date,
|
||||
preferenceHelper.homeDateAlignment,
|
||||
preferenceHelper.dateColor,
|
||||
preferenceHelper.timeTextSize,
|
||||
preferenceHelper.showDate
|
||||
)
|
||||
}
|
||||
preferenceViewModel.showBatteryLiveData.observe(viewLifecycleOwner){
|
||||
//binding.battery.setTextColor(preferenceHelper.batteryColor)
|
||||
appHelper.updateUI(binding.battery, Gravity.END,
|
||||
preferenceHelper.batteryColor,
|
||||
preferenceHelper.timeTextSize,
|
||||
preferenceHelper.showBattery
|
||||
)
|
||||
}
|
||||
|
||||
preferenceViewModel.showDailyWordLiveData.observe(viewLifecycleOwner) {
|
||||
// updateViewVisibility(binding.word, showDailyWord)
|
||||
// appHelper.updateUI(binding.word, preferenceHelper.homeDailyWordAlignment, preferenceHelper.dailyWordColor, preferenceHelper.showDailyWord)
|
||||
}
|
||||
val is24HourFormat = DateFormat.is24HourFormat(requireContext())
|
||||
val localLocale = Locale.getDefault()
|
||||
val best12 = DateFormat.getBestDateTimePattern(localLocale, "hmma")
|
||||
val best24 = DateFormat.getBestDateTimePattern(localLocale, "HHmm")
|
||||
|
||||
val timePattern = if (is24HourFormat) best24 else best12
|
||||
binding.clock.format12Hour = timePattern
|
||||
binding.clock.format24Hour = timePattern
|
||||
val datePattern = DateFormat.getBestDateTimePattern(localLocale, "eeeddMMM")
|
||||
binding.date.format12Hour = datePattern
|
||||
binding.date.format24Hour = datePattern
|
||||
}
|
||||
|
||||
private fun observeBioAuthCheck(appInfo: AppInfo) {
|
||||
if (!appInfo.lock) appHelper.launchApp(context, appInfo) else fingerHelper.startFingerprintAuth(appInfo, this)
|
||||
}
|
||||
|
||||
private fun showSelectedApp(appInfo: AppInfo) {
|
||||
val bottomSheetFragment = AppInfoBottomSheetFragment(appInfo)
|
||||
bottomSheetFragment.setOnBottomSheetDismissedListener(this)
|
||||
bottomSheetFragment.setOnAppStateClickListener(this)
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
|
||||
}
|
||||
|
||||
private fun getSwipeGestureListener(context: Context): View.OnTouchListener {
|
||||
return object : OnSwipeTouchListener(context) {
|
||||
override fun onLongClick() {
|
||||
super.onLongClick()
|
||||
val intent = Intent(requireActivity(), SettingsActivity::class.java)
|
||||
requireActivity().startActivity(intent)
|
||||
return
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.P)
|
||||
override fun onDoubleClick() {
|
||||
super.onDoubleClick()
|
||||
if(preferenceHelper.tapLockScreen) { MyAccessibilityService.instance()?.lockScreen() } else { return }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
requireActivity().unregisterReceiver(batteryReceiver)
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
observeUserInterfaceSettings()
|
||||
observeFavoriteAppList()
|
||||
}
|
||||
|
||||
override fun onAppClicked(appInfo: AppInfo) {
|
||||
observeBioAuthCheck(appInfo)
|
||||
}
|
||||
|
||||
override fun onAppLongClicked(appInfo: AppInfo) {
|
||||
showSelectedApp(appInfo)
|
||||
Log.d("Tag", "Home LiveData Favorite : ${appInfo.favorite}")
|
||||
}
|
||||
|
||||
override fun onBottomSheetDismissed() {
|
||||
}
|
||||
|
||||
override fun onAppStateClicked(appInfo: AppInfo) {
|
||||
viewModel.update(appInfo)
|
||||
Log.d("Tag", "${appInfo.appName} : Home Favorite: ${appInfo.favorite}")
|
||||
}
|
||||
|
||||
override fun onAuthenticationSucceeded(appInfo: AppInfo) {
|
||||
appHelper.launchApp(context, appInfo)
|
||||
appHelper.showToast(context, getString(R.string.authentication_succeeded))
|
||||
}
|
||||
|
||||
override fun onAuthenticationFailed() {
|
||||
appHelper.showToast(context, getString(R.string.authentication_failed))
|
||||
}
|
||||
|
||||
override fun onAuthenticationError(errorCode: Int, errorMessage: CharSequence?) {
|
||||
appHelper.showToast(context, getString(R.string.authentication_error))
|
||||
}
|
||||
|
||||
override fun onTopReached() {
|
||||
appHelper.expandNotificationDrawer(context)
|
||||
}
|
||||
|
||||
override fun onBottomReached() {
|
||||
appHelper.searchView(context)
|
||||
}
|
||||
|
||||
override fun onScroll(isTopReached: Boolean, isBottomReached: Boolean) {
|
||||
Log.d("Tag", "onScroll")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.github.droidworksstudio.launcher.ui.home
|
||||
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.appcompat.widget.LinearLayoutCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.databinding.ItemHomeBinding
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.listener.OnItemClickedListener
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
class HomeViewHolder @Inject constructor(
|
||||
private val binding: ItemHomeBinding,
|
||||
private val onAppClickedListener: OnItemClickedListener.OnAppsClickedListener,
|
||||
private val onAppLongClickedListener: OnItemClickedListener.OnAppLongClickedListener,
|
||||
private val preferenceHelper: PreferenceHelper
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(appInfo: AppInfo) {
|
||||
|
||||
binding.apply {
|
||||
val layoutParams = LinearLayoutCompat.LayoutParams(
|
||||
LinearLayoutCompat.LayoutParams.WRAP_CONTENT,
|
||||
LinearLayoutCompat.LayoutParams.WRAP_CONTENT
|
||||
).apply {
|
||||
gravity = preferenceHelper.homeAppAlignment
|
||||
}
|
||||
|
||||
appHomeName.layoutParams = layoutParams
|
||||
appHomeName.text = appInfo.appName
|
||||
appHomeName.setTextColor(preferenceHelper.appColor)
|
||||
appHomeName.textSize = preferenceHelper.appTextSize
|
||||
Log.d("Tag", "Home Adapter Color: ${preferenceHelper.appColor}")
|
||||
appHomeIcon.visibility = View.GONE
|
||||
}
|
||||
|
||||
itemView.setOnClickListener { onAppClickedListener.onAppClicked(appInfo) }
|
||||
|
||||
itemView.setOnLongClickListener {
|
||||
onAppLongClickedListener.onAppLongClicked(appInfo)
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.github.droidworksstudio.launcher.ui.settings
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.github.droidworksstudio.launcher.R
|
||||
import com.github.droidworksstudio.launcher.databinding.FragmentSettingsBinding
|
||||
import com.github.droidworksstudio.launcher.helper.AppHelper
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import com.github.droidworksstudio.launcher.listener.ScrollEventListener
|
||||
import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.AlignmentBottomSheetDialogFragment
|
||||
import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.ColorBottomSheetDialogFragment
|
||||
import com.github.droidworksstudio.launcher.ui.bottomsheetdialog.TextBottomSheetDialogFragment
|
||||
import com.github.droidworksstudio.launcher.viewmodel.PreferenceViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class SettingsFragment : Fragment(), ScrollEventListener {
|
||||
|
||||
private var _binding: FragmentSettingsBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
//private val viewModel: AppViewModel by viewModels()
|
||||
private val preferenceViewModel: PreferenceViewModel by viewModels()
|
||||
|
||||
@Inject
|
||||
lateinit var preferenceHelper: PreferenceHelper
|
||||
|
||||
@Inject
|
||||
lateinit var appHelper: AppHelper
|
||||
|
||||
private lateinit var navController: NavController
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
// Inflate the layout for this fragment
|
||||
_binding = FragmentSettingsBinding.inflate(inflater, container, false)
|
||||
_binding = binding
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
// Called after the fragment view is created
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
// Set according to the system theme mode
|
||||
appHelper.dayNightMod(requireContext(), binding.nestScrollView)
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
initializeInjectedDependencies()
|
||||
observeClickListener()
|
||||
}
|
||||
|
||||
private fun initializeInjectedDependencies() {
|
||||
navController = findNavController()
|
||||
binding.nestScrollView.scrollEventListener = this
|
||||
|
||||
// Set initial values and listeners for switches
|
||||
binding.statueBarSwitchCompat.isChecked = preferenceHelper.showStatusBar
|
||||
binding.timeSwitchCompat.isChecked = preferenceHelper.showTime
|
||||
binding.dateSwitchCompat.isChecked = preferenceHelper.showDate
|
||||
binding.batterySwitchCompat.isChecked = preferenceHelper.showBattery
|
||||
binding.gesturesLockSwitchCompat1.isChecked = preferenceHelper.tapLockScreen
|
||||
}
|
||||
|
||||
private fun observeClickListener() {
|
||||
setupSwitchListeners()
|
||||
|
||||
// Click listener for reset default launcher
|
||||
binding.setLauncherSelector.setOnClickListener {
|
||||
appHelper.resetDefaultLauncher(requireContext())
|
||||
}
|
||||
|
||||
binding.favoriteText.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_SettingsFragment_to_FavoriteFragment)
|
||||
}
|
||||
|
||||
binding.hiddenText.setOnClickListener {
|
||||
findNavController().navigate(R.id.action_SettingsFragment_to_HiddenFragment)
|
||||
}
|
||||
|
||||
binding.setAppWallpaper.setOnClickListener {
|
||||
val intent = Intent(Intent.ACTION_SET_WALLPAPER)
|
||||
startActivity(Intent.createChooser(intent, "Select Wallpaper"))
|
||||
}
|
||||
|
||||
binding.selectAppearanceTextSize.setOnClickListener {
|
||||
val bottomSheetFragment = TextBottomSheetDialogFragment(this.requireContext())
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
}
|
||||
|
||||
binding.selectAppearanceAlignment.setOnClickListener {
|
||||
val bottomSheetFragment = AlignmentBottomSheetDialogFragment(this.requireContext())
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
}
|
||||
|
||||
binding.selectAppearanceColor.setOnClickListener {
|
||||
val bottomSheetFragment = ColorBottomSheetDialogFragment(this.requireContext())
|
||||
bottomSheetFragment.show(parentFragmentManager, "BottomSheetDialog")
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupSwitchListeners() {
|
||||
binding.statueBarSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowStatusBar(isChecked)
|
||||
}
|
||||
|
||||
binding.timeSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowTime(isChecked)
|
||||
}
|
||||
|
||||
binding.dateSwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowDate(isChecked)
|
||||
}
|
||||
binding.batterySwitchCompat.setOnCheckedChangeListener { _, isChecked ->
|
||||
preferenceViewModel.setShowBattery(isChecked)
|
||||
}
|
||||
binding.gesturesLockSwitchCompat1.setOnCheckedChangeListener { _, isChecked ->
|
||||
appHelper.enableAppAsAccessibilityService(requireContext(), preferenceHelper.tapLockScreen)
|
||||
preferenceViewModel.setDoubleTapLock(isChecked)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onTopReached() {
|
||||
requireActivity().onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
|
||||
override fun onBottomReached() {
|
||||
Log.d("Tag", "onBottomReached")
|
||||
}
|
||||
|
||||
override fun onScroll(isTopReached: Boolean, isBottomReached: Boolean) {
|
||||
Log.d("Tag", "onScroll")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.github.droidworksstudio.launcher.ui.viewpager
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.github.droidworksstudio.launcher.ui.drawer.DrawFragment
|
||||
import com.github.droidworksstudio.launcher.ui.home.HomeFragment
|
||||
|
||||
|
||||
class ViewPagerAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle) :
|
||||
FragmentStateAdapter(fragmentManager, lifecycle) {
|
||||
|
||||
private val fragments: ArrayList<Fragment> = arrayListOf(
|
||||
HomeFragment(),
|
||||
DrawFragment(),
|
||||
)
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return fragments.size
|
||||
}
|
||||
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
return fragments[position]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.github.droidworksstudio.launcher.view
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.ViewConfiguration
|
||||
import androidx.core.widget.NestedScrollView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.droidworksstudio.launcher.listener.ScrollEventListener
|
||||
|
||||
class GestureNestedScrollView(context: Context, attrs: AttributeSet) : NestedScrollView(context, attrs){
|
||||
|
||||
private var startY: Float = 0f
|
||||
private var startTouchY: Float = 0f
|
||||
private var isTopReached: Boolean = false
|
||||
private var isBottomReached: Boolean = false
|
||||
private var isScrollingUp: Boolean = false
|
||||
private var isPullingDown: Boolean = false
|
||||
private var isPullingUp: Boolean = false
|
||||
|
||||
var scrollEventListener: ScrollEventListener? = null
|
||||
|
||||
|
||||
init {
|
||||
isNestedScrollingEnabled = true
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
||||
when (ev.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
startY = ev.y
|
||||
startTouchY = ev.y
|
||||
isScrollingUp = false
|
||||
isPullingDown = false
|
||||
isPullingUp = false
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
val deltaY = ev.y - startY
|
||||
isTopReached = !canScrollVertically(-1)
|
||||
isBottomReached = !canScrollVertically(1)
|
||||
isScrollingUp = deltaY < 0 && isTopReached
|
||||
|
||||
val distanceY = ev.y - startTouchY
|
||||
val threshold = ViewConfiguration.get(context).scaledTouchSlop.toFloat()
|
||||
isPullingDown = distanceY > threshold && isTopReached
|
||||
isPullingUp = distanceY < -threshold && isBottomReached
|
||||
}
|
||||
}
|
||||
return super.onInterceptTouchEvent(ev)
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onTouchEvent(ev: MotionEvent): Boolean {
|
||||
when (ev.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
startY = ev.y
|
||||
startTouchY = ev.y
|
||||
isScrollingUp = false
|
||||
isPullingDown = false
|
||||
isPullingUp = false
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
val deltaY = ev.y - startY
|
||||
isTopReached = !canScrollVertically(-1)
|
||||
isBottomReached = !canScrollVertically(1)
|
||||
isScrollingUp = deltaY < 0 && isTopReached
|
||||
|
||||
val distanceY = ev.y - startTouchY
|
||||
val threshold = 200
|
||||
isPullingDown = distanceY > threshold && isTopReached
|
||||
isPullingUp = distanceY < -threshold && isBottomReached
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
startY = 0f
|
||||
if (isPullingDown) {
|
||||
scrollEventListener?.onTopReached()
|
||||
return true
|
||||
} else if (isPullingUp) {
|
||||
scrollEventListener?.onBottomReached()
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.onTouchEvent(ev)
|
||||
}
|
||||
|
||||
fun isTopReached(): Boolean {
|
||||
return !canScrollVertically(-1)
|
||||
// return isTopReached && isScrollingUp
|
||||
}
|
||||
|
||||
fun isBottomReached(): Boolean {
|
||||
return !canScrollVertically(1)
|
||||
// return isBottomReached && !isScrollingUp
|
||||
}
|
||||
|
||||
fun registerRecyclerView(recyclerView: RecyclerView, eventListener: ScrollEventListener) {
|
||||
scrollEventListener = eventListener
|
||||
recyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||
scrollEventListener?.onScroll(isTopReached(), isBottomReached())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.github.droidworksstudio.launcher.viewmodel
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.github.droidworksstudio.launcher.data.entities.AppInfo
|
||||
import com.github.droidworksstudio.launcher.repository.AppInfoRepository
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.conflate
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class AppViewModel @Inject constructor(
|
||||
private val appInfoRepository: AppInfoRepository
|
||||
) : ViewModel() {
|
||||
|
||||
val drawApps: Flow<List<AppInfo>> = appInfoRepository.getDrawApps().conflate()
|
||||
val favoriteApps: Flow<List<AppInfo>> = appInfoRepository.getFavoriteApps().conflate()
|
||||
val hiddenApps: Flow<List<AppInfo>> = appInfoRepository.getHiddenApps().conflate()
|
||||
fun initializeInstalledAppInfo(context: Context) {
|
||||
viewModelScope.launch {
|
||||
appInfoRepository.initInstalledAppInfo(context)
|
||||
}
|
||||
}
|
||||
fun updateAppInfoFavorite(appInfo: AppInfo) {
|
||||
viewModelScope.launch {
|
||||
appInfoRepository.updateFavoriteAppInfo(appInfo)
|
||||
Log.d("Tag", "ViewModel Home Order : ${appInfo.appOrder}")
|
||||
}
|
||||
}
|
||||
fun updateAppInfoAppName(appInfo: AppInfo, newAppName: String) {
|
||||
viewModelScope.launch {
|
||||
appInfoRepository.updateAppName(appInfo, newAppName)
|
||||
Log.d("Tag", "ViewModel Home Name : ${appInfo.appName}")
|
||||
}
|
||||
}
|
||||
fun updateAppHidden(appInfo: AppInfo, appHidden: Boolean) {
|
||||
viewModelScope.launch {
|
||||
appInfoRepository.updateAppHidden(appInfo, appHidden)
|
||||
}
|
||||
}
|
||||
fun updateAppLock(appInfo: AppInfo, appLock: Boolean) {
|
||||
viewModelScope.launch {
|
||||
appInfoRepository.updateAppLock(appInfo, appLock)
|
||||
}
|
||||
}
|
||||
fun compareInstalledAppInfo() {
|
||||
viewModelScope.launch {
|
||||
appInfoRepository.compareInstalledApp()
|
||||
}
|
||||
}
|
||||
suspend fun updateAppOrder(appInfoList: List<AppInfo>) {
|
||||
withContext(Dispatchers.IO) {
|
||||
appInfoRepository.updateAppOrder(appInfoList)
|
||||
}
|
||||
}
|
||||
fun update(appInfo: AppInfo) {
|
||||
viewModelScope.launch {
|
||||
appInfoRepository.updateInfo(appInfo)
|
||||
}
|
||||
}
|
||||
fun searchAppInfo(query: String?) = appInfoRepository.searchNote(query)
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.github.droidworksstudio.launcher.viewmodel
|
||||
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.github.droidworksstudio.launcher.helper.PreferenceHelper
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class PreferenceViewModel @Inject constructor(
|
||||
private val preferenceHelper: PreferenceHelper)
|
||||
: ViewModel() {
|
||||
|
||||
val firstLaunchLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||
val showStatusBarLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||
val showTimeLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||
val showDateLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||
val showDailyWordLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||
val showBatteryLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||
val homeAppAlignmentLiveData: MutableLiveData<Int> = MutableLiveData()
|
||||
val homeDateAlignmentLiveData: MutableLiveData<Int> = MutableLiveData()
|
||||
val homeTimeAlignmentLiveData: MutableLiveData<Int> = MutableLiveData()
|
||||
val dateColorLiveData: MutableLiveData<Int> = MutableLiveData()
|
||||
val timeColorLiveData: MutableLiveData<Int> = MutableLiveData()
|
||||
val batteryColorLiveData: MutableLiveData<Int> = MutableLiveData()
|
||||
val dailyWordColorLiveData: MutableLiveData<Int> = MutableLiveData()
|
||||
val appColorLiveData: MutableLiveData<Int> = MutableLiveData()
|
||||
val dateTextSizeLiveData: MutableLiveData<Float> = MutableLiveData()
|
||||
val timeTextSizeLiveData: MutableLiveData<Float> = MutableLiveData()
|
||||
val appTextSizeLiveData: MutableLiveData<Float> = MutableLiveData()
|
||||
val tapLockScreenLiveData: MutableLiveData<Boolean> = MutableLiveData()
|
||||
|
||||
fun setFirstLaunch(firstLaunch: Boolean) {
|
||||
preferenceHelper.firstLaunch = firstLaunch
|
||||
firstLaunchLiveData.postValue(preferenceHelper.firstLaunch)
|
||||
}
|
||||
|
||||
fun setShowStatusBar(showStatusBar: Boolean) {
|
||||
preferenceHelper.showStatusBar = showStatusBar
|
||||
showStatusBarLiveData.postValue(preferenceHelper.showStatusBar)
|
||||
}
|
||||
|
||||
fun setShowTime(showTime: Boolean) {
|
||||
preferenceHelper.showTime = showTime
|
||||
showTimeLiveData.postValue(preferenceHelper.showTime)
|
||||
}
|
||||
|
||||
fun setShowDate(showDate: Boolean) {
|
||||
preferenceHelper.showDate = showDate
|
||||
showDateLiveData.postValue(preferenceHelper.showDate)
|
||||
}
|
||||
|
||||
fun setShowBattery(showBattery: Boolean){
|
||||
preferenceHelper.showBattery = showBattery
|
||||
showBatteryLiveData.postValue(preferenceHelper.showBattery)
|
||||
}
|
||||
|
||||
fun setShowDailyWord(showDailyWord: Boolean) {
|
||||
preferenceHelper.showDailyWord = showDailyWord
|
||||
showDailyWordLiveData.postValue(preferenceHelper.showDailyWord)
|
||||
}
|
||||
|
||||
fun setDailyWordColor(dailyWordColor: Int) {
|
||||
preferenceHelper.dailyWordColor = dailyWordColor
|
||||
dailyWordColorLiveData.postValue(preferenceHelper.dailyWordColor)
|
||||
}
|
||||
|
||||
fun setAppColor(appColor: Int) {
|
||||
preferenceHelper.appColor = appColor
|
||||
appColorLiveData.postValue(preferenceHelper.appColor)
|
||||
}
|
||||
|
||||
fun setDateColor(dateColor: Int) {
|
||||
preferenceHelper.dateColor = dateColor
|
||||
dateColorLiveData.postValue(preferenceHelper.dateColor)
|
||||
}
|
||||
|
||||
fun setTimeColor(timeColor: Int) {
|
||||
preferenceHelper.timeColor = timeColor
|
||||
timeColorLiveData.postValue(preferenceHelper.timeColor)
|
||||
}
|
||||
|
||||
fun setBatteryColor(batteryColor: Int){
|
||||
preferenceHelper.batteryColor = batteryColor
|
||||
batteryColorLiveData.postValue(preferenceHelper.batteryColor)
|
||||
}
|
||||
|
||||
fun setHomeAppAlignment(homeAppAlignment: Int) {
|
||||
preferenceHelper.homeAppAlignment = homeAppAlignment
|
||||
homeAppAlignmentLiveData.postValue(preferenceHelper.homeAppAlignment)
|
||||
}
|
||||
|
||||
fun setHomeDateAlignment(homeDateAlignment: Int) {
|
||||
preferenceHelper.homeDateAlignment = homeDateAlignment
|
||||
homeDateAlignmentLiveData.postValue(preferenceHelper.homeDateAlignment)
|
||||
}
|
||||
|
||||
fun setHomeTimeAppAlignment(homeTimeAlignment: Int) {
|
||||
preferenceHelper.homeTimeAlignment = homeTimeAlignment
|
||||
homeTimeAlignmentLiveData.postValue(preferenceHelper.homeTimeAlignment)
|
||||
}
|
||||
|
||||
fun setDateTextSize(dateTextSize: Float) {
|
||||
preferenceHelper.dateTextSize = dateTextSize
|
||||
dateTextSizeLiveData.postValue(preferenceHelper.dateTextSize)
|
||||
}
|
||||
|
||||
fun setTimeTextSize(timeTextSize: Float) {
|
||||
preferenceHelper.timeTextSize = timeTextSize
|
||||
timeTextSizeLiveData.postValue(preferenceHelper.timeTextSize)
|
||||
}
|
||||
|
||||
fun setAppTextSize(appTextSize: Float) {
|
||||
preferenceHelper.appTextSize = appTextSize
|
||||
appTextSizeLiveData.postValue(preferenceHelper.appTextSize)
|
||||
}
|
||||
|
||||
fun setDoubleTapLock(tapLockScreen: Boolean){
|
||||
preferenceHelper.tapLockScreen = tapLockScreen
|
||||
tapLockScreenLiveData.postValue((preferenceHelper.tapLockScreen))
|
||||
}
|
||||
}
|
||||
25
app/src/main/res/drawable/app_launcher.xml
Normal file
25
app/src/main/res/drawable/app_launcher.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:autoMirrored="true"
|
||||
android:height="1024sp"
|
||||
android:width="1024sp"
|
||||
android:viewportHeight="1024"
|
||||
android:viewportWidth="1024">
|
||||
<path android:fillAlpha="0.098039"
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="m969.7,351.3q-8.6,-20.9 -19.4,-40.8c-4.1,-7.6 -8.4,-15.1 -12.9,-22.4 -19.5,-31.7 -43.4,-61.7 -71.6,-89.8 -92.2,-92.2 -203.4,-138.3 -333.8,-138.3s-241.6,46.1 -333.8,138.3 -138.3,203.4 -138.3,333.8 46.1,241.6 138.3,333.8 203.4,138.2 333.8,138.2 241.6,-46 333.8,-138.2c50.8,-50.8 87.6,-107.4 110.3,-169.8 18.5,-50.8 27.9,-105.5 27.9,-164.1 0,-44.9 -5.4,-87.6 -16.4,-127.9 -1.3,-4.6 -2.5,-9.1 -3.9,-13.6 -4.1,-13.3 -8.8,-26.4 -14.1,-39.2z"/>
|
||||
<path android:fillColor="#e85479"
|
||||
android:pathData="m982.1,517q0,-2.5 0,-4.9c0,-130.4 -46,-241.6 -138.2,-333.8 -91.9,-91.8 -202.9,-137.9 -332.8,-138.2v475h2v2z"/>
|
||||
<path android:fillColor="#00c0e6"
|
||||
android:pathData="m511.1,40.1c-0.3,0 -0.6,0 -1,0 -130.4,0 -241.6,46 -333.8,138.2s-138.2,203.4 -138.2,333.8v3h473z"/>
|
||||
<path android:fillColor="#ebc240"
|
||||
android:pathData="m513.1,517v-2h-2,-473c0.7,129.1 46.8,239.4 138.2,330.8 92.2,92.2 203.4,138.2 333.8,138.2h1,2z"/>
|
||||
<path android:fillColor="#55da97"
|
||||
android:pathData="m513.1,517v467c129.1,-0.8 239.4,-46.8 330.8,-138.2 90.9,-91 137.1,-200.6 138.2,-328.9z"/>
|
||||
<path android:fillColor="#fff"
|
||||
android:pathData="m862.5,528.8q0.3,-8.3 0.3,-16.8c0,-96.8 -34.3,-179.6 -102.7,-248 -68.5,-68.4 -151.2,-102.7 -248.1,-102.7s-179.6,34.3 -248,102.7 -102.7,151.1 -102.7,248 34.3,179.6 102.7,248.1c68.4,68.4 151.1,102.7 248,102.7 31.4,0 61.3,-3.6 89.8,-10.8 59.2,-15 112,-45.7 158.3,-91.9 64.4,-64.4 98.6,-141.4 102.3,-231.3z"/>
|
||||
<path android:fillAlpha="0.098039"
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="m760.1,760.1q94.7,-94.8 102.1,-225.7l-177.1,-177.1 -56,34.5 -163.9,-4.6 -72.1,11.1v202.7l-44.5,68 192.7,192.7 0,0c21,-1.6 41.2,-4.8 60.5,-9.8 59.2,-15 112,-45.7 158.3,-91.9z"/>
|
||||
<path android:fillColor="#96a6a6"
|
||||
android:pathData="m692.5,387c0,-33.1 -26.8,-60 -60,-60 -33.1,0 -60,26.9 -60,60 0,29.2 20.9,53.5 48.2,59 -28.4,4.8 -50,29.4 -50,59.2 0,33.2 26.8,60 60,60 33.1,0 60,-26.8 60,-60 0,-29 -20.7,-53.3 -48.2,-58.8 28.4,-4.8 50,-29.5 50,-59.3zM629.5,685c33.2,0 60,-26.8 60,-60 0,-33.1 -26.8,-60 -60,-60 -33.1,0 -60,26.9 -60,60 0,33.2 26.9,60 60,60zM392.7,327.3c-33.1,0 -60,26.9 -60,60 0,16.6 5.9,30.7 17.6,42.4 11.5,11.5 25.4,17.4 41.6,17.5 -16.3,0.2 -30.1,6.1 -41.6,17.5 -11.7,11.7 -17.6,25.9 -17.6,42.4 0,33.2 26.9,60 60,60 29.3,0 53.7,-21 59,-48.9 5.4,28 29.8,48.9 59,48.9q24.9,0 42.4,-17.6 17.6,-17.5 17.6,-42.4c0,-29 -20.7,-53.3 -48.3,-58.9 28.5,-4.8 50.1,-29.4 50.1,-59.2 0,-33.1 -26.8,-60 -60,-60 -33.1,0 -60,26.9 -60,60 0,29.2 20.9,53.5 48.2,59 -24.9,4.2 -44.5,23.6 -49.1,48.2 -2.1,-11.9 -7.6,-22.4 -16.6,-31.4 -11.4,-11.5 -25.4,-17.4 -41.7,-17.5 16.3,-0.2 30.2,-6.1 41.7,-17.5 11.7,-11.7 17.5,-25.8 17.5,-42.4 0,-33.1 -26.8,-60 -60,-60zM569.5,627.2c0,-33.1 -26.9,-60 -60,-60 -29.3,0 -53.8,21.1 -59,48.8 -5.3,-27.8 -29.7,-48.8 -59,-48.8 -33.1,0 -60,26.9 -60,60 0,33.2 26.9,60 60,60 29.3,0 53.6,-20.9 59,-48.8 5.5,28 29.9,48.8 59,48.8 33.2,0 60,-26.8 60,-60z"/>
|
||||
</vector>
|
||||
10
app/src/main/res/drawable/bottom_dialog_style.xml
Normal file
10
app/src/main/res/drawable/bottom_dialog_style.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@android:color/white"/>
|
||||
<corners
|
||||
android:topLeftRadius="20dp"
|
||||
android:topRightRadius="20dp"/>
|
||||
</shape>
|
||||
10
app/src/main/res/drawable/bottom_dialog_style_night.xml
Normal file
10
app/src/main/res/drawable/bottom_dialog_style_night.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#333333"/>
|
||||
<corners
|
||||
android:topLeftRadius="20dp"
|
||||
android:topRightRadius="20dp"/>
|
||||
</shape>
|
||||
4
app/src/main/res/drawable/dialog_corner_style.xml
Normal file
4
app/src/main/res/drawable/dialog_corner_style.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="16dp" />
|
||||
<solid android:color="?android:colorBackground" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/icon_favorite_order.xml
Normal file
5
app/src/main/res/drawable/icon_favorite_order.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<vector android:height="16dp" android:tint="@android:color/darker_gray"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/search_style.xml
Normal file
9
app/src/main/res/drawable/search_style.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#33000000"/>
|
||||
<stroke android:width="0dp"
|
||||
android:color="@android:color/black"/>
|
||||
<corners android:radius="12dp" />
|
||||
</shape>
|
||||
5
app/src/main/res/drawable/selector_switch.xml
Normal file
5
app/src/main/res/drawable/selector_switch.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/shape_switch_track_off" android:state_checked="false" />
|
||||
<item android:drawable="@drawable/shape_switch_track_on" android:state_checked="true" />
|
||||
</selector>
|
||||
12
app/src/main/res/drawable/shape_switch_thumb.xml
Normal file
12
app/src/main/res/drawable/shape_switch_thumb.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="oval">
|
||||
<size
|
||||
android:width="24dp"
|
||||
android:height="24dp" />
|
||||
<solid android:color="@color/white" />
|
||||
|
||||
<stroke
|
||||
android:width="6dp"
|
||||
android:color="#00ffffff"/>
|
||||
</shape>
|
||||
13
app/src/main/res/drawable/shape_switch_track_off.xml
Normal file
13
app/src/main/res/drawable/shape_switch_track_off.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size android:height="20dp"/>
|
||||
<size android:width="50dp"/>
|
||||
|
||||
<corners android:radius="20dp"/>
|
||||
|
||||
<gradient
|
||||
android:endColor="#DCDCDC"
|
||||
android:startColor="#B6B6B6" />
|
||||
|
||||
</shape>
|
||||
12
app/src/main/res/drawable/shape_switch_track_on.xml
Normal file
12
app/src/main/res/drawable/shape_switch_track_on.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<size android:height="20dp"/>
|
||||
<size android:width="50dp"/>
|
||||
|
||||
<corners android:radius="20dp"/>
|
||||
|
||||
<gradient
|
||||
android:endColor="#56AFE2"
|
||||
android:startColor="#56AFE2" />
|
||||
</shape>
|
||||
7
app/src/main/res/layout/activity_fake_home.xml
Normal file
7
app/src/main/res/layout/activity_fake_home.xml
Normal file
@@ -0,0 +1,7 @@
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activities.FakeHomeActivity">
|
||||
|
||||
</merge>
|
||||
32
app/src/main/res/layout/activity_main.xml
Normal file
32
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activities.MainActivity">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/nav_host_fragment_content_main"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/nav_graph" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="1.0"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<!--include layout="@layout/content_main"-->
|
||||
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
9
app/src/main/res/layout/activity_mock.xml
Normal file
9
app/src/main/res/layout/activity_mock.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activities.LauncherActivity">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
11
app/src/main/res/layout/activity_settings.xml
Normal file
11
app/src/main/res/layout/activity_settings.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.activities.SettingsActivity">
|
||||
|
||||
<include layout="@layout/content_settings"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
61
app/src/main/res/layout/bottom_sheet_alignment_dialog.xml
Normal file
61
app/src/main/res/layout/bottom_sheet_alignment_dialog.xml
Normal file
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent"
|
||||
android:id="@+id/dialog_background">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:background="@android:color/transparent"
|
||||
android:layout_margin="12dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="12dp"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
android:id="@+id/alignment_title"
|
||||
style="@style/TextDefaultStyle">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="12dp"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:text="@string/bottom_alignment_star"
|
||||
android:id="@+id/alignment_star"
|
||||
style="@style/TextDefaultStyle">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="12dp"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:text="@string/bottom_alignment_center"
|
||||
android:id="@+id/alignment_center"
|
||||
style="@style/TextDefaultStyle">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="12dp"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:text="@string/bottom_alignment_end"
|
||||
android:id="@+id/alignment_end"
|
||||
style="@style/TextDefaultStyle">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
175
app/src/main/res/layout/bottomsheet_dialog.xml
Normal file
175
app/src/main/res/layout/bottomsheet_dialog.xml
Normal file
@@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/bottom_sheet0"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/bottom_sheet_rename"
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="@android:color/transparent"
|
||||
android:text="@string/bottom_dialog_app_rename"
|
||||
android:textSize="@dimen/bottom_dialog_text_large"></androidx.appcompat.widget.AppCompatEditText>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bottom_sheet_rename_done"
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:gravity="center"
|
||||
android:text="Save"
|
||||
android:textSize="@dimen/bottom_dialog_text_small" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bottom_sheet_fav_hidden"
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bottom_dialog_remove_from_home"
|
||||
android:textSize="@dimen/bottom_dialog_text_large">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bottom_sheet_order"
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bottom_dialog_order_home_apps"
|
||||
android:textSize="@dimen/bottom_dialog_text_large">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bottom_sheet_hidden"
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bottom_dialog_add_to_hidden"
|
||||
android:textSize="@dimen/bottom_dialog_text_large">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bottom_sheet_lock"
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bottom_dialog_add_to_lock"
|
||||
android:textSize="@dimen/bottom_dialog_text_large">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bottom_sheet_uninstall"
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bottom_dialog_app_uninstall"
|
||||
android:textSize="@dimen/bottom_dialog_text_large">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/bottom_sheet4"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:orientation="horizontal"
|
||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/bottom_sheet_info"
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/bottom_dialog_app_info"
|
||||
android:textSize="@dimen/bottom_dialog_text_large">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatTextView>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
139
app/src/main/res/layout/bottomsheetdialog_alignment_settings.xml
Normal file
139
app/src/main/res/layout/bottomsheetdialog_alignment_settings.xml
Normal file
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:text="@string/appearance_bottom_dialog_alignment_title"
|
||||
android:textAlignment="textStart"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/bottom_alignment_date_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_date_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="left|center"
|
||||
android:inputType="number"
|
||||
android:text="@string/appearance_bottom_dialog_desc_date"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_date_text_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/bottom_alignment_time_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_time_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/appearance_bottom_dialog_desc_time"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_time_text_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/bottom_alignment_app_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_app_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/appearance_bottom_dialog_desc_app"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_app_text_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
175
app/src/main/res/layout/bottomsheetdialog_color_settings.xml
Normal file
175
app/src/main/res/layout/bottomsheetdialog_color_settings.xml
Normal file
@@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:text="@string/appearance_bottom_dialog_text_color_title"
|
||||
android:textAlignment="textStart"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/bottom_color_date_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_date_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="left|center"
|
||||
android:inputType="number"
|
||||
android:text="@string/appearance_bottom_dialog_desc_date"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_date_text_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/bottom_color_time_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_time_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/appearance_bottom_dialog_desc_time"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_time_text_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/bottom_color_app_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_app_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/appearance_bottom_dialog_desc_app"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_app_text_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:gravity="left|center"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/bottom_color_battery_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_battery_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/appearance_bottom_dialog_desc_battery"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_battery_text_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:gravity="left|center"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
142
app/src/main/res/layout/bottomsheetdialog_text_settings.xml
Normal file
142
app/src/main/res/layout/bottomsheetdialog_text_settings.xml
Normal file
@@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/textSizeSave"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:text="@string/settings_appearance_text_size_title"
|
||||
android:textAlignment="textStart"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_date_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:gravity="left|center"
|
||||
android:inputType="number"
|
||||
android:text="@string/appearance_bottom_dialog_desc_date"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/select_date_text_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_time_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/appearance_bottom_dialog_desc_time"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/select_time_text_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/select_app_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/appearance_bottom_dialog_desc_app"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/select_app_text_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="20dp"
|
||||
android:gravity="left|center"
|
||||
android:background="@android:color/transparent"
|
||||
android:textSize="@dimen/text_large"
|
||||
android:inputType="number"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
20
app/src/main/res/layout/content_settings.xml
Normal file
20
app/src/main/res/layout/content_settings.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/nav_host_fragment_content_settings"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/settings_graph" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
66
app/src/main/res/layout/fragment_draw.xml
Normal file
66
app/src/main/res/layout/fragment_draw.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/draw_background"
|
||||
tools:context=".ui.drawer.DrawFragment">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginVertical="32dp"
|
||||
android:layout_marginHorizontal="20dp">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/searchViewContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginVertical="16dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/search_view1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:hint="search"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
android:textStyle="normal"
|
||||
android:background="@android:color/transparent"
|
||||
android:inputType="text"
|
||||
style="@style/TextDefaultStyle">
|
||||
|
||||
</androidx.appcompat.widget.AppCompatEditText>
|
||||
|
||||
<!--androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/searchView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"/-->
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/drawAdapter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
android:id="@+id/draw_search_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Widget.MaterialComponents.FloatingActionButton"
|
||||
android:clickable="true"
|
||||
app:backgroundTint="@color/search_button_background"
|
||||
android:src="?android:attr/actionModeWebSearchDrawable"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_margin="32dp" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
46
app/src/main/res/layout/fragment_favorite.xml
Normal file
46
app/src/main/res/layout/fragment_favorite.xml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/favorite_view"
|
||||
tools:context=".ui.favorite.FavoriteFragment">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginVertical="32dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/topTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="Home App Order"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/favoriteAdapter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="92dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/topTextView"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
45
app/src/main/res/layout/fragment_hidden.xml
Normal file
45
app/src/main/res/layout/fragment_hidden.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/hidden_view"
|
||||
tools:context=".ui.favorite.FavoriteFragment">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginVertical="32dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/topTextView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="Hidden App"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/hiddenAdapter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="92dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/topTextView"
|
||||
/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
98
app/src/main/res/layout/fragment_home.xml
Normal file
98
app/src/main/res/layout/fragment_home.xml
Normal file
@@ -0,0 +1,98 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true"
|
||||
android:orientation="vertical"
|
||||
android:longClickable="true"
|
||||
tools:context=".ui.home.HomeFragment">
|
||||
|
||||
<com.github.droidworksstudio.launcher.view.GestureNestedScrollView
|
||||
android:id="@+id/nestScrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:fadingEdgeLength="48dp"
|
||||
android:overScrollMode="never"
|
||||
android:requiresFadingEdge="vertical"
|
||||
android:scrollbars="none">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/mainView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginVertical="32dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/battery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:text="Battery"
|
||||
android:textSize="16sp"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/clock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="start"
|
||||
android:layout_marginVertical="16dp"
|
||||
android:fontFamily="sans-serif-light"
|
||||
android:format12Hour="h:mm"
|
||||
android:textSize="48sp"
|
||||
tools:text="02:34"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:format12Hour="EEE, dd MMM"
|
||||
android:format24Hour="EEE, dd MMM"
|
||||
android:gravity="start"
|
||||
android:paddingHorizontal="2dp"
|
||||
android:textSize="32sp"
|
||||
tools:text="Thu, 30 Dec"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<!--TextView
|
||||
android:id="@+id/word"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:text="@string/settings_appearance_daily_word_default"
|
||||
android:textSize="32sp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginBottom="42dp" /-->
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/appListAdapter"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</com.github.droidworksstudio.launcher.view.GestureNestedScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
421
app/src/main/res/layout/fragment_settings.xml
Normal file
421
app/src/main/res/layout/fragment_settings.xml
Normal file
@@ -0,0 +1,421 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ui.settings.SettingsFragment">
|
||||
|
||||
<com.github.droidworksstudio.launcher.view.GestureNestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/nestScrollView"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:fadingEdgeLength="48dp"
|
||||
android:overScrollMode="never"
|
||||
android:requiresFadingEdge="vertical"
|
||||
android:scrollbars="none">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginVertical="32dp"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="48dp"
|
||||
android:text="@string/settings_name"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/set_launcher_selector"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginTop="18dp"
|
||||
android:text="@string/action_settings_default"
|
||||
android:textSize="@dimen/text_large"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="@string/settings_title_home_display_preferences"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/statue_bar_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_appearance_statue_bar"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/statue_bar_switchCompat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleX="0.7"
|
||||
android:scaleY="0.8"
|
||||
android:thumb="@drawable/shape_switch_thumb"
|
||||
app:track="@drawable/selector_switch"
|
||||
tools:ignore="DuplicateSpeakableTextCheck,TouchTargetSizeCheck" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/date_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_appearance_date"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/date_switchCompat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleX="0.7"
|
||||
android:scaleY="0.8"
|
||||
android:thumb="@drawable/shape_switch_thumb"
|
||||
app:track="@drawable/selector_switch"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/time_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_appearance_time"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/time_switchCompat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleX="0.7"
|
||||
android:scaleY="0.8"
|
||||
android:thumb="@drawable/shape_switch_thumb"
|
||||
app:track="@drawable/selector_switch"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/battery_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_appearance_battery"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/battery_switchCompat"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleX="0.7"
|
||||
android:scaleY="0.8"
|
||||
android:thumb="@drawable/shape_switch_thumb"
|
||||
app:track="@drawable/selector_switch"
|
||||
tools:ignore="TouchTargetSizeCheck" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="@string/settings_title_home_appearance_preferences"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/select_appearance_text_size"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_appearance_text_size_title"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/select_appearance_color"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_appearance_color_title"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/select_appearance_alignment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
tools:ignore="MissingConstraints,TextSizeCheck">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_appearance_alignment_title"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/set_app_wallpaper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
tools:ignore="MissingConstraints,TextSizeCheck">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_appearance_wallpaper"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="@string/settings_title_app_manager"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/favorite_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_manager_favorite"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="28dp"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:layout_marginVertical="20dp"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/hidden_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_manager_hidden"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="@string/settings_title_gestures"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="20dp"
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/gestures_lock_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/settings_double_tap_lock"
|
||||
android:textSize="@dimen/text_large"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/gestures_lock_switchCompat1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:thumb="@drawable/shape_switch_thumb"
|
||||
app:track="@drawable/selector_switch"
|
||||
android:scaleY="0.8"
|
||||
android:scaleX="0.7"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="20dp"
|
||||
android:text="@string/settings_title_others"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
</com.github.droidworksstudio.launcher.view.GestureNestedScrollView>
|
||||
|
||||
</FrameLayout>
|
||||
27
app/src/main/res/layout/item_draw.xml
Normal file
27
app/src/main/res/layout/item_draw.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginVertical="16dp"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/appDraw_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginVertical="16dp"
|
||||
android:textSize="@dimen/text_super_large"
|
||||
android:textStyle="normal"
|
||||
style="@style/TextDefaultStyle"
|
||||
android:layout_gravity="start"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
38
app/src/main/res/layout/item_favorite.xml
Normal file
38
app/src/main/res/layout/item_favorite.xml
Normal file
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:orientation="horizontal"
|
||||
tools:ignore="MissingConstraints">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/appFavorite_name"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginVertical="10dp"
|
||||
android:layout_weight="1"
|
||||
android:gravity="left|center"
|
||||
android:textSize="24sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="RtlHardcoded"
|
||||
style="@style/TextDefaultStyle"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/appFavorite_drag_icon"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/icon_favorite_order" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user