Skip to content

Commit 7c60ecf

Browse files
renattelerenattele
authored andcommitted
added choce to welcome, interations to help and welcome, clear data in settings
1 parent 0869595 commit 7c60ecf

File tree

10 files changed

+624
-30
lines changed

10 files changed

+624
-30
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Introducing 2 main and 1 additional features:
2323
First of all, it's a one-handed feature that helps you control your device and makes it easier.
2424
It's a very important because most of phones has very big screens and it's a very hard to use one-handed.
2525

26-
![4](https://user-images.githubusercontent.com/79582543/110311346-b2a82f80-8014-11eb-88f6-83367ad8678f.png)
26+
![4](https://user-images.githubusercontent.com/79582543/109321495-41bd8680-7862-11eb-9e7c-d58e1733e601.png)
2727

2828
# Bubble Manager
2929

@@ -33,15 +33,15 @@ You have choice between Power Assistant and Bubble Manager.
3333
Bubble Manager created for another user experience and has additional features.
3434
If Bubble manager is more comfortable for you, choose it.
3535

36-
![6](https://user-images.githubusercontent.com/79582543/110311353-b3d95c80-8014-11eb-844c-5594bd22f6e8.png)
36+
![6](https://user-images.githubusercontent.com/79582543/109321502-43874a00-7862-11eb-8b92-fe234c59bda3.png)
3737

3838
# Weather Director
3939

4040
![7](https://user-images.githubusercontent.com/79582543/109800583-6a60ca00-7c2e-11eb-8467-11079dc492c6.png)
4141

4242
Weather Director is additional feature for Bubble Manager. You can choose city that will show on the top.
4343

44-
![8](https://user-images.githubusercontent.com/79582543/110311356-b50a8980-8014-11eb-85d2-1328b8124e75.png)
44+
![8](https://user-images.githubusercontent.com/79582543/109321510-44b87700-7862-11eb-8016-9c606a84a1bb.png)
4545

4646
# Conclution
4747

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ android {
3535

3636
dependencies {
3737

38-
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.30"
38+
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.31"
3939
implementation 'androidx.core:core-ktx:1.3.2'
4040
implementation 'androidx.appcompat:appcompat:1.2.0'
4141
implementation 'com.google.android.material:material:1.3.0'

app/src/main/java/com/colorata/st/ControlTile.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import android.service.controls.templates.ToggleTemplate
1616
import androidx.annotation.DrawableRes
1717
import androidx.annotation.RequiresApi
1818
import androidx.localbroadcastmanager.content.LocalBroadcastManager
19+
import com.colorata.st.bubble.BubbleActivity
1920
import java.lang.reflect.Method
2021
import java.util.concurrent.Flow
2122
import java.util.function.Consumer
@@ -32,7 +33,7 @@ class ControlTile : ControlsProviderService() {
3233
PendingIntent.getActivity(
3334
this,
3435
0,
35-
Intent(this, MainActivity::class.java),
36+
Intent(this, BubbleActivity::class.java),
3637
PendingIntent.FLAG_CANCEL_CURRENT
3738
)
3839
).setTitle(title)

app/src/main/java/com/colorata/st/MainActivity.kt

Lines changed: 149 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,29 +108,13 @@ class MainActivity : AppCompatActivity() {
108108
//Configuring SHAREDPREFS
109109
sharedPreference = getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
110110

111-
if (sharedPreference.getInt("welcome", 0) < 100) {
111+
if (sharedPreference.getInt("welcome", 0) < 1) {
112112
val editor = sharedPreference.edit()
113113
editor.putInt("welcome", sharedPreference.getInt("welcome", 0) + 1)
114114
editor.apply()
115115
welcome()
116116
}
117117

118-
119-
//Showing Accessibility SNACKBAR
120-
if (sharedPreference.getInt("accessibilitySnack", 0) < 2) {
121-
val snackBar = Snackbar.make(
122-
main_layout, "Please, turn on Accessibility on this app",
123-
Snackbar.LENGTH_INDEFINITE
124-
).setAction("Go!"){
125-
val intent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)
126-
startActivity(intent)
127-
}
128-
snackBar.show()
129-
val editor = sharedPreference.edit()
130-
editor.putInt("accessibilitySnack", sharedPreference.getInt("accessibilitySnack", 0) + 1)
131-
editor.apply()
132-
}
133-
134118
//Creating ANIMATIONS and configuring GUIDELINES
135119
createVideos()
136120
guidelineConfig()
@@ -245,6 +229,8 @@ class MainActivity : AppCompatActivity() {
245229

246230
//Founding BUTTONS
247231
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_help)
232+
val enable = dialogLayout.findViewById<Button>(R.id.enable_help)
233+
val goAccess = dialogLayout.findViewById<Button>(R.id.go_access)
248234
val imageBubble1 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_1)
249235
val imageBubble2 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_2)
250236
val imageBubble3 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_3)
@@ -267,6 +253,20 @@ class MainActivity : AppCompatActivity() {
267253
materialBuilder.setContentView(dialogLayout)
268254
materialBuilder.show()
269255

256+
//Click listener for ENABLE BUTTON
257+
enable.setOnClickListener {
258+
if (materialBuilder.isShowing){
259+
showBubble(this)
260+
}
261+
}
262+
263+
//Click listener for GO BUTTON
264+
goAccess.setOnClickListener {
265+
if (materialBuilder.isShowing) {
266+
val intent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)
267+
startActivity(intent)
268+
}
269+
}
270270
//Click listener for CANCEL BUTTON
271271
cancel.setOnClickListener {
272272
if(materialBuilder.isShowing){
@@ -353,6 +353,7 @@ class MainActivity : AppCompatActivity() {
353353
//Founding BUTTONS
354354
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_settings)
355355
val settings = dialogLayout.findViewById<Button>(R.id.settings_app)
356+
val clear = dialogLayout.findViewById<Button>(R.id.clear_data)
356357

357358
//Configuring BACKGROUND
358359
configBack(dialogLayout)
@@ -374,6 +375,14 @@ class MainActivity : AppCompatActivity() {
374375
}
375376
}
376377

378+
//Click listener for CLEAR BUTTON
379+
clear.setOnClickListener {
380+
if (materialBuilder.isShowing){
381+
materialBuilder.dismiss()
382+
clearData()
383+
}
384+
}
385+
377386
//Click listener for CANCEL BUTTON
378387
cancel.setOnClickListener {
379388
if(materialBuilder.isShowing){
@@ -788,8 +797,8 @@ class MainActivity : AppCompatActivity() {
788797
val dialogLayout: View = inflater.inflate(R.layout.welcome_alert, null)
789798

790799
//Founding BUTTONS
791-
val bubble = dialogLayout.findViewById<Button>(R.id.bubble)
792-
val power = dialogLayout.findViewById<Button>(R.id.power)
800+
val power = dialogLayout.findViewById<Button>(R.id.bubble)
801+
val bubble = dialogLayout.findViewById<Button>(R.id.power)
793802
val logo = dialogLayout.findViewById<ImageView>(R.id.image_logo_shorttasks)
794803
val imageBubble = dialogLayout.findViewById<ImageView>(R.id.image_bubble)
795804

@@ -809,11 +818,132 @@ class MainActivity : AppCompatActivity() {
809818
bubble.setOnClickListener {
810819
if(materialBuilder.isShowing){
811820
materialBuilder.dismiss()
821+
bubbleManagerFirst()
812822
}
813823
}
814824

815825
//Click listener for POWER BUTTON
816826
power.setOnClickListener {
827+
if(materialBuilder.isShowing){
828+
materialBuilder.dismiss()
829+
powerAssistantFirst()
830+
}
831+
}
832+
}
833+
834+
//Fun for the BUBBLE MANAGER FIRST
835+
@SuppressLint("InflateParams")
836+
private fun bubbleManagerFirst(){
837+
val materialBuilder = BottomSheetDialog(this)
838+
val inflater = layoutInflater
839+
val dialogLayout: View = inflater.inflate(R.layout.bubble_manager_first_alert, null)
840+
841+
//Founding BUTTONS
842+
val understand = dialogLayout.findViewById<Button>(R.id.cancel_bubble_manager_first)
843+
val enable = dialogLayout.findViewById<Button>(R.id.enable_first)
844+
val image1 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_1_first)
845+
val image2 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_2_first)
846+
val image3 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_3_first)
847+
848+
//Configuring pictures
849+
if(nightMode){
850+
image1.setImageResource(R.drawable.ic_bubble_manager_1_dark)
851+
image2.setImageResource(R.drawable.ic_bubble_manager_2_dark)
852+
image3.setImageResource(R.drawable.ic_bubble_manager_3_dark)
853+
}
854+
855+
//Configuring BACKGROUND
856+
configBack(dialogLayout)
857+
858+
//Showing BOTTOM SHEET
859+
materialBuilder.setContentView(dialogLayout)
860+
materialBuilder.show()
861+
862+
//Click listener for UNDERSTAND BUTTON
863+
understand.setOnClickListener {
864+
if(materialBuilder.isShowing){
865+
materialBuilder.dismiss()
866+
}
867+
}
868+
869+
//Click listener for ENABLE BUTTON
870+
enable.setOnClickListener {
871+
if(materialBuilder.isShowing){
872+
showBubble(this)
873+
}
874+
}
875+
}
876+
877+
//Fun for the POWER ASSISTANT FIRST
878+
@SuppressLint("InflateParams")
879+
private fun powerAssistantFirst(){
880+
val materialBuilder = BottomSheetDialog(this)
881+
val inflater = layoutInflater
882+
val dialogLayout: View = inflater.inflate(R.layout.power_assistant_first_alert, null)
883+
884+
//Founding BUTTONS
885+
val understand = dialogLayout.findViewById<Button>(R.id.cancel_power_assistant_first)
886+
val go = dialogLayout.findViewById<Button>(R.id.go_access_first)
887+
val image1 = dialogLayout.findViewById<ImageView>(R.id.image_power_1_first)
888+
val image2 = dialogLayout.findViewById<ImageView>(R.id.image_power_2_first)
889+
890+
//Configuring pictures
891+
if(nightMode){
892+
image1.setImageResource(R.drawable.ic_power_assistant_1_dark)
893+
image2.setImageResource(R.drawable.ic_power_assistant_2_dark)
894+
}
895+
896+
//Configuring BACKGROUND
897+
configBack(dialogLayout)
898+
899+
//Showing BOTTOM SHEET
900+
materialBuilder.setContentView(dialogLayout)
901+
materialBuilder.show()
902+
903+
//Click listener for UNDERSTAND BUTTON
904+
understand.setOnClickListener {
905+
if(materialBuilder.isShowing){
906+
materialBuilder.dismiss()
907+
}
908+
}
909+
910+
//Click listener for GO BUTTON
911+
go.setOnClickListener {
912+
if(materialBuilder.isShowing){
913+
val intent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)
914+
startActivity(intent)
915+
}
916+
}
917+
}
918+
919+
//Fun for the CLEAR DATA
920+
@SuppressLint("InflateParams")
921+
private fun clearData(){
922+
val materialBuilder = BottomSheetDialog(this)
923+
val inflater = layoutInflater
924+
val dialogLayout: View = inflater.inflate(R.layout.clear_data_allowing_alert, null)
925+
926+
//Founding BUTTONS
927+
val ok = dialogLayout.findViewById<Button>(R.id.ok_clear)
928+
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_clear)
929+
930+
//Configuring BACKGROUND
931+
configBack(dialogLayout)
932+
933+
//Showing BOTTOM SHEET
934+
materialBuilder.setContentView(dialogLayout)
935+
materialBuilder.show()
936+
937+
//Click listener for UNDERSTAND BUTTON
938+
ok.setOnClickListener {
939+
if(materialBuilder.isShowing){
940+
materialBuilder.dismiss()
941+
sharedPreference.edit().clear().apply()
942+
}
943+
}
944+
945+
//Click listener for GO BUTTON
946+
cancel.setOnClickListener {
817947
if(materialBuilder.isShowing){
818948
materialBuilder.dismiss()
819949
}

0 commit comments

Comments
 (0)