├── .github
├── ISSUE_TEMPLATE.md
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ └── build-android-project.yml
├── .gitignore
├── CHANGELOG.md
├── CONTRIBUTORS.md
├── LICENSE
├── Makefile
├── README.md
├── app
├── build.gradle
└── src
│ ├── flavorGplayPreAlpha
│ ├── ic_launcher-web.png
│ └── res
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ └── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ └── main
│ ├── AndroidManifest.xml
│ ├── assets
│ ├── RobotoCondensed-Bold.ttf
│ ├── RobotoCondensed-BoldItalic.ttf
│ ├── RobotoCondensed-Italic.ttf
│ ├── RobotoCondensed-Light.ttf
│ ├── RobotoCondensed-LightItalic.ttf
│ └── RobotoCondensed-Regular.ttf
│ ├── java
│ ├── com
│ │ ├── benny
│ │ │ └── openlauncher
│ │ │ │ ├── AppObject.java
│ │ │ │ ├── activity
│ │ │ │ ├── AddShortcutActivity.java
│ │ │ │ ├── AutoFinishActivity.java
│ │ │ │ ├── ColorActivity.java
│ │ │ │ ├── HideAppsActivity.java
│ │ │ │ ├── HomeActivity.java
│ │ │ │ ├── MinibarEditActivity.java
│ │ │ │ ├── MoreInfoActivity.java
│ │ │ │ ├── OnBoardActivity.java
│ │ │ │ ├── SettingsActivity.java
│ │ │ │ └── homeparts
│ │ │ │ │ ├── HpAppDrawer.java
│ │ │ │ │ ├── HpDesktopOption.java
│ │ │ │ │ ├── HpDragOption.java
│ │ │ │ │ ├── HpEventHandler.java
│ │ │ │ │ ├── HpGestureCallback.java
│ │ │ │ │ ├── HpInitSetup.java
│ │ │ │ │ ├── HpItemOption.java
│ │ │ │ │ └── HpSearchBar.java
│ │ │ │ ├── fragment
│ │ │ │ ├── HideAppsFragment.java
│ │ │ │ ├── SettingsAboutFragment.java
│ │ │ │ ├── SettingsAppDrawerFragment.java
│ │ │ │ ├── SettingsAppearanceFragment.java
│ │ │ │ ├── SettingsBaseFragment.java
│ │ │ │ ├── SettingsBehaviorFragment.java
│ │ │ │ ├── SettingsDesktopFragment.java
│ │ │ │ ├── SettingsDockFragment.java
│ │ │ │ ├── SettingsMasterFragment.java
│ │ │ │ └── SettingsMiscellaneousFragment.java
│ │ │ │ ├── interfaces
│ │ │ │ ├── AppDeleteListener.java
│ │ │ │ ├── AppUpdateListener.java
│ │ │ │ ├── DialogListener.java
│ │ │ │ ├── DropTargetListener.java
│ │ │ │ └── ItemHistory.java
│ │ │ │ ├── manager
│ │ │ │ └── Setup.java
│ │ │ │ ├── model
│ │ │ │ ├── App.java
│ │ │ │ └── Item.java
│ │ │ │ ├── notifications
│ │ │ │ └── NotificationListener.java
│ │ │ │ ├── receivers
│ │ │ │ ├── AppUpdateReceiver.java
│ │ │ │ ├── DeviceAdminReceiver.java
│ │ │ │ └── ShortcutReceiver.java
│ │ │ │ ├── util
│ │ │ │ ├── AppManager.java
│ │ │ │ ├── AppSettings.java
│ │ │ │ ├── BackupHelper.java
│ │ │ │ ├── DatabaseHelper.java
│ │ │ │ ├── Definitions.java
│ │ │ │ ├── DragAction.java
│ │ │ │ ├── DragHandler.java
│ │ │ │ ├── IconPackHelper.java
│ │ │ │ ├── LauncherAction.java
│ │ │ │ └── Tool.java
│ │ │ │ ├── viewutil
│ │ │ │ ├── AbstractPopupIconLabelItem.java
│ │ │ │ ├── CircleDrawable.java
│ │ │ │ ├── DesktopCallback.java
│ │ │ │ ├── DesktopGestureListener.java
│ │ │ │ ├── DialogHelper.java
│ │ │ │ ├── DrawerAppItem.java
│ │ │ │ ├── GroupDrawable.java
│ │ │ │ ├── IconLabelItem.java
│ │ │ │ ├── ItemViewFactory.java
│ │ │ │ ├── MinibarAdapter.java
│ │ │ │ ├── PopupDynamicIconLabelItem.java
│ │ │ │ ├── PopupIconLabelItem.java
│ │ │ │ └── WidgetHost.java
│ │ │ │ └── widget
│ │ │ │ ├── AppDrawerController.java
│ │ │ │ ├── AppDrawerGrid.java
│ │ │ │ ├── AppDrawerPage.java
│ │ │ │ ├── AppItemView.java
│ │ │ │ ├── CellContainer.java
│ │ │ │ ├── ColorPreferenceCategory.java
│ │ │ │ ├── Desktop.java
│ │ │ │ ├── DesktopOptionView.java
│ │ │ │ ├── Dock.java
│ │ │ │ ├── GroupPopupView.java
│ │ │ │ ├── ItemOptionView.java
│ │ │ │ ├── MinibarView.java
│ │ │ │ ├── NavigationView.java
│ │ │ │ ├── PagerIndicator.java
│ │ │ │ ├── SearchBar.java
│ │ │ │ ├── StatusView.java
│ │ │ │ ├── WidgetContainer.java
│ │ │ │ └── WidgetView.java
│ │ └── flask
│ │ │ └── colorpicker
│ │ │ ├── ColorCircle.java
│ │ │ ├── ColorCircleDrawable.java
│ │ │ ├── ColorPickerPreference.java
│ │ │ ├── ColorPickerView.java
│ │ │ ├── OnColorChangedListener.java
│ │ │ ├── OnColorSelectedListener.java
│ │ │ ├── Utils.java
│ │ │ ├── builder
│ │ │ ├── ColorPickerClickListener.java
│ │ │ ├── ColorPickerDialogBuilder.java
│ │ │ ├── ColorWheelRendererBuilder.java
│ │ │ └── PaintBuilder.java
│ │ │ ├── renderer
│ │ │ ├── AbsColorWheelRenderer.java
│ │ │ ├── ColorWheelRenderOption.java
│ │ │ ├── ColorWheelRenderer.java
│ │ │ ├── FlowerColorWheelRenderer.java
│ │ │ └── SimpleColorWheelRenderer.java
│ │ │ └── slider
│ │ │ ├── AbsCustomSlider.java
│ │ │ ├── AlphaSlider.java
│ │ │ ├── LightnessSlider.java
│ │ │ └── OnValueChangedListener.java
│ └── net
│ │ └── gsantner
│ │ └── opoc
│ │ ├── format
│ │ └── markdown
│ │ │ └── SimpleMarkdownParser.java
│ │ ├── preference
│ │ ├── GsPreferenceFragmentCompat.java
│ │ ├── LanguagePreferenceCompat.java
│ │ ├── PropertyBackend.java
│ │ └── SharedPreferencesPropertyBackend.java
│ │ └── util
│ │ ├── ActivityUtils.java
│ │ ├── Callback.java
│ │ ├── ContextUtils.java
│ │ ├── FileUtils.java
│ │ ├── NetworkUtils.java
│ │ ├── PermissionChecker.java
│ │ └── ShareUtil.java
│ └── res
│ ├── drawable-nodpi
│ ├── intro_2.png
│ ├── intro_3.png
│ └── intro_4.png
│ ├── drawable
│ ├── ic_android.xml
│ ├── ic_apps.xml
│ ├── ic_arrow_back_white.xml
│ ├── ic_behavior.xml
│ ├── ic_bug.xml
│ ├── ic_camera_.xml
│ ├── ic_check_dark.xml
│ ├── ic_check_white.xml
│ ├── ic_clear.xml
│ ├── ic_close.xml
│ ├── ic_code.xml
│ ├── ic_copyright.xml
│ ├── ic_dashboard.xml
│ ├── ic_delete.xml
│ ├── ic_desktop.xml
│ ├── ic_dock.xml
│ ├── ic_edit.xml
│ ├── ic_expand.xml
│ ├── ic_favorite.xml
│ ├── ic_group.xml
│ ├── ic_hide_apps.xml
│ ├── ic_info.xml
│ ├── ic_launch.xml
│ ├── ic_lock.xml
│ ├── ic_lock_open.xml
│ ├── ic_minibar.xml
│ ├── ic_network.xml
│ ├── ic_notifications.xml
│ ├── ic_palette.xml
│ ├── ic_person.xml
│ ├── ic_photo.xml
│ ├── ic_resize.xml
│ ├── ic_search.xml
│ ├── ic_settings.xml
│ ├── ic_star.xml
│ ├── ic_star_border.xml
│ ├── ic_thumb_up.xml
│ ├── ic_translate.xml
│ ├── ic_view_grid_white.xml
│ ├── ic_view_list_white.xml
│ ├── ic_visibility.xml
│ ├── ic_volume.xml
│ ├── item_drawer.xml
│ ├── new_page.xml
│ ├── ol_loading_1.xml
│ ├── ol_loading_2.xml
│ ├── ol_loading_3.xml
│ └── scale_widget.xml
│ ├── layout
│ ├── activity_hide_apps.xml
│ ├── activity_home.xml
│ ├── activity_minibar_edit.xml
│ ├── activity_more.xml
│ ├── activity_settings.xml
│ ├── color_edit.xml
│ ├── color_preview.xml
│ ├── color_selector.xml
│ ├── color_widget.xml
│ ├── item_app.xml
│ ├── item_edit_minibar.xml
│ ├── item_hide_apps.xml
│ ├── item_icon_label.xml
│ ├── item_minibar.xml
│ ├── item_popup_icon_label.xml
│ ├── toolbar.xml
│ ├── view_app_drawer_grid.xml
│ ├── view_app_drawer_page.xml
│ ├── view_app_drawer_page_inner.xml
│ ├── view_drag_option.xml
│ ├── view_drawer_indicator.xml
│ ├── view_group_popup.xml
│ ├── view_hide_apps.xml
│ ├── view_home.xml
│ ├── view_intro.xml
│ ├── view_search_clock.xml
│ └── view_widget_container.xml
│ ├── mipmap-hdpi
│ └── ic_launcher.png
│ ├── mipmap-mdpi
│ └── ic_launcher.png
│ ├── mipmap-xhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxhdpi
│ └── ic_launcher.png
│ ├── mipmap-xxxhdpi
│ └── ic_launcher.png
│ ├── raw
│ ├── licenses.md
│ └── project.md
│ ├── values-ar
│ └── strings.xml
│ ├── values-ca
│ └── strings.xml
│ ├── values-cs
│ └── strings.xml
│ ├── values-de
│ └── strings.xml
│ ├── values-en-rAU
│ └── strings.xml
│ ├── values-eo
│ └── strings.xml
│ ├── values-es
│ └── strings.xml
│ ├── values-fr
│ └── strings.xml
│ ├── values-hr
│ └── strings.xml
│ ├── values-hu
│ └── strings.xml
│ ├── values-it
│ └── strings.xml
│ ├── values-ja
│ └── strings.xml
│ ├── values-kab
│ └── strings.xml
│ ├── values-nb-rNO
│ └── strings.xml
│ ├── values-nl
│ └── strings.xml
│ ├── values-pl
│ └── strings.xml
│ ├── values-pt-rBR
│ └── strings.xml
│ ├── values-pt-rPT
│ └── strings.xml
│ ├── values-ru
│ └── strings.xml
│ ├── values-sc
│ └── strings.xml
│ ├── values-sk
│ └── strings.xml
│ ├── values-sr
│ └── strings.xml
│ ├── values-sw360dp-v13
│ └── values-preference.xml
│ ├── values-zh-rCN
│ └── strings.xml
│ ├── values
│ ├── arrays.xml
│ ├── color_attrs.xml
│ ├── color_dimens.xml
│ ├── color_styles.xml
│ ├── colors.xml
│ ├── dimens.xml
│ ├── ids.xml
│ ├── strings.xml
│ ├── strings_not_translatable.xml
│ └── styles.xml
│ └── xml
│ ├── device_admin.xml
│ ├── file_paths.xml
│ ├── preferences_about.xml
│ ├── preferences_advanced.xml
│ ├── preferences_app_drawer.xml
│ ├── preferences_appearance.xml
│ ├── preferences_behavior.xml
│ ├── preferences_desktop.xml
│ ├── preferences_dock.xml
│ └── preferences_master.xml
├── assets
├── featureGraphic.svg
├── icon_all.svg
├── icon_nightly.png
├── icon_stable.png
├── icon_test.png
└── screenshots.png
├── build.gradle
├── fastlane
└── metadata
│ └── android
│ ├── de
│ └── short_description.txt
│ └── en-US
│ ├── changelogs
│ ├── 1.txt
│ ├── 100.txt
│ ├── 36.txt
│ ├── 37.txt
│ ├── 38.txt
│ ├── 39.txt
│ ├── 40.txt
│ └── 41.txt
│ ├── full_description.txt
│ ├── images
│ ├── featureGraphic.png
│ ├── icon.png
│ └── phoneScreenshots
│ │ ├── 01.jpg
│ │ ├── 02.jpg
│ │ ├── 03.jpg
│ │ ├── 04.jpg
│ │ ├── 05.jpg
│ │ └── 06.jpg
│ └── short_description.txt
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | #### General Information
2 |
3 | * **OpenLauncher Version:** 1.0?
4 | * **Android Version:** 1.0?
5 | * **Custom ROM:** None?
6 | * **Install Source:** F-Droid?
7 |
8 | #### Description
9 |
10 |
11 | #### Log
12 |
13 | This is only needed for crashes or other issues you notice in your system logs from OpenLauncher.
14 |
15 |
20 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
21 |
--------------------------------------------------------------------------------
/.github/workflows/build-android-project.yml:
--------------------------------------------------------------------------------
1 | ##############################################################################################################################
2 | # # Cleanup:
3 | #const sleep = ms => () => new Promise((resolve, reject) => window.setTimeout(resolve, ms));
4 | #Promise.resolve()
5 | #.then(() => { document.getElementsByClassName("details-overlay details-reset position-relative d-inline-block ")[3].children[0].click(); })
6 | #.then(sleep(500))
7 | #.then(() => { document.getElementsByClassName("dropdown-item btn-link menu-item-danger")[0].click(); })
8 | #.then(sleep(1000))
9 | #.then(() => { document.getElementsByClassName("btn btn-block btn-danger")[0].click();});
10 | #
11 | # while [ 1 ] ; do sleep 4; xdotool key Up; sleep 0.1; xdotool key Return; done
12 | ##############################################################################################################################
13 |
14 | name: "CI"
15 |
16 | on: [push, pull_request]
17 |
18 | jobs:
19 | build:
20 | if: "!contains(github.event.head_commit.message, 'ci skip') && (!contains(github.event_name, 'pull_request') || (contains(github.event_name, 'pull_request') && github.event.pull_request.head.repo.full_name != github.repository))"
21 | runs-on: ubuntu-latest
22 | steps:
23 |
24 | - name: "Checkout: Code"
25 | uses: actions/checkout@v2
26 |
27 |
28 | - name: "Checkout: Code (PR)"
29 | uses: actions/checkout@v2
30 | if: "contains(github.event_name, 'pull_request')"
31 | with:
32 | ref: ${{github.event.pull_request.head.ref}}
33 | repository: ${{github.event.pull_request.head.repo.full_name}}
34 |
35 | - name: "Setup: Java"
36 | uses: actions/setup-java@v1
37 | with:
38 | java-version: 1.8
39 |
40 | - name: "Cache: Gradle"
41 | uses: actions/cache@v2
42 | with:
43 | path: |
44 | ~/.gradle
45 | .gradle
46 | key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.*') }}
47 |
48 | - name: "Build: Project with make"
49 | run: make clean all
50 |
51 | - name: "Build: List dist files"
52 | if: always()
53 | run: find dist -type f -maxdepth 2
54 |
55 | - name: "Artifacts: All"
56 | if: always()
57 | uses: actions/upload-artifact@v2.2.1
58 | with:
59 | name: "all"
60 | path: dist
61 | retention-days: 5
62 |
63 | - name: "Artifacts: Android APK"
64 | uses: actions/upload-artifact@v2.2.1
65 | with:
66 | name: "android-apk"
67 | path: |
68 | dist/*.apk
69 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | /.vscode
3 | .project
4 |
5 | # Common
6 | *~*
7 | tmp/
8 | *.tmp
9 | *.bak
10 | *.log
11 | gradle/
12 | gradlew
13 | gradlew.bat
14 |
15 | # IntelliJ
16 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio
17 | *.iml
18 | /out/
19 |
20 | .idea/
21 | # if you remove the above rule, at least ignore the following:
22 | ## User-specific stuff:
23 | # .idea/workspace.xml
24 | # .idea/tasks.xml
25 | # .idea/dictionaries
26 | ## Sensitive or high-churn files:
27 | # .idea/dataSources.ids
28 | # .idea/dataSources.xml
29 | # .idea/sqlDataSources.xml
30 | # .idea/dynamic.xml
31 | # .idea/uiDesigner.xml
32 |
33 | # Gradle:
34 | # .idea/gradle.xml
35 | # .idea/libraries
36 |
37 | ## File-based project format:
38 | *.ipr
39 | *.iws
40 |
41 | ### Gradle ###
42 | .gradle
43 | build/
44 | gradle-app.setting
45 |
46 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
47 | !gradle-wrapper.jar
48 |
49 | # Eclipse
50 | #.project
51 | *.pydevproject
52 | .metadata
53 | *.swp
54 | *~.nib
55 | .settings/
56 | .loadpath
57 | .externalToolBuilders/
58 | *.launch
59 | .cproject
60 | .classpath
61 | .factorypath
62 | .buildpath
63 | .target
64 | .texlipse
65 |
66 | # Java
67 | *.class
68 | .mtj.tmp/
69 | *.jar
70 | *.war
71 | *.ear
72 | hs_err_pid*
73 |
74 | # Android
75 | # Built application files
76 | *.apk
77 | *.ap_
78 |
79 | # Files for the Dalvik VM
80 | *.dex
81 |
82 | # Generated files
83 | bin/
84 | gen/
85 |
86 | # Local configuration file (sdk path, etc)
87 | local.properties
88 |
89 | # Proguard
90 | proguard/
91 |
92 | # Android Studio Stuff
93 | .navigation/
94 | gen-external-apklibs
95 | !gradle/wrapper/gradle-wrapper.jar
96 |
97 | app/src/main/res/raw/changelog.md
98 | app/src/main/res/raw/contributors.md
99 | app/src/main/res/raw/readme.md
100 | app/src/main/res/raw/license
101 | app-flavorDefault-debug/
102 |
103 | .directory
104 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ### v1.0.0
2 | * Please see either of the links for changes in the v1.0.0 version:
3 | * https://github.com/OpenLauncherTeam/openlauncher/compare/v0.7.4...v1.0.0
4 | * https://github.com/OpenLauncherTeam/openlauncher/milestone/2?closed=1
5 | * https://github.com/OpenLauncherTeam/openlauncher/commits/master
6 |
7 | ### v0.5.1
8 | * fix incorrect label clipping
9 | * improve free space calculation for widgets
10 | * slight changes to settings page
11 | * fix crash related to group items
12 | * maximum grid size set to twenty
13 | * labels can be edited from the drag menu
14 |
15 | ### v0.5.0
16 | * Settings have been redesigned and will be reset
17 | * Add ability launch app with gesture
18 | * Custom search bar layout without requiring google services
19 | * Option to lock the desktop from changes
20 | * Lots of bug fixes
21 | * Layout fixes
22 |
23 | ### v0.4.0
24 | * Desktop is now saved in database and will be reset
25 | * Move launcheranim and smoothviewpager to app
26 | * Lots of bug fixes
27 |
28 | ### v0.3.1
29 | * Update build scheme
30 | * Add nightly icons
31 | * Add CircleCI
32 | * Update library strings
33 | * Optimize icons
34 | * Refactor activities
35 | * Add minibar edit fragment
36 | * Using ButterKnife in the Home activity, using CustomOnCrash.. lib to catch any error. #36 (quick fix)
37 | * Remove unused resources, extra translations
38 | * Add settings button in desktop preview (when long pressing the desktop)
39 | * Add a switch to disable the minibar
40 | * Move backup dialog to dialog utils and rename backup folder
41 | * Refactor project to use default android gradle project layout
42 |
--------------------------------------------------------------------------------
/CONTRIBUTORS.md:
--------------------------------------------------------------------------------
1 |
19 | * **[Aabaker](https://github.com/aabaker)**
~° Code contributions
20 | * **[TeamBrainStorm](https://github.com/TeamBrainStorm)**
~° Very supportive when the project started
21 | * **[GauklerFaun](https://github.com/scoute-dich)**
~° German translation
22 | * **[Naofum](https://github.com/naofum)**
~° Japanese translation
23 | * **[FranzMari](https://github.com/FranzMari)**
~° Italian translation
24 | * **[MFlisar](https://github.com/MFlisar)**
~° Extraction of core
25 | * **[saechimdaeki](https://github.com/saechimdaeki)**
~° Code contributions
26 | * **[P'tit g](https://github.com/Ptitg)**
~° Code contributions
27 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # License of Makefile: Public Domain / CC0
2 | .PHONY: $(shell sed -n -e '/^$$/ { n ; /^[^ .\#][^ ]*:/ { s/:.*$$// ; p ; } ; }' $(MAKEFILE_LIST))
3 | .NOTPARALLEL: clean
4 | .DEFAULT_GOAL := all
5 |
6 | env-%:
7 | @: $(if ${${*}},,$(error Environment variable $* not set))
8 | ####################################################################################
9 |
10 | DIST_DIR = dist
11 | MOVE = mv
12 |
13 | all: $(DIST_DIR) lint test build aapt_dump_badging
14 |
15 | ####################################################################################
16 |
17 | $(DIST_DIR):
18 | mkdir -p ${DIST_DIR}
19 |
20 | ANDROID_BUILD_TOOLS := $(shell test -n "$ANDROID_SDK_ROOT" && find "${ANDROID_SDK_ROOT}/build-tools" -iname "aapt" | sort -r | head -n1 | xargs dirname)
21 |
22 | .NOTPARALLEL: gradle gradle-analyze-log
23 | gradle: env-ANDROID_SDK_ROOT
24 | mkdir -p $(DIST_DIR)/log/
25 | chmod +x gradlew
26 | ./gradlew --no-daemon --parallel --stacktrace $A 2>&1 | tee "$(DIST_DIR)/log/gradle.log"
27 | @echo "-----------------------------------------------------------------------------------"
28 |
29 | gradle-analyze-log:
30 | mv "$(DIST_DIR)/log/gradle.log" "$(DIST_DIR)/log/gradle$A.log"
31 | cat "$(DIST_DIR)/log/gradle$A.log" | grep "BUILD " | tail -n1 | grep -q "BUILD SUCCESSFUL in"
32 |
33 | adb: env-ANDROID_SDK_ROOT
34 | "${ANDROID_SDK_ROOT}/platform-tools/adb" $A 2>&1 | tee "$(DIST_DIR)/log/adb$L.log"
35 |
36 | aapt: env-ANDROID_SDK_ROOT
37 | "${ANDROID_BUILD_TOOLS}/aapt" $A 2>&1 | grep -v 'application-label-' | tee "$(DIST_DIR)/log/aapt$L.log"
38 |
39 | build:
40 | rm -f $(DIST_DIR)/*.apk
41 | $(MAKE) A="clean assembleFlavorAtest -x lint" gradle
42 | find app -type f -newermt '-100 seconds' -iname '*.apk' -not -iname '*unsigned.apk' | xargs cp -R -t $(DIST_DIR)/
43 | $(MAKE) A="-build" gradle-analyze-log
44 |
45 | lint:
46 | rm -Rf $(DIST_DIR)/lint
47 | mkdir -p $(DIST_DIR)/lint/
48 | $(MAKE) A="lintFlavorDefaultDebug" gradle
49 | find app -type f -iname 'lint-results-*' | xargs cp -R -t $(DIST_DIR)/lint
50 | $(MAKE) A="-lint" gradle-analyze-log
51 |
52 | test:
53 | rm -Rf $(DIST_DIR)/tests
54 | $(MAKE) A="testFlavorDefaultDebugUnitTest -x lint" gradle
55 | mkdir -p app/build/test-results/testFlavorDefaultDebugUnitTest && echo 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHRlc3RzdWl0ZSBuYW1lPSJkdW1teSIgdGVzdHM9IjEiIHNraXBwZWQ9IjAiIGZhaWx1cmVzPSIwIiBlcnJvcnM9IjAiIHRpbWVzdGFtcD0iMjAyMC0xMi0wOFQwMDowMDowMCIgaG9zdG5hbWU9ImxvY2FsaG9zdCIgdGltZT0iMC4wMSI+CiAgPHByb3BlcnRpZXMvPgogIDx0ZXN0Y2FzZSBuYW1lPSJkdW1teSIgY2xhc3NuYW1lPSJkdW1teSIgdGltZT0iMC4wMSIvPgogIDxzeXN0ZW0tb3V0PjwhW0NEQVRBW11dPjwvc3lzdGVtLW91dD4KICA8c3lzdGVtLWVycj48IVtDREFUQVtdXT48L3N5c3RlbS1lcnI+CjwvdGVzdHN1aXRlPgo=' | base64 -d > 'app/build/test-results/testFlavorDefaultDebugUnitTest/TEST-dummy.xml'
56 | find app -type d -iname 'testFlavorDefaultDebugUnitTest' | xargs cp -R -t $(DIST_DIR)/
57 | mv ${DIST_DIR}/testFlavorDefaultDebugUnitTest $(DIST_DIR)/tests
58 | $(MAKE) A="-test" gradle-analyze-log
59 |
60 | clean:
61 | $(MAKE) A="clean" gradle
62 | rm -Rf $(DIST_DIR) app/build app/flavor*
63 | $(MAKE) $(DIST_DIR)
64 |
65 | install:
66 | $(MAKE) A="install -r $(DIST_DIR)/*.apk" L="install" adb
67 |
68 | aapt_dump_badging:
69 | $(MAKE) A="dump badging $(DIST_DIR)/*.apk" aapt
70 | @echo "-----------------------------------------------------------------------------------"
71 |
--------------------------------------------------------------------------------
/app/src/flavorGplayPreAlpha/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/flavorGplayPreAlpha/ic_launcher-web.png
--------------------------------------------------------------------------------
/app/src/flavorGplayPreAlpha/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/flavorGplayPreAlpha/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/flavorGplayPreAlpha/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/flavorGplayPreAlpha/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/flavorGplayPreAlpha/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/flavorGplayPreAlpha/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/flavorGplayPreAlpha/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/flavorGplayPreAlpha/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/flavorGplayPreAlpha/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/flavorGplayPreAlpha/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/assets/RobotoCondensed-Bold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/main/assets/RobotoCondensed-Bold.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/RobotoCondensed-BoldItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/main/assets/RobotoCondensed-BoldItalic.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/RobotoCondensed-Italic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/main/assets/RobotoCondensed-Italic.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/RobotoCondensed-Light.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/main/assets/RobotoCondensed-Light.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/RobotoCondensed-LightItalic.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/main/assets/RobotoCondensed-LightItalic.ttf
--------------------------------------------------------------------------------
/app/src/main/assets/RobotoCondensed-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/OpenLauncherTeam/openlauncher/d86d23e14f8a045efad41fa5dd1de3c6250b4541/app/src/main/assets/RobotoCondensed-Regular.ttf
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/AppObject.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher;
2 |
3 | import android.app.Application;
4 |
5 | public class AppObject extends Application {
6 | private static AppObject _instance;
7 |
8 | public static AppObject get() {
9 | return _instance;
10 | }
11 |
12 | @Override
13 | public void onCreate() {
14 | super.onCreate();
15 | _instance = this;
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/AddShortcutActivity.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.pm.LauncherApps;
7 | import android.content.pm.ShortcutInfo;
8 | import android.graphics.Point;
9 | import android.graphics.drawable.Drawable;
10 | import android.os.Build;
11 | import android.os.Bundle;
12 | import android.util.Log;
13 |
14 | import com.benny.openlauncher.AppObject;
15 | import com.benny.openlauncher.R;
16 | import com.benny.openlauncher.model.Item;
17 | import com.benny.openlauncher.util.Definitions;
18 | import com.benny.openlauncher.util.Tool;
19 |
20 | public class AddShortcutActivity extends Activity {
21 |
22 | @Override
23 | protected void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 | if (getIntent() != null && getIntent().getAction().equalsIgnoreCase(LauncherApps.ACTION_CONFIRM_PIN_SHORTCUT)) {
26 | LauncherApps launcherApps = (LauncherApps) getSystemService(Context.LAUNCHER_APPS_SERVICE);
27 | LauncherApps.PinItemRequest request = launcherApps.getPinItemRequest(getIntent());
28 | if (request == null) {
29 | finish();
30 | return;
31 | }
32 |
33 | if (request.getRequestType() == LauncherApps.PinItemRequest.REQUEST_TYPE_SHORTCUT) {
34 |
35 | ShortcutInfo info = request.getShortcutInfo();
36 | String shortcutLabel = info.getShortLabel().toString();
37 | Intent shortcutIntent = new Intent(Intent.ACTION_MAIN)
38 | .setComponent(info.getActivity())
39 | .setPackage(info.getPackage())
40 | .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED)
41 | .putExtra("shortcut_id", info.getId());
42 |
43 | Context context = AppObject.get().getApplicationContext();
44 | Drawable shortcutIcon = launcherApps.getShortcutIconDrawable(info, context.getResources().getDisplayMetrics().densityDpi);
45 |
46 | Item item = Item.newShortcutItem(shortcutIntent, shortcutIcon, shortcutLabel);
47 | Point preferredPos = HomeActivity.Companion.getLauncher().getDesktop().getPages().get(HomeActivity.Companion.getLauncher().getDesktop().getCurrentItem()).findFreeSpace();
48 |
49 | if (preferredPos == null) {
50 | Tool.toast(HomeActivity.Companion.getLauncher(), R.string.toast_not_enough_space);
51 | } else {
52 | item.setX(preferredPos.x);
53 | item.setY(preferredPos.y);
54 | HomeActivity._db.saveItem(item, HomeActivity.Companion.getLauncher().getDesktop().getCurrentItem(), Definitions.ItemPosition.Desktop);
55 | HomeActivity.Companion.getLauncher().getDesktop().addItemToPage(item, HomeActivity.Companion.getLauncher().getDesktop().getCurrentItem());
56 | Log.d(this.getClass().toString(), "shortcut installed");
57 | }
58 |
59 | request.accept();
60 | finish();
61 | }
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/AutoFinishActivity.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity;
2 |
3 | import android.app.Activity;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.os.Bundle;
7 | import android.support.annotation.Nullable;
8 |
9 | public class AutoFinishActivity extends Activity {
10 | @Override
11 | protected void onCreate(@Nullable Bundle savedInstanceState) {
12 | super.onCreate(savedInstanceState);
13 | finish();
14 | }
15 |
16 | public static void start(Context context) {
17 | context.startActivity(new Intent(context, AutoFinishActivity.class));
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/ColorActivity.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity;
2 |
3 | import android.content.Intent;
4 | import android.graphics.Color;
5 | import android.os.Build;
6 | import android.os.Bundle;
7 | import android.support.v7.app.AppCompatActivity;
8 |
9 | import com.benny.openlauncher.R;
10 | import com.benny.openlauncher.util.AppSettings;
11 |
12 | public abstract class ColorActivity extends AppCompatActivity {
13 |
14 | protected AppSettings _appSettings;
15 | private String _currentTheme;
16 |
17 | @Override
18 | protected void onCreate(Bundle savedInstanceState) {
19 | _appSettings = AppSettings.get();
20 | _currentTheme = _appSettings.getTheme();
21 |
22 | if (_appSettings.getTheme().equals("0")) {
23 | setTheme(R.style.NormalActivity_Light);
24 | } else if (_appSettings.getTheme().equals("1")) {
25 | setTheme(R.style.NormalActivity_Dark);
26 | } else {
27 | setTheme(R.style.NormalActivity_Black);
28 | }
29 |
30 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
31 | getWindow().setStatusBarColor(dark(_appSettings.getPrimaryColor(), 0.8));
32 | getWindow().setNavigationBarColor(_appSettings.getPrimaryColor());
33 | }
34 |
35 | super.onCreate(savedInstanceState);
36 | }
37 |
38 | @Override
39 | protected void onResume() {
40 | super.onResume();
41 | if (!_appSettings.getTheme().equals(_currentTheme)) {
42 | restart();
43 | }
44 | }
45 |
46 | protected void restart() {
47 | Intent intent = new Intent(this, getClass());
48 | intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
49 | overridePendingTransition(0, 0);
50 | startActivity(intent);
51 | }
52 |
53 | public int dark(int color, double factor) {
54 | int a = Color.alpha(color);
55 | int r = Color.red(color);
56 | int g = Color.green(color);
57 | int b = Color.blue(color);
58 | return Color.argb(a, Math.max((int) (r * factor), 0), Math.max((int) (g * factor), 0), Math.max((int) (b * factor), 0));
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/HideAppsActivity.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity;
2 |
3 | import android.os.Build;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.support.v4.app.FragmentManager;
7 | import android.support.v4.app.FragmentPagerAdapter;
8 | import android.support.v4.view.ViewPager;
9 | import android.support.v7.widget.Toolbar;
10 | import android.view.MenuItem;
11 | import android.view.WindowManager;
12 |
13 | import com.benny.openlauncher.R;
14 | import com.benny.openlauncher.fragment.HideAppsFragment;
15 | import com.benny.openlauncher.util.AppManager;
16 |
17 | import java.util.ArrayList;
18 |
19 | public class HideAppsActivity extends ColorActivity {
20 |
21 | @Override
22 | protected void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 | setContentView(R.layout.activity_hide_apps);
25 |
26 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
27 | getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
28 | getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark));
29 | }
30 |
31 | ViewPager viewPager = findViewById(R.id.viewpager);
32 | setupViewPager(viewPager);
33 |
34 | Toolbar toolbar = findViewById(R.id.toolbar);
35 | toolbar.setTitle(getString(R.string.pref_title__hide_apps));
36 | setSupportActionBar(toolbar);
37 |
38 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
39 | getSupportActionBar().setDisplayShowHomeEnabled(true);
40 | }
41 |
42 | @Override
43 | protected void onDestroy() {
44 | AppManager.getInstance(this)._recreateAfterGettingApps = true;
45 | AppManager.getInstance(this).init();
46 | super.onDestroy();
47 | }
48 |
49 | private void setupViewPager(ViewPager viewPager) {
50 | ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
51 | adapter.addFragment(new HideAppsFragment(), "Skip");
52 | viewPager.setAdapter(adapter);
53 | }
54 |
55 | @Override
56 | public boolean onOptionsItemSelected(MenuItem item) {
57 | switch (item.getItemId()) {
58 | case android.R.id.home: {
59 | onBackPressed();
60 | break;
61 | }
62 | }
63 | return super.onOptionsItemSelected(item);
64 | }
65 |
66 | private static class ViewPagerAdapter extends FragmentPagerAdapter {
67 | private ArrayList mFragmentList = new ArrayList<>();
68 | private ArrayList mFragmentTitleList = new ArrayList<>();
69 |
70 | ViewPagerAdapter(FragmentManager fm) {
71 | super(fm);
72 | }
73 |
74 | @Override
75 | public Fragment getItem(int position) {
76 | return mFragmentList.get(position);
77 | }
78 |
79 | @Override
80 | public int getCount() {
81 | return mFragmentTitleList.size();
82 | }
83 |
84 | @Override
85 | public CharSequence getPageTitle(int position) {
86 | return mFragmentTitleList.get(position);
87 | }
88 |
89 | public void addFragment(Fragment fragment, String title) {
90 | mFragmentList.add(fragment);
91 | mFragmentTitleList.add(title);
92 | }
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/MoreInfoActivity.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.FragmentTransaction;
5 | import android.support.v7.widget.Toolbar;
6 |
7 | import com.benny.openlauncher.R;
8 | import com.benny.openlauncher.fragment.SettingsAboutFragment;
9 |
10 | public class MoreInfoActivity extends ColorActivity {
11 | @Override
12 | protected void onCreate(Bundle savedInstanceState) {
13 | super.onCreate(savedInstanceState);
14 | setContentView(R.layout.activity_more);
15 |
16 | Toolbar toolbar = findViewById(R.id.toolbar);
17 | setSupportActionBar(toolbar);
18 | toolbar.setBackgroundColor(_appSettings.getPrimaryColor());
19 |
20 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
21 |
22 | FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
23 | SettingsAboutFragment settingsAboutFragment = SettingsAboutFragment.newInstance();
24 | transaction.replace(R.id.fragment_holder, settingsAboutFragment, SettingsAboutFragment.TAG).commit();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/homeparts/HpAppDrawer.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity.homeparts;
2 |
3 | import com.benny.openlauncher.activity.HomeActivity;
4 | import com.benny.openlauncher.manager.Setup;
5 | import com.benny.openlauncher.util.Tool;
6 | import com.benny.openlauncher.widget.AppDrawerController;
7 | import com.benny.openlauncher.widget.PagerIndicator;
8 |
9 | import net.gsantner.opoc.util.Callback;
10 |
11 | public class HpAppDrawer implements Callback.a2 {
12 | private HomeActivity _homeActivity;
13 | private PagerIndicator _appDrawerIndicator;
14 |
15 | public HpAppDrawer(HomeActivity homeActivity, PagerIndicator appDrawerIndicator) {
16 | _homeActivity = homeActivity;
17 | _appDrawerIndicator = appDrawerIndicator;
18 | }
19 |
20 | public void initAppDrawer(AppDrawerController appDrawerController) {
21 | appDrawerController.setCallBack(this);
22 | }
23 |
24 | @Override
25 | public void callback(Boolean openingOrClosing, Boolean startOrEnd) {
26 | if (openingOrClosing) {
27 | if (startOrEnd) {
28 | _homeActivity.getAppDrawerController().postDelayed(new Runnable() {
29 | @Override
30 | public void run() {
31 | Tool.visibleViews(200, _appDrawerIndicator);
32 | Tool.invisibleViews(200, _homeActivity.getDesktop());
33 | _homeActivity.updateDesktopIndicator(false);
34 | _homeActivity.updateDock(false);
35 | _homeActivity.updateSearchBar(false);
36 | }
37 | }, 100);
38 | }
39 | } else {
40 | if (startOrEnd) {
41 | Tool.invisibleViews(200, _appDrawerIndicator);
42 | Tool.visibleViews(200, _homeActivity.getDesktop());
43 | _homeActivity.updateDesktopIndicator(true);
44 | _homeActivity.updateDock(true);
45 | _homeActivity.updateSearchBar(true);
46 | } else {
47 | if (!Setup.appSettings().getDrawerRememberPosition()) {
48 | _homeActivity.getAppDrawerController().reset();
49 | }
50 | }
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/homeparts/HpEventHandler.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity.homeparts;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import com.afollestad.materialdialogs.MaterialDialog;
7 | import com.benny.openlauncher.interfaces.DialogListener;
8 | import com.benny.openlauncher.manager.Setup;
9 | import com.benny.openlauncher.model.Item;
10 | import com.benny.openlauncher.util.Definitions;
11 | import com.benny.openlauncher.util.LauncherAction;
12 | import com.benny.openlauncher.viewutil.DialogHelper;
13 |
14 | public class HpEventHandler implements Setup.EventHandler {
15 | @Override
16 | public void showLauncherSettings(Context context) {
17 | LauncherAction.RunAction(LauncherAction.Action.LauncherSettings, context);
18 | }
19 |
20 | @Override
21 | public void showPickAction(Context context, final DialogListener.OnActionDialogListener listener) {
22 | DialogHelper.selectDesktopActionDialog(context, new MaterialDialog.ListCallback() {
23 | @Override
24 | public void onSelection(MaterialDialog dialog, View itemView, int position, CharSequence text) {
25 | if (position == 0) {
26 | listener.onAdd(Definitions.ACTION_LAUNCHER);
27 | }
28 | }
29 | });
30 | }
31 |
32 | @Override
33 | public void showEditDialog(Context context, Item item, final DialogListener.OnEditDialogListener listener) {
34 | DialogHelper.editItemDialog("Edit Item", item.getLabel(), context, new DialogHelper.OnItemEditListener() {
35 | @Override
36 | public void itemLabel(String label) {
37 | listener.onRename(label);
38 | }
39 | });
40 | }
41 |
42 | @Override
43 | public void showDeletePackageDialog(Context context, Item item) {
44 | DialogHelper.deletePackageDialog(context, item);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/homeparts/HpGestureCallback.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity.homeparts;
2 |
3 | import android.content.Intent;
4 | import android.util.Log;
5 |
6 | import com.benny.openlauncher.activity.HomeActivity;
7 | import com.benny.openlauncher.manager.Setup;
8 | import com.benny.openlauncher.util.AppSettings;
9 | import com.benny.openlauncher.util.LauncherAction;
10 | import com.benny.openlauncher.util.Tool;
11 | import com.benny.openlauncher.viewutil.DesktopGestureListener;
12 | import com.benny.openlauncher.widget.Desktop;
13 |
14 | public class HpGestureCallback implements DesktopGestureListener.DesktopGestureCallback {
15 | private AppSettings _appSettings;
16 |
17 | HpGestureCallback(AppSettings appSettings) {
18 | _appSettings = appSettings;
19 | }
20 |
21 | @Override
22 | public boolean onDrawerGesture(Desktop desktop, DesktopGestureListener.Type event) {
23 | Object gesture = null;
24 | switch (event) {
25 | case SwipeUp:
26 | gesture = _appSettings.getGestureSwipeUp();
27 | break;
28 | case SwipeDown:
29 | gesture = _appSettings.getGestureSwipeDown();
30 | break;
31 | case SwipeLeft:
32 | case SwipeRight:
33 | break;
34 | case Pinch:
35 | gesture = _appSettings.getGesturePinch();
36 | break;
37 | case Unpinch:
38 | gesture = _appSettings.getGestureUnpinch();
39 | break;
40 | case DoubleTap:
41 | gesture = _appSettings.getGestureDoubleTap();
42 | break;
43 | default:
44 | Log.e(getClass().toString(), "gesture error");
45 | }
46 |
47 | if (gesture != null) {
48 | if (_appSettings.getGestureFeedback()) {
49 | Tool.vibrate(desktop);
50 | }
51 | if (gesture instanceof Intent) {
52 | Intent intent = (Intent) gesture;
53 | Tool.startApp(HomeActivity._launcher, Setup.appLoader().findApp(intent), null);
54 | } else if (gesture instanceof LauncherAction.ActionDisplayItem) {
55 | LauncherAction.RunAction((LauncherAction.ActionDisplayItem) gesture, desktop.getContext());
56 | }
57 | return true;
58 | }
59 |
60 | return false;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/homeparts/HpInitSetup.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity.homeparts;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 |
6 | import com.benny.openlauncher.AppObject;
7 | import com.benny.openlauncher.manager.Setup;
8 | import com.benny.openlauncher.util.AppManager;
9 | import com.benny.openlauncher.util.AppSettings;
10 | import com.benny.openlauncher.util.DatabaseHelper;
11 | import com.benny.openlauncher.viewutil.DesktopGestureListener.DesktopGestureCallback;
12 |
13 | public final class HpInitSetup extends Setup {
14 | private final AppManager _appLoader;
15 | private final DatabaseHelper _dataManager;
16 | private final HpGestureCallback _desktopGestureCallback;
17 | private final HpEventHandler _eventHandler;
18 | private final AppSettings _appSettings;
19 |
20 | public HpInitSetup(Context context) {
21 | _appSettings = AppSettings.get();
22 | _desktopGestureCallback = new HpGestureCallback(_appSettings);
23 | _dataManager = new DatabaseHelper(context.getApplicationContext());
24 | _appLoader = AppManager.getInstance(context.getApplicationContext());
25 | _eventHandler = new HpEventHandler();
26 | }
27 |
28 | @NonNull
29 | public Context getAppContext() {
30 | return AppObject.get();
31 | }
32 |
33 | @NonNull
34 | public AppSettings getAppSettings() {
35 | return _appSettings;
36 | }
37 |
38 | @NonNull
39 | public DesktopGestureCallback getDesktopGestureCallback() {
40 | return _desktopGestureCallback;
41 | }
42 |
43 | @NonNull
44 | public DatabaseHelper getDataManager() {
45 | return _dataManager;
46 | }
47 |
48 | @NonNull
49 | public AppManager getAppLoader() {
50 | return _appLoader;
51 | }
52 |
53 | @NonNull
54 | public EventHandler getEventHandler() {
55 | return _eventHandler;
56 | }
57 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/activity/homeparts/HpSearchBar.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.activity.homeparts;
2 |
3 | import android.app.SearchManager;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.view.View;
7 |
8 | import com.benny.openlauncher.activity.HomeActivity;
9 | import com.benny.openlauncher.manager.Setup;
10 | import com.benny.openlauncher.util.Tool;
11 | import com.benny.openlauncher.widget.SearchBar;
12 |
13 | import net.gsantner.opoc.util.ActivityUtils;
14 |
15 | public class HpSearchBar implements SearchBar.CallBack, View.OnClickListener {
16 | private HomeActivity _homeActivity;
17 | private SearchBar _searchBar;
18 |
19 | public HpSearchBar(HomeActivity homeActivity, SearchBar searchBar) {
20 | _homeActivity = homeActivity;
21 | _searchBar = searchBar;
22 | }
23 |
24 |
25 | public void initSearchBar() {
26 | _searchBar.setCallback(this);
27 | _searchBar._searchClock.setOnClickListener(this);
28 | _homeActivity.updateSearchClock();
29 | }
30 |
31 | @Override
32 | public void onInternetSearch(String string) {
33 | Intent intent = new Intent();
34 |
35 | if (Tool.isIntentActionAvailable(_homeActivity.getApplicationContext(), Intent.ACTION_WEB_SEARCH) && !Setup.appSettings().getSearchBarForceBrowser()) {
36 | intent.setAction(Intent.ACTION_WEB_SEARCH);
37 | intent.putExtra(SearchManager.QUERY, string);
38 | } else {
39 | String baseUri = Setup.appSettings().getSearchBarBaseURI();
40 | String searchUri = baseUri.contains("{query}") ? baseUri.replace("{query}", string) : (baseUri + string);
41 |
42 | intent.setAction(Intent.ACTION_VIEW);
43 | intent.setData(Uri.parse(searchUri));
44 | }
45 |
46 | try {
47 | _homeActivity.startActivity(intent);
48 | } catch (Exception e) {
49 | e.printStackTrace();
50 | }
51 | }
52 |
53 | @Override
54 | public void onExpand() {
55 | _searchBar._searchInput.setFocusable(true);
56 | _searchBar._searchInput.setFocusableInTouchMode(true);
57 | _searchBar._searchInput.postDelayed(new Runnable() {
58 | @Override
59 | public void run() {
60 | _homeActivity.dimBackground();
61 | _homeActivity.clearRoomForPopUp();
62 | _searchBar._searchInput.requestFocus();
63 | }
64 | }, 100);
65 | Tool.showKeyboard(_homeActivity, _searchBar._searchInput);
66 | }
67 |
68 | @Override
69 | public void onCollapse() {
70 | _homeActivity.getDesktop().postDelayed(new Runnable() {
71 | @Override
72 | public void run() {
73 | _homeActivity.unDimBackground();
74 | _homeActivity.unClearRoomForPopUp();
75 | _searchBar._searchInput.clearFocus();
76 | }
77 | }, 100);
78 | Tool.hideKeyboard(_homeActivity, _searchBar._searchInput);
79 | }
80 |
81 | @Override
82 | public void onClick(View v) {
83 | new ActivityUtils(_homeActivity).startCalendarApp().freeContextRef();
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/fragment/SettingsAppDrawerFragment.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.fragment;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.benny.openlauncher.R;
6 |
7 | public class SettingsAppDrawerFragment extends SettingsBaseFragment {
8 | @Override
9 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
10 | super.onCreatePreferences(savedInstanceState, rootKey);
11 | addPreferencesFromResource(R.xml.preferences_app_drawer);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/fragment/SettingsAppearanceFragment.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.preference.Preference;
5 |
6 | import com.benny.openlauncher.R;
7 | import com.benny.openlauncher.activity.HomeActivity;
8 | import com.benny.openlauncher.viewutil.DialogHelper;
9 |
10 | import net.gsantner.opoc.util.ContextUtils;
11 |
12 | public class SettingsAppearanceFragment extends SettingsBaseFragment {
13 | @Override
14 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
15 | super.onCreatePreferences(savedInstanceState, rootKey);
16 | addPreferencesFromResource(R.xml.preferences_appearance);
17 | }
18 |
19 | @Override
20 | public boolean onPreferenceTreeClick(Preference preference) {
21 | HomeActivity homeActivity = HomeActivity._launcher;
22 | int key = new ContextUtils(homeActivity).getResId(ContextUtils.ResType.STRING, preference.getKey());
23 | switch (key) {
24 | case R.string.pref_key__icon_pack:
25 | DialogHelper.startPickIconPackIntent(getActivity());
26 | return true;
27 | }
28 | return false;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/fragment/SettingsBaseFragment.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.fragment;
2 |
3 | import android.content.SharedPreferences;
4 | import android.graphics.PorterDuff;
5 | import android.graphics.drawable.Drawable;
6 | import android.os.Bundle;
7 | import android.support.v7.preference.Preference;
8 | import android.support.v7.preference.PreferenceFragmentCompat;
9 | import android.support.v7.preference.PreferenceGroup;
10 | import android.support.v7.widget.Toolbar;
11 | import android.util.TypedValue;
12 |
13 | import com.benny.openlauncher.R;
14 | import com.benny.openlauncher.util.AppSettings;
15 |
16 | import java.util.ArrayList;
17 | import java.util.Arrays;
18 | import java.util.List;
19 |
20 | public abstract class SettingsBaseFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
21 | private static final List noRestart = new ArrayList<>(Arrays.asList(
22 | R.string.pref_key__gesture_double_tap,
23 | R.string.pref_key__gesture_swipe_up,
24 | R.string.pref_key__gesture_swipe_down,
25 | R.string.pref_key__gesture_pinch_in,
26 | R.string.pref_key__gesture_pinch_out
27 | ));
28 |
29 | @Override
30 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
31 | getPreferenceManager().setSharedPreferencesName("app");
32 | }
33 |
34 | @Override
35 | public void onResume() {
36 | super.onResume();
37 |
38 | Toolbar toolbar = getActivity().findViewById(R.id.toolbar);
39 | if (toolbar != null) toolbar.setTitle(getPreferenceScreen().getTitle());
40 |
41 | SharedPreferences sharedPreferences = AppSettings.get().getDefaultPreferences();
42 | sharedPreferences.registerOnSharedPreferenceChangeListener(this);
43 |
44 | updateIcons(getPreferenceScreen());
45 | updateSummaries();
46 | }
47 |
48 | @Override
49 | public void onPause() {
50 | super.onPause();
51 |
52 | SharedPreferences sharedPreferences = AppSettings.get().getDefaultPreferences();
53 | sharedPreferences.unregisterOnSharedPreferenceChangeListener(this);
54 | }
55 |
56 | @Override
57 | public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
58 | updateSummaries();
59 | if (!noRestart.contains(key)) {
60 | AppSettings.get().setAppRestartRequired(true);
61 | }
62 | }
63 |
64 | public void updateSummaries() {
65 | // override in fragments
66 | }
67 |
68 | public void updateIcons(PreferenceGroup prefGroup) {
69 | if (prefGroup != null && isAdded()) {
70 | int prefCount = prefGroup.getPreferenceCount();
71 | for (int i = 0; i < prefCount; i++) {
72 | Preference preference = prefGroup.getPreference(i);
73 | if (preference != null) {
74 | Drawable drawable = preference.getIcon();
75 | if (drawable != null) {
76 | TypedValue color = new TypedValue();
77 | getContext().getTheme().resolveAttribute(android.R.attr.textColor, color, true);
78 | drawable.mutate().setColorFilter(getResources().getColor(color.resourceId), PorterDuff.Mode.SRC_IN);
79 | }
80 |
81 | if (preference instanceof PreferenceGroup) {
82 | updateIcons((PreferenceGroup) preference);
83 | }
84 | }
85 | }
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/fragment/SettingsDesktopFragment.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.v7.preference.Preference;
5 |
6 | import com.benny.openlauncher.R;
7 | import com.benny.openlauncher.activity.HomeActivity;
8 | import com.benny.openlauncher.util.LauncherAction;
9 |
10 | import net.gsantner.opoc.util.ContextUtils;
11 |
12 | public class SettingsDesktopFragment extends SettingsBaseFragment {
13 | @Override
14 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
15 | super.onCreatePreferences(savedInstanceState, rootKey);
16 | addPreferencesFromResource(R.xml.preferences_desktop);
17 | }
18 |
19 | @Override
20 | public boolean onPreferenceTreeClick(Preference preference) {
21 | HomeActivity homeActivity = HomeActivity._launcher;
22 | int key = new ContextUtils(homeActivity).getResId(ContextUtils.ResType.STRING, preference.getKey());
23 | switch (key) {
24 | case R.string.pref_key__minibar:
25 | LauncherAction.RunAction(LauncherAction.Action.EditMinibar, getActivity());
26 | return true;
27 | }
28 | return false;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/fragment/SettingsDockFragment.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.fragment;
2 |
3 | import android.os.Bundle;
4 |
5 | import com.benny.openlauncher.R;
6 |
7 | public class SettingsDockFragment extends SettingsBaseFragment {
8 | @Override
9 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
10 | super.onCreatePreferences(savedInstanceState, rootKey);
11 | addPreferencesFromResource(R.xml.preferences_dock);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/fragment/SettingsMasterFragment.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.fragment;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.preference.Preference;
6 |
7 | import com.benny.openlauncher.R;
8 | import com.benny.openlauncher.activity.HideAppsActivity;
9 | import com.benny.openlauncher.activity.HomeActivity;
10 | import com.benny.openlauncher.activity.MoreInfoActivity;
11 | import com.benny.openlauncher.util.AppSettings;
12 |
13 | import net.gsantner.opoc.util.ContextUtils;
14 |
15 | import java.util.Locale;
16 |
17 | import static com.benny.openlauncher.widget.AppDrawerController.Mode.GRID;
18 | import static com.benny.openlauncher.widget.AppDrawerController.Mode.PAGE;
19 |
20 | public class SettingsMasterFragment extends SettingsBaseFragment {
21 | @Override
22 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
23 | super.onCreatePreferences(savedInstanceState, rootKey);
24 | addPreferencesFromResource(R.xml.preferences_master);
25 | }
26 |
27 | @Override
28 | public boolean onPreferenceTreeClick(Preference preference) {
29 | super.onPreferenceTreeClick(preference);
30 | HomeActivity homeActivity = HomeActivity._launcher;
31 | int key = new ContextUtils(homeActivity).getResId(ContextUtils.ResType.STRING, preference.getKey());
32 | switch (key) {
33 | case R.string.pref_key__cat_hide_apps:
34 | Intent intent = new Intent(getActivity(), HideAppsActivity.class);
35 | intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
36 | startActivity(intent);
37 | return true;
38 | case R.string.pref_key__cat_about:
39 | startActivity(new Intent(getActivity(), MoreInfoActivity.class));
40 | return true;
41 | }
42 |
43 | return false;
44 | }
45 |
46 | @Override
47 | public void updateSummaries() {
48 | Preference categoryDesktop = findPreference(getString(R.string.pref_key__cat_desktop));
49 | Preference categoryDock = findPreference(getString(R.string.pref_key__cat_dock));
50 | Preference categoryAppDrawer = findPreference(getString(R.string.pref_key__cat_app_drawer));
51 | Preference categoryAppearance = findPreference(getString(R.string.pref_key__cat_appearance));
52 |
53 | categoryDesktop.setSummary(String.format(Locale.ENGLISH, "%s: %d x %d", getString(R.string.pref_title__size), AppSettings.get().getDesktopColumnCount(), AppSettings.get().getDesktopRowCount()));
54 | categoryDock.setSummary(String.format(Locale.ENGLISH, "%s: %d x %d", getString(R.string.pref_title__size), AppSettings.get().getDockColumnCount(), AppSettings.get().getDockRowCount()));
55 | categoryAppearance.setSummary(String.format(Locale.ENGLISH, "%s: %ddp", getString(R.string.pref_title__icons), AppSettings.get().getIconSize()));
56 |
57 | switch (AppSettings.get().getDrawerStyle()) {
58 | case GRID:
59 | categoryAppDrawer.setSummary(String.format("%s: %s", getString(R.string.pref_title__style), getString(R.string.vertical_scroll_drawer)));
60 | break;
61 | case PAGE:
62 | default:
63 | categoryAppDrawer.setSummary(String.format("%s: %s", getString(R.string.pref_title__style), getString(R.string.horizontal_paged_drawer)));
64 | break;
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/interfaces/AppDeleteListener.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.interfaces;
2 |
3 | import com.benny.openlauncher.model.App;
4 |
5 | import java.util.List;
6 |
7 | public interface AppDeleteListener {
8 | boolean onAppDeleted(List apps);
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/interfaces/AppUpdateListener.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.interfaces;
2 |
3 | import com.benny.openlauncher.model.App;
4 |
5 | import java.util.List;
6 |
7 | public interface AppUpdateListener {
8 | boolean onAppUpdated(List apps);
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/interfaces/DialogListener.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.interfaces;
2 |
3 | public interface DialogListener {
4 |
5 | interface OnActionDialogListener {
6 | void onAdd(int type);
7 | }
8 |
9 | interface OnEditDialogListener {
10 | void onRename(String name);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/interfaces/DropTargetListener.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.interfaces;
2 |
3 | import android.graphics.PointF;
4 | import android.view.View;
5 |
6 | import com.benny.openlauncher.model.Item;
7 | import com.benny.openlauncher.util.DragAction;
8 |
9 | public interface DropTargetListener {
10 | View getView();
11 |
12 | boolean onStart(DragAction.Action action, PointF location, boolean isInside);
13 |
14 | void onStartDrag(DragAction.Action action, PointF location);
15 |
16 | void onDrop(DragAction.Action action, PointF location, Item item);
17 |
18 | void onMove(DragAction.Action action, PointF location);
19 |
20 | void onEnter(DragAction.Action action, PointF location);
21 |
22 | void onExit(DragAction.Action action, PointF location);
23 |
24 | void onEnd();
25 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/interfaces/ItemHistory.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.interfaces;
2 |
3 | import android.view.View;
4 |
5 | import com.benny.openlauncher.model.Item;
6 |
7 | public interface ItemHistory {
8 | void setLastItem(Item item, View view);
9 |
10 | void revertLastItem();
11 |
12 | void consumeLastItem();
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/manager/Setup.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.manager;
2 |
3 | import android.content.Context;
4 |
5 | import com.benny.openlauncher.interfaces.DialogListener;
6 | import com.benny.openlauncher.model.Item;
7 | import com.benny.openlauncher.util.AppManager;
8 | import com.benny.openlauncher.util.AppSettings;
9 | import com.benny.openlauncher.util.DatabaseHelper;
10 | import com.benny.openlauncher.viewutil.DesktopGestureListener;
11 |
12 | public abstract class Setup {
13 | private static Setup _setup = null;
14 |
15 | public static boolean wasInitialised() {
16 | return _setup != null;
17 | }
18 |
19 | public static void init(Setup setup) {
20 | Setup._setup = setup;
21 | }
22 |
23 | public static Setup get() {
24 | if (_setup == null) {
25 | throw new RuntimeException("Setup has not been initialised!");
26 | }
27 | return _setup;
28 | }
29 |
30 | public static Context appContext() {
31 | return get().getAppContext();
32 | }
33 |
34 | public static AppSettings appSettings() {
35 | return get().getAppSettings();
36 | }
37 |
38 | public static DesktopGestureListener.DesktopGestureCallback desktopGestureCallback() {
39 | return get().getDesktopGestureCallback();
40 | }
41 |
42 | public static DatabaseHelper dataManager() {
43 | return get().getDataManager();
44 | }
45 |
46 | public static AppManager appLoader() {
47 | return get().getAppLoader();
48 | }
49 |
50 | public static EventHandler eventHandler() {
51 | return get().getEventHandler();
52 | }
53 |
54 | public abstract Context getAppContext();
55 |
56 | public abstract AppSettings getAppSettings();
57 |
58 | public abstract DesktopGestureListener.DesktopGestureCallback getDesktopGestureCallback();
59 |
60 | public abstract DatabaseHelper getDataManager();
61 |
62 | public abstract AppManager getAppLoader();
63 |
64 | public abstract EventHandler getEventHandler();
65 |
66 | public interface EventHandler {
67 | void showLauncherSettings(Context context);
68 |
69 | void showPickAction(Context context, DialogListener.OnActionDialogListener listener);
70 |
71 | void showEditDialog(Context context, Item item, DialogListener.OnEditDialogListener listener);
72 |
73 | void showDeletePackageDialog(Context context, Item item);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/model/App.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.model;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.ComponentName;
5 | import android.content.pm.LauncherActivityInfo;
6 | import android.content.pm.PackageManager;
7 | import android.content.pm.ResolveInfo;
8 | import android.content.pm.ShortcutInfo;
9 | import android.graphics.drawable.Drawable;
10 | import android.os.UserHandle;
11 |
12 | import java.util.List;
13 |
14 | public class App {
15 | public Drawable _icon;
16 | public String _label;
17 | public String _packageName;
18 | public String _className;
19 | public UserHandle _userHandle;
20 | public List _shortcutInfo;
21 |
22 | public App(PackageManager pm, ResolveInfo info, List shortcutInfo) {
23 | _icon = info.loadIcon(pm);
24 | _label = info.loadLabel(pm).toString();
25 | _packageName = info.activityInfo.packageName;
26 | _className = info.activityInfo.name;
27 | _shortcutInfo = shortcutInfo;
28 | }
29 |
30 | @SuppressLint("NewApi")
31 | public App(PackageManager pm, LauncherActivityInfo info, List shortcutInfo) {
32 | _icon = info.getIcon(0);
33 | _label = info.getLabel().toString();
34 | _packageName = info.getComponentName().getPackageName();
35 | _className = info.getName();
36 | _shortcutInfo = shortcutInfo;
37 | }
38 |
39 | @Override
40 | public boolean equals(Object object) {
41 | if (object instanceof App) {
42 | App app = (App) object;
43 | return _packageName.equals(app._packageName);
44 | } else {
45 | return false;
46 | }
47 | }
48 |
49 | public void setIcon(Drawable icon) {
50 | _icon = icon;
51 | }
52 |
53 | public Drawable getIcon() {
54 | return _icon;
55 | }
56 |
57 | public String getLabel() {
58 | return _label;
59 | }
60 |
61 | public String getPackageName() {
62 | return _packageName;
63 | }
64 |
65 | public String getClassName() {
66 | return _className;
67 | }
68 |
69 | public String getComponentName() {
70 | return new ComponentName(_packageName, _className).toString();
71 | }
72 |
73 | public List getShortcutInfo() {
74 | return _shortcutInfo;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/receivers/AppUpdateReceiver.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.receivers;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 |
7 | import com.benny.openlauncher.manager.Setup;
8 |
9 | public class AppUpdateReceiver extends BroadcastReceiver {
10 | @Override
11 | public void onReceive(Context context, Intent intent) {
12 | Setup.appLoader().onAppUpdated(context, intent);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/receivers/DeviceAdminReceiver.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.receivers;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.util.Log;
7 |
8 | public class DeviceAdminReceiver extends BroadcastReceiver {
9 | @Override
10 | public void onReceive(Context context, Intent intent) {
11 | Log.d("DeviceAdminReceiver", "DeviceAdmin received");
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/receivers/ShortcutReceiver.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.receivers;
2 |
3 | import android.content.BroadcastReceiver;
4 | import android.content.Context;
5 | import android.content.Intent;
6 | import android.content.res.Resources;
7 | import android.graphics.Bitmap;
8 | import android.graphics.Point;
9 | import android.graphics.drawable.BitmapDrawable;
10 | import android.graphics.drawable.Drawable;
11 | import android.os.Parcelable;
12 | import android.util.Log;
13 |
14 | import com.benny.openlauncher.R;
15 | import com.benny.openlauncher.activity.HomeActivity;
16 | import com.benny.openlauncher.activity.homeparts.HpInitSetup;
17 | import com.benny.openlauncher.manager.Setup;
18 | import com.benny.openlauncher.model.App;
19 | import com.benny.openlauncher.model.Item;
20 | import com.benny.openlauncher.util.Definitions;
21 | import com.benny.openlauncher.util.Tool;
22 |
23 | public class ShortcutReceiver extends BroadcastReceiver {
24 |
25 | public ShortcutReceiver() {
26 | }
27 |
28 | @Override
29 | public void onReceive(Context context, Intent intent) {
30 | if (intent.getExtras() == null) return;
31 |
32 | // this will only work before Android Oreo
33 | // was deprecated in favor of ShortcutManager.pinRequestShortcut()
34 | String shortcutLabel = intent.getExtras().getString(Intent.EXTRA_SHORTCUT_NAME);
35 | Intent shortcutIntent = (Intent) intent.getExtras().get(Intent.EXTRA_SHORTCUT_INTENT);
36 | Drawable shortcutIcon = null;
37 |
38 | try {
39 | Parcelable parcelable = intent.getExtras().getParcelable(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
40 | if (parcelable instanceof Intent.ShortcutIconResource) {
41 | Intent.ShortcutIconResource iconResource = (Intent.ShortcutIconResource) parcelable;
42 | Resources resources = context.getPackageManager().getResourcesForApplication(iconResource.packageName);
43 | if (resources != null) {
44 | int id = resources.getIdentifier(iconResource.resourceName, null, null);
45 | shortcutIcon = resources.getDrawable(id);
46 | }
47 | }
48 | } catch (Exception e) {
49 | e.printStackTrace();
50 | } finally {
51 | if (shortcutIcon == null)
52 | shortcutIcon = new BitmapDrawable(context.getResources(), (Bitmap) intent.getExtras().getParcelable(Intent.EXTRA_SHORTCUT_ICON));
53 | }
54 |
55 | if (!Setup.wasInitialised()) {
56 | Setup.init(new HpInitSetup(context));
57 | }
58 |
59 | App app = Setup.appLoader().createApp(shortcutIntent);
60 | Item item;
61 | if (app != null) {
62 | item = Item.newAppItem(app);
63 | } else {
64 | item = Item.newShortcutItem(shortcutIntent, shortcutIcon, shortcutLabel);
65 | }
66 | Point preferredPos = HomeActivity.Companion.getLauncher().getDesktop().getPages().get(HomeActivity.Companion.getLauncher().getDesktop().getCurrentItem()).findFreeSpace();
67 | if (preferredPos == null) {
68 | Tool.toast(HomeActivity.Companion.getLauncher(), R.string.toast_not_enough_space);
69 | } else {
70 | item.setX(preferredPos.x);
71 | item.setY(preferredPos.y);
72 | HomeActivity._db.saveItem(item, HomeActivity.Companion.getLauncher().getDesktop().getCurrentItem(), Definitions.ItemPosition.Desktop);
73 | HomeActivity.Companion.getLauncher().getDesktop().addItemToPage(item, HomeActivity.Companion.getLauncher().getDesktop().getCurrentItem());
74 | Log.d(this.getClass().toString(), "shortcut installed");
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/util/Definitions.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.util;
2 |
3 | public class Definitions {
4 | public static final int BUFFER_SIZE = 2048;
5 | public static final int INTENT_BACKUP = 5;
6 | public static final int INTENT_RESTORE = 3;
7 | public static final int ACTION_LAUNCHER = 8;
8 |
9 | // separates a list of integers
10 | public static final String DELIMITER = "#";
11 |
12 | // DO NOT REARRANGE
13 | // enum ordinal used for db
14 | public enum ItemPosition {
15 | Dock,
16 | Desktop,
17 | Group
18 | }
19 |
20 | public enum ItemState {
21 | Hidden,
22 | Visible
23 | }
24 |
25 | public enum WallpaperScroll {
26 | Normal,
27 | Inverse,
28 | Off
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/util/DragAction.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.util;
2 |
3 | public class DragAction {
4 | public Action action;
5 |
6 | public DragAction(Action action) {
7 | this.action = action;
8 | }
9 |
10 | public enum Action {
11 | DESKTOP, DRAWER, SEARCH
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/util/DragHandler.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.util;
2 |
3 | import android.graphics.Bitmap;
4 | import android.graphics.Bitmap.Config;
5 | import android.graphics.Canvas;
6 | import android.view.View;
7 |
8 | import com.benny.openlauncher.activity.HomeActivity;
9 | import com.benny.openlauncher.manager.Setup;
10 | import com.benny.openlauncher.model.Item;
11 | import com.benny.openlauncher.viewutil.DesktopCallback;
12 | import com.benny.openlauncher.widget.AppItemView;
13 |
14 | public final class DragHandler {
15 | public static Bitmap _cachedDragBitmap;
16 |
17 | public static void startDrag(View view, Item item, DragAction.Action action, final DesktopCallback desktopCallback) {
18 | _cachedDragBitmap = loadBitmapFromView(view);
19 |
20 | if (HomeActivity.Companion.getLauncher() != null)
21 | HomeActivity._launcher.getItemOptionView().startDragNDropOverlay(view, item, action);
22 |
23 | if (desktopCallback != null)
24 | desktopCallback.setLastItem(item, view);
25 | }
26 |
27 | public static View.OnLongClickListener getLongClick(final Item item, final DragAction.Action action, final DesktopCallback desktopCallback) {
28 | return new View.OnLongClickListener() {
29 | @Override
30 | public boolean onLongClick(View view) {
31 | if (Setup.appSettings().getDesktopLock()) {
32 | if (HomeActivity.Companion.getLauncher() != null && !DragAction.Action.SEARCH.equals(action)) {
33 | if (Setup.appSettings().getGestureFeedback()) {
34 | Tool.vibrate(view);
35 | }
36 | HomeActivity._launcher.getItemOptionView().showItemPopupForLockedDesktop(item, HomeActivity.Companion.getLauncher());
37 | return true;
38 | }
39 | return false;
40 | }
41 | if (Setup.appSettings().getGestureFeedback()) {
42 | Tool.vibrate(view);
43 | }
44 | startDrag(view, item, action, desktopCallback);
45 | return true;
46 | }
47 | };
48 | }
49 |
50 | private static Bitmap loadBitmapFromView(View view) {
51 | Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Config.ARGB_8888);
52 | Canvas canvas = new Canvas(bitmap);
53 | String tempLabel = null;
54 | if (view instanceof AppItemView) {
55 | tempLabel = ((AppItemView) view).getLabel();
56 | ((AppItemView) view).setLabel(" ");
57 | }
58 | view.layout(0, 0, view.getWidth(), view.getHeight());
59 | view.draw(canvas);
60 | if (view instanceof AppItemView) {
61 | ((AppItemView) view).setLabel(tempLabel);
62 | }
63 | view.getParent().requestLayout();
64 | return bitmap;
65 | }
66 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/viewutil/AbstractPopupIconLabelItem.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.viewutil;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 | import android.widget.ImageView;
6 | import android.widget.TextView;
7 |
8 | import com.benny.openlauncher.R;
9 | import com.mikepenz.fastadapter.IClickable;
10 | import com.mikepenz.fastadapter.IItem;
11 | import com.mikepenz.fastadapter.items.AbstractItem;
12 |
13 | public abstract class AbstractPopupIconLabelItem- extends AbstractItem
- {
14 |
15 | static class ViewHolder extends RecyclerView.ViewHolder {
16 | ImageView iconView;
17 | TextView labelView;
18 |
19 | ViewHolder(View itemView) {
20 | super(itemView);
21 |
22 | labelView = itemView.findViewById(R.id.item_popup_label);
23 | iconView = itemView.findViewById(R.id.item_popup_icon);
24 | }
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/viewutil/CircleDrawable.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.viewutil;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.graphics.ColorFilter;
7 | import android.graphics.Paint;
8 | import android.graphics.PixelFormat;
9 | import android.graphics.PorterDuff;
10 | import android.graphics.drawable.Drawable;
11 |
12 | import com.benny.openlauncher.util.Tool;
13 |
14 | public class CircleDrawable extends Drawable {
15 |
16 | private int _iconSize;
17 | private int _iconSizeReal;
18 | private int _iconPadding;
19 | private int _iconColor;
20 | private Bitmap _icon;
21 | private Bitmap _iconToFade;
22 | private Paint _paint;
23 | private Paint _paint2;
24 |
25 | private float _scaleStep = 0.08f;
26 | private float _currentScale = 1f;
27 | private boolean _hidingOldIcon;
28 |
29 | public CircleDrawable(Context context, Drawable icon, int colorIcon, int colorBackground, int alphaBackground) {
30 | icon.setColorFilter(colorIcon, PorterDuff.Mode.SRC_ATOP);
31 | _icon = Tool.drawableToBitmap(icon);
32 |
33 | _iconPadding = Tool.dp2px(6);
34 | _iconColor = colorIcon;
35 |
36 | _iconSizeReal = icon.getIntrinsicHeight();
37 | _iconSize = icon.getIntrinsicHeight() + _iconPadding * 2;
38 |
39 | _paint = new Paint(Paint.ANTI_ALIAS_FLAG);
40 | _paint.setColor(colorBackground);
41 | _paint.setAlpha(alphaBackground);
42 | _paint.setStyle(Paint.Style.FILL);
43 |
44 | _paint2 = new Paint(Paint.ANTI_ALIAS_FLAG);
45 | _paint2.setColor(colorIcon);
46 | _paint2.setFilterBitmap(true);
47 | }
48 |
49 | public void setIcon(Drawable icon) {
50 | _iconToFade = _icon;
51 | _hidingOldIcon = true;
52 |
53 | icon.setColorFilter(_iconColor, PorterDuff.Mode.SRC_ATOP);
54 |
55 | _icon = Tool.drawableToBitmap(icon);
56 | invalidateSelf();
57 | }
58 |
59 | @Override
60 | public void draw(Canvas canvas) {
61 | canvas.drawCircle(_iconSize / 2, _iconSize / 2, _iconSize / 2, _paint);
62 |
63 | if (_iconToFade != null) {
64 | canvas.save();
65 | if (_hidingOldIcon)
66 | _currentScale -= _scaleStep;
67 | else
68 | _currentScale += _scaleStep;
69 | _currentScale = Tool.clampFloat(_currentScale, 0, 1);
70 | canvas.scale(_currentScale, _currentScale, _iconSize / 2, _iconSize / 2);
71 | canvas.drawBitmap(_hidingOldIcon ? _iconToFade : _icon, _iconSize / 2 - _iconSizeReal / 2, _iconSize / 2 - _iconSizeReal / 2, _paint2);
72 | canvas.restore();
73 |
74 | if (_currentScale == 0)
75 | _hidingOldIcon = false;
76 |
77 | if (!_hidingOldIcon && _scaleStep == 1)
78 | _iconToFade = null;
79 |
80 | invalidateSelf();
81 | } else {
82 | canvas.drawBitmap(_icon, _iconSize / 2 - _iconSizeReal / 2, _iconSize / 2 - _iconSizeReal / 2, _paint2);
83 | }
84 | }
85 |
86 | @Override
87 | public int getIntrinsicWidth() {
88 | return _iconSize;
89 | }
90 |
91 | @Override
92 | public int getIntrinsicHeight() {
93 | return _iconSize;
94 | }
95 |
96 | @Override
97 | public void setAlpha(int i) {
98 | }
99 |
100 | @Override
101 | public void setColorFilter(ColorFilter colorFilter) {
102 | }
103 |
104 | @Override
105 | public int getOpacity() {
106 | return PixelFormat.TRANSPARENT;
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/viewutil/DesktopCallback.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.viewutil;
2 |
3 | import android.view.View;
4 |
5 | import com.benny.openlauncher.interfaces.ItemHistory;
6 | import com.benny.openlauncher.model.Item;
7 |
8 | public interface DesktopCallback extends ItemHistory {
9 | boolean addItemToPoint(Item item, int x, int y);
10 |
11 | boolean addItemToPage(Item item, int page);
12 |
13 | boolean addItemToCell(Item item, int x, int y);
14 |
15 | void removeItem(View view, boolean animate);
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/viewutil/DesktopGestureListener.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.viewutil;
2 |
3 | import com.benny.openlauncher.widget.Desktop;
4 |
5 | import in.championswimmer.sfg.lib.SimpleFingerGestures;
6 |
7 | public class DesktopGestureListener implements SimpleFingerGestures.OnFingerGestureListener {
8 |
9 | public enum Type {
10 | SwipeUp,
11 | SwipeDown,
12 | SwipeLeft,
13 | SwipeRight,
14 | Pinch,
15 | Unpinch,
16 | DoubleTap
17 | }
18 |
19 | private final DesktopGestureCallback _callback;
20 | private final Desktop _desktop;
21 |
22 | public DesktopGestureListener(Desktop desktop, DesktopGestureCallback callback) {
23 | _desktop = desktop;
24 | _callback = callback;
25 | }
26 |
27 | @Override
28 | public boolean onSwipeUp(int i, long l, double v) {
29 | return _callback.onDrawerGesture(_desktop, Type.SwipeUp);
30 | }
31 |
32 | @Override
33 | public boolean onSwipeDown(int i, long l, double v) {
34 | return _callback.onDrawerGesture(_desktop, Type.SwipeDown);
35 | }
36 |
37 | @Override
38 | public boolean onSwipeLeft(int i, long l, double v) {
39 | return _callback.onDrawerGesture(_desktop, Type.SwipeLeft);
40 | }
41 |
42 | @Override
43 | public boolean onSwipeRight(int i, long l, double v) {
44 | return _callback.onDrawerGesture(_desktop, Type.SwipeRight);
45 | }
46 |
47 | @Override
48 | public boolean onPinch(int i, long l, double v) {
49 | return _callback.onDrawerGesture(_desktop, Type.Pinch);
50 | }
51 |
52 | @Override
53 | public boolean onUnpinch(int i, long l, double v) {
54 | return _callback.onDrawerGesture(_desktop, Type.Unpinch);
55 | }
56 |
57 | @Override
58 | public boolean onDoubleTap(int i) {
59 | return _callback.onDrawerGesture(_desktop, Type.DoubleTap);
60 | }
61 |
62 | public interface DesktopGestureCallback {
63 | boolean onDrawerGesture(Desktop desktop, Type event);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/viewutil/DrawerAppItem.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.viewutil;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 |
6 | import com.benny.openlauncher.R;
7 | import com.benny.openlauncher.manager.Setup;
8 | import com.benny.openlauncher.model.App;
9 | import com.benny.openlauncher.model.Item;
10 | import com.benny.openlauncher.util.DragAction;
11 | import com.benny.openlauncher.widget.AppDrawerGrid;
12 | import com.benny.openlauncher.widget.AppItemView;
13 | import com.mikepenz.fastadapter.items.AbstractItem;
14 |
15 | import java.util.List;
16 |
17 | public class DrawerAppItem extends AbstractItem {
18 | private App _app;
19 |
20 | public DrawerAppItem(App app) {
21 | // TODO merge IconLabelItem and DrawerAppItem into one class
22 | // they both do the same thing
23 | // ideally remove all the custom code for AppItemView in favor of the
24 | // nicer code in IconLabelItem
25 | _app = app;
26 | }
27 |
28 | @Override
29 | public int getType() {
30 | return R.id.id_adapter_drawer_app_item;
31 | }
32 |
33 | @Override
34 | public int getLayoutRes() {
35 | return R.layout.item_app;
36 | }
37 |
38 | @Override
39 | public ViewHolder getViewHolder(View v) {
40 | return new ViewHolder(v);
41 | }
42 |
43 | @Override
44 | public void bindView(DrawerAppItem.ViewHolder holder, List payloads) {
45 | Item item = Item.newAppItem(_app);
46 | holder.builder
47 | .setAppItem(item)
48 | .withOnLongClick(item, DragAction.Action.DRAWER, null);
49 | super.bindView(holder, payloads);
50 | }
51 |
52 | static class ViewHolder extends RecyclerView.ViewHolder {
53 | AppItemView appItemView;
54 | AppItemView.Builder builder;
55 |
56 | public ViewHolder(View itemView) {
57 | super(itemView);
58 | appItemView = (AppItemView) itemView;
59 | appItemView.setTargetedWidth(AppDrawerGrid._itemWidth);
60 | appItemView.setTargetedHeightPadding(AppDrawerGrid._itemHeightPadding);
61 |
62 | builder = new AppItemView.Builder(appItemView)
63 | .setIconSize(Setup.appSettings().getIconSize())
64 | .setLabelVisibility(Setup.appSettings().getDrawerShowLabel())
65 | .setTextColor(Setup.appSettings().getDrawerLabelColor());
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/viewutil/MinibarAdapter.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.viewutil;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.benny.openlauncher.R;
12 | import com.benny.openlauncher.util.LauncherAction;
13 |
14 | import java.util.List;
15 |
16 | public class MinibarAdapter extends BaseAdapter {
17 |
18 | private Context context;
19 | private List items;
20 |
21 | public MinibarAdapter(Context context, List items) {
22 | this.context = context;
23 | this.items = items;
24 | }
25 |
26 | public int getCount() {
27 | return items.size();
28 | }
29 |
30 | public Object getItem(int arg0) {
31 | return null;
32 | }
33 |
34 | public long getItemId(int position) {
35 | return position;
36 | }
37 |
38 | public View getView(int position, View convertView, ViewGroup parent) {
39 | LayoutInflater inflater = LayoutInflater.from(context);
40 | View view = inflater.inflate(R.layout.item_minibar, parent, false);
41 |
42 | ImageView icon = view.findViewById(R.id.iv);
43 | TextView label = view.findViewById(R.id.tv);
44 |
45 | icon.setImageResource(items.get(position)._icon);
46 | label.setText(items.get(position)._label);
47 | return view;
48 | }
49 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/benny/openlauncher/viewutil/PopupDynamicIconLabelItem.java:
--------------------------------------------------------------------------------
1 | package com.benny.openlauncher.viewutil;
2 |
3 | import android.graphics.drawable.Drawable;
4 | import android.support.annotation.NonNull;
5 | import android.view.View;
6 | import android.widget.ImageView;
7 | import android.widget.TextView;
8 |
9 | import com.benny.openlauncher.R;
10 |
11 | import java.util.List;
12 |
13 | public final class PopupDynamicIconLabelItem extends AbstractPopupIconLabelItem {
14 | private final Drawable _icon;
15 | private final CharSequence _label;
16 |
17 | public PopupDynamicIconLabelItem(CharSequence label, Drawable icon) {
18 | _label = label;
19 | _icon = icon;
20 | }
21 |
22 | public int getType() {
23 | return R.id.id_adapter_popup_icon_label_item;
24 | }
25 |
26 | public int getLayoutRes() {
27 | return R.layout.item_popup_icon_label;
28 | }
29 |
30 | public void bindView(@NonNull ViewHolder holder, @NonNull List