Add background frame for the thumbnails
This commit is contained in:
parent
60b8d34d1f
commit
f039106194
6 changed files with 138 additions and 127 deletions
|
@ -52,6 +52,7 @@ import org.shadowice.flocke.andotp.Utilities.Constants;
|
|||
import org.shadowice.flocke.andotp.Utilities.DatabaseHelper;
|
||||
import org.shadowice.flocke.andotp.Utilities.EntryThumbnail;
|
||||
import org.shadowice.flocke.andotp.Utilities.Settings;
|
||||
import org.shadowice.flocke.andotp.Utilities.Tools;
|
||||
import org.shadowice.flocke.andotp.View.ItemTouchHelper.ItemTouchHelperAdapter;
|
||||
|
||||
import java.text.Collator;
|
||||
|
@ -377,8 +378,13 @@ public class EntriesCardAdapter extends RecyclerView.Adapter<EntryViewHolder>
|
|||
}
|
||||
});
|
||||
|
||||
int gridPadding = context.getResources().getDimensionPixelSize(R.dimen.activity_margin_small);
|
||||
int gridBackground = Tools.getThemeColor(context, R.attr.thumbnailBackground);
|
||||
|
||||
GridView grid = new GridView(context);
|
||||
grid.setAdapter(thumbnailAdapter);
|
||||
grid.setBackgroundColor(gridBackground);
|
||||
grid.setPadding(gridPadding, gridPadding, gridPadding, gridPadding);
|
||||
grid.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
|
||||
int thumbnailSize = settings.getThumbnailSize();
|
||||
|
|
|
@ -28,6 +28,7 @@ import android.support.v7.widget.CardView;
|
|||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
@ -51,6 +52,7 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
|
|||
private LinearLayout valueLayout;
|
||||
private LinearLayout coverLayout;
|
||||
private LinearLayout customPeriodLayout;
|
||||
private FrameLayout thumbnailFrame;
|
||||
private ImageView visibleImg;
|
||||
private ImageView thumbnailImg;
|
||||
private TextView value;
|
||||
|
@ -68,6 +70,7 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
|
|||
value = v.findViewById(R.id.valueText);
|
||||
valueLayout = v.findViewById(R.id.valueLayout);
|
||||
visibleImg = v.findViewById(R.id.valueImg);
|
||||
thumbnailFrame = v.findViewById(R.id.thumbnailFrame);
|
||||
thumbnailImg = v.findViewById(R.id.thumbnailImg);
|
||||
coverLayout = v.findViewById(R.id.coverLayout);
|
||||
label = v.findViewById(R.id.textViewLabel);
|
||||
|
@ -131,7 +134,7 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
|
|||
this.tags.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
thumbnailImg.setVisibility(settings.getThumbnailVisible() ? View.VISIBLE : View.GONE);
|
||||
thumbnailFrame.setVisibility(settings.getThumbnailVisible() ? View.VISIBLE : View.GONE);
|
||||
|
||||
int thumbnailSize = settings.getThumbnailSize();
|
||||
if(settings.getThumbnailVisible()) {
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package org.shadowice.flocke.andotp.View;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.GridView;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import org.shadowice.flocke.andotp.R;
|
||||
import org.shadowice.flocke.andotp.Utilities.EntryThumbnail;
|
||||
import org.shadowice.flocke.andotp.Utilities.Settings;
|
||||
|
||||
|
@ -80,18 +76,6 @@ public class ThumbnailSelectionAdapter extends BaseAdapter {
|
|||
EntryThumbnail.EntryThumbnails thumb = (EntryThumbnail.EntryThumbnails)getItem(i);
|
||||
|
||||
imageView.setImageBitmap(EntryThumbnail.getThumbnailGraphic(context, label, thumbnailSize, thumb));
|
||||
|
||||
try {
|
||||
TypedValue typedValue = new TypedValue();
|
||||
Resources.Theme theme = context.getTheme();
|
||||
theme.resolveAttribute(R.attr.thumbnailBackground, typedValue, true);
|
||||
@ColorInt int color = typedValue.data;
|
||||
|
||||
imageView.setBackgroundColor(color);
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
imageView.setBackgroundColor(context.getResources().getColor(android.R.color.white));
|
||||
}
|
||||
return imageView;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,133 +10,151 @@
|
|||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:baselineAligned="false" >
|
||||
android:baselineAligned="false">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/thumbnailImg"
|
||||
android:layout_width="@dimen/card_thumbnail_size"
|
||||
android:layout_height="@dimen/card_thumbnail_size"
|
||||
android:layout_marginEnd="@dimen/activity_margin"
|
||||
android:background="?attr/thumbnailBackground"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
<FrameLayout
|
||||
android:id="@+id/thumbnailFrame"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:paddingStart="@dimen/card_padding_without_corners"
|
||||
android:background="?attr/thumbnailBackground">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1">
|
||||
<ImageView
|
||||
android:id="@+id/thumbnailImg"
|
||||
android:layout_width="@dimen/card_thumbnail_size"
|
||||
android:layout_height="@dimen/card_thumbnail_size"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/valueLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/valueImg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/activity_margin_small"
|
||||
android:src="@drawable/ic_visibility_visible"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/valueText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/coverLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/coverImg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/activity_margin_small"
|
||||
android:alpha="0.4"
|
||||
android:src="@drawable/ic_visibility_invisible"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.4"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/label_hidden" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewTags"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textSize="13.5sp" />
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin"
|
||||
android:gravity="center_vertical"
|
||||
android:baselineAligned="false" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/customPeriodLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal" >
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_alarm_gray" />
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/valueLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/valueImg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/activity_margin_small"
|
||||
android:src="@drawable/ic_visibility_visible"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/valueText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/coverLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/coverImg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginEnd="@dimen/activity_margin_small"
|
||||
android:alpha="0.4"
|
||||
android:src="@drawable/ic_visibility_invisible"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:alpha="0.4"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="28sp"
|
||||
android:textStyle="bold"
|
||||
android:text="@string/label_hidden" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/customPeriod"
|
||||
android:id="@+id/textViewLabel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold" />
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textViewTags"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:textSize="13.5sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/copyButton"
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin_small"
|
||||
android:src="@drawable/ic_content_copy_gray"
|
||||
android:background="?android:attr/selectableItemBackground"/>
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/customPeriodLayout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/activity_horizontal_margin"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/ic_alarm_gray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/customPeriod"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/copyButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin_small"
|
||||
android:src="@drawable/ic_content_copy_gray"
|
||||
android:background="?android:attr/selectableItemBackground"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/menuButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin_small"
|
||||
android:src="@drawable/ic_more_vert_gray"
|
||||
android:background="?android:attr/selectableItemBackground"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/menuButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/activity_margin_small"
|
||||
android:src="@drawable/ic_more_vert_gray"
|
||||
android:background="?android:attr/selectableItemBackground"/>
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
|
||||
<dimen name="activity_horizontal_margin">16dp</dimen>
|
||||
|
||||
<dimen name="card_corner_radius">0dp</dimen>
|
||||
<dimen name="card_corner_radius">2dp</dimen>
|
||||
<dimen name="card_padding_without_corners">14dp</dimen>
|
||||
<dimen name="card_thumbnail_size">46dp</dimen>
|
||||
|
||||
<!-- The default letter tile text size -->
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
<style name="CardViewStyle" parent="CardView">
|
||||
<item name="cardCornerRadius">@dimen/card_corner_radius</item>
|
||||
<item name="cardUseCompatPadding">true</item>
|
||||
<item name="contentPadding">@dimen/activity_margin</item>
|
||||
</style>
|
||||
|
||||
<!-- Dark application theme. -->
|
||||
|
|
Loading…
Reference in a new issue