Commit 3f89fd52 authored by Gilbert Ndresaj's avatar Gilbert Ndresaj 💬

Merge pull request #2 from DNLDsht/master

Merge Donald
parents 0aa13069 dde80af5
......@@ -10,6 +10,9 @@ apply plugin: 'com.android.application'
repositories {
jcenter()
maven {
url "http://dl.bintray.com/dasar/maven"
}
}
android {
......@@ -61,4 +64,5 @@ dependencies {
compile('com.github.afollestad.material-dialogs:commons:0.8.5.3@aar') {
transitive = true
}
compile(group: 'uz.shift', name: 'colorpicker', version: '0.5', ext: 'aar')
}
......@@ -11,9 +11,9 @@
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name=".Preferences_Activity"
android:label="Setting"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
<activity android:name=".SettingsActivity"
android:label="Setting"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
>
</activity>
......
......@@ -10,7 +10,6 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.leafpic.app.Album;
import com.leafpic.app.R;
......@@ -60,23 +59,16 @@ public class AlbumsAdapter extends RecyclerView.Adapter<AlbumsAdapter.ViewHolder
SharedPreferences SP;
SP = PreferenceManager.getDefaultSharedPreferences(holder.picture.getContext());
String SColor = SP.getString("PrefColor","1");
//string.showToast(holder.picture.getContext(),SColor);
String SColor = SP.getString("PrefColor", "#03A9F4");
holder.nPhotos.setText(Html.fromHtml("<b><font color='" + SColor + "'>" + a.getImagesCount() + "</font></b>" + "<font " +
"color='#FFFFFF'> Photos</font>"));
holder.name.setTag(a.Path);
/*
holder.nPhotos.setText(Html.fromHtml("<b><font color='#FBC02D'>" + a.getImagesCount() + "</font></b>" + "<font " +
"color='#FFFFFF'> Photos</font>"));
holder.name.setTag(a.Path);
*/
if (a.isSelected()) {
//name.setBackgroundColor(localContext.getColor(R.color.selected_album));
holder.card_layout.setBackgroundColor(holder.card_layout.getContext().getColor(R.color.selected_album));
} else {
holder.card_layout.setBackgroundColor(holder.card_layout.getContext().getColor(R.color.unselected_album));
//holder.card_layout.setBackgroundColor(albums.get(position).getColorAlbum());
}
}
......
......@@ -142,7 +142,10 @@ public class AlbumsActivity extends AppCompatActivity {
checkPermissions();
break;
case 6: //settings
Intent intent = new Intent(AlbumsActivity.this, Preferences_Activity.class);
//MyPreferenceFragment f = new MyPreferenceFragment();
// FragmentManager fragment = getFragmentManager();
Intent intent = new Intent(AlbumsActivity.this, SettingsActivity.class);
startActivity(intent);
break;
case 7: //github
......
......@@ -83,8 +83,11 @@ public class PhotoActivity extends AppCompatActivity {
} catch (Exception e) {
e.printStackTrace();
}
//DA FIXXARE
hideSystemUI();
showSystemUI();
hideSystemUI();
}
@Override
......
......@@ -24,19 +24,19 @@ import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.text.InputType;
import android.transition.Slide;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.*;
import android.widget.ImageView;
import android.widget.TextView;
import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.bumptech.glide.Glide;
import com.leafpic.app.Adapters.PhotosAdapter;
import com.mikepenz.materialdrawer.AccountHeader;
import com.mikepenz.materialdrawer.AccountHeaderBuilder;
import com.mikepenz.materialdrawer.Drawer;
import com.mikepenz.materialdrawer.DrawerBuilder;
import com.mikepenz.materialdrawer.model.DividerDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import java.io.File;
import java.util.ArrayList;
......@@ -409,7 +409,49 @@ public class PhotosActivity extends AppCompatActivity {
collapsingToolbarLayout.setExpandedTitleGravity(Gravity.CENTER_HORIZONTAL);
collapsingToolbarLayout.setExpandedTitleColor(getColor(android.R.color.transparent));
/*******
* DRAWER
* ******/
AccountHeader headerResult = new AccountHeaderBuilder()
.withActivity(this)
.withHeaderBackground(R.drawable.side_wall)
.withSelectionListEnabledForSingleProfile(false)
.withCompactStyle(true)
.build();
final Drawer result = new DrawerBuilder()
.withActivity(this)
.withAccountHeader(headerResult)
.withDrawerGravity(Gravity.END)
.addDrawerItems(
new DividerDrawerItem()
)
.withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() {
@Override
public boolean onItemClick(View view, int position, IDrawerItem drawerItem) {
switch (position) {
default:
break;
}
return false;
}
})
.build();
//setPalette();
/* File image = new File(photos.getPreviewAlbumImg());
BitmapFactory.Options bmOptions = new BitmapFactory.Options();
Bitmap bitmap = BitmapFactory.decodeFile(image.getAbsolutePath(),bmOptions);
setPalette(bitmap);*/
}
private void updateHeaderContent() {
......@@ -430,16 +472,12 @@ public class PhotosActivity extends AppCompatActivity {
SharedPreferences SP;
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
String SColor = SP.getString("PrefColor","1");
String SColor = SP.getString("PrefColor", "#03A9F4");
textView.setText(Html.fromHtml("<b><font color='" + SColor + "'>" + photos.photos.size() + "</font></b>" + "<font " +
"color='#FFFFFF'> Photos</font>"));
int color = Color.parseColor(SColor);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setBackgroundTintList(ColorStateList.valueOf(color));
/*
textView.setText(Html.fromHtml("<b><font color='#FBC02D'>" + photos.photos.size() + "</font></b>" + "<font " +
"color='#FFFFFF'> Photos</font>"));
*/
}
private void initActivityTransitions() {
......
......@@ -3,20 +3,21 @@ package com.leafpic.app;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
public class Preferences_Activity extends PreferenceActivity {
public class SettingsActivity extends AppCompatActivity {
SharedPreferences SP;
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
addPreferencesFromResource(R.layout.preferences);
initUiTweaks();
//FOR ADDING TOOLBAR
......@@ -29,27 +30,15 @@ public class Preferences_Activity extends PreferenceActivity {
finish();
}
});
}
/**********
public static class MyPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.layout.preferences);
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(android.R.id.content, new MyPreferenceFragment()).commit();
//getActionBar().setTitle("Setting");
//setTitle("Setting");
//initUiTweaks();
}
*********/
public void initUiTweaks() {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
......@@ -57,18 +46,29 @@ public class Preferences_Activity extends PreferenceActivity {
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
boolean NavBar = SP.getBoolean("nav_bar", false);
//boolean NightTheme = SP.getBoolean("set_theme", false);
if (NavBar==true)
if (NavBar)
getWindow().setNavigationBarColor(getResources().getColor(R.color.toolbar));
}
/*
toolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setShowHideAnimationEnabled(true);
toolbar.setBackgroundColor(getColor(R.color.trasparent_toolbar));
*/
}
}
public static class MyPreferenceFragment extends PreferenceFragment {
@Override
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) {
return false;
}
});
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<uz.shift.colorpicker.LineColorPicker
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/picker"
android:layout_width="match_parent"
android:layout_height="60dp"
app:orientation="horizontal"/>
\ No newline at end of file
......@@ -5,6 +5,7 @@
<item>Green</item>
<item>Orange</item>
</string-array>
<string-array name="ColorsPref">
<item>#03A9F4</item>
<item>#009688</item>
......
......@@ -31,5 +31,6 @@
<string name="security_setting">Security</string>
<string name="folder_setting">Folder</string>
<string name="primaryColor">Primary Color</string>
<string name="color_palette">Color Palette</string>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:useStockLayout="true">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:useStockLayout="true">
<PreferenceCategory
android:title="@string/general_setting"
>
......@@ -54,18 +54,18 @@
android:key="set_theme"
/>
<Preference
android:selectable="true"
android:enabled="true"
android:key="primaryColor"
android:title="Primary Color"
android:summary="Selecet the Primary Color"
android:selectable="true"
android:enabled="true"
android:key="primary_color"
android:title="Primary Color"
android:summary="Selecet the Primary Color"
/>
<Preference
android:selectable="true"
android:enabled="true"
android:key="Ancent Color"
android:title="Primary Color"
android:summary="Selecet the Ancent Color" />
android:selectable="true"
android:enabled="true"
android:key="accent_color"
android:title="Accent Color"
android:summary="Selecet the Accent Color"/>
<CheckBoxPreference
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