Commit f033e3eb authored by Gilbert Ndresaj's avatar Gilbert Ndresaj

Theme Dark & Light #2

parent e4b8ab0b
......@@ -14,6 +14,7 @@ import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.leafpic.app.Adapters.SelectAlbumAdapter;
......@@ -75,6 +76,16 @@ public class SelectAlbumActivity extends AppCompatActivity {
}
});
loadAlbumPreview();
//Base Theme
LinearLayout ll = (LinearLayout) findViewById(R.id.select_album_layout);
if (SP.getBoolean("set_dark_theme", false)){
//setTheme(R.style.AppTheme_Dark);
ll.setBackgroundColor(getColor(R.color.background_material_dark));
}else {
//setTheme(R.style.AppTheme);
ll.setBackgroundColor(getColor(R.color.background_material_light));
}
}
private void loadAlbumPreview(){
......
package com.leafpic.app;
import android.app.Dialog;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
......@@ -10,7 +11,9 @@ import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
public class SettingsActivity extends AppCompatActivity {
......@@ -68,6 +71,7 @@ public class SettingsActivity extends AppCompatActivity {
}
};
*/
}
@Override
......@@ -82,10 +86,13 @@ public class SettingsActivity extends AppCompatActivity {
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
boolean NavBar = SP.getBoolean("nav_bar", false);
/**** Nav Bar ****/
if (NavBar)
getWindow().setNavigationBarColor(getColor(R.color.toolbar));
else getWindow().setNavigationBarColor(getColor(R.color.md_black_1000));
/**** Status Bar */
getWindow().setStatusBarColor(getColor(R.color.primary));
/*
if (SP.getBoolean("set_dark_theme", false)){
setTheme(R.style.PreferencesThemeLight);
......@@ -101,24 +108,30 @@ public class SettingsActivity extends AppCompatActivity {
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
Preference p = findPreference("accent_color");
Preference p = findPreference("primary_color");
p.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
/* new MaterialDialog.Builder(getContext())
.title(R.string.setting_accent_color_title)
.items(R.array.preference_accent_Color)
.itemsCallbackSingleChoice(-1, new MaterialDialog.ListCallbackSingleChoice() {
@Override
public boolean onSelection(MaterialDialog dialog, View view, int which, CharSequence text) {
return true;
}
})
.positiveText("OK")
.show();*/
// custom dialog
final Dialog dialog = new Dialog(getContext());
dialog.setContentView(R.layout.custom_color_piker_primary);
dialog.setTitle("Primary Color");
// set the custom dialog components - text, image and button
TextView grey = (TextView) dialog.findViewById(R.id.grey);
TextView green = (TextView) dialog.findViewById(R.id.green);
TextView amber = (TextView) dialog.findViewById(R.id.amber);
TextView orange = (TextView) dialog.findViewById(R.id.orange);
Button dialogButton = (Button) dialog.findViewById(R.id.dialogButtonOK);
// if button is clicked, close the custom dialog
dialogButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
dialog.show();
return false;
}
});
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/ll"
>
<TextView
android:id="@+id/grey"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#FAFAFA"
android:background="@color/grey_1"
android:text="GREY"
android:layout_margin="4dp"
/>
<TextView
android:id="@+id/amber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#FAFAFA"
android:background="@color/md_amber_100"
android:text="AMBER"
android:layout_margin="4dp"
/>
<TextView
android:id="@+id/orange"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#FAFAFA"
android:background="@color/fabOrange"
android:text="ORANGE"
android:layout_margin="4dp"
/>
<TextView
android:id="@+id/green"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#FAFAFA"
android:background="@color/toolbar"
android:text="GREEN"
android:layout_margin="4dp"
/>
<Button
android:id="@+id/dialogButtonOK"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text="Ok"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -3,14 +3,17 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
android:theme="@style/Theme.AppCompat.NoActionBar"
android:background="@color/background_material_dark">
android:id="@+id/select_album_layout"
>
<include layout="@layout/toolbar"
android:id="@+id/toolbar"
......
......@@ -56,7 +56,8 @@
android:enabled="true"
android:key="accent_color"
android:title="@string/setting_accent_color_title"
android:summary="Selecet the Accent Color"/>
android:summary="Selecet the Accent Color"
/>
<SwitchPreference
android:title="Colored Navigation Bar"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment