Skip to content

Commit

Permalink
Material3: less customizing for night
Browse files Browse the repository at this point in the history
 mode.
  • Loading branch information
dennisguse committed Jun 20, 2023
1 parent 5c17c8f commit a431850
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public void onGpsStatusChanged(GpsStatusValue newStatus) {

private void setFloatButton() {
viewBinding.trackListFabAction.setImageResource(recordingStatus.isRecording() ? R.drawable.ic_baseline_stop_24 : R.drawable.ic_baseline_record_24);
viewBinding.trackListFabAction.setBackgroundTintList(ContextCompat.getColorStateList(this, recordingStatus.isRecording() ? R.color.opentracks_secondary_color : R.color.red_dark));
viewBinding.trackListFabAction.setBackgroundTintList(ContextCompat.getColorStateList(this, recordingStatus.isRecording() ? R.color.opentracks : R.color.red_dark));
}

private void onRecordingStatusChanged(RecordingStatus status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ protected void onCreate(Bundle savedInstanceState) {
}

viewBinding.trackRecordingFabAction.setImageResource(R.drawable.ic_baseline_stop_24);
viewBinding.trackRecordingFabAction.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.opentracks_secondary_color));
viewBinding.trackRecordingFabAction.setBackgroundColor(ContextCompat.getColor(this, R.color.opentracks_secondary_color));
viewBinding.trackRecordingFabAction.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.opentracks));
viewBinding.trackRecordingFabAction.setBackgroundColor(ContextCompat.getColor(this, R.color.opentracks));
viewBinding.trackRecordingFabAction.setOnLongClickListener((view) -> {
ActivityUtils.vibrate(this, 1000);
trackRecordingServiceConnection.stopRecording(TrackRecordingActivity.this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
}

if (position == selected) {
imageView.setBackgroundColor(ContextCompat.getColor(parent.getContext(), R.color.opentracks_secondary_color));
imageView.setBackgroundColor(ContextCompat.getColor(parent.getContext(), R.color.opentracks));
} else {
imageView.setBackgroundColor(Color.TRANSPARENT);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/res/drawable/activated_background.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/opentracks_secondary_transparent" android:state_activated="true" />
<item android:drawable="@color/opentracks_transparent" android:state_activated="true" />
<item android:drawable="@android:color/transparent" />
</selector>
14 changes: 7 additions & 7 deletions src/main/res/drawable/ic_button_done.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
android:pathData="M62.5,62.5m-59.984,0a59.984,59.984 0,1 1,119.968 0a59.984,59.984 0,1 1,-119.968 0"
android:strokeWidth="5.03185"
android:fillColor="@android:color/transparent"
android:strokeColor="@color/opentracks_secondary_color"/>
<path
android:pathData="M62.5,62.5m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0"
android:strokeWidth="1.0"
android:fillColor="@color/opentracks_secondary_color"
android:strokeColor="@color/opentracks_secondary_color"/>
android:strokeColor="@color/opentracks" />
<path
android:pathData="M62.5,62.5m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0"
android:strokeWidth="1.0"
android:fillColor="@color/opentracks"
android:strokeColor="@color/opentracks" />
<path
android:pathData="M38.62,63.866 L52.899,78.144 86.38,44.664"
android:strokeLineJoin="miter"
android:strokeWidth="6.2"
android:fillColor="@color/opentracks_secondary_color"
android:fillColor="@color/opentracks"
android:strokeColor="@android:color/white"
android:strokeLineCap="butt"/>
</vector>
4 changes: 2 additions & 2 deletions src/main/res/drawable/ic_button_resume.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
android:pathData="M62.5,62.5m-59.984,0a59.984,59.984 0,1 1,119.968 0a59.984,59.984 0,1 1,-119.968 0"
android:strokeWidth="5.03185"
android:fillColor="@android:color/transparent"
android:strokeColor="@color/opentracks_secondary_color"/>
android:strokeColor="@color/opentracks" />
<path
android:pathData="M62.5,62.5m-50,0a50,50 0,1 1,100 0a50,50 0,1 1,-100 0"
android:strokeWidth="6.91728"
android:fillColor="@color/opentracks_secondary_color"
android:fillColor="@color/opentracks"
android:strokeColor="@android:color/transparent"/>
<path
android:pathData="M87.6,62.5 L67.991,73.822 48.381,85.143l-0,-22.643 0,-22.643 19.61,11.322z"
Expand Down
1 change: 1 addition & 0 deletions src/main/res/layout/track_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ limitations under the License.

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/track_list_fab_action"
android:tint="@android:color/white"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/image_record"
Expand Down
26 changes: 7 additions & 19 deletions src/main/res/values-night/themes_custom.xml
Original file line number Diff line number Diff line change
@@ -1,37 +1,25 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<style name="ThemeCustom" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/opentracks_secondary_color</item>
<item name="colorOnPrimary">@android:color/white</item>
<item name="colorPrimary">@color/opentracks</item>
<item name="colorSecondary">@color/opentracks</item>

<item name="colorSecondary">@color/opentracks_secondary_color</item>
<item name="colorSecondaryVariant">@color/opentracks_secondary_color</item>
<item name="colorOnSecondary">@color/opentracks_on_secondary_color</item>

<item name="android:statusBarColor">@android:color/black</item>

<item name="android:colorBackground">@android:color/black</item>
<item name="colorOnBackground">@android:color/white</item>

<item name="android:activatedBackgroundIndicator">@drawable/activated_background</item>
<item name="android:statusBarColor">@color/oled_friendly</item>
<item name="android:windowLightStatusBar">false</item>
<item name="android:navigationBarColor">@color/oled_friendly</item>

<item name="bottomAppBarStyle">@style/Widget.OpenTracks.BottomAppBar</item>

<item name="floatingActionButtonStyle">@style/Widget.OpenTracks.FloatingActionButton</item>

<item name="android:windowActionModeOverlay">true</item>

<item name="windowActionModeOverlay">true</item>
</style>

<style name="Widget.OpenTracks.BottomAppBar" parent="Widget.Material3.BottomAppBar">
<item name="materialThemeOverlay">@style/ThemeOverlay.OpenTracks.BottomAppBar</item>
</style>

<style name="ThemeOverlay.OpenTracks.BottomAppBar" parent="">
<item name="colorPrimary">@android:color/black</item>
<item name="colorAccent">@android:color/white</item>
<!-- <item name="android:drawableTint">@android:color/white</item>-->

<item name="colorPrimary">@color/oled_friendly</item>
</style>

</resources>
9 changes: 3 additions & 6 deletions src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<resources>
<color name="oled_friendly">@android:color/black</color>
<!-- Brand colors -->
<color name="opentracks_primary_color">#344955</color>
<color name="opentracks_primary_variant_color">#232f34</color>
<color name="opentracks_on_primary_color">@android:color/white</color>
<color name="opentracks_secondary_color">#FF6D00</color>
<color name="opentracks_secondary_transparent">#55FF6D00</color>
<color name="opentracks_on_secondary_color">@android:color/white</color>
<color name="opentracks">#FF6D00</color>
<color name="opentracks_transparent">#55FF6D00</color> <!-- TODO REMOVE -->

<!-- Chart colors -->
<color name="chart_cadence_border">#FFF128F3</color> <!-- pink -->
Expand Down
3 changes: 2 additions & 1 deletion src/main/res/values/themes_custom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ limitations under the License.
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<style name="ThemeCustom" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/opentracks_secondary_color</item>
<item name="colorPrimary">@color/opentracks</item>
<item name="colorSecondary">@color/opentracks</item>

<item name="android:statusBarColor">?attr/colorSurfaceBright</item>
<item name="android:windowLightStatusBar">true</item>
Expand Down

0 comments on commit a431850

Please sign in to comment.