@@ -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