Skip to content

Commit

Permalink
"A few minor tweaks" (refactored entire theme resource structure)
Browse files Browse the repository at this point in the history
  • Loading branch information
19lmyers committed May 8, 2018
1 parent 243aef0 commit 22cc092
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 81 deletions.
43 changes: 28 additions & 15 deletions app/src/main/java/com/team980/thunderscout/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v7.app.AlertDialog;

import com.danielstone.materialaboutlibrary.MaterialAboutActivity;
Expand All @@ -39,8 +43,9 @@

public class AboutActivity extends MaterialAboutActivity {

@NonNull
@Override
protected MaterialAboutList getMaterialAboutList(Context context) {
protected MaterialAboutList getMaterialAboutList(@NonNull Context context) {
MaterialAboutCard.Builder titleCard = new MaterialAboutCard.Builder();

titleCard.addItem(new MaterialAboutTitleItem.Builder()
Expand All @@ -51,7 +56,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {
titleCard.addItem(new MaterialAboutActionItem.Builder()
.text("Version " + BuildConfig.VERSION_NAME)
.subText("Click for patch notes")
.icon(R.drawable.ic_info_outline_24dp)
.icon(getTintedIcon(R.drawable.ic_info_outline_24dp))
.setOnClickAction(() -> {
AlertDialog.Builder builder = new AlertDialog.Builder(AboutActivity.this);
builder.setTitle("New in version " + BuildConfig.VERSION_NAME);
Expand All @@ -63,7 +68,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {

titleCard.addItem(new MaterialAboutActionItem.Builder()
.text("View on Google Play")
.icon(R.drawable.ic_google_play_24dp)
.icon(getTintedIcon(R.drawable.ic_google_play_24dp))
.setOnClickAction(() -> {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getPackageName())));
Expand All @@ -75,7 +80,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {

titleCard.addItem(new MaterialAboutActionItem.Builder()
.text("View on Amazon Appstore")
.icon(R.drawable.ic_amazon_24dp)
.icon(getTintedIcon(R.drawable.ic_amazon_24dp))
.setOnClickAction(() -> {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("amzn://apps/android?p=" + getPackageName())));
Expand All @@ -88,7 +93,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {
titleCard.addItem(new MaterialAboutActionItem.Builder()
.text("Fork on GitHub")
.subText("Team980/ThunderScout-Android")
.icon(R.drawable.ic_github_24dp)
.icon(getTintedIcon(R.drawable.ic_github_24dp))
.setOnClickAction(() -> {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://github.com/Team980/ThunderScout-Android"));
Expand All @@ -98,7 +103,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {

/*titleCard.addItem(new MaterialAboutActionItem.Builder()
.text("View on Chief Delphi")
.icon(R.drawable.ic_forum_24dp)
.icon(getTintedIcon(R.drawable.ic_forum_24dp))
.setOnClickAction(() -> {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://www.chiefdelphi.com/forums/showthread.php?t=151953"));
Expand All @@ -108,7 +113,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {

titleCard.addItem(new MaterialAboutActionItem.Builder()
.text("Open source licenses")
.icon(R.drawable.ic_code_24dp)
.icon(getTintedIcon(R.drawable.ic_code_24dp))
.setOnClickAction(() -> new LibsBuilder()
.withActivityStyle(Libs.ActivityStyle.LIGHT_DARK_TOOLBAR)
.withActivityTheme(R.style.ThunderScout_LibraryInfo)
Expand All @@ -123,13 +128,13 @@ protected MaterialAboutList getMaterialAboutList(Context context) {
authorCard.addItem(new MaterialAboutActionItem.Builder()
.text("Luke Myers")
.subText("Lead Developer")
.icon(R.drawable.ic_person_24dp)
.icon(getTintedIcon(R.drawable.ic_person_24dp))
.build());

authorCard.addItem(new MaterialAboutActionItem.Builder()
.text("Chief Delphi")
.subText("@19lmyers")
.icon(R.drawable.ic_forum_24dp)
.icon(getTintedIcon(R.drawable.ic_forum_24dp))
.setOnClickAction(() -> {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://www.chiefdelphi.com/forums/member.php?u=91239"));
Expand All @@ -146,7 +151,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {
teamCard.addItem(new MaterialAboutActionItem.Builder()
.text("Like us on Facebook")
.subText("@Team980Thunderbots")
.icon(R.drawable.ic_facebook_24dp)
.icon(getTintedIcon(R.drawable.ic_facebook_24dp))
.setOnClickAction(() -> {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://www.facebook.com/Team980ThunderBots"));
Expand All @@ -157,7 +162,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {
teamCard.addItem(new MaterialAboutActionItem.Builder()
.text("Follow us on Twitter")
.subText("@frc980")
.icon(R.drawable.ic_twitter_24dp)
.icon(getTintedIcon(R.drawable.ic_twitter_24dp))
.setOnClickAction(() -> {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://twitter.com/frc980"));
Expand All @@ -168,7 +173,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {
teamCard.addItem(new MaterialAboutActionItem.Builder()
.text("Follow us on Instagram")
.subText("@frcteam980")
.icon(R.drawable.ic_instagram_24dp)
.icon(getTintedIcon(R.drawable.ic_instagram_24dp))
.setOnClickAction(() -> {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://www.instagram.com/frcteam980/"));
Expand All @@ -179,7 +184,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {
teamCard.addItem(new MaterialAboutActionItem.Builder()
.text("Follow us on Snapchat")
.subText("@frcteam980")
.icon(R.drawable.ic_snapchat_24dp)
.icon(getTintedIcon(R.drawable.ic_snapchat_24dp))
.setOnClickAction(() -> {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://www.snapchat.com/add/frcteam980"));
Expand All @@ -190,7 +195,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {
teamCard.addItem(new MaterialAboutActionItem.Builder()
.text("Subscribe to us on YouTube")
.subText("FRC Team 980 Official")
.icon(R.drawable.ic_youtube_24dp)
.icon(getTintedIcon(R.drawable.ic_youtube_24dp))
.setOnClickAction(() -> {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://www.youtube.com/channel/UCxW_2sc2SANjckwsFJt14AQ"));
Expand All @@ -201,7 +206,7 @@ protected MaterialAboutList getMaterialAboutList(Context context) {
teamCard.addItem(new MaterialAboutActionItem.Builder()
.text("Visit our website")
.subText("team980.com")
.icon(R.drawable.ic_web_24dp)
.icon(getTintedIcon(R.drawable.ic_web_24dp))
.setOnClickAction(() -> {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("http://team980.com/"));
Expand All @@ -221,4 +226,12 @@ protected CharSequence getActivityTitle() {
return getString(R.string.mal_title_about);
}

/**
* Manually create Drawable icons to "support" DayNight icon tinting
*/
private Drawable getTintedIcon(@DrawableRes int iconRes) {
Drawable icon = getResources().getDrawable(iconRes);
DrawableCompat.setTint(icon, getResources().getColor(R.color.about_icon_override));
return icon;
}
}
4 changes: 2 additions & 2 deletions app/src/main/res/layout/card_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
android:layout_height="24dp"
android:layout_alignParentLeft="true"
android:layout_marginRight="8dp"
android:tint="?android:attr/textColorPrimary"
android:tint="?android:attr/textColorSecondary"
tools:src="@drawable/ic_info_24dp" />

<TextView
Expand All @@ -63,7 +63,7 @@
android:fontFamily="@font/nunito_sans_bold"
android:gravity="center_vertical"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
android:textColor="@color/card_title_color"
android:textSize="14sp"
android:textStyle="bold"
tools:text="Card Title" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/match_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:gravity="center"
android:textColor="?android:attr/textColorPrimary"
android:textColor="?android:attr/textColorSecondary"
android:textSize="36sp"
tools:text="1" />

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
<color name="background_floating">#424242</color>
<color name="background_card">#424242</color>

<color name="navigation_bar_divider">#32FFFFFF</color>
<!--<color name="navigation_bar">@color/primary_dark</color>
<color name="navigation_bar_divider">@color/primary</color>-->

<color name="card_title_color">@android:color/primary_text_dark</color>
<color name="about_icon_override">@android:color/primary_text_dark</color>
</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values-night/styles-dark.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
<item name="android:windowLightNavigationBar" tools:targetApi="O_MR1">false</item>
</style>

<style name="ThunderScout.DayNight.MaterialAbout" parent="Theme.Mal.Light.DarkActionBar">
<style name="ThunderScout.DayNight.MaterialAbout" parent="Theme.Mal.Dark">
<item name="android:windowLightNavigationBar" tools:targetApi="O_MR1">false</item>
</style>

<style name="ThunderScout.DayNight.LibraryInfo" parent="AboutLibrariesTheme.Light.DarkToolbar">
<style name="ThunderScout.DayNight.LibraryInfo" parent="AboutLibrariesTheme">
<item name="android:windowLightNavigationBar" tools:targetApi="O_MR1">false</item>
</style>

Expand Down
61 changes: 0 additions & 61 deletions app/src/main/res/values-v21/styles.xml

This file was deleted.

3 changes: 3 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@

<color name="shortcut_background">#F5F5F5</color>

<color name="card_title_color">@android:color/tertiary_text_light</color>
<color name="about_icon_override">@android:color/tertiary_text_light</color>

<!--<color name="primary">#fbc02d</color> Old theme
<color name="primary_dark">#F9A825</color>
<color name="accent">#fdd835</color>-->
Expand Down

0 comments on commit 22cc092

Please sign in to comment.