Commit 4b35a1cd authored by Gilbert Ndresaj's avatar Gilbert Ndresaj

Theme Try!

parent 56be7754
......@@ -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;
......
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;
......@@ -39,10 +41,24 @@ public class SettingsActivity extends AppCompatActivity {
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));
......@@ -82,6 +98,4 @@ public class SettingsActivity extends AppCompatActivity {
});
}
}
}
......@@ -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"
......
<?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>
......
<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>
......
......@@ -41,7 +41,7 @@
android:title="Dark Theme"
android:defaultValue="false"
android:summary="Apply the DarkTheme to LeafPic."
android:key="set_theme"
android:key="set_dark_theme"
/>
<Preference
......
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