theme the screenshot placeholder
This commit is contained in:
parent
1fd3b308e9
commit
10111b2beb
@ -483,12 +483,7 @@ public final class Utils {
|
||||
*/
|
||||
public static DisplayImageOptions.Builder getDefaultDisplayImageOptionsBuilder() {
|
||||
if (defaultDisplayImageOptionsBuilder == null) {
|
||||
defaultDisplayImageOptionsBuilder = new DisplayImageOptions.Builder()
|
||||
.cacheInMemory(true)
|
||||
.cacheOnDisk(true)
|
||||
.considerExifParams(false)
|
||||
.bitmapConfig(Bitmap.Config.RGB_565)
|
||||
.imageScaleType(ImageScaleType.EXACTLY);
|
||||
defaultDisplayImageOptionsBuilder = createDefaultDisplayImageOptionsBuilder();
|
||||
}
|
||||
return defaultDisplayImageOptionsBuilder;
|
||||
}
|
||||
@ -500,7 +495,7 @@ public final class Utils {
|
||||
*/
|
||||
public static DisplayImageOptions getRepoAppDisplayImageOptions() {
|
||||
if (repoAppDisplayImageOptions == null) {
|
||||
repoAppDisplayImageOptions = getDefaultDisplayImageOptionsBuilder()
|
||||
repoAppDisplayImageOptions = createDefaultDisplayImageOptionsBuilder()
|
||||
.showImageOnLoading(R.drawable.ic_repo_app_default)
|
||||
.showImageForEmptyUri(R.drawable.ic_repo_app_default)
|
||||
.showImageOnFail(R.drawable.ic_repo_app_default)
|
||||
@ -510,6 +505,15 @@ public final class Utils {
|
||||
return repoAppDisplayImageOptions;
|
||||
}
|
||||
|
||||
private static DisplayImageOptions.Builder createDefaultDisplayImageOptionsBuilder() {
|
||||
return new DisplayImageOptions.Builder()
|
||||
.cacheInMemory(true)
|
||||
.cacheOnDisk(true)
|
||||
.considerExifParams(false)
|
||||
.bitmapConfig(Bitmap.Config.RGB_565)
|
||||
.imageScaleType(ImageScaleType.EXACTLY);
|
||||
}
|
||||
|
||||
/**
|
||||
* If app has an iconUrl we feed that to UIL, otherwise we ask the PackageManager which will
|
||||
* return the app's icon directly when the app is installed.
|
||||
|
@ -3,6 +3,7 @@ package org.fdroid.fdroid.views;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -22,6 +23,7 @@ import org.fdroid.fdroid.data.AppProvider;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
@ -132,10 +134,14 @@ public class ScreenShotsActivity extends AppCompatActivity {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
|
||||
Drawable screenShotPlaceholder = ContextCompat.getDrawable(
|
||||
inflater.getContext(),
|
||||
R.drawable.screenshot_placeholder
|
||||
);
|
||||
DisplayImageOptions displayImageOptions = Utils.getDefaultDisplayImageOptionsBuilder()
|
||||
.showImageOnFail(R.drawable.screenshot_placeholder)
|
||||
.showImageOnLoading(R.drawable.screenshot_placeholder)
|
||||
.showImageForEmptyUri(R.drawable.screenshot_placeholder)
|
||||
.showImageOnFail(screenShotPlaceholder)
|
||||
.showImageOnLoading(screenShotPlaceholder)
|
||||
.showImageForEmptyUri(screenShotPlaceholder)
|
||||
.build();
|
||||
|
||||
View rootView = inflater.inflate(R.layout.activity_screenshots_page, container, false);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.fdroid.fdroid.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@ -14,6 +15,7 @@ import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.App;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
@ -29,10 +31,12 @@ class ScreenShotsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.V
|
||||
this.listener = listener;
|
||||
|
||||
screenshots = app.getAllScreenshots(context);
|
||||
|
||||
Drawable screenShotPlaceholder = ContextCompat.getDrawable(context, R.drawable.screenshot_placeholder);
|
||||
displayImageOptions = Utils.getDefaultDisplayImageOptionsBuilder()
|
||||
.showImageOnFail(R.drawable.screenshot_placeholder)
|
||||
.showImageOnLoading(R.drawable.screenshot_placeholder)
|
||||
.showImageForEmptyUri(R.drawable.screenshot_placeholder)
|
||||
.showImageOnFail(screenShotPlaceholder)
|
||||
.showImageOnLoading(screenShotPlaceholder)
|
||||
.showImageForEmptyUri(screenShotPlaceholder)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -1,33 +1,9 @@
|
||||
<vector android:height="169dp"
|
||||
android:viewportHeight="169.33333"
|
||||
android:viewportWidth="95.25"
|
||||
android:width="92dp"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="80dp"
|
||||
android:height="140dp"
|
||||
android:viewportWidth="80"
|
||||
android:viewportHeight="140">
|
||||
<path
|
||||
android:fillAlpha="1"
|
||||
android:fillColor="#e8e8e8"
|
||||
android:pathData="M1.75,0L93.5,0A1.75,1.75 0,0 1,95.25 1.75L95.25,167.59A1.75,1.75 0,0 1,93.5 169.33L1.75,169.33A1.75,1.75 0,0 1,0 167.59L0,1.75A1.75,1.75 0,0 1,1.75 0z"
|
||||
android:strokeAlpha="1"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="0.52916664" />
|
||||
<path
|
||||
android:fillAlpha="1"
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M40.77,53.63L54.38,53.63A1.75,1.75 0,0 1,56.13 55.37L56.13,68.98A1.75,1.75 0,0 1,54.38 70.73L40.77,70.73A1.75,1.75 0,0 1,39.03 68.98L39.03,55.37A1.75,1.75 0,0 1,40.77 53.63z"
|
||||
android:strokeAlpha="1"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeWidth="0.52916664" />
|
||||
<path
|
||||
android:fillAlpha="1"
|
||||
android:fillColor="#e8e8e8"
|
||||
android:pathData="m41.01,67.8 l3.21,-4.2 2.46,2.79 3.26,-4.16 4.16,5.58z"
|
||||
android:strokeAlpha="1"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeLineCap="butt"
|
||||
android:strokeLineJoin="miter"
|
||||
android:strokeWidth="0.26458332" />
|
||||
android:pathData="M47,63L47,77L33,77L33,63h14m0,-2L33,61c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L49,63c0,-1.1 -0.9,-2 -2,-2zM42.14,69.86 L39.14,73.73L37,71.14 34,75h12z"
|
||||
android:fillColor="?attr/screenshotPlaceholderIconColor"/>
|
||||
</vector>
|
||||
|
@ -1,11 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/screenshot"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/screenshot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/layout_horizontal_margin"
|
||||
android:adjustViewBounds="true"
|
||||
android:background="?attr/colorSurface"
|
||||
android:contentDescription="@null"
|
||||
android:padding="@dimen/layout_horizontal_margin"
|
||||
tools:src="@drawable/screenshot_placeholder"
|
||||
android:fitsSystemWindows="true"/>
|
||||
android:elevation="4dp"
|
||||
tools:src="@drawable/screenshot_placeholder" />
|
||||
|
||||
</FrameLayout>
|
@ -1,11 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView 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="match_parent"
|
||||
android:layout_margin="@dimen/details_screenshot_margin"
|
||||
android:padding="12dp"
|
||||
app:cardCornerRadius="0dp">
|
||||
android:layout_margin="@dimen/details_screenshot_margin">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
|
@ -47,6 +47,8 @@
|
||||
<item name="backButtonDrawable">@drawable/ic_back</item>
|
||||
<item name="clearButtonDrawable">@drawable/ic_close</item>
|
||||
<item name="appDetailsAntiFeatureIconColor">#ffffff</item>
|
||||
|
||||
<item name="screenshotPlaceholderIconColor">#424242</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.App.Black" parent="Theme.App">
|
||||
|
@ -15,5 +15,6 @@
|
||||
<attr name="backButtonDrawable" format="reference"/>
|
||||
<attr name="clearButtonDrawable" format="reference"/>
|
||||
<attr name="appDetailsAntiFeatureIconColor" format="color"/>
|
||||
<attr name="screenshotPlaceholderIconColor" format="color"/>
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
|
@ -65,7 +65,10 @@
|
||||
<item name="lightGrayTextColor">#4a4a4a</item>
|
||||
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
|
||||
<item name="appDetailsAntiFeatureIconColor">#000000</item>
|
||||
|
||||
<item name="bottomNavigationStyle">@style/Widget.MaterialComponents.BottomNavigationView.PrimarySurface</item>
|
||||
|
||||
<item name="screenshotPlaceholderIconColor">#e8e8e8</item>
|
||||
</style>
|
||||
|
||||
<!-- light app theme with accent colors following roughly android design guidelines -->
|
||||
|
Loading…
x
Reference in New Issue
Block a user