Commit 5699e9fa authored by Donald Shtjefni's avatar Donald Shtjefni

Merge pull request #24 from Mow3l/master

Theme Ui Tweeks (not work propely)
parents 2d0ab25c 4b35a1cd
......@@ -13,23 +13,20 @@
<activity android:name=".IntroActivity"
android:label="Intro Activity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
/>
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"/>
<activity android:name=".SelectAlbumActivity"
android:label="Select Album"
android:theme="@style/Theme.AppCompat.NoActionBar"
/>
android:theme="@style/Theme.AppCompat.NoActionBar" />
<activity android:name=".SettingsActivity"
android:label="Setting"
android:theme="@style/Theme.AppCompat.NoActionBar"
>
android:theme="@style/Theme.AppCompat.NoActionBar">
</activity>
<activity android:name=".AlbumsActivity"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat.NoActionBar"
>
android:theme="@style/Theme.AppCompat.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
......@@ -39,8 +36,7 @@
<activity android:name=".PhotosActivity"
android:label="Album"
android:parentActivityName=".AlbumsActivity"
android:theme="@style/Theme.AppCompat.NoActionBar"
>
android:theme="@style/Theme.AppCompat.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".AlbumsActivity"/>
......@@ -53,8 +49,7 @@
<activity android:name=".PhotoActivity"
android:label="Album"
android:parentActivityName=".PhotosActivity"
android:theme="@style/Theme.AppCompat.NoActionBar"
>
android:theme="@style/Theme.AppCompat.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".PhotosActivity"/>
......@@ -63,5 +58,6 @@
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
</manifest>
package com.leafpic.app.Adapters;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.PorterDuff;
import android.preference.PreferenceManager;
......@@ -14,6 +15,7 @@ import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.leafpic.app.Base.Album;
import com.leafpic.app.R;
import com.leafpic.app.utils.StringUtils;
import java.util.ArrayList;
......@@ -54,10 +56,22 @@ public class AlbumsAdapter extends RecyclerView.Adapter<AlbumsAdapter.ViewHolder
.placeholder(R.drawable.ic_empty)
.into(holder.picture);
holder.name.setText(Html.fromHtml("<i><font>" + a.DisplayName + "</font></i>"));
SharedPreferences SP;
SP = PreferenceManager.getDefaultSharedPreferences(holder.picture.getContext());
String titcolor;
boolean darkTheme = SP.getBoolean("set_dark_theme", false);
if (darkTheme==true){
titcolor="#FAFAFA";
holder.card_layout.setBackgroundColor(holder.card_layout.getContext().getColor(R.color.background_material_dark));
}else {
titcolor="4#24242";
holder.card_layout.setBackgroundColor(holder.card_layout.getContext().getColor(R.color.background_material_light));
}
holder.name.setText(Html.fromHtml("<i><font color='" + titcolor + "'>" + a.DisplayName + "</font></i>"));
String SColor = SP.getString("PrefColor", "#03A9F4");
holder.nPhotos.setText(Html.fromHtml("<b><font color='" + SColor + "'>" + a.getImagesCount() + "</font></b>" + "<font " +
......
......@@ -23,6 +23,7 @@ import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.afollestad.materialdialogs.DialogAction;
......@@ -44,6 +45,7 @@ import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.ProfileDrawerItem;
import com.mikepenz.materialdrawer.model.SecondaryDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import com.mikepenz.materialize.color.Material;
import java.io.File;
......@@ -57,6 +59,7 @@ public class AlbumsActivity extends AppCompatActivity implements FolderChooserDi
SharedPreferences SP;
boolean editmode = false, hidden = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -83,6 +86,7 @@ public class AlbumsActivity extends AppCompatActivity implements FolderChooserDi
}
});
t.start();
}
@Override
......@@ -96,35 +100,49 @@ public class AlbumsActivity extends AppCompatActivity implements FolderChooserDi
updateSelectedStuff();
invalidateOptionsMenu();
checkPermissions();
initUiTweaks();
super.onResume();
}
public void initUiTweaks(){
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
/**** Nav Bar ****/
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
boolean NavBar = SP.getBoolean("nav_bar", false);
//boolean NightTheme = SP.getBoolean("set_theme", false);
if (NavBar)
getWindow().setNavigationBarColor(getColor(R.color.toolbar));
getWindow().setNavigationBarColor(getColor(R.color.primary));
}
/**** ToolBar *****/
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
/**** Status Bar */
//getWindow().setStatusBarColor(getColor(R.color.status_bar));
getWindow().setStatusBarColor(getColor(R.color.toolbar));
getWindow().setStatusBarColor(getColor(R.color.primary));
//getWindow().setStatusBarColor(getColor(R.color.toolbar));
RelativeLayout rl = (RelativeLayout) findViewById(R.id.Relative_Album_layout);
boolean darkTheme = SP.getBoolean("set_dark_theme", false);
if (darkTheme==true){
//setTheme(R.style.AppTheme_Dark);
rl.setBackgroundColor(getColor(R.color.background_material_dark));
}else {
//setTheme(R.style.AppTheme);
rl.setBackgroundColor(getColor(R.color.background_material_light));
}
PrimaryDrawerItem item1 = new PrimaryDrawerItem().withName("Default").withIcon(FontAwesome.Icon.faw_picture_o);
PrimaryDrawerItem item2 = new PrimaryDrawerItem().withName("Hidden").withIcon(FontAwesome.Icon.faw_eye_slash);
PrimaryDrawerItem item21 = new PrimaryDrawerItem().withName("Map").withIcon(FontAwesome.Icon.faw_globe);
PrimaryDrawerItem item22 = new PrimaryDrawerItem().withName("Calendar").withIcon(FontAwesome.Icon.faw_calendar_o);
SecondaryDrawerItem item3 = new SecondaryDrawerItem().withName("Settings").withIcon(FontAwesome.Icon.faw_cog);
SecondaryDrawerItem item4 = new SecondaryDrawerItem().withName("GitHub").withIcon(FontAwesome.Icon.faw_github);
SecondaryDrawerItem item5 = new SecondaryDrawerItem().withName("Donate").withIcon(FontAwesome.Icon.faw_gift);
PrimaryDrawerItem item3 = new PrimaryDrawerItem().withName("Settings").withIcon(FontAwesome.Icon.faw_cog);
PrimaryDrawerItem item4 = new PrimaryDrawerItem().withName("GitHub").withIcon(FontAwesome.Icon.faw_github);
PrimaryDrawerItem item5 = new PrimaryDrawerItem().withName("Donate").withIcon(FontAwesome.Icon.faw_gift);
//SecondaryDrawerItem item3 = new SecondaryDrawerItem().withName("Settings").withIcon(FontAwesome.Icon.faw_cog);
//SecondaryDrawerItem item4 = new SecondaryDrawerItem().withName("GitHub").withIcon(FontAwesome.Icon.faw_github);
//SecondaryDrawerItem item5 = new SecondaryDrawerItem().withName("Donate").withIcon(FontAwesome.Icon.faw_gift);
AccountHeader headerResult = new AccountHeaderBuilder()
.withActivity(this)
......@@ -164,7 +182,6 @@ public class AlbumsActivity extends AppCompatActivity implements FolderChooserDi
break;
case 6: //settings
//MyPreferenceFragment f = new MyPreferenceFragment();
// FragmentManager fragment = getFragmentManager();
Intent intent = new Intent(AlbumsActivity.this, SettingsActivity.class);
startActivity(intent);
......@@ -176,7 +193,6 @@ public class AlbumsActivity extends AppCompatActivity implements FolderChooserDi
default:
break;
}
return false;
}
})
......@@ -322,7 +338,7 @@ public class AlbumsActivity extends AppCompatActivity implements FolderChooserDi
public boolean onMenuItemClick(MenuItem item) {
Toast.makeText(
AlbumsActivity.this,
"You Clicked : " + item.getTitle(),
"You Clicked: " + item.getTitle(),
Toast.LENGTH_SHORT
).show();
return true;
......
......@@ -471,7 +471,10 @@ public class PhotosActivity extends AppCompatActivity {
getWindow().setStatusBarColor(Color.TRANSPARENT);
/**** ToolBar*/
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
//String SColor = SP.getString("PrimaryPrefColor", "#009688");
//toolbar.setBackgroundColor(Color.parseColor(SColor));
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
......
package com.leafpic.app;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.support.v4.content.IntentCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import com.afollestad.materialdialogs.MaterialDialog;
public class SettingsActivity extends AppCompatActivity {
SharedPreferences SP;
......@@ -23,6 +27,7 @@ public class SettingsActivity extends AppCompatActivity {
//FOR ADDING TOOLBAR
LinearLayout root = (LinearLayout)findViewById(android.R.id.list).getParent().getParent().getParent();
Toolbar bar = (Toolbar) LayoutInflater.from(this).inflate(R.layout.setting_toolbar, root, false);
root.addView(bar, 0); // insert at top
bar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
......@@ -30,17 +35,30 @@ public class SettingsActivity extends AppCompatActivity {
finish();
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(android.R.id.content, new MyPreferenceFragment()).commit();
/*
mListener = new SharedPreferences.OnSharedPreferenceChangeListener() {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if (!key.equals("pref_dark_theme")) {
return;
}
getActivity().finish();
final Intent intent = getActivity().getIntent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | IntentCompat.FLAG_ACTIVITY_CLEAR_TASK);
getActivity().startActivity(intent);
}
};
*/
}
public void initUiTweaks() {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(getColor(R.color.status_bar));
......@@ -57,18 +75,27 @@ public class SettingsActivity extends AppCompatActivity {
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
Preference p = findPreference("accent_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();
return false;
}
});
}
}
}
......@@ -2,6 +2,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/Relative_Album_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@style/Theme.AppCompat.NoActionBar"
......
......@@ -19,6 +19,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/toolbar">
<RelativeLayout
android:id="@+id/header_album_card"
android:layout_width="wrap_content"
......
......@@ -5,14 +5,17 @@
android:layout_height="wrap_content"
>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_margin="4dp"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="150dp"
android:orientation="vertical"
tools:ignore="MissingPrefix"
android:layout_marginTop="2dp"
android:layout_marginRight="2dp"
android:layout_marginLeft="2dp"
android:orientation="vertical"
tools:ignore="MissingPrefix"
>
<ImageView
android:id="@+id/album_preview"
......@@ -27,7 +30,6 @@
android:foreground="?selectableItemBackgroundBorderless"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="72dp"
......
......@@ -12,10 +12,30 @@
<item>#FBC02D</item>
</string-array>
<!--Primary TEst Color-->
<string-array name="PrimaryprefListColor">
<item>Blue</item>
<item>Green</item>
<item>Orange</item>
</string-array>
<string-array name="PrimaryColorsPref">
<item>#03A9F4</item>
<item>#009688</item>
<item>#FBC02D</item>
</string-array>
<!--PREFERENCES ACTIVITY ITEMS-->
<string-array name="PreferenceTheme">
<item>Light</item>
<item>Dark</item>
</string-array>
<string-array name="preference_accent_Color">
<item>#03A9F4</item>
<item>#00796B</item>
<item>#FBC02D</item>
</string-array>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--Added For Theme-->
<color name="colorPrimary">#009688</color>
<color name="colorPrimaryDark">#00796b</color>
<color name="colorPrimaryLight">#009688</color>
<color name="colorAccent">#FF9800</color>
<color name="textColorPrimary">#FFFFFF</color>
<color name="textColorSecondary">#9E9E9E</color>
<color name="textColorPrimaryInverse">#DE000000</color>
<color name="textColorSecondaryInverse">#9E9E9E</color>
<color name="colorPrimaryInverse">#03A9F4</color>
<color name="colorPrimaryDarkInverse">#03A9A8</color>
<color name="colorAccentInverse">#FF9899</color>
<!--BASE COLOR-->
<color name="status_bar">#00796b</color>
<color name="selected_album">#009688</color>
......@@ -9,6 +27,7 @@
<color name="album_info">#000</color>
<color name="trasparent_toolbar">#33009688</color>
<color name="trasparent">#00000000</color>
<color name="white">#FAFAFA</color>
<!--GREY-->
<color name="grey_1">#727272</color>
<color name="grey_2">#424242</color>
......
......@@ -32,6 +32,7 @@
<string name="folder_setting">Folder</string>
<string name="primaryColor">Primary Color</string>
<string name="color_palette">Color Palette</string>
<string name="setting_accent_color_title">Accent Color</string>
<string name="setting_primary_color_title">Primary Color</string>
<string name="skip">Why You Skip This Beautyfull Intro? Maledetto!!!</string>
</resources>
<resources xmlns:tools="http://schemas.android.com/tools">
<color name="white_opaque">#FAFAFA</color>
<color name="pitch_black">#212121</color>
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:background">@color/white_opaque</item>
<item name="android:windowBackground">@color/white_opaque</item>
<item name="android:colorBackground">@color/white_opaque</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorPrimary">@color/textColorPrimary</item>
<item name="android:textColorSecondary">@color/textColorSecondary</item>
<item name="android:textColorPrimaryInverse">@color/textColorPrimaryInverse</item>
<item name="android:textColorSecondaryInverse">@color/textColorSecondaryInverse</item>
<!-- some other theme configurations for actionbar, overflow menu etc. -->
</style>
<style name="AppTheme.Dark" parent="Theme.AppCompat">
<item name="android:background">@color/pitch_black</item>
<item name="android:windowBackground">@color/pitch_black</item>
<item name="android:colorBackground">@color/pitch_black</item>
<item name="colorPrimary">@color/colorPrimaryInverse</item>
<item name="colorPrimaryDark">@color/colorPrimaryDarkInverse</item>
<item name="colorAccent">@color/colorAccentInverse</item>
<item name="android:textColorPrimary">@color/textColorPrimaryInverse</item>
<item name="android:textColorSecondary">@color/textColorSecondaryInverse</item>
<item name="android:textColorPrimaryInverse">@color/textColorPrimary</item>
<item name="android:textColorSecondaryInverse">@color/textColorSecondary</item>
...
</style>
<!--
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/material_drawer_primary</item>
<item name="colorPrimaryDark">@color/material_drawer_primary_dark</item>
......@@ -7,6 +40,7 @@
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
-->
<style name="AlertDialogCustom" parent="Theme.AppCompat.Dialog">
</style>
......
......@@ -17,16 +17,6 @@
android:persistent="true"
android:summary="Pleas Provide Your Name"
android:title="Your Name" />
<ListPreference
android:title="Test Color Pref"
android:summary="Select a Color."
android:key="PrefColor"
android:defaultValue="1"
android:entries="@array/prefListColor"
android:entryValues="@array/ColorsPref"
/>
</PreferenceCategory>
<PreferenceCategory
......@@ -47,33 +37,53 @@
<PreferenceCategory
android:title="@string/theme_setting"
>
<CheckBoxPreference
android:title="Night Theme"
<SwitchPreference
android:title="Dark Theme"
android:defaultValue="false"
android:summary="Apply the DarkTheme to LeafPic."
android:key="set_theme"
android:key="set_dark_theme"
/>
<Preference
android:selectable="true"
android:enabled="true"
android:key="primary_color"
android:title="Primary Color"
android:summary="Selecet the Primary Color"
android:selectable="true"
android:enabled="true"
android:key="primary_color"
android:title="@string/setting_primary_color_title"
android:summary="Selecet the Primary Color"
/>
<Preference
android:selectable="true"
android:enabled="true"
android:key="accent_color"
android:title="Accent Color"
android:summary="Selecet the Accent Color"/>
android:selectable="true"
android:enabled="true"
android:key="accent_color"
android:title="@string/setting_accent_color_title"
android:summary="Selecet the Accent Color"/>
<CheckBoxPreference
<SwitchPreference
android:title="Colored Navigation Bar"
android:defaultValue="false"
android:summary="Apply the Theme color to the Navigation Bar."
android:key="nav_bar"
android:onClick="initUiTweaks"
/>
<ListPreference
android:title="Anncent Color Test"
android:summary="Select the accent Color"
android:key="PrefColor"
android:defaultValue="1"
android:entries="@array/prefListColor"
android:entryValues="@array/ColorsPref"
/>
<ListPreference
android:title="Primary Color Test"
android:summary="Select the Primary Color"
android:key="PrimaryPrefColor"
android:defaultValue="1"
android:entries="@array/PrimaryprefListColor"
android:entryValues="@array/PrimaryColorsPref"
/>
</PreferenceCategory>
</PreferenceScreen>
\ No newline at end of file
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