Legacy Cards : Update the layout

This commit is contained in:
Mr. Dragon
2019-06-07 21:17:00 +05:30
parent 2fb6ec9f8d
commit 6ff0faafd8
4 changed files with 58 additions and 49 deletions

View File

@@ -31,6 +31,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.aurora.store.CardType;
@@ -97,6 +98,9 @@ public class FeaturedAppsAdapter extends RecyclerView.Adapter<FeaturedAppsAdapte
viewHolder.txtIndicator.setVisibility(PackageUtil.isInstalled(context, app)
? View.VISIBLE
: View.GONE);
if (viewHolder.txtSize != null)
viewHolder.txtSize.setText(Util.humanReadableByteValue(app.getSize(), true));
}
private void drawBackground(App app, ViewHolder holder) {
@@ -123,6 +127,9 @@ public class FeaturedAppsAdapter extends RecyclerView.Adapter<FeaturedAppsAdapte
ImageView imgIcon;
@BindView(R.id.app_name)
TextView txtName;
@Nullable
@BindView(R.id.app_size)
TextView txtSize;
@BindView(R.id.txt_indicator)
TextView txtIndicator;

View File

@@ -284,7 +284,7 @@ public class Util {
}
public static boolean snapPagerEnabled(Context context) {
return getPrefs(context).getBoolean(Constants.PREFERENCE_FEATURED_SNAP, true);
return getPrefs(context).getBoolean(Constants.PREFERENCE_FEATURED_SNAP, false);
}
public static boolean isIMEEnabled(Context context) {

View File

@@ -18,57 +18,59 @@
~
-->
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="132dp"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginEnd="@dimen/margin_xsmall"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/margin_xsmall"
app:rippleColor="@color/colorScrim">
<RelativeLayout
<ImageView
android:id="@+id/app_icon"
android:layout_width="@dimen/icon_size_big"
android:layout_height="@dimen/icon_size_big"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/margin_small"
android:layout_marginBottom="@dimen/margin_xxsmall"
android:contentDescription="@string/content_description_icon" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_below="@id/app_icon"
android:layout_alignStart="@id/app_icon"
android:layout_alignEnd="@id/app_icon"
android:ellipsize="end"
android:maxLines="1"
android:textAlignment="viewStart"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
tools:text="Aurora Store" />
<ImageView
android:id="@+id/app_icon"
android:layout_width="@dimen/icon_size_big"
android:layout_height="@dimen/icon_size_big"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/margin_small"
android:layout_marginBottom="@dimen/margin_xxsmall"
android:contentDescription="@string/content_description_icon"
android:padding="@dimen/margin_small" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/app_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/app_name"
android:layout_alignStart="@id/app_icon"
android:layout_alignEnd="@id/app_icon"
android:layout_marginBottom="@dimen/margin_xxsmall"
android:ellipsize="end"
android:maxLines="1"
android:textAlignment="viewStart"
android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp"
tools:text="6 MB" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/app_icon"
android:layout_marginStart="@dimen/margin_xsmall"
android:layout_marginEnd="@dimen/margin_xsmall"
android:layout_marginBottom="@dimen/margin_xxsmall"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:textStyle="bold"
android:minHeight="42dp"
android:textAlignment="center"
android:textColor="?android:attr/textColorPrimary"
android:textSize="14sp"
app:autoSizeMaxTextSize="15sp"
app:autoSizeMinTextSize="12sp"
app:autoSizeTextType="uniform" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/txt_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:drawableEnd="@drawable/ic_installed"
android:drawablePadding="@dimen/margin_small"
android:padding="@dimen/margin_xxsmall"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="normal"
android:visibility="gone" />
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/txt_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:drawableEnd="@drawable/ic_installed"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="normal"
android:visibility="visible" />
</RelativeLayout>

View File

@@ -33,7 +33,7 @@
<dimen name="bottom_nav_padding">64dp</dimen>
<dimen name="icon_size">64dp</dimen>
<dimen name="icon_size_big">96dp</dimen>
<dimen name="icon_size_big">100dp</dimen>
<dimen name="icon_size_small">56dp</dimen>
<dimen name="icon_size_med">48dp</dimen>
<dimen name="icon_size_cat">36dp</dimen>