Skip to content

Commit fe2ad4c

Browse files
author
Takehiro
committed
Enhanced styling in Dashboard, Dashboard_chart (not perfect yet). Fixed Gauge styling. Fixed Bottom navigation in chart, gauge.
1 parent 1289d39 commit fe2ad4c

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

androidapp/app/src/main/java/com/cantech/cannect/Dashboard_chart.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import android.widget.ArrayAdapter;
2323
import android.widget.Button;
2424
import android.widget.Spinner;
25+
import android.widget.TextView;
2526
import android.widget.Toast;
2627

2728

@@ -40,6 +41,8 @@
4041

4142

4243
public class Dashboard_chart extends AppCompatActivity {
44+
SharedPref sharedPref;
45+
String spinnerTextColor;
4346

4447
StringBuilder messages;
4548
DataParsing dataParsing;
@@ -62,6 +65,16 @@ public class Dashboard_chart extends AppCompatActivity {
6265

6366
@Override
6467
protected void onCreate(Bundle savedInstanceState) {
68+
//load saved theme state
69+
sharedPref = new SharedPref(this);
70+
//set theme
71+
if(sharedPref.loadDarkModeState()==true){
72+
setTheme(R.style.darkTheme);
73+
spinnerTextColor = "#FFFFFF";
74+
}else{
75+
setTheme(R.style.AppTheme);
76+
spinnerTextColor = "#000000";
77+
}
6578
super.onCreate(savedInstanceState);
6679
setContentView(R.layout.activity_dashboard_chart);
6780

@@ -98,6 +111,7 @@ protected void onCreate(Bundle savedInstanceState) {
98111
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
99112
toDisplay = adapterView.getItemAtPosition(i).toString();
100113
reDesignChart(lineDataSet, toDisplay);
114+
((TextView) view).setTextColor(Color.parseColor(spinnerTextColor));
101115
}
102116

103117
@Override
@@ -193,6 +207,10 @@ public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
193207
startActivity(new Intent(getApplicationContext(),Dashboard_gauge.class));
194208
overridePendingTransition(0,0);
195209
return true;
210+
case R.id.DOF:
211+
startActivity(new Intent(getApplicationContext(),FrictionCircle.class));
212+
overridePendingTransition(0,0);
213+
return true;
196214
}
197215
return false;
198216
}

androidapp/app/src/main/java/com/cantech/cannect/Dashboard_gauge.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
175175
return true;
176176
case R.id.Gauge:
177177
return true;
178+
case R.id.DOF:
179+
startActivity(new Intent(getApplicationContext(),FrictionCircle.class));
180+
overridePendingTransition(0,0);
181+
return true;
178182
}
179183
return false;
180184
}

androidapp/app/src/main/res/layout/activity_dashboard.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
<com.google.android.material.bottomnavigation.BottomNavigationView
1818
android:layout_width="match_parent"
1919
android:layout_height="wrap_content"
20-
android:id="@+id/bottom_navigation"
21-
app:itemBackground="?attr/barcolor"
20+
android:id="@id/bottom_navigation"
21+
app:itemBackground="@color/colorPrimary"
2222
app:itemTextColor="@drawable/selector"
2323
app:itemIconTint="@drawable/selector"
2424
app:menu="@menu/menu_navigation"
25-
android:layout_alignParentBottom="true"/>
25+
android:layout_alignParentBottom="true"
26+
tools:ignore="MissingConstraints" />
2627

2728
</RelativeLayout>

androidapp/app/src/main/res/layout/activity_dashboard_gauge.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,11 @@
99
android:background="?attr/backgroundcolor"
1010
tools:context=".Dashboard_gauge">
1111

12-
<TextView
13-
14-
android:id="@+id/gauge_view"
15-
android:layout_width="wrap_content"
16-
android:layout_height="wrap_content"
17-
android:layout_centerHorizontal="true"
18-
android:text="Vehicle DashBoard"
19-
android:textColor="#000"
20-
android:textStyle="bold"
21-
android:textSize="30sp"/>
22-
2312
<GridLayout
2413
android:id="@+id/grid_layout_gauge"
2514
android:layout_width="match_parent"
2615
android:layout_height="match_parent"
2716
android:layout_above="@+id/bottom_navigation"
28-
android:layout_below="@+id/gauge_view"
2917
android:rowCount="2"
3018
android:columnCount="2">
3119

0 commit comments

Comments
 (0)