Skip to content

Commit 013f8ab

Browse files
committed
Started working on custom SystemUI in Kotlin
1 parent 9d49d26 commit 013f8ab

39 files changed

+884
-32
lines changed

.gitignore

+9-32
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Built application files
22
*.apk
3-
*.aar
43
*.ap_
5-
*.aab
64

75
# Files for the ART/Dalvik VM
86
*.dex
@@ -14,8 +12,6 @@
1412
bin/
1513
gen/
1614
out/
17-
# Uncomment the following line in case you need and you don't have the release build type files in your app
18-
# release/
1915

2016
# Gradle files
2117
.gradle/
@@ -36,50 +32,31 @@ proguard/
3632
# Android Studio captures folder
3733
captures/
3834

39-
# IntelliJ
35+
# Intellij
4036
*.iml
4137
.idea/workspace.xml
4238
.idea/tasks.xml
4339
.idea/gradle.xml
44-
.idea/assetWizardSettings.xml
4540
.idea/dictionaries
4641
.idea/libraries
47-
# Android Studio 3 in .gitignore file.
48-
.idea/caches
49-
.idea/modules.xml
50-
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
51-
.idea/navEditor.xml
5242

5343
# Keystore files
54-
# Uncomment the following lines if you do not want to check your keystore files in.
55-
#*.jks
56-
#*.keystore
44+
*.jks
5745

5846
# External native build folder generated in Android Studio 2.2 and later
5947
.externalNativeBuild
60-
.cxx/
6148

6249
# Google Services (e.g. APIs or Firebase)
63-
# google-services.json
50+
google-services.json
6451

6552
# Freeline
6653
freeline.py
6754
freeline/
6855
freeline_project_description.json
6956

70-
# fastlane
71-
fastlane/report.xml
72-
fastlane/Preview.html
73-
fastlane/screenshots
74-
fastlane/test_output
75-
fastlane/readme.md
76-
77-
# Version control
78-
vcs.xml
79-
80-
# lint
81-
lint/intermediates/
82-
lint/generated/
83-
lint/outputs/
84-
lint/tmp/
85-
# lint/reports/
57+
# Android Studio Configurations
58+
.DS_Store
59+
/local.properties
60+
/.idea
61+
/build
62+
/captures

CODE_OF_CONDUCT.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
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.
28+
29+
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.
30+
31+
## Scope
32+
33+
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.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [email protected]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
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.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# How to Contribute
2+
3+
We'd love to accept your patches and contributions to this project. There are just a few small guidelines you need to follow.
4+
5+
## Contributor License Agreement
6+
7+
When you contribute (code, documentation, or anything else), you have to be aware that your contribution is covered by the same [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).
8+
9+
## Code reviews
10+
11+
All submissions, including submissions by project members, require review. We use GitHub pull requests for this purpose. Consult [GitHub Help](https://help.github.com/articles/about-pull-requests/) for more information on using pull requests.
12+
13+
## Contributing A Patch
14+
15+
1. Submit an issue describing your proposed change to the repo in question.
16+
1. The repo owner will respond to your issue promptly.
17+
1. If your proposed change is accepted, and your contribution is covered by the same [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).
18+
1. Fork the desired repo, develop and test your code changes.
19+
1. Ensure that your code adheres to the existing style in the sample to which you are contributing. Refer to the [Android Code Style Guide](https://source.android.com/source/code-style.html) for the recommended coding standards for this organization.
20+
1. Ensure that your code has an appropriate set of unit tests which all pass.
21+
1. Submit a pull request.

ISSUE_TEMPLATE.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Expected Behavior
2+
3+
Please describe the behavior you are expecting
4+
5+
# Current Behavior
6+
7+
What is the current behavior?
8+
9+
# Failure Information (for bugs)
10+
11+
Please help provide information about the failure if this is a bug. If it is not a bug, please remove the rest of this template.
12+
13+
## Steps to Reproduce
14+
15+
Please provide detailed steps for reproducing the issue.
16+
17+
1. step 1
18+
2. step 2
19+
3. you get it...
20+
21+
## Context
22+
23+
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
24+
25+
## Your Environment
26+
27+
* Device Specifications:
28+
* Operating System:
29+
* SDK version:
30+
* Build Tools version:
31+
32+
## Failure Logs
33+
34+
Please include any relevant log snippets or files here.

PULL_REQUEST_TEMPLATE.md

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Description
2+
3+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
4+
5+
Fixes # (issue)
6+
7+
## Type of change
8+
9+
Please delete options that are not relevant.
10+
11+
- [ ] Bug fix (non-breaking change which fixes an issue)
12+
- [ ] New feature (non-breaking change which adds functionality)
13+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14+
- [ ] This change requires a documentation update
15+
16+
# How Has This Been Tested?
17+
18+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
19+
20+
- [ ] Test A
21+
- [ ] Test B
22+
23+
**Test Configuration**:
24+
25+
* Device Specifications:
26+
* Operating System:
27+
* SDK version:
28+
* Build Tools version:
29+
30+
# Checklist:
31+
32+
- [ ] My code follows the style guidelines of this project
33+
- [ ] I have performed a self-review of my own code
34+
- [ ] I have commented my code, particularly in hard-to-understand areas
35+
- [ ] I have made corresponding changes to the documentation
36+
- [ ] My changes generate no new warnings
37+
- [ ] I have added tests that prove my fix is effective or that my feature works
38+
- [ ] New and existing unit tests pass locally with my changes
39+
- [ ] Any dependent changes have been merged and published in downstream modules

app/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/build
2+
/release
3+
/schemas

app/build.gradle

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
apply plugin: 'com.android.application'
2+
3+
apply plugin: 'kotlin-android'
4+
5+
apply plugin: 'kotlin-android-extensions'
6+
7+
android {
8+
compileSdkVersion 29
9+
buildToolsVersion "29.0.2"
10+
defaultConfig {
11+
applicationId "com.litekite.systemui"
12+
minSdkVersion 28
13+
targetSdkVersion 29
14+
versionCode 1
15+
versionName "1.0"
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
}
25+
26+
dependencies {
27+
implementation fileTree(dir: 'libs', include: ['*.jar'])
28+
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
29+
implementation 'androidx.appcompat:appcompat:1.1.0'
30+
implementation 'androidx.core:core-ktx:1.1.0'
31+
testImplementation 'junit:junit:4.12'
32+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
33+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
34+
}

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.litekite.systemui
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("com.litekite.systemui", appContext.packageName)
23+
}
24+
}

app/src/main/AndroidManifest.xml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
coreApp="true"
4+
package="com.litekite.systemui"
5+
android:sharedUserId="android.uid.systemui">
6+
7+
<application
8+
android:name=".SystemUIApplication"
9+
android:allowBackup="true"
10+
android:allowClearUserData="false"
11+
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
12+
android:defaultToDeviceProtectedStorage="true"
13+
android:directBootAware="true"
14+
android:hardwareAccelerated="true"
15+
android:icon="@mipmap/ic_launcher"
16+
android:label="@string/app_name"
17+
android:persistent="true"
18+
android:process="com.android.systemui"
19+
android:roundIcon="@mipmap/ic_launcher_round"
20+
android:supportsRtl="true"
21+
android:theme="@style/Theme.SystemUI"
22+
tools:ignore="GoogleAppIndexingWarning">
23+
24+
<service android:name=".SystemUIService" />
25+
26+
</application>
27+
28+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package com.litekite.systemui
2+
3+
class SystemBars {
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.litekite.systemui
2+
3+
import android.app.Application
4+
import android.util.Log
5+
6+
class SystemUIApplication: Application() {
7+
8+
private val tag = "SystemUIApplication"
9+
/**
10+
* Hold a reference on the stuff we start.
11+
*/
12+
private val services: Array<SystemUI>? = null
13+
14+
override fun onCreate() {
15+
super.onCreate()
16+
17+
// Set the application theme that is inherited by all services. Note that setting the
18+
// application theme in the manifest does only work for activities. Keep this in sync with
19+
// the theme set there.
20+
setTheme(R.style.Theme_SystemUI)
21+
22+
Log.d(tag, " started successfully")
23+
24+
startServicesIfNeeded()
25+
}
26+
27+
/**
28+
* Makes sure that all the SystemUI services are running. If they are already running, this is a
29+
* no-op. This is needed to conditinally start all the services, as we only need to have it in
30+
* the main process.
31+
* <p>This method must only be called from the main thread.</p>
32+
*/
33+
private fun startServicesIfNeeded() {
34+
services = resources.getStringArray(R.array.config_systemUIServiceComponents)
35+
}
36+
37+
}

0 commit comments

Comments
 (0)