Commit 656c1e7d authored by Gilbert Ndresaj's avatar Gilbert Ndresaj

Card Album Style

parent 66a1157e
......@@ -15,7 +15,6 @@ import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.bumptech.glide.Priority;
import com.mikepenz.google_material_typeface_library.GoogleMaterial;
import com.mikepenz.iconics.IconicsDrawable;
import com.mikepenz.iconics.view.IconicsImageView;
import org.horaapps.leafpic.BuildConfig;
......@@ -139,27 +138,27 @@ public class AboutActivity extends ThemedActivity {
Glide.with(this)
.load(R.drawable.donald_header)
.placeholder(getPlaceHolder())
//.placeholder(getPlaceHolder())
.priority(Priority.HIGH)
.animate(R.anim.fade_in)
.into((ImageView) findViewById(R.id.donald_header_img));
Glide.with(this)
.load(R.drawable.donald_profile)
.priority(Priority.HIGH)
.error(new IconicsDrawable(this, "gmd-person").sizeDp(90).color(getIconColor()).paddingDp(24))
//.error(new IconicsDrawable(this, "gmd-person").sizeDp(90).color(getIconColor()).paddingDp(24))
.animate(R.anim.fade_in)
.into((CircleImageView) findViewById(R.id.donald_profile_img));
Glide.with(this)
.load(R.drawable.gilbert_header)
.priority(Priority.HIGH)
.placeholder(getPlaceHolder())
//.placeholder(getPlaceHolder())
.animate(R.anim.fade_in)
.into((ImageView) findViewById(R.id.gilbert_header_img));
Glide.with(this)
.load(R.drawable.gilbert_profile)
.priority(Priority.HIGH)
.error(new IconicsDrawable(this, "gmd-person").sizeDp(90).color(getIconColor()).paddingDp(24))
//.error(new IconicsDrawable(this, "gmd-person").sizeDp(90).color(getIconColor()).paddingDp(24))
.animate(R.anim.fade_in)
.into((CircleImageView) findViewById(R.id.gilbert_profile_img));
......
......@@ -414,8 +414,12 @@ public class SettingsActivity extends ThemedActivity {
private void cardViewStyleDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(SettingsActivity.this, getDialogStyle());
final View dialogLayout = getLayoutInflater().inflate(R.layout.dialog_select_cardview_style, null);
final RadioGroup rGroup = (RadioGroup) dialogLayout.findViewById(R.id.radio_group_card_view_style);
TextView dialogTitle = (TextView) dialogLayout.findViewById(R.id.dialog_card_view_style_title);
((CardView) dialogLayout.findViewById(R.id.dialog_card_view_style)).setCardBackgroundColor(getCardBackgroundColor());
dialogTitle.setBackgroundColor(getPrimaryColor());
final RadioGroup rGroup = (RadioGroup) dialogLayout.findViewById(R.id.radio_group_card_view_style);
final CheckBox chkShowNPhots = (CheckBox) dialogLayout.findViewById(R.id.show_n_photos);
RadioButton rCompact = (RadioButton) dialogLayout.findViewById(R.id.radio_card_compact);
RadioButton rFlat = (RadioButton) dialogLayout.findViewById(R.id.radio_card_flat);
......@@ -431,7 +435,6 @@ public class SettingsActivity extends ThemedActivity {
rGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
View v;
switch (i) {
case R.id.radio_card_compact:
......@@ -452,7 +455,7 @@ public class SettingsActivity extends ThemedActivity {
img.setBackgroundColor(getPrimaryColor());
Glide.with(getApplicationContext())
.load(R.drawable.gilbert_profile)
.load(R.drawable.leaf_pic)
.into(img);
String hexPrimaryColor = ColorPalette.getHexColor(getPrimaryColor());
......@@ -463,19 +466,33 @@ public class SettingsActivity extends ThemedActivity {
String textColor = getBaseTheme().equals(Theme.LIGHT) ? "#2B2B2B" : "#FAFAFA";
String albumNameHtml = "<i><font color='" + textColor + "'>#PraiseDuarte</font></i>";
/** CHECK BOX **/
if (chkShowNPhots.isChecked()) {
// TODO: 12/4/16 ehhhh
String albumPhotoCountHtml = "<b><font color='" + hexAccentColor + "'>420</font></b>" + "<font " +
"color='" + textColor + "'> " + getString(R.string.media) + "</font>";
String albumPhotoCountHtml = ("<font color='" + textColor + "'> " + ((i!=R.id.radio_card_compact)? "" : "#" + "")
+ "</font>")+"<b><font color='" + hexAccentColor + "'>420</font></b>" + "<font " +
"color='" + textColor + "'> " + ((i!=R.id.radio_card_compact) ? getString(R.string.media) : "" )+ "</font>";
((TextView) v.findViewById(R.id.album_photos_count)).setText(StringUtils.html(albumPhotoCountHtml));
} else
v.findViewById(R.id.album_photos_count).setVisibility(View.GONE);
/*
TODO: find a way to do this shit
chkShowNPhots.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
if (chkShowNPhots.isChecked()) {
String albumPhotoCountHtml = ((i!=R.id.radio_card_compact)?"#":"")+"<b><font color='" + hexAccentColor + "'>420</font></b>" + "<font " +
"color='" + textColor + "'> " + ((i!=R.id.radio_card_compact)? " " : getString(R.string.media)) + "</font>";
((TextView) v.findViewById(R.id.album_photos_count)).setText(StringUtils.html(albumPhotoCountHtml));
} else
v.findViewById(R.id.album_photos_count).setVisibility(View.GONE);
}
});
*/
((TextView) v.findViewById(R.id.album_name)).setText(StringUtils.html(albumNameHtml));
((CardView) v).setUseCompatPadding(true);
((CardView) v).setRadius(2);
......@@ -494,7 +511,14 @@ public class SettingsActivity extends ThemedActivity {
builder.setPositiveButton(getString(R.string.ok_action).toUpperCase(), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(SettingsActivity.this, "Jibo mettilo apposto", Toast.LENGTH_SHORT).show();
switch (rGroup.getCheckedRadioButtonId()) {
case R.id.radio_card_material:
default: SP.putInt("card_view_style", CardViewStyle.MATERIAL.getValue()); break;
case R.id.radio_card_flat: SP.putInt("card_view_style", CardViewStyle.FLAT.getValue()); break;
case R.id.radio_card_compact: SP.putInt("card_view_style", CardViewStyle.COMPACT.getValue()); break;
}
SP.putBoolean("show_n_photos", chkShowNPhots.isChecked());
Toast.makeText(SettingsActivity.this, getString(R.string.card_style_alert), Toast.LENGTH_SHORT).show();
}
});
builder.setView(dialogLayout);
......
......@@ -257,6 +257,7 @@ public class WhiteListActivity extends ThemedActivity {
int pos = (int) v.findViewById(R.id.folder_path).getTag();
SwitchCompat s = (SwitchCompat) v.findViewById(R.id.tracked_status);
s.setChecked(folders.get(pos).toggleInclude());
setSwitchColor(s, getAccentColor());
//notifyItemChanged(pos);
}
};
......
......@@ -38,6 +38,8 @@ public class AlbumsAdapter extends RecyclerView.Adapter<AlbumsAdapter.ViewHolder
private View.OnClickListener mOnClickListener;
private View.OnLongClickListener mOnLongClickListener;
private ThemeHelper theme;
private PreferenceUtil SP;
private BitmapDrawable placeholder;
......@@ -48,6 +50,7 @@ public class AlbumsAdapter extends RecyclerView.Adapter<AlbumsAdapter.ViewHolder
}
public void updateTheme(Context context) {
SP = PreferenceUtil.getInstance(context);
theme.updateTheme();
placeholder = ((BitmapDrawable) theme.getPlaceHolder());
cvs = CardViewStyle.fromValue(PreferenceUtil.getInstance(context).getInt("card_view_style",CardViewStyle.MATERIAL.getValue()));
......@@ -115,13 +118,17 @@ public class AlbumsAdapter extends RecyclerView.Adapter<AlbumsAdapter.ViewHolder
"color='" + textColor + "'> " + holder.nPhotos.getContext().getString(R.string.media) + "</font>";
if (cvs.equals(CardViewStyle.COMPACT)) {
// TODO: 12/4/16 ehhhhh
albumPhotoCountHtml = "<b><font color='" + textColor + "'>#" + a.getCount() + "</font></b>";
albumPhotoCountHtml = "<b><font color='" + hexAccentColor + "'>#" + a.getCount() + "</font></b>";
}
holder.name.setText(StringUtils.html(albumNameHtml));
holder.nPhotos.setText(StringUtils.html(albumPhotoCountHtml));
//IMAGE COUNTER
if (!SP.getBoolean("show_n_photos", true))
holder.nPhotos.setVisibility(View.GONE);
// (a.getImagesCount() == 1 ? c.getString(R.string.singular_photo) : c.getString(R.string.plural_photos))
}
......
......@@ -43,7 +43,9 @@
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:orientation="horizontal">
android:orientation="horizontal"
android:padding="@dimen/small_spacing"
>
<TextView
android:id="@+id/album_photos_count"
android:layout_width="wrap_content"
......@@ -51,21 +53,16 @@
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="14sp"
android:paddingStart="8dp"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:visibility="gone"
/>
<TextView
android:paddingLeft="@dimen/sub_small_spacing"
android:id="@+id/album_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:padding="@dimen/small_spacing"
android:textColor="@android:color/white"
android:textSize="16sp"
/>
</LinearLayout>
</org.horaapps.leafpic.views.SquareRelativeLayout>
</LinearLayout>
......
......@@ -44,15 +44,16 @@
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:orientation="vertical"
android:paddingLeft="@dimen/sub_medium_spacing"
android:paddingRight="@dimen/sub_medium_spacing"
android:paddingBottom="@dimen/small_spacing"
android:paddingTop="@dimen/small_spacing"
>
<TextView
android:id="@+id/album_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:paddingEnd="20dp"
android:paddingStart="10dp"
android:paddingTop="10dp"
android:textColor="@android:color/white"
android:textSize="16sp"
/>
......@@ -61,9 +62,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:paddingBottom="10dp"
android:paddingEnd="10dp"
android:paddingStart="10dp"
android:textColor="@android:color/white"
android:textSize="14sp"
/>
......
......@@ -54,6 +54,10 @@
android:layout_alignParentStart="true"
android:layout_below="@id/album_card_divider"
android:orientation="vertical"
android:paddingLeft="@dimen/sub_medium_spacing"
android:paddingRight="@dimen/sub_medium_spacing"
android:paddingBottom="@dimen/small_spacing"
android:paddingTop="@dimen/small_spacing"
>
<TextView
......@@ -61,9 +65,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:paddingEnd="20dp"
android:paddingStart="10dp"
android:paddingTop="10dp"
android:textColor="@android:color/white"
android:textSize="16sp"
/>
......@@ -72,9 +73,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:paddingBottom="10dp"
android:paddingEnd="10dp"
android:paddingStart="10dp"
android:textColor="@android:color/white"
android:textSize="14sp"
/>
......
......@@ -48,6 +48,7 @@
<CheckBox
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="@dimen/medium_text"
android:id="@+id/show_n_photos"
android:text="Show count"/>
......
......@@ -82,6 +82,7 @@
<string name="new_folder_message">The new folder will be created in the current path, and
then the media will be copied or moved in the new folder.
</string>
<string name="card_style_alert">NOTE: Restart the app for make changes.</string>
<!-- ITEMS -->
<string name="singular_photo">Photo</string>
......
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