Add widget preview images
@@ -1046,9 +1046,8 @@ public abstract class BraveToolbarLayoutImpl extends ToolbarLayout
|
||||
Intent searchActivityIntent = new Intent(context, SearchActivity.class);
|
||||
context.startActivity(searchActivityIntent);
|
||||
}
|
||||
if (hasFocus)
|
||||
mSearchWidgetPromoPanel.showIfNeeded(this);
|
||||
|
||||
if (hasFocus) mSearchWidgetPromoPanel.showIfNeeded(this);
|
||||
|
||||
if (OnboardingPrefManager.getInstance().getUrlFocusCount() == 0) {
|
||||
OnboardingPrefManager.getInstance().updateUrlFocusCount();
|
||||
}
|
||||
|
||||
@@ -7,20 +7,19 @@
|
||||
|
||||
package org.chromium.chrome.browser.widget.quickactionsearchandbookmark.promo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import org.chromium.chrome.R;
|
||||
import android.content.Context;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatTextView;
|
||||
import androidx.cardview.widget.CardView;
|
||||
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.widget.quickactionsearchandbookmark.utils.BraveSearchWidgetUtils;
|
||||
|
||||
public class SearchWidgetPromoPanel implements View.OnClickListener {
|
||||
|
||||
private PopupWindow mPopupWindow;
|
||||
|
||||
public SearchWidgetPromoPanel(@NonNull Context context) {
|
||||
|
||||
@@ -7,61 +7,58 @@
|
||||
|
||||
package org.chromium.chrome.browser.widget.quickactionsearchandbookmark.utils;
|
||||
|
||||
import org.chromium.chrome.browser.preferences.SharedPreferencesManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import org.chromium.chrome.browser.widget.quickactionsearchandbookmark.QuickActionSearchAndBookmarkWidgetProvider;
|
||||
import org.chromium.base.ContextUtils;
|
||||
import android.content.ComponentName;
|
||||
import android.os.Build;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ComponentName;
|
||||
import android.app.PendingIntent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.chrome.browser.preferences.SharedPreferencesManager;
|
||||
import org.chromium.chrome.browser.widget.quickactionsearchandbookmark.QuickActionSearchAndBookmarkWidgetProvider;
|
||||
|
||||
public class BraveSearchWidgetUtils {
|
||||
private static final String SHOW_WIDGET =
|
||||
"org.chromium.chrome.browser.widget.quickactionsearchandbookmark.utils.SHOW_WIDGET";
|
||||
|
||||
private static final String SHOW_WIDGET = "org.chromium.chrome.browser.widget.quickactionsearchandbookmark.utils.SHOW_WIDGET";
|
||||
|
||||
public static boolean getShouldShowWidgetPromo() {
|
||||
return SharedPreferencesManager.getInstance().readBoolean(SHOW_WIDGET, isRequestPinAppWidgetSupported());
|
||||
}
|
||||
public static boolean getShouldShowWidgetPromo() {
|
||||
return SharedPreferencesManager.getInstance().readBoolean(
|
||||
SHOW_WIDGET, isRequestPinAppWidgetSupported());
|
||||
}
|
||||
|
||||
public static void setShouldShowWidgetPromo(boolean shouldShow) {
|
||||
SharedPreferencesManager.getInstance().writeBoolean(SHOW_WIDGET, shouldShow);
|
||||
}
|
||||
public static void setShouldShowWidgetPromo(boolean shouldShow) {
|
||||
SharedPreferencesManager.getInstance().writeBoolean(SHOW_WIDGET, shouldShow);
|
||||
}
|
||||
|
||||
public static boolean isRequestPinAppWidgetSupported() {
|
||||
AppWidgetManager appWidgetManager =
|
||||
public static boolean isRequestPinAppWidgetSupported() {
|
||||
AppWidgetManager appWidgetManager =
|
||||
ContextUtils.getApplicationContext().getSystemService(AppWidgetManager.class);
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && appWidgetManager != null
|
||||
&& appWidgetManager.isRequestPinAppWidgetSupported();
|
||||
}
|
||||
}
|
||||
|
||||
public static void requestPinAppWidget() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
public static void requestPinAppWidget() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
Context context = ContextUtils.getApplicationContext();
|
||||
AppWidgetManager appWidgetManager =
|
||||
context.getSystemService(AppWidgetManager.class);
|
||||
AppWidgetManager appWidgetManager = context.getSystemService(AppWidgetManager.class);
|
||||
|
||||
ComponentName appWidgetProvider = new ComponentName(
|
||||
context, QuickActionSearchAndBookmarkWidgetProvider.class);
|
||||
ComponentName appWidgetProvider =
|
||||
new ComponentName(context, QuickActionSearchAndBookmarkWidgetProvider.class);
|
||||
|
||||
if (appWidgetManager != null
|
||||
&& appWidgetManager.isRequestPinAppWidgetSupported()) {
|
||||
if (appWidgetManager != null && appWidgetManager.isRequestPinAppWidgetSupported()) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putBoolean(
|
||||
QuickActionSearchAndBookmarkWidgetProvider.FROM_SETTINGS, true);
|
||||
Intent pinnedWidgetCallbackIntent = new Intent(
|
||||
context, QuickActionSearchAndBookmarkWidgetProvider.class);
|
||||
bundle.putBoolean(QuickActionSearchAndBookmarkWidgetProvider.FROM_SETTINGS, true);
|
||||
Intent pinnedWidgetCallbackIntent =
|
||||
new Intent(context, QuickActionSearchAndBookmarkWidgetProvider.class);
|
||||
pinnedWidgetCallbackIntent.putExtras(bundle);
|
||||
PendingIntent successCallback = PendingIntent.getBroadcast(context, 0,
|
||||
pinnedWidgetCallbackIntent,
|
||||
PendingIntent.FLAG_IMMUTABLE
|
||||
| PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
PendingIntent successCallback =
|
||||
PendingIntent.getBroadcast(context, 0, pinnedWidgetCallbackIntent,
|
||||
PendingIntent.FLAG_IMMUTABLE | PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
|
||||
appWidgetManager.requestPinAppWidget(appWidgetProvider, null, successCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 47 KiB After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 32 KiB |