Commit e5f0b7de authored by DNLDsht's avatar DNLDsht

Merge branch 'Mow3l-master'

fixed color picker
parent 89abb5d5
[Dolphin]
Timestamp=2016,2,15,19,6,18
Version=3
[Settings]
HiddenFilesShown=true
......@@ -4,6 +4,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
apply plugin: 'com.android.application'
......@@ -11,6 +12,7 @@ apply plugin: 'com.android.application'
repositories {
jcenter()
maven { url "http://repo1.maven.org/maven2" }
maven { url "http://dl.bintray.com/dasar/maven" }
}
android {
......@@ -54,4 +56,8 @@ dependencies {
compile 'com.mikepenz:google-material-typeface:2.1.0.1.original@aar'
compile 'com.mikepenz:fontawesome-typeface:4.5.0.1@aar'
compile 'com.github.paolorotolo:appintro:3.4.0'
//colorPiker >lobsterpicker
//compile 'com.larswerkman:lobsterpicker:1.0.1'
//colorPiker >Shift
compile(group: 'uz.shift', name: 'colorpicker', version: '0.5', ext: 'aar')
}
package com.leafpic.app.Adapters;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import com.leafpic.app.R;
/**
* Created by Jibo on 21/02/2016.
*/
public class ThemeAdapter extends RecyclerView.Adapter<ThemeAdapter.ViewHolder> {
private int layout_ID;
private String Theme;
private String PrimaryColor;
private String AccentColor;
boolean selected = false;
private View.OnClickListener mOnClickListener;
//COSTRUTTORE
public ThemeAdapter(int id, String ac, String pc, String thm) {
layout_ID = id;
Theme = thm;
PrimaryColor = pc;
AccentColor = ac;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(layout_ID, parent, false);
v.setOnClickListener(mOnClickListener);
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(ThemeAdapter.ViewHolder holder, int position) {
//Photo f = photos.get(position);
//Glide.clear(holder.imageView);//fix corruption
/*
if (f.isGif()) {
Ion.with(holder.imageView.getContext())
.load(f.Path)
.intoImageView(holder.imageView);
holder.gifIcon.setVisibility(View.VISIBLE);
} else {
holder.gifIcon.setVisibility(View.INVISIBLE);
Glide.with(holder.imageView.getContext())
.load(f.Path)
.asBitmap()
.centerCrop()
.placeholder(R.drawable.ic_empty)
.into(holder.imageView);
}
holder.path.setTag(f.Path);
if (f.isSelected()) {
holder.selectHolder.setVisibility(View.VISIBLE);
holder.imageView.setColorFilter(0x88000000, PorterDuff.Mode.SRC_ATOP);
holder.imageView.setPadding(15,15,15,15);
} else {
holder.selectHolder.setVisibility(View.INVISIBLE);
holder.imageView.clearColorFilter();
holder.imageView.setPadding(0,0,0,0);
}
*/
}
@Override
public int getItemCount() {
return 5;
/*photos.size()*/
}
public void setOnClickListener(View.OnClickListener lis) {
mOnClickListener = lis;
}
public static class ViewHolder extends RecyclerView.ViewHolder {
ImageView navIcon, menuIcon, selectHolder;
LinearLayout card_layout;
public ViewHolder(View itemView) {
super(itemView);
//imageView = (ImageView) itemView.findViewById(R.id.photo_preview);
selectHolder = (ImageView) itemView.findViewById(R.id.selected_icon);
menuIcon = (ImageView) itemView.findViewById(R.id.menu_icon);
navIcon = (ImageView) itemView.findViewById(R.id.nav_icon);
card_layout = (LinearLayout) itemView.findViewById(R.id.linear_card_text);
}
}
}
package com.leafpic.app;
import android.Manifest;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
......@@ -23,7 +24,6 @@ import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
......@@ -38,7 +38,6 @@ import com.leafpic.app.Base.HandlingAlbums;
import com.leafpic.app.utils.StringUtils;
import com.mikepenz.fontawesome_typeface_library.FontAwesome;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.Iconics;
import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.iconics.context.IconicsContextWrapper;
import com.mikepenz.materialdrawer.AccountHeader;
......@@ -49,6 +48,9 @@ import com.mikepenz.materialdrawer.model.DividerDrawerItem;
import com.mikepenz.materialdrawer.model.PrimaryDrawerItem;
import com.mikepenz.materialdrawer.model.interfaces.IDrawerItem;
import uz.shift.colorpicker.LineColorPicker;
import uz.shift.colorpicker.OnColorChangedListener;
public class AlbumsActivity extends AppCompatActivity /*implements FolderChooserDialog.FolderCallback */{
HandlingAlbums albums = new HandlingAlbums(AlbumsActivity.this);
......@@ -59,7 +61,6 @@ public class AlbumsActivity extends AppCompatActivity /*implements FolderChooser
SharedPreferences SP;
boolean editmode = false, hidden = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -479,7 +480,37 @@ public class AlbumsActivity extends AppCompatActivity /*implements FolderChooser
Intent i = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
startActivity(i);
return true;
case R.id.filter_albums_action:
// int[] j = {Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW};
View dialoglayout = getLayoutInflater().inflate(R.layout.choosecolor, null);
AlertDialog.Builder builder12 = new AlertDialog.Builder(AlbumsActivity.this);
LineColorPicker colorPicker = (LineColorPicker) dialoglayout.findViewById(R.id.picker3);
// set color palette
colorPicker.setColors(new int[]{Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW});
// set selected color [optional]
colorPicker.setSelectedColor(Color.RED);
// set on change listener
colorPicker.setOnColorChangedListener(new OnColorChangedListener() {
@Override
public void onColorChanged(int c) {
//Log.d(TAG, "Selected color " + Integer.toHexString(c));
Toast.makeText(getBaseContext(), "Selected color " + Integer.toHexString(c),
Toast.LENGTH_SHORT).show();
}
});
builder12.setView(dialoglayout);
builder12.show();
int color = colorPicker.getColor();
// dialog.show();
break;
default:
// If we got here, the user's action was not recognized.
// Invoke the superclass to handle it.
......
......@@ -97,7 +97,7 @@ public class ImageFragment extends Fragment {
//Log.wtf("asdasdasdasdas","fulllllllll");
// Glide.get(getActivity()).clearDiskCache();
// Glide.get(getActivity()).trimMemory(3);
Glide.with(getContext())
/* Glide.with(getContext())
.load(path)
.asBitmap()
// .thumbnail(0.1f)
......@@ -113,7 +113,7 @@ public class ImageFragment extends Fragment {
picture.setImage(ImageSource.bitmap(bitmap));
}
});
});*/
}
});
......
......@@ -80,7 +80,7 @@ public class SelectAlbumActivity extends AppCompatActivity {
//Base Theme
LinearLayout ll = (LinearLayout) findViewById(R.id.select_album_layout);
if (SP.getBoolean("set_dark_theme", false)){
//setTheme(R.style.AppTheme_Dark);
//setTheme(R.style.AppTheme_Dark
ll.setBackgroundColor(getColor(R.color.background_material_dark));
}else {
//setTheme(R.style.AppTheme);
......
......@@ -2,6 +2,7 @@ package com.leafpic.app;
import android.app.Dialog;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
......@@ -11,9 +12,11 @@ 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;
import android.widget.Toast;
import uz.shift.colorpicker.LineColorPicker;
import uz.shift.colorpicker.OnColorChangedListener;
public class SettingsActivity extends AppCompatActivity {
......@@ -103,7 +106,7 @@ public class SettingsActivity extends AppCompatActivity {
}
}
public static class MyPreferenceFragment extends PreferenceFragment {
public class MyPreferenceFragment extends PreferenceFragment {
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
......@@ -112,6 +115,80 @@ public class SettingsActivity extends AppCompatActivity {
p.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
int[] j = {Color.RED,Color.GREEN,Color.BLUE,Color.YELLOW};
/**/
//SHIFT COLOR PIKLER
final Dialog dialog = new Dialog(getContext());
dialog.setContentView(R.layout.colorpiker);
dialog.setTitle("Primary Color");
LineColorPicker colorPicker;
colorPicker = (LineColorPicker) findViewById(R.id.picker);
// set color palette
colorPicker.setColors(j);
// set selected color [optional]
colorPicker.setSelectedColor(Color.RED);
// set on change listener
colorPicker.setOnColorChangedListener(new OnColorChangedListener() {
@Override
public void onColorChanged(int c) {
//Log.d(TAG, "Selected color " + Integer.toHexString(c));
Toast.makeText(getActivity(), "Selected color " + Integer.toHexString(c),
Toast.LENGTH_SHORT).show();
}
});
// get selected color
int color = colorPicker.getColor();
dialog.show();
/*
//LOBSTER
final Dialog dialog = new Dialog(getContext());
dialog.setContentView(R.layout.colorpiker);
dialog.setTitle("Primary Color");
// set the custom dialog components - text, image and button
LobsterPicker lobsterPicker = (LobsterPicker) findViewById(R.id.lobsterpicker);
LobsterShadeSlider shadeSlider = (LobsterShadeSlider) findViewById(R.id.shadeslider);
//To retrieve the selected color use
lobsterPicker.getColor();
//You'r also able to add a listener
lobsterPicker.addOnColorListener(new OnColorListener() {
@Override
public void onColorChanged(@ColorInt int color) {
}
@Override
public void onColorSelected(@ColorInt int color) {
}
});
dialog.show();
*/
/*
//NORMAL
// custom dialog
final Dialog dialog = new Dialog(getContext());
dialog.setContentView(R.layout.custom_color_piker_primary);
......@@ -132,6 +209,7 @@ public class SettingsActivity extends AppCompatActivity {
}
});
dialog.show();
*/
return false;
}
});
......
package com.leafpic.app;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.widget.RelativeLayout;
/**
* Created by Jibo on 21/02/2016.
*/
public class ThemeActivity extends AppCompatActivity{
RecyclerView mRecyclerView;
Toolbar toolbar;
SharedPreferences SP;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.theme_layout);
initUiTweaks();
}
@Override
public void onDestroy() {
super.onDestroy();
}
@Override
public void onResume() {
super.onResume();
}
public void initUiTweaks(){
SP = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
/**** 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.primary));
else getWindow().setNavigationBarColor(getColor(R.color.md_black_1000));
}
/**** ToolBar *****/
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
/**** Status Bar */
getWindow().setStatusBarColor(getColor(R.color.primary));
//getWindow().setStatusBarColor(getColor(R.color.toolbar));
RelativeLayout rl = (RelativeLayout) findViewById(R.id.rl_theme_layout);
if (SP.getBoolean("set_dark_theme", false)){
//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));
}
}
private void LoadThems(){
/*
mRecyclerView = (RecyclerView) findViewById(R.id.grid_theme);
adapt = new AlbumsAdapter(albums.dispAlbums, R.layout.theme_card);
adapt.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
TextView a = (TextView) v.findViewById(R.id.album_name);
adapt.notifyItemChanged(albums.toggleSelectAlbum(a.getTag().toString()));
editmode = true;
invalidateOptionsMenu();
return true;
}
});
adapt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TextView a = (TextView) v.findViewById(R.id.album_name);
if (editmode) {
adapt.notifyItemChanged(albums.toggleSelectAlbum(a.getTag().toString()));
invalidateOptionsMenu();
} else {
Album album = albums.getAlbum(a.getTag().toString());
Intent intent = new Intent(AlbumsActivity.this, PhotosActivity.class);
Bundle b = new Bundle();
b.putParcelable("album", album);
intent.putExtras(b);
startActivity(intent);
}
}
});
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setAdapter(adapt);
mRecyclerView.setLayoutManager(new GridLayoutManager(this, 2));
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
adapt.notifyDataSetChanged();
*/
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardCornerRadius="2dp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:textColor="#fff"
android:layout_height="wrap_content"
android:background="@color/md_light_green_500"
android:padding="24dp"
android:text="fuck"
android:textSize="18sp"
android:textStyle="bold" />
<RelativeLayout
android:id="@+id/body3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="24dp">
<uz.shift.colorpicker.LineColorPicker xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/picker3"
android:layout_width="match_parent"
android:layout_height="60dp"
app:orientation="horizontal"
app:selectedColorIndex="0" />
</RelativeLayout>
<TextView
android:id="@+id/ok"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right|bottom"
android:padding="16dp"
android:text="ok"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</ScrollView>
</android.support.v7.widget.CardView>
</LinearLayout>
\ No newline at end of file
<?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"/>
-->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--
<com.larswerkman.lobsterpicker.LobsterPicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/lobsterpicker"
/>
<com.larswerkman.lobsterpicker.sliders.LobsterShadeSlider
android:id="@+id/shadeslider"
app:color_history_enabled="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<com.larswerkman.lobsterpicker.sliders.LobsterOpacitySlider
android:id="@+id/opacityslider"
<com.larswerkman.lobsterpicker.sliders.LobsterShadeSlider
android:id="@+id/shadeslider"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
-->
<uz.shift.colorpicker.LineColorPicker
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/picker"
android:layout_width="match_parent"
android:layout_height="60dp"
app:orientation="horizontal"/>
</LinearLayout>
\ No newline at end of file
<?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
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="5dp"
android:layout_marginTop="2dp"
android:layout_marginLeft="2dp"
>
<RelativeLayout
android:id="@+id/theme_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="@+id/header_theme_card"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:background="@color/primary"
>
<ImageView
android:id="@+id/nav_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
android:elevation="10dp"
android:src="@mipmap/ic_menu_white_24dp"
android:layout_centerHorizontal="true"
android:layout_gravity="left"
android:paddingLeft="5dp"
/>
<ImageView
android:id="@+id/menu_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
android:elevation="10dp"
android:src="@mipmap/ic_more_vert_white_24dp"
android:layout_centerHorizontal="true"
android:layout_gravity="right"
android:paddingRight="5dp"
/>
</RelativeLayout>
<View
android:id="@+id/theme_divider"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="@id/header_theme_card"
/>
<RelativeLayout
android:id="@+id/footer_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/primary_light"
>
<ImageView
android:id="@+id/selected_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
android:elevation="10dp"
android:src="@mipmap/ic_done_white_48dp"
android:layout_gravity="center"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"