Skip to content

Commit

Permalink
Add night theme support to sample and library. (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
vanniktech authored Jun 1, 2017
1 parent 0289e27 commit aa13afd
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import android.app.Application;
import android.os.StrictMode;
import android.support.v7.app.AppCompatDelegate;
import com.squareup.leakcanary.LeakCanary;
import com.vanniktech.emoji.EmojiManager;
import com.vanniktech.emoji.ios.IosEmojiProvider;

import static android.support.v7.app.AppCompatDelegate.MODE_NIGHT_AUTO;

public class EmojiApplication extends Application {
@Override public void onCreate() {
super.onCreate();
Expand All @@ -14,6 +17,8 @@ public class EmojiApplication extends Application {
return;
}

AppCompatDelegate.setDefaultNightMode(MODE_NIGHT_AUTO);

EmojiManager.install(new IosEmojiProvider());

if (BuildConfig.DEBUG) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#FFF"
android:background="@color/chat_input_background"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="4dp">
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/dialog_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:id="@+id/main_dialog_emoji_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#FFF"
android:background="@color/chat_input_background"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="4dp">
Expand Down Expand Up @@ -51,4 +51,4 @@
app:srcCompat="@drawable/ic_send"
tools:ignore="ContentDescription"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
8 changes: 8 additions & 0 deletions app/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>

<color name="chat_input_background">#212121</color>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>

<color name="chat_input_background">#FFFFFF</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
Expand Down
6 changes: 6 additions & 0 deletions emoji/src/main/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="emoji_background">#13100e</color>
<color name="emoji_icons">#61ffffff</color>
<color name="emoji_divider">#1fffffff</color>
</resources>
6 changes: 3 additions & 3 deletions emoji/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="emoji_background">#ECEFF1</color>
<color name="emoji_background">#eceff1</color>
<color name="emoji_icons">#61000000</color>
<color name="emoji_divider">#1F000000</color>
</resources>
<color name="emoji_divider">#1f000000</color>
</resources>

0 comments on commit aa13afd

Please sign in to comment.