Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Commit

Permalink
New themes: Ford style and my own Dark design
Browse files Browse the repository at this point in the history
  • Loading branch information
jilleb committed Jan 18, 2019
1 parent 28f6d42 commit 0b5f2bc
Show file tree
Hide file tree
Showing 20 changed files with 94 additions and 55 deletions.
46 changes: 20 additions & 26 deletions app/src/main/java/com/mqbcoding/stats/DashboardFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public class DashboardFragment extends CarFragment {
//icons/labels of the data elements. upper left, upper right, lower left, lower right.
private TextView mIconElement1, mIconElement2, mIconElement3, mIconElement4;
//values of the data elements. upper left, upper right, lower left, lower right.
private TextView mValueElement1, mValueElement2, mValueElement3, mValueElement4, mTitleElement, mTitleElementRight, mTitleElementLeft, mTitleIcon1, mTitleIcon2;
private TextView mValueElement1, mValueElement2, mValueElement3, mValueElement4, mTitleElement, mTitleElementRight, mTitleElementLeft;
private ConstraintLayout mConstraintClockLeft, mConstraintClockRight, mConstraintClockCenter;
private ConstraintLayout mConstraintGraphLeft, mConstraintGraphRight, mConstraintGraphCenter;
private TextView mTextMinLeft, mTextMaxLeft;
Expand Down Expand Up @@ -277,10 +277,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
ambientOn = sharedPreferences.getBoolean("ambientActive", false); //true = use ambient colors, false = don't use.
selectedTheme = sharedPreferences.getString("selectedTheme", "");
//todo: fix this. currently not very efficient, because this is already requested in MainCarActivity
selectedBackground = sharedPreferences.getString("selectedBackground", "Black");
selectedBackground = sharedPreferences.getString("selectedBackground", "background_incar_black");

Log.d(TAG,"Background: " + selectedBackground);
//Set wallpaper
int resId = getResources().getIdentifier(selectedBackground, "drawable", getContext().getPackageName());
Drawable wallpaperImage = getResources().getDrawable(resId);

rootView.setBackground(wallpaperImage);

//set textview to have a custom digital font:
Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), "digital.ttf");
Expand Down Expand Up @@ -385,8 +388,6 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
mTitleElement = rootView.findViewById(R.id.textTitleElement);
mTitleElementRight = rootView.findViewById(R.id.textTitleElementRight);
mTitleElementLeft = rootView.findViewById(R.id.textTitleElementLeft);
mTitleIcon1= rootView.findViewById(R.id.titleIcon1);
mTitleIcon2= rootView.findViewById(R.id.titleIcon2);

//labels at these text elements:
mIconElement1 = rootView.findViewById(R.id.icon_Element1);
Expand Down Expand Up @@ -761,8 +762,6 @@ public void onDestroyView() {
mValueElement4 = null;
mTitleElement = null;
mTitleElementRight = null;
mTitleIcon1=null;
mTitleIcon2=null;
mIconElement1 = null;
mIconElement2 = null;
mIconElement3 = null;
Expand Down Expand Up @@ -1227,18 +1226,16 @@ private void setupGraph(Speedometer clock, GraphView graph, LineGraphSeries seri
//graph.getViewport().setMinY(0);
graph.getViewport().setScrollable(false);
graph.getGridLabelRenderer().setVerticalLabelsVisible(true);
graph.getGridLabelRenderer().setGridColor(Color.parseColor("#44FFFFFF"));
graph.getGridLabelRenderer().setGridColor(Color.parseColor("#22FFFFFF"));

graph.getGridLabelRenderer().setHorizontalLabelsVisible(false);
graph.getGridLabelRenderer().setGridStyle(GridLabelRenderer.GridStyle.HORIZONTAL);
graph.getViewport().setBackgroundColor(Color.argb(0, 255, 0, 0));
serie.setDrawDataPoints(false);
serie.setThickness(3);
serie.setThickness(2);
serie.setColor(Color.argb(80, 255, 255, 255));

}


private void setupClocks(String queryClock, Speedometer clock, TextView icon, RaySpeedometer ray, Speedometer min, Speedometer max) {

String queryTrim = "";
Expand Down Expand Up @@ -1692,45 +1689,44 @@ private void updateClock(String query, Speedometer clock, RaySpeedometer visray,
return;
}
// update clock with latest clockValue
if (clockValue != null) {
clock.speedTo(clockValue);
visray.speedTo(clockValue);

graph.getViewport().setMaxY(clock.getMaxSpeed());
graph.getViewport().setMinY(clock.getMinSpeed());


series.appendData(new DataPoint(graphLastXValue, clockValue), true, 200);
String tempString = (String.format(Locale.US, getContext().getText(R.string.format_decimals).toString(), clockValue));
graphValue.setText(tempString);
}
}

// get the speed from the clock and have the high-visibility rays move to this speed as well
float tempValue = clock.getSpeed();
float clockValueToGraph = clock.getSpeed();
// update graph, based on the value of the clock


series.appendData(new DataPoint(graphLastXValue, clockValueToGraph), true, 400);
String tempString = (String.format(Locale.US, getContext().getText(R.string.format_decimals).toString(), clockValueToGraph));
graphValue.setText(tempString);

// update the max clocks and text
if (stagingDone) {
Float maxValue = clockmax.getSpeed();
Float minValue = clockmin.getSpeed();

if (tempValue > maxValue) {
clockmax.setSpeedAt(tempValue);
textmax.setText(String.format(Locale.US, getContext().getText(R.string.format_decimals).toString(), tempValue));
if (clockValueToGraph > maxValue) {
clockmax.setSpeedAt(clockValueToGraph);
textmax.setText(String.format(Locale.US, getContext().getText(R.string.format_decimals).toString(), clockValueToGraph));
}

// update the min clocks and text
if (tempValue < minValue) {
clockmin.setSpeedAt(tempValue);
textmin.setText(String.format(Locale.US, getContext().getText(R.string.format_decimals).toString(), tempValue));
if (clockValueToGraph < minValue) {
clockmin.setSpeedAt(clockValueToGraph);
textmin.setText(String.format(Locale.US, getContext().getText(R.string.format_decimals).toString(), clockValueToGraph));
}
}

}
}


private void updateTitle() {

String currentTitleValue = mTitleElement.getText().toString();
Expand All @@ -1753,7 +1749,6 @@ private void updateTitle() {
if (location1 == null) {
if (location2 == null) {
leftTitle = "";
mTitleIcon2.setVisibility(View.INVISIBLE);
} else if (location2 != null) {
leftTitle = location2;
}
Expand Down Expand Up @@ -1782,7 +1777,6 @@ private void updateTitle() {
mTitleElementRight.setText(temperature);
}
} else if (currentTemperature == null){
mTitleIcon1.setVisibility(View.INVISIBLE);
mTitleElementRight.setText("");

}
Expand Down
7 changes: 6 additions & 1 deletion app/src/main/java/com/mqbcoding/stats/MainCarActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ public void onCreate(Bundle bundle) {
case "Test":
setTheme(R.style.AppTheme_Testing);
break;

case "Dark":
setTheme(R.style.AppTheme_Dark);
break;
case "Mustang GT":
setTheme(R.style.AppTheme_Ford);
break;
}
// get user setting for mic on/of
micOn = sharedPreferences.getBoolean("micActive", true);
Expand Down
Binary file modified app/src/main/res/drawable/background_incar_dots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_theme_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_theme_ford.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/needle_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/sw_background_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/sw_background_ford.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable/thumb_background_incar_dots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 1 addition & 17 deletions app/src/main/res/layout/fragment_dashboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
android:layout_height="40dp"
android:textAppearance="@style/CarBody2"
android:textColor="@android:color/white"
app:layout_constraintLeft_toRightOf="@id/titleIcon2"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
Expand All @@ -50,21 +50,5 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/titleIcon1"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/ic_outsidetemperature"
app:layout_constraintRight_toLeftOf="@id/textTitleElementRight"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/titleIcon2"
android:layout_width="30dp"
android:layout_height="30dp"
android:background="@drawable/ic_world"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />


</android.support.constraint.ConstraintLayout>
14 changes: 4 additions & 10 deletions app/src/main/res/layout/layout_dashboard_gauges.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@
style="@style/AppTheme.Car.Speedometer"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:layout_marginEnd="2dp"
android:background="?attr/themedDialBackground"
android:padding="25dp"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down Expand Up @@ -190,9 +189,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
>

app:layout_constraintTop_toTopOf="parent">


<com.github.anastr.speedviewlib.SpeedView
Expand Down Expand Up @@ -312,7 +309,6 @@
style="@style/AppTheme.Car.Speedometer"
android:layout_width="275dp"
android:layout_height="wrap_content"
android:layout_marginStart="2dp"
android:background="?attr/themedDialBackground"
android:elevation="0dp"
android:padding="25dp"
Expand Down Expand Up @@ -445,8 +441,7 @@

app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
app:layout_constraintStart_toStartOf="parent" />


<android.support.v7.widget.CardView
Expand Down Expand Up @@ -523,9 +518,9 @@

<android.support.constraint.ConstraintLayout
android:id="@+id/constraintGraphLeft"
android:visibility="invisible"
android:layout_width="275dp"
android:layout_height="0dp"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/constraintClockLeft"
app:layout_constraintRight_toRightOf="@+id/constraintClockLeft"
app:layout_constraintStart_toStartOf="@+id/constraintClockLeft"
Expand All @@ -543,8 +538,7 @@

app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
/>
app:layout_constraintStart_toStartOf="parent" />

<android.support.v7.widget.CardView
android:id="@+id/left_layout"
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
<item>Audi Virtual Cockpit</item>
<item>Audi TT</item>
<item>Minimalistic</item>
<item>Dark</item>
<item>Mustang GT</item>
<item>Test</item>
</string-array>

Expand All @@ -40,6 +42,8 @@
<item>@drawable/ic_theme_audivc</item>
<item>@drawable/ic_theme_auditt</item>
<item>@drawable/ic_theme_minimalistic</item>
<item>@drawable/ic_theme_dark</item>
<item>@drawable/ic_theme_ford</item>
<item>@drawable/ic_theme_test</item>
</array>

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<color name="yellow">#77fecc00</color>
<color name="blue">#770000FF</color>
<color name="fordblue">#0066ff</color>
<color name="green">#7700FF00</color>
<color name="white">#77ffffff</color>
<color name="pink">#77FF69B4</color>
Expand Down
59 changes: 58 additions & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@
<item name="themedEmptyDialBackground">@drawable/dial_background_empty_vw2</item>
<item name="themedBlankDialBackground">@drawable/dial_background_blank_vw2</item>
<item name="themedCarBackground">@drawable/background_incar_vw_plaid</item>
<item name="themedNeedle">@drawable/needle_vw3</item>
<item name="themedNeedle">@drawable/needle_vw3</item>
<item name="sv_markColor">@android:color/transparent</item>
<item name="themedStopWatchBackground">@drawable/sw_background_vw2</item>
<item name="themedNeedleColor">@color/red</item>
Expand Down Expand Up @@ -484,6 +484,63 @@
<item name="sv_textSize">12sp</item>
<item name="sv_unitSpeedInterval">4dp</item>
</style>

<style name="AppTheme.Dark" parent="AppTheme.Car">
<item name="themedCarBackground">@drawable/background_incar_black</item>
<item name="themedDialBackground">@drawable/dial_background_dark</item>
<item name="themedEmptyDialBackground">@drawable/dial_background_empty_dark</item>
<item name="themedBlankDialBackground">@drawable/dial_background_blank_dark</item>
<item name="themedNeedle">@drawable/needle_dark</item>
<item name="sv_markColor">@android:color/transparent</item>
<item name="sv_markWidth">20dp</item>
<item name="themedStopWatchBackground">@drawable/sw_background_dark</item>
<item name="themedNeedleColor">@color/red</item>
<item name="sv_withIndicatorLight">true</item>
<item name="sv_indicatorLightColor">#00FF0000</item>
<item name="sv_indicator">HalfLineIndicator</item>
<item name="sv_indicatorWidth">2dp</item>
<item name="sv_tickPadding">0dp</item>
<item name="sv_tickRotation">false</item>
<item name="sv_speedTextPadding">50dp</item>
<item name="sv_withTremble">false</item>
<item name="sv_speedTextColor">@color/car_primary</item>
<item name="sv_speedTextSize">32sp</item>
<item name="sv_unitTextColor">@color/car_primary</item>
<item name="sv_unitTextSize">20sp</item>
<item name="sv_textColor">@android:color/transparent</item>
<item name="sv_textSize">12sp</item>
<item name="sv_unitSpeedInterval">4dp</item>
</style>


<style name="AppTheme.Ford" parent="AppTheme.Car">
<item name="themedCarBackground">@drawable/background_incar_black</item>
<item name="themedDialBackground">@drawable/dial_background_ford</item>
<item name="themedEmptyDialBackground">@drawable/dial_background_empty_ford</item>
<item name="themedBlankDialBackground">@drawable/dial_background_blank_ford</item>
<item name="themedNeedle">@drawable/needle_mib2p</item>
<item name="sv_markColor">@android:color/transparent</item>
<item name="sv_markWidth">20dp</item>
<item name="themedStopWatchBackground">@drawable/dial_background_blank_ford</item>
<item name="themedNeedleColor">@color/fordblue</item>
<item name="sv_withIndicatorLight">true</item>
<item name="sv_indicatorLightColor">#880066ff</item>
<item name="sv_indicator">HalfLineIndicator</item>
<item name="sv_indicatorColor">@android:color/white</item>
<item name="sv_indicatorWidth">2dp</item>
<item name="sv_tickPadding">15dp</item>
<item name="sv_tickRotation">false</item>
<item name="sv_speedTextPadding">50dp</item>
<item name="sv_withTremble">false</item>
<item name="sv_speedTextColor">@color/car_primary</item>
<item name="sv_speedTextSize">32sp</item>
<item name="sv_unitTextColor">@color/car_primary</item>
<item name="sv_unitTextSize">20sp</item>
<item name="sv_textColor">@android:color/transparent</item>
<item name="sv_textSize">12sp</item>
<item name="sv_unitSpeedInterval">4dp</item>
</style>

<style name="AppTheme.Car.ProgressBar.Horizontal" parent="Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/progress_vertical_material_car</item>
<item name="android:minWidth">@dimen/progress_bar_height_material_car</item>
Expand Down

0 comments on commit 0b5f2bc

Please sign in to comment.