2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] Issue https://github.com/mozilla-mobile/fenix/issues/8277: Reuse app icon in widget layout.

This patch refactors the widget layouts so that we can reuse the app icon and do not have to have
another logo resource with different constraints. This will also make it easier to update the
branding in https://github.com/mozilla-mobile/fenix/issues/8277 and https://github.com/mozilla-mobile/fenix/issues/8278.
This commit is contained in:
Sebastian Kaspari 2020-02-13 16:17:28 +01:00
parent a77c4b05ee
commit dcf1356a6e
7 changed files with 47 additions and 78 deletions

View File

@ -17,7 +17,7 @@ import android.view.View
import android.widget.RemoteViews
import androidx.annotation.Dimension
import androidx.annotation.Dimension.DP
import androidx.appcompat.widget.AppCompatDrawableManager
import androidx.appcompat.content.res.AppCompatResources
import androidx.core.graphics.drawable.toBitmap
import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.IntentReceiverActivity
@ -168,13 +168,13 @@ class SearchWidgetProvider : AppWidgetProvider() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
setImageViewResource(
R.id.button_search_widget_new_tab_icon,
R.drawable.ic_logo_widget)
R.drawable.ic_launcher_foreground)
} else {
setImageViewBitmap(
R.id.button_search_widget_new_tab_icon,
AppCompatDrawableManager.get().getDrawable(
AppCompatResources.getDrawable(
context,
R.drawable.ic_logo_widget
R.drawable.ic_launcher_foreground
)?.toBitmap())
}
}

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@id/button_search_widget_new_tab"
android:layout_width="match_parent"
android:layout_height="50dp"
@ -12,7 +13,10 @@
<ImageView
android:id="@+id/button_search_widget_new_tab_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="centerInside"
tools:src="@drawable/ic_launcher_foreground"
android:layout_gravity="center"/>
</FrameLayout>

View File

@ -4,6 +4,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@id/button_search_widget_new_tab"
android:layout_width="64dp"
android:layout_height="50dp"
@ -12,7 +13,9 @@
<ImageView
android:id="@+id/button_search_widget_new_tab_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="centerInside"
tools:src="@drawable/ic_launcher_foreground"
android:layout_gravity="center"/>
</FrameLayout>

View File

@ -12,11 +12,10 @@
<ImageView
android:id="@+id/button_search_widget_new_tab_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentStart="true"
android:adjustViewBounds="true"
android:padding="12dp"/>
android:scaleType="centerInside" />
<TextView
android:id="@+id/button_search_widget_new_tab"

View File

@ -12,11 +12,10 @@
<ImageView
android:id="@+id/button_search_widget_new_tab_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentStart="true"
android:adjustViewBounds="true"
android:padding="12dp"/>
android:scaleType="centerInside" />
<TextView
android:id="@+id/button_search_widget_new_tab"

View File

@ -2,33 +2,23 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="100dp"
android:layout_height="50dp"
android:background="@drawable/rounded_white_corners"
android:layout_gravity="center">
<FrameLayout android:id="@+id/button_search_widget_new_tab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="9dp">
android:orientation="horizontal">
<ImageView
android:id="@+id/button_search_widget_new_tab_icon"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="9dp"/>
</FrameLayout>
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="centerInside" />
<ImageButton
<ImageView
android:id="@+id/button_search_widget_voice"
android:layout_width="32dp"
android:layout_height="32dp"
android:background="@drawable/ic_microphone_widget"
android:layout_alignParentEnd="true"
android:layout_alignTop="@id/button_search_widget_new_tab"
android:layout_marginEnd="9dp"/>
</RelativeLayout>
android:layout_width="50dp"
android:layout_height="50dp"
android:padding="10dp"
android:src="@drawable/ic_microphone_widget"
android:scaleType="centerInside" />
</LinearLayout>