Skip to content

Commit 9da448e

Browse files
renattelerenattele
authored andcommitted
theme based on system but not working on recycler_items and BubbleActivity
1 parent 9e50b37 commit 9da448e

File tree

9 files changed

+146
-8
lines changed

9 files changed

+146
-8
lines changed

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

Lines changed: 129 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import android.content.Intent
88
import android.content.SharedPreferences
99
import android.content.pm.PackageManager
1010
import android.content.pm.ResolveInfo
11-
import android.content.res.ColorStateList
1211
import android.content.res.Configuration
1312
import android.graphics.Color
1413
import android.graphics.drawable.Drawable
@@ -249,15 +248,47 @@ import java.util.*
249248
val dialogLayout: View = inflater.inflate(R.layout.help_alert, null)
250249

251250
//Founding BUTTONS
251+
val text = dialogLayout.findViewById<TextView>(R.id.text_help)
252+
val power = dialogLayout.findViewById<TextView>(R.id.power_assistant)
253+
val power1 = dialogLayout.findViewById<TextView>(R.id.power_1)
254+
val power2 = dialogLayout.findViewById<TextView>(R.id.power_2)
255+
val power3 = dialogLayout.findViewById<TextView>(R.id.power_3)
256+
val power4 = dialogLayout.findViewById<TextView>(R.id.power_4)
257+
val power5 = dialogLayout.findViewById<TextView>(R.id.power_5)
258+
val power6 = dialogLayout.findViewById<TextView>(R.id.power_6)
259+
val bubble = dialogLayout.findViewById<TextView>(R.id.bubble_manager)
260+
val bubble1 = dialogLayout.findViewById<TextView>(R.id.bubble_1)
261+
val bubble2 = dialogLayout.findViewById<TextView>(R.id.bubble_2)
262+
val bubble3 = dialogLayout.findViewById<TextView>(R.id.bubble_3)
263+
252264
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_help)
253265
val enable = dialogLayout.findViewById<Button>(R.id.enable_help)
254266
val goAccess = dialogLayout.findViewById<Button>(R.id.go_access)
267+
255268
val imageBubble1 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_1)
256269
val imageBubble2 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_2)
257270
val imageBubble3 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_3)
258271
val imagePower1 = dialogLayout.findViewById<ImageView>(R.id.image_power_1)
259272
val imagePower2 = dialogLayout.findViewById<ImageView>(R.id.image_power_2)
260273

274+
//Changing COLOR THEME
275+
cancel.setTextColor(getButtonColor())
276+
enable.setTextColor(getButtonColor())
277+
goAccess.setTextColor(getButtonColor())
278+
text.setTextColor(getButtonColor())
279+
power.setTextColor(getButtonColor())
280+
power1.setTextColor(getButtonColor())
281+
power2.setTextColor(getButtonColor())
282+
power3.setTextColor(getButtonColor())
283+
power4.setTextColor(getButtonColor())
284+
power5.setTextColor(getButtonColor())
285+
power6.setTextColor(getButtonColor())
286+
bubble.setTextColor(getButtonColor())
287+
bubble1.setTextColor(getButtonColor())
288+
bubble2.setTextColor(getButtonColor())
289+
bubble3.setTextColor(getButtonColor())
290+
291+
261292
//Configuring pictures
262293
if(nightMode){
263294
imagePower1.setImageResource(R.drawable.ic_power_assistant_1_dark)
@@ -380,11 +411,17 @@ import java.util.*
380411
val dialogLayout: View = inflater.inflate(R.layout.settings_alert, null)
381412

382413
//Founding BUTTONS
414+
val text = dialogLayout.findViewById<TextView>(R.id.text_settings)
383415
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_settings)
384416
val settings = dialogLayout.findViewById<Button>(R.id.settings_app)
385417
val clear = dialogLayout.findViewById<Button>(R.id.clear_data)
386418

387-
419+
//Changing COLOR THEME
420+
cancel.setTextColor(getButtonColor())
421+
settings.setTextColor(getButtonColor())
422+
clear.setTextColor(getButtonColor())
423+
text.setTextColor(getButtonColor())
424+
388425
//Configuring BACKGROUND
389426
configBack(dialogLayout)
390427

@@ -429,9 +466,14 @@ import java.util.*
429466
val dialogLayout: View = inflater.inflate(R.layout.add_button_alert, null)
430467

431468
//Founding BUTTONS AND EDITTEXTS
469+
val text = dialogLayout.findViewById<TextView>(R.id.text_add_button)
432470
val appRecycler = dialogLayout.findViewById<RecyclerView>(R.id.app_recycler)
433471
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_add_button)
434472

473+
//Changing COLOR THEME
474+
cancel.setTextColor(getButtonColor())
475+
text.setTextColor(getButtonColor())
476+
435477
//Configuring FOR ALL APPS
436478
val mutableLabels = getAppsLabel()
437479
val mutablePackages = getAppsPackage()
@@ -478,10 +520,16 @@ import java.util.*
478520
val dialogLayout: View = inflater.inflate(R.layout.change_controls_alert, null)
479521

480522
//Founding BUTTONS and RECYCLERVIEW
523+
val text = dialogLayout.findViewById<TextView>(R.id.text_change_controls)
481524
val changeRecycler = dialogLayout.findViewById<RecyclerView>(R.id.change_recycler)
482525
val ok = dialogLayout.findViewById<Button>(R.id.ok_change_position)
483526
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_change_position)
484527

528+
//Change COLOR THEME
529+
ok.setTextColor(getButtonColor())
530+
cancel.setTextColor(getButtonColor())
531+
text.setTextColor(getButtonColor())
532+
485533
//Init values for CONTROLS
486534
val mutableNames = mutableListOf<String>()
487535
val mutableIcons = mutableListOf<Int>()
@@ -581,11 +629,19 @@ import java.util.*
581629
val dialogLayout: View = inflater.inflate(R.layout.bubble_manager_alert, null)
582630

583631
//Founding BUTTONS
632+
val text = dialogLayout.findViewById<TextView>(R.id.text_bubble_manager)
584633
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_bubble_manager)
585634
val enable = dialogLayout.findViewById<Button>(R.id.enable)
586635
val changePosition = dialogLayout.findViewById<Button>(R.id.change_position)
587636
val addButton = dialogLayout.findViewById<Button>(R.id.add_button)
588637

638+
//Changing COLOR THEME
639+
cancel.setTextColor(getButtonColor())
640+
enable.setTextColor(getButtonColor())
641+
changePosition.setTextColor(getButtonColor())
642+
addButton.setTextColor(getButtonColor())
643+
text.setTextColor(getButtonColor())
644+
589645
//Configuring BACKGROUND
590646
configBack(dialogLayout)
591647

@@ -648,9 +704,15 @@ import java.util.*
648704
val dialogLayout: View = inflater.inflate(R.layout.weather_director_alert, null)
649705

650706
//Founding BUTTONS
707+
val text = dialogLayout.findViewById<TextView>(R.id.text_weather_director)
651708
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_weather_director)
652709
val changeCity = dialogLayout.findViewById<Button>(R.id.city_change)
653710

711+
//Changing COLOR THEME
712+
cancel.setTextColor(getButtonColor())
713+
changeCity.setTextColor(getButtonColor())
714+
text.setTextColor(getButtonColor())
715+
654716
//Configuring BACKGROUND
655717
configBack(dialogLayout)
656718

@@ -693,6 +755,11 @@ import java.util.*
693755
val cancelCity = dialogLayoutCity.findViewById<Button>(R.id.cancel_change_city)
694756
val changeCityField = dialogLayoutCity.findViewById<TextInputEditText>(R.id.city_field_in)
695757

758+
//Changing COLOR THEME
759+
okCity.setTextColor(getButtonColor())
760+
cancelCity.setTextColor(getButtonColor())
761+
changeCityField.setTextColor(getButtonColor())
762+
696763
//Configuring BACKGROUND for CITY
697764
configBack(dialogLayoutCity)
698765

@@ -749,8 +816,13 @@ import java.util.*
749816
val dialogLayout: View = inflater.inflate(R.layout.first_change_alert, null)
750817

751818
//Founding BUTTONS
819+
val text = dialogLayout.findViewById<TextView>(R.id.text_how_change)
752820
val understand = dialogLayout.findViewById<Button>(R.id.understand_first_change)
753821

822+
//Changing COLOR THEME
823+
understand.setTextColor(getButtonColor())
824+
text.setTextColor(getButtonColor())
825+
754826
//Configuring BACKGROUND
755827
configBack(dialogLayout)
756828

@@ -775,8 +847,13 @@ import java.util.*
775847
val dialogLayout: View = inflater.inflate(R.layout.first_change_city_alert, null)
776848

777849
//Founding BUTTONS
850+
val text = dialogLayout.findViewById<TextView>(R.id.text_how_change_city)
778851
val understand = dialogLayout.findViewById<Button>(R.id.understand_first_change_city_alert)
779852

853+
//Changing COLOR THEME
854+
understand.setTextColor(getButtonColor())
855+
text.setTextColor(getButtonColor())
856+
780857
//Configuring BACKGROUND
781858
configBack(dialogLayout)
782859

@@ -801,8 +878,13 @@ import java.util.*
801878
val dialogLayout: View = inflater.inflate(R.layout.first_add_button_alert, null)
802879

803880
//Founding BUTTONS
881+
val text = dialogLayout.findViewById<TextView>(R.id.text_how_add)
804882
val understand = dialogLayout.findViewById<Button>(R.id.understand_first_add)
805883

884+
//Changing COLOR THEME
885+
understand.setTextColor(getButtonColor())
886+
text.setTextColor(getButtonColor())
887+
806888
//Configuring BACKGROUND
807889
configBack(dialogLayout)
808890

@@ -827,11 +909,19 @@ import java.util.*
827909
val dialogLayout: View = inflater.inflate(R.layout.welcome_alert, null)
828910

829911
//Founding BUTTONS
912+
val text = dialogLayout.findViewById<TextView>(R.id.text_welcome)
913+
val subText = dialogLayout.findViewById<TextView>(R.id.text_subwelcome)
830914
val power = dialogLayout.findViewById<Button>(R.id.bubble)
831915
val bubble = dialogLayout.findViewById<Button>(R.id.power)
832916
val logo = dialogLayout.findViewById<ImageView>(R.id.image_logo_shorttasks)
833917
val imageBubble = dialogLayout.findViewById<ImageView>(R.id.image_bubble)
834918

919+
//Changing COLOR THEME
920+
power.setTextColor(getButtonColor())
921+
bubble.setTextColor(getButtonColor())
922+
text.setTextColor(getButtonColor())
923+
subText.setTextColor(getButtonColor())
924+
835925
//Configuring pictures
836926
if(nightMode){
837927
logo.setImageResource(R.drawable.ic_logo_main_dark)
@@ -869,12 +959,24 @@ import java.util.*
869959
val dialogLayout: View = inflater.inflate(R.layout.bubble_manager_first_alert, null)
870960

871961
//Founding BUTTONS
962+
val text = dialogLayout.findViewById<TextView>(R.id.bubble_manager)
963+
val bubble1 = dialogLayout.findViewById<TextView>(R.id.bubble_1)
964+
val bubble2 = dialogLayout.findViewById<TextView>(R.id.bubble_2)
965+
val bubble3 = dialogLayout.findViewById<TextView>(R.id.bubble_3)
872966
val understand = dialogLayout.findViewById<Button>(R.id.cancel_bubble_manager_first)
873967
val enable = dialogLayout.findViewById<Button>(R.id.enable_first)
874968
val image1 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_1_first)
875969
val image2 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_2_first)
876970
val image3 = dialogLayout.findViewById<ImageView>(R.id.image_bubble_3_first)
877971

972+
//Changing COLOR THEME
973+
understand.setTextColor(getButtonColor())
974+
enable.setTextColor(getButtonColor())
975+
text.setTextColor(getButtonColor())
976+
bubble1.setTextColor(getButtonColor())
977+
bubble2.setTextColor(getButtonColor())
978+
bubble3.setTextColor(getButtonColor())
979+
878980
//Configuring pictures
879981
if(nightMode){
880982
image1.setImageResource(R.drawable.ic_bubble_manager_1_dark)
@@ -912,11 +1014,29 @@ import java.util.*
9121014
val dialogLayout: View = inflater.inflate(R.layout.power_assistant_first_alert, null)
9131015

9141016
//Founding BUTTONS
1017+
val power = dialogLayout.findViewById<TextView>(R.id.power_assistant)
1018+
val power1 = dialogLayout.findViewById<TextView>(R.id.power_1)
1019+
val power2 = dialogLayout.findViewById<TextView>(R.id.power_2)
1020+
val power3 = dialogLayout.findViewById<TextView>(R.id.power_3)
1021+
val power4 = dialogLayout.findViewById<TextView>(R.id.power_4)
1022+
val power5 = dialogLayout.findViewById<TextView>(R.id.power_5)
1023+
val power6 = dialogLayout.findViewById<TextView>(R.id.power_6)
9151024
val understand = dialogLayout.findViewById<Button>(R.id.cancel_power_assistant_first)
9161025
val go = dialogLayout.findViewById<Button>(R.id.go_access_first)
9171026
val image1 = dialogLayout.findViewById<ImageView>(R.id.image_power_1_first)
9181027
val image2 = dialogLayout.findViewById<ImageView>(R.id.image_power_2_first)
9191028

1029+
//Changing COLOR THEME
1030+
understand.setTextColor(getButtonColor())
1031+
go.setTextColor(getButtonColor())
1032+
power.setTextColor(getButtonColor())
1033+
power1.setTextColor(getButtonColor())
1034+
power2.setTextColor(getButtonColor())
1035+
power3.setTextColor(getButtonColor())
1036+
power4.setTextColor(getButtonColor())
1037+
power5.setTextColor(getButtonColor())
1038+
power6.setTextColor(getButtonColor())
1039+
9201040
//Configuring pictures
9211041
if(nightMode){
9221042
image1.setImageResource(R.drawable.ic_power_assistant_1_dark)
@@ -954,9 +1074,16 @@ import java.util.*
9541074
val dialogLayout: View = inflater.inflate(R.layout.clear_data_allowing_alert, null)
9551075

9561076
//Founding BUTTONS
1077+
val text = dialogLayout.findViewById<TextView>(R.id.text_allow)
1078+
val subText = dialogLayout.findViewById<TextView>(R.id.text_clear)
9571079
val ok = dialogLayout.findViewById<Button>(R.id.ok_clear)
9581080
val cancel = dialogLayout.findViewById<Button>(R.id.cancel_clear)
9591081

1082+
//Changing COLOR THEME
1083+
ok.setTextColor(getButtonColor())
1084+
cancel.setTextColor(getButtonColor())
1085+
text.setTextColor(getButtonColor())
1086+
subText.setTextColor(getButtonColor())
9601087
//Configuring BACKGROUND
9611088
configBack(dialogLayout)
9621089

app/src/main/java/com/colorata/st/bubble/BubbleAdapter.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.view.ViewGroup
66
import android.widget.TextView
77
import androidx.recyclerview.widget.RecyclerView
88
import com.colorata.st.R
9+
import com.google.android.material.button.MaterialButton
910
import com.google.android.material.floatingactionbutton.FloatingActionButton
1011

1112
class BubbleAdapter(private val values: MutableList<String>, private val icon: MutableList<Int>/*, private val drawable: MutableList<Drawable?> = mutableListOf(null)*/): RecyclerView.Adapter<BubbleAdapter.ViewHolder>() {

app/src/main/res/layout/bubble_item.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
android:id="@+id/bubble_button"
1212
android:layout_width="wrap_content"
1313
android:layout_height="wrap_content"
14-
app:borderWidth="1dp"
15-
android:backgroundTint="@android:color/transparent"
14+
app:backgroundTint="@color/bubble_item"
1615
android:src="@drawable/ic_baseline_flash_on_24"
1716
app:tint="#ffffff"
1817
android:contentDescription="@string/bubble_item"

app/src/main/res/layout/bubble_manager_first_alert.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
app:layout_constraintBottom_toTopOf="@id/image_bubble_1_first"
4545
app:layout_constraintEnd_toEndOf="parent"
4646
app:layout_constraintStart_toStartOf="parent"
47+
android:layout_margin="@dimen/margin_button"
48+
android:padding="@dimen/padding_button"
4749
android:text="@string/enable"/>
4850

4951
<!-- Image PARAGRAPH 2_1 -->
@@ -131,6 +133,8 @@
131133
app:layout_constraintStart_toStartOf="parent"
132134
app:layout_constraintTop_toBottomOf="@id/image_bubble_3_first"
133135
app:layout_constraintBottom_toBottomOf="parent"
136+
android:layout_margin="@dimen/margin_button"
137+
android:padding="@dimen/padding_button"
134138
android:text="@string/understand"/>
135139

136140
</androidx.constraintlayout.widget.ConstraintLayout>

app/src/main/res/layout/first_change_city_alert.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<!-- Text HOW TO CHANGE -->
99
<TextView
10-
android:id="@+id/text_how_change"
10+
android:id="@+id/text_how_change_city"
1111
android:layout_width="wrap_content"
1212
android:layout_height="wrap_content"
1313
app:layout_constraintTop_toTopOf="parent"
@@ -27,7 +27,7 @@
2727
android:text="@string/enter_city_name_to_text_field"
2828
android:textSize="@dimen/size_first"
2929
android:layout_margin="@dimen/margin_text"
30-
app:layout_constraintTop_toBottomOf="@id/text_how_change"
30+
app:layout_constraintTop_toBottomOf="@id/text_how_change_city"
3131
app:layout_constraintStart_toStartOf="parent"
3232
app:layout_constraintEnd_toEndOf="parent"
3333
app:layout_constraintBottom_toTopOf="@id/understand_first_change_city_alert"/>

app/src/main/res/layout/help_alert.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
app:layout_constraintBottom_toTopOf="@id/image_power_1"
5757
app:layout_constraintEnd_toEndOf="parent"
5858
app:layout_constraintStart_toStartOf="parent"
59+
android:layout_margin="@dimen/margin_button"
60+
android:padding="@dimen/padding_button"
5961
android:text="@string/go"/>
6062

6163
<!-- Image PARAGRAPH 1_1 -->
@@ -258,6 +260,8 @@
258260
app:layout_constraintBottom_toTopOf="@id/image_bubble_1"
259261
app:layout_constraintEnd_toEndOf="parent"
260262
app:layout_constraintStart_toStartOf="parent"
263+
android:layout_margin="@dimen/margin_button"
264+
android:padding="@dimen/padding_button"
261265
android:text="@string/enable"/>
262266

263267
<!-- Image PARAGRAPH 2_1 -->

app/src/main/res/layout/settings_alert.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77

88
<!-- Text SETTINGS -->
99
<TextView
10-
android:id="@+id/text_about"
10+
android:id="@+id/text_settings"
1111
android:layout_width="wrap_content"
1212
android:layout_height="wrap_content"
1313
app:layout_constraintTop_toTopOf="parent"
1414
app:layout_constraintBottom_toTopOf="@id/settings_app"
1515
app:layout_constraintStart_toStartOf="parent"
1616
app:layout_constraintEnd_toEndOf="parent"
17+
android:layout_margin="@dimen/margin_text"
1718
android:textSize="@dimen/size_title_text"
1819
android:text="@string/settings"/>
1920

@@ -25,7 +26,7 @@
2526
app:layout_constraintBottom_toTopOf="@id/cancel_settings"
2627
app:layout_constraintEnd_toEndOf="parent"
2728
app:layout_constraintStart_toEndOf="@id/clear_data"
28-
app:layout_constraintTop_toBottomOf="@id/text_about"
29+
app:layout_constraintTop_toBottomOf="@id/text_settings"
2930
android:text="@string/app_settings"/>
3031

3132
<!-- Button CLEAR DATA -->

app/src/main/res/layout/weather_director_alert.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
app:layout_constraintBottom_toTopOf="@id/city_change"
1414
app:layout_constraintStart_toStartOf="parent"
1515
app:layout_constraintEnd_toEndOf="parent"
16+
android:layout_margin="@dimen/margin_text"
1617
android:textSize="@dimen/size_title_text"
1718
android:text="@string/weather_director"/>
1819

0 commit comments

Comments
 (0)