Commit ecfa5384 authored by Gilbert Ndresaj's avatar Gilbert Ndresaj

Themes Implemented

First Working Theme With:
>ShiftColorPiker
parent b0bca078
......@@ -7,6 +7,7 @@ buildscript {
}
}
apply plugin: 'com.android.application'
repositories {
......
package com.leafpic.app.Adapters;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.preference.PreferenceManager;
import android.support.v7.widget.RecyclerView;
......@@ -60,20 +61,26 @@ public class AlbumsAdapter extends RecyclerView.Adapter<AlbumsAdapter.ViewHolder
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(holder.picture.getContext());
String textColor;
int accentColor = SP.getInt("accent_color", Color.rgb(0, 77, 64));//TEAL COLOR DEFAULT
String hexAccentColor = String.format("#%06X", (0xFFFFFF & accentColor));
int primaryColor = SP.getInt("primary_color", Color.rgb(0, 150, 136));//TEAL CARD BG DEFAULT
String hexPrimaryColor = String.format("#%06X", (0xFFFFFF & primaryColor));
if (SP.getBoolean("set_dark_theme", false))
textColor="#FAFAFA";
else
textColor="#2b2b2b";
if (a.isSelected()) {
holder.card_layout.setBackgroundColor(holder.card_layout.getContext().getColor(R.color.selected_album));
holder.card_layout.setBackgroundColor(Color.parseColor(hexPrimaryColor));
//holder.card_layout.setBackgroundColor(holder.card_layout.getContext().getColor(R.color.selected_album));
holder.picture.setColorFilter(0x77000000, PorterDuff.Mode.SRC_ATOP);
holder.selectHolder.setVisibility(View.VISIBLE);
//White Text On White Theme
if (SP.getBoolean("set_dark_theme", false)==false){
selected=true;
holder.name.setText(Html.fromHtml("<i><font color='#FAFAFA'>" + a.DisplayName + "</font></i>"));
holder.nPhotos.setText(Html.fromHtml("<b><font color='" + SP.getString("PrefColor", "#03A9F4") + "'>" + a.getImagesCount() + "</font></b>" + "<font " +
holder.nPhotos.setText(Html.fromHtml("<b><font color='" + hexAccentColor + "'>" + a.getImagesCount() + "</font></b>" + "<font " +
"color='#FAFAFA'> Photos</font>"));
}
} else {
......@@ -87,7 +94,8 @@ public class AlbumsAdapter extends RecyclerView.Adapter<AlbumsAdapter.ViewHolder
}
if (!selected) {
holder.name.setText(Html.fromHtml("<i><font color='" + textColor + "'>" + a.DisplayName + "</font></i>"));
holder.nPhotos.setText(Html.fromHtml("<b><font color='" + SP.getString("PrefColor", "#03A9F4") + "'>" + a.getImagesCount() + "</font></b>" + "<font " +
//SP.getString("PrefColor", "#03A9F4")
holder.nPhotos.setText(Html.fromHtml("<b><font color='" + hexAccentColor + "'>" + a.getImagesCount() + "</font></b>" + "<font " +
"color='" + textColor + "'> Photos</font>"));
}
}
......
......@@ -97,42 +97,40 @@ public class AlbumsActivity extends AppCompatActivity /*implements FolderChooser
updateSelectedStuff();
invalidateOptionsMenu();
checkPermissions();
initUiTweaks();
super.onResume();
}
public void initUiTweaks(){
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
//int pc = SP.getInt("primary_color", Color.BLUE);
int primaryColor = SP.getInt("primary_color", Color.rgb(0, 150, 136));///////////////
String hexPrimaryColor = String.format("#%06X", (0xFFFFFF & primaryColor));
/**** Nav Bar ****/
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
boolean NavBar = SP.getBoolean("nav_bar", false);
if (NavBar)
getWindow().setNavigationBarColor(getColor(R.color.toolbar));//R.color.primary
getWindow().setNavigationBarColor(Color.parseColor(hexPrimaryColor));
else getWindow().setNavigationBarColor(getColor(R.color.md_black_1000));
}
/**** ToolBar *****/
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
/**** Status Bar */
toolbar.setBackgroundColor(Color.parseColor(hexPrimaryColor));
int primaryColor = SP.getInt("primary_color", 8);///////////////////////////////////////////////////////////////
getWindow().setStatusBarColor(getColor(R.color.toolbar));//R.color.primary
/**** Status Bar */
getWindow().setStatusBarColor(Color.parseColor(hexPrimaryColor));
//getWindow().setStatusBarColor(getColor(R.color.toolbar));
RelativeLayout rl = (RelativeLayout) findViewById(R.id.Relative_Album_layout);
if (SP.getBoolean("set_dark_theme", false)){
//setTheme(R.style.AppTheme_Dark);
rl.setBackgroundColor(getColor(R.color.background_material_dark));
rl.setBackgroundColor(getColor(R.color.act_bg_dark));
}else {
//setTheme(R.style.AppTheme);
rl.setBackgroundColor(getColor(R.color.background_material_light));
rl.setBackgroundColor(getColor(R.color.act_bg_light));
}
......@@ -145,7 +143,6 @@ public class AlbumsActivity extends AppCompatActivity /*implements FolderChooser
PrimaryDrawerItem item4 = new PrimaryDrawerItem().withName("GitHub").withIcon(FontAwesome.Icon.faw_github);
PrimaryDrawerItem item5 = new PrimaryDrawerItem().withName("Donate").withIcon(FontAwesome.Icon.faw_gift);
AccountHeader headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withHeaderBackground(R.drawable.side_wall)
......@@ -199,7 +196,6 @@ public class AlbumsActivity extends AppCompatActivity /*implements FolderChooser
addHiddenFolder_FABEvent();
}
public void addHiddenFolder_FABEvent() {
FloatingActionButton btnAddFolder = (FloatingActionButton) findViewById(R.id.fab_add_folder);
......@@ -428,7 +424,7 @@ public class AlbumsActivity extends AppCompatActivity /*implements FolderChooser
})
.setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {}});
builder.show();
builder.show();
break;
case R.id.deleteAction:
......
......@@ -11,9 +11,7 @@ import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.support.design.widget.AppBarLayout;
import android.support.design.widget.CollapsingToolbarLayout;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
......@@ -24,7 +22,6 @@ import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.transition.Slide;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
......@@ -57,7 +54,6 @@ public class PhotosActivity extends AppCompatActivity {
CustomAlbumsHandler customAlbumsHandler = new CustomAlbumsHandler(PhotosActivity.this);
HandlingPhotos photos;
CollapsingToolbarLayout collapsingToolbarLayout;
Toolbar toolbar;
ImageView headerImage;
......@@ -515,10 +511,15 @@ public class PhotosActivity extends AppCompatActivity {
public void initUiTweaks() {
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
int accentColor = SP.getInt("accent_color", Color.rgb(0, 77, 64));//TEAL COLOR DEFAULT
String hexAccentColor = String.format("#%06X", (0xFFFFFF & accentColor));
int primaryColor = SP.getInt("primary_color", Color.rgb(0, 150, 136));//TEAL CARD BG DEFAULT
String hexPrimaryColor = String.format("#%06X", (0xFFFFFF & primaryColor));
/**** Navigation Bar*/
boolean NavBar = SP.getBoolean("nav_bar", false);
if ((android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) && (NavBar)) {
getWindow().setNavigationBarColor(getColor(R.color.toolbar));
getWindow().setNavigationBarColor(Color.parseColor(hexPrimaryColor));
//getWindow().setNavigationBarColor(getColor(R.color.toolbar));
}
/**** Status Bar */
......@@ -531,19 +532,16 @@ public class PhotosActivity extends AppCompatActivity {
/**** ToolBar*/
toolbar = (Toolbar) findViewById(R.id.toolbar);
//String SColor = SP.getString("PrimaryPrefColor", "#009688");
//toolbar.setBackgroundColor(Color.parseColor(SColor));
setSupportActionBar(toolbar);
//toolbar.setBackgroundColor(Color.parseColor(hexPrimaryColor));
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
/****SET THEME***/
RecyclerView rw = (RecyclerView) findViewById(R.id.grid_photos);
if (SP.getBoolean("set_dark_theme", false)){
//setTheme(R.style.AppTheme_Dark);
rw.setBackgroundColor(getColor(R.color.background_material_dark));
rw.setBackgroundColor(getColor(R.color.act_bg_dark));
}else {
//setTheme(R.style.AppTheme);
rw.setBackgroundColor(getColor(R.color.background_material_light));
rw.setBackgroundColor(getColor(R.color.act_bg_light));
}
......@@ -562,11 +560,11 @@ public class PhotosActivity extends AppCompatActivity {
collapsingToolbarLayout.setTitle(photos.DisplayName);
collapsingToolbarLayout.setExpandedTitleGravity(Gravity.CENTER_HORIZONTAL);
collapsingToolbarLayout.setExpandedTitleColor(getColor(android.R.color.transparent));
collapsingToolbarLayout.setContentScrimColor(getColor(R.color.toolbar));
collapsingToolbarLayout.setStatusBarScrimColor(getColor(R.color.toolbar));
collapsingToolbarLayout.setContentScrimColor(Color.parseColor(hexPrimaryColor));//getColor(R.color.toolbar)
collapsingToolbarLayout.setStatusBarScrimColor(Color.parseColor(hexPrimaryColor));//getColor(R.color.toolbar)
FloatingActionButton fabCamera = (FloatingActionButton) findViewById(R.id.fab_camera);
fabCamera.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor(SP.getString("PrefColor", "#03A9F4"))));
fabCamera.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor(hexAccentColor)));
fabCamera.setOnClickListener(new View.OnClickListener() {
@Override
......@@ -593,9 +591,13 @@ public class PhotosActivity extends AppCompatActivity {
textView = (TextView) findViewById(R.id.album_photos_count);
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
String SColor = SP.getString("PrefColor", "#03A9F4");
textView.setText(Html.fromHtml("<b><font color='" + SColor + "'>" + photos.photos.size() + "</font></b>" + "<font " +
int accentColor = SP.getInt("accent_color", Color.rgb(0, 77, 64));//TEAL COLOR DEFAULT
String hexAccentColor = String.format("#%06X", (0xFFFFFF & accentColor));
textView.setText(Html.fromHtml("<b><font color='" + hexAccentColor + "'>" + photos.photos.size() + "</font></b>" + "<font " +
"color='#FFFFFF'> Photos</font>"));
}
private void initActivityTransitions() {
......
......@@ -56,6 +56,14 @@
<color name="accent_white">#FFFFFF</color>
<color name="accent_grey">#9e9e9e</color>
<color name="accent_black">#000000</color>
<!--ACTIVITY BACKGROUND-->
<color name="act_bg_light">#E0E0E0</color>
<color name="act_bg_light2">#EEEEEE</color>
<color name="act_bg_dark">#212121</color>
<!--ALBUM CARD-->
<color name="ac_bg_light">#FAFAFA</color>
<color name="ac_bg_dark">#424242</color>
<!--SHIFT COLOR PIKER-->
<!--SFONDO-->
......
......@@ -11,7 +11,6 @@ buildscript {
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
......
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