Skip to content

Commit

Permalink
applied presubmit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyBarabash committed Nov 7, 2024
1 parent b89a758 commit 696947d
Show file tree
Hide file tree
Showing 28 changed files with 207 additions and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,14 @@ public void initiatePurchase(Activity activity, ProductDetails productDetails) {
MutableLiveData<Boolean> _billingConnectionState = new MutableLiveData();
LiveData<Boolean> billingConnectionState = _billingConnectionState;
startBillingServiceConnection(_billingConnectionState);
LiveDataUtil.observeOnce(billingConnectionState, isConnected -> {
if (isConnected) {
BillingResult unused_billingResult =
mBillingClient.launchBillingFlow(activity, billingFlowParams);
}
});
LiveDataUtil.observeOnce(
billingConnectionState,
isConnected -> {
if (isConnected) {
BillingResult unused_billingResult =
mBillingClient.launchBillingFlow(activity, billingFlowParams);
}
});
}

public void processPurchases(Context context, Purchase activePurchase) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,9 @@ private void createdDisplayAdCard(DisplayAd adData) {
RecyclerView.LayoutParams linearLayoutParams =
(RecyclerView.LayoutParams) mLinearLayout.getLayoutParams();

TableLayout.LayoutParams rowTableParams = new TableLayout.LayoutParams(
TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
TableLayout.LayoutParams rowTableParams =
new TableLayout.LayoutParams(
TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

FrameLayout adLayoutUp = new FrameLayout(mActivity);
ImageView adImage = new ImageView(mActivity);
Expand All @@ -211,17 +212,23 @@ private void createdDisplayAdCard(DisplayAd adData) {
TableRow row1 = new TableRow(mActivity);
TableRow row2 = new TableRow(mActivity);

TableRow.LayoutParams adLayoutParams = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams adLayoutParams =
new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);

FrameLayout.LayoutParams adImageParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
FrameLayout.LayoutParams adImageParams =
new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT);

TableRow.LayoutParams adButtonParams = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams adButtonParams =
new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);

tableLayoutTopNews.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
tableLayoutTopNews.setLayoutParams(
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
mLinearLayout.addView(tableLayoutTopNews);

linearLayoutParams.height = 0;
Expand All @@ -233,8 +240,10 @@ private void createdDisplayAdCard(DisplayAd adData) {
if (adData != null) {
linearLayoutParams.height = RecyclerView.LayoutParams.WRAP_CONTENT;
mLinearLayout.setLayoutParams(linearLayoutParams);
FrameLayout.LayoutParams adLogoParams = new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT);
FrameLayout.LayoutParams adLogoParams =
new FrameLayout.LayoutParams(
FrameLayout.LayoutParams.MATCH_PARENT,
FrameLayout.LayoutParams.WRAP_CONTENT);

rowTableParams.setMargins(50, 0, 50, 0);
rowTableParams.width = TableLayout.LayoutParams.MATCH_PARENT;
Expand Down Expand Up @@ -301,8 +310,11 @@ public void onClick(View v) {
row2.addView(adDesc);
row2.addView(adButton);

TableRow.LayoutParams adItemsParams = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT, 1.0f);
TableRow.LayoutParams adItemsParams =
new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT,
TableRow.LayoutParams.WRAP_CONTENT,
1.0f);
adTitle.setTextSize(17);
adItemsParams.bottomMargin = 2 * MARGIN_VERTICAL;
adTitle.setTypeface(null, Typeface.BOLD);
Expand Down Expand Up @@ -352,10 +364,12 @@ public void onClick(View v) {
public LinearLayout createCard(int type, int position) {
TableLayout tableLayoutTopNews = new TableLayout(mActivity);

TableLayout.LayoutParams tableParamsTopNews = new TableLayout.LayoutParams(
TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
TableLayout.LayoutParams rowTableParams = new TableLayout.LayoutParams(
TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
TableLayout.LayoutParams tableParamsTopNews =
new TableLayout.LayoutParams(
TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
TableLayout.LayoutParams rowTableParams =
new TableLayout.LayoutParams(
TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
TableRow rowTop = new TableRow(mActivity);
TextView topText = new TextView(mActivity);
BraveTouchUtils.ensureMinTouchTarget(topText);
Expand Down Expand Up @@ -729,30 +743,49 @@ private void addElementsToSingleLayout(ViewGroup view, int index, int itemType,
TextView source = new TextView(mActivity);
TextView desc = new TextView(mActivity);

LinearLayout.LayoutParams publisherParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1f);
LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1f);
LinearLayout.LayoutParams titleParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1f);
LinearLayout.LayoutParams descParams = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT, 1f);

TableLayout.LayoutParams tableParamsTopNews = new TableLayout.LayoutParams(
TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

TableRow.LayoutParams linearLayoutRowParams = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams linearLayoutRowParams1 = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams sourceRowParams = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams titleRowParams = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams descRowParams = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams imageRowParams = new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
LinearLayout.LayoutParams publisherParams =
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT,
1f);
LinearLayout.LayoutParams imageParams =
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
1f);
LinearLayout.LayoutParams titleParams =
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
1f);
LinearLayout.LayoutParams descParams =
new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT,
1f);

TableLayout.LayoutParams tableParamsTopNews =
new TableLayout.LayoutParams(
TableLayout.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

TableRow.LayoutParams linearLayoutRowParams =
new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams linearLayoutRowParams1 =
new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams sourceRowParams =
new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams titleRowParams =
new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams descRowParams =
new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);
TableRow.LayoutParams imageRowParams =
new TableRow.LayoutParams(
TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT);

LinearLayout layoutSingleCard = new LinearLayout(mActivity);
publisher.setLetterSpacing(0.03f);
Expand Down Expand Up @@ -1268,8 +1301,7 @@ private FeedItemMetadata getItemData(int index) {
return itemDataFinal;
}

private void setListeners(
View view, String creativeInstanceId, boolean isPromo) {
private void setListeners(View view, String creativeInstanceId, boolean isPromo) {
DisplayAd displayAd = mNewsItem.getDisplayAd();
view.setOnClickListener(
new View.OnClickListener() {
Expand Down Expand Up @@ -1397,13 +1429,21 @@ private void setImage(ImageView imageView, String type, int index) {
private RequestListener<Drawable> createLoggerListener(final String unused_name) {
return new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target,
public boolean onLoadFailed(
@Nullable GlideException e,
Object model,
Target target,
boolean isFirstResource) {
return false;
}

@Override
public boolean onResourceReady(Drawable resource, Object model, Target target,
DataSource dataSource, boolean isFirstResource) {
public boolean onResourceReady(
Drawable resource,
Object model,
Target target,
DataSource dataSource,
boolean isFirstResource) {
if (resource instanceof BitmapDrawable) {
// Bitmap bitmap = ((BitmapDrawable) resource).getBitmap();
// Log.d(TAG,String.format(Locale.getDefault(), "Ready %s bitmap %,d bytes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
import java.util.List;

public class BraveStatsBottomSheetDialogFragment extends BottomSheetDialogFragment {
final public static String TAG_FRAGMENT = "BRAVESTATS_FRAG";
public static final String TAG_FRAGMENT = "BRAVESTATS_FRAG";
private DatabaseHelper mDatabaseHelper = DatabaseHelper.getInstance();

private static final int WEBSITES = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ private static class SolanaInstructionAccountPresenter {
private String mPubKey;
private SolanaAccountMeta mSolanaAccountMeta;
private String mLocalizeAccountHeader;

@SuppressWarnings("UnusedVariable")
private String mAccountHeader;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ public BraveNotificationPermissionRationaleDialogController(
super(context, modalDialogManager);
}

/**
* This is empty override method, to block default android 13 chromium dialog
* */
/** This is empty override method, to block default android 13 chromium dialog */
@Override
public void showRationaleUi(Callback<Integer> rationaleCallback) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ public class BraveNewTabPage extends NewTabPage {
// To delete in bytecode, members from parent class will be used instead.
private BrowserControlsStateProvider mBrowserControlsStateProvider;
private NewTabPageLayout mNewTabPageLayout;

@SuppressWarnings("UnusedVariable")
private FeedSurfaceProvider mFeedSurfaceProvider;

private Supplier<Toolbar> mToolbarSupplier;
private BottomSheetController mBottomSheetController;
private ObservableSupplier<Integer> mTabStripHeightSupplier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ public class BraveNewTabPageLayout

// To delete in bytecode, parent variable will be used instead.
private ViewGroup mMvTilesContainerLayout;

@SuppressWarnings("UnusedVariable")
private LogoCoordinator mLogoCoordinator;

private Integer mInitialTileNum;

// Own members.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,27 @@ public class NTPImageUtil {
// The resource R.string.you_are_earning_tokens appears to be unused [UnusedResources]
// This is related to rewards, so I keep it till review
@SuppressWarnings("UnusedVariable")
private static SpannableString getBannerText(ChromeActivity chromeActivity, int ntpType,
View bannerLayout, SponsoredTab sponsoredTab, NewTabPageListener newTabPageListener) {
private static SpannableString getBannerText(
ChromeActivity chromeActivity,
int ntpType,
View bannerLayout,
SponsoredTab sponsoredTab,
NewTabPageListener newTabPageListener) {
String bannerText = "";
if (ntpType == SponsoredImageUtil.BR_ON_ADS_ON) {
bannerText = String.format(
chromeActivity.getResources().getString(R.string.you_are_earning_tokens),
chromeActivity.getResources().getString(R.string.learn_more));
bannerText =
String.format(
chromeActivity
.getResources()
.getString(R.string.you_are_earning_tokens),
chromeActivity.getResources().getString(R.string.learn_more));
} else if (ntpType == SponsoredImageUtil.BR_ON_ADS_OFF) {
bannerText = String.format(
chromeActivity.getResources().getString(R.string.earn_tokens_for_viewing),
chromeActivity.getResources().getString(R.string.learn_more));
bannerText =
String.format(
chromeActivity
.getResources()
.getString(R.string.earn_tokens_for_viewing),
chromeActivity.getResources().getString(R.string.learn_more));
}
int learnMoreIndex =
bannerText.indexOf(chromeActivity.getResources().getString(R.string.learn_more));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public BraveRewardsOnboardingFragment() {

@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

// Inflate the layout for this fragment
View root = inflater.inflate(R.layout.fragment_brave_rewards_onboarding, container, false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
/**
* Copyright (c) 2019 The Brave Authors. All rights reserved.
* 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 https://mozilla.org/MPL/2.0/.
* Copyright (c) 2019 The Brave Authors. All rights reserved. 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 https://mozilla.org/MPL/2.0/.
*/

package org.chromium.chrome.browser.onboarding;

import android.content.Context;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.content.Context;
import androidx.fragment.app.FragmentPagerAdapter;

public class OnboardingViewPagerAdapter extends FragmentPagerAdapter {
private final OnViewPagerAction onViewPagerAction;
private static final int ONBOARDING_WITH_3_PAGES = 3;

public OnboardingViewPagerAdapter(Context unused_context, FragmentManager fm,
OnViewPagerAction onViewPagerAction) {
public OnboardingViewPagerAdapter(
Context unused_context, FragmentManager fm, OnViewPagerAction onViewPagerAction) {
super(fm);
this.onViewPagerAction = onViewPagerAction;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ public interface HighlightDialogListener {
void onLearnMore();
}

private static final List<Integer> highlightViews = Arrays.asList(R.id.brave_stats_ads,
R.id.brave_stats_data_saved, R.id.brave_stats_time, R.id.ntp_stats_layout);
private static final List<Integer> highlightViews =
Arrays.asList(
R.id.brave_stats_ads,
R.id.brave_stats_data_saved,
R.id.brave_stats_time,
R.id.ntp_stats_layout);

private HighlightView highlightView;
private ViewPager viewpager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ public class BravePlaylistResetPreference

private int mPrefAccentColor;

/**
* Constructor for BravePlaylistResetPreference.
*/
/** Constructor for BravePlaylistResetPreference. */
public BravePlaylistResetPreference(Context context, AttributeSet attrs) {
super(context, attrs);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public void setNewsOptIn(boolean value) {
public boolean getNewsOptIn() {
return BravePrefServiceBridgeJni.get().getNewsOptIn();
}

public void setShowNews(boolean value) {
BravePrefServiceBridgeJni.get().setShowNews(value);
}
Expand Down
Loading

0 comments on commit 696947d

Please sign in to comment.