Merge pull request #8173 from brave/remove_warning_android
Remove warning android
This commit is contained in:
@@ -30,6 +30,7 @@ public class BraveHelper {
|
||||
// Disables data reduction promo dialog
|
||||
ContextUtils.getAppSharedPreferences()
|
||||
.edit()
|
||||
.putBoolean(SHARED_PREF_DISPLAYED_INFOBAR_PROMO, true);
|
||||
.putBoolean(SHARED_PREF_DISPLAYED_INFOBAR_PROMO, true)
|
||||
.apply();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
package org.chromium.chrome.browser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
@@ -50,6 +51,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
@@ -157,6 +159,7 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
private String currentNotificationId;
|
||||
private TextView tvPublisherNotVerified;
|
||||
private TextView tvPublisherNotVerifiedSummary;
|
||||
private TextView tvBrBatWallet;
|
||||
private boolean walletDetailsReceived; //flag: wallet details received
|
||||
private boolean showRewardsSummary; //flag: we don't want OnGetCurrentBalanceReport always opens up Rewards Summary window
|
||||
private BraveRewardsHelper mIconFetcher;
|
||||
@@ -212,6 +215,7 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
mIconFetcher = new BraveRewardsHelper(BraveRewardsHelper.currentActiveChromeTabbedActivityTab());
|
||||
|
||||
this.window.setTouchInterceptor(new View.OnTouchListener() {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
|
||||
@@ -285,8 +289,11 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
btSendATip = (Button)root.findViewById(R.id.send_a_tip);
|
||||
tvPublisherNotVerified = (TextView)root.findViewById(R.id.publisher_not_verified);
|
||||
mTip_amount_spinner = root.findViewById(R.id.auto_tip_amount);
|
||||
|
||||
tvBrBatWallet = root.findViewById(R.id.br_bat_wallet);
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private void initViewActionEvents() {
|
||||
if (tvPublisherNotVerifiedSummary != null) {
|
||||
tvPublisherNotVerifiedSummary.setOnTouchListener(new View.OnTouchListener() {
|
||||
@@ -550,11 +557,13 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
tosTextSS.setSpan(privacyProtectionClickableSpan, privacyPolicyIndex, privacyPolicyIndex + mActivity.getResources().getString(R.string.privacy_policy).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
tosTextSS.setSpan(new ForegroundColorSpan(mActivity.getResources().getColor(R.color.brave_rewards_modal_theme_color)), privacyPolicyIndex, privacyPolicyIndex + mActivity.getResources().getString(R.string.privacy_policy).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
TextView tosAndPpText = braveRewardsOptInView.findViewById(R.id.tos_pp_text);
|
||||
TextView tosAndPpText =
|
||||
braveRewardsOptInView.findViewById(R.id.brave_rewards_opt_in_tos_pp_text);
|
||||
tosAndPpText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tosAndPpText.setText(tosTextSS);
|
||||
|
||||
AppCompatImageView modalCloseButton = braveRewardsOptInView.findViewById(R.id.modal_close);
|
||||
AppCompatImageView modalCloseButton =
|
||||
braveRewardsOptInView.findViewById(R.id.brave_rewards_opt_in_modal_close);
|
||||
modalCloseButton.setOnClickListener((new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -603,7 +612,8 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
tosTextSS.setSpan(privacyProtectionClickableSpan, privacyPolicyIndex, privacyPolicyIndex + mActivity.getResources().getString(R.string.privacy_policy).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
tosTextSS.setSpan(new ForegroundColorSpan(mActivity.getResources().getColor(R.color.brave_rewards_modal_theme_color)), privacyPolicyIndex, privacyPolicyIndex + mActivity.getResources().getString(R.string.privacy_policy).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
TextView tosAndPpText = braveRewardsOnboardingModalView.findViewById(R.id.tos_pp_text);
|
||||
TextView tosAndPpText = braveRewardsOnboardingModalView.findViewById(
|
||||
R.id.brave_rewards_onboarding_modal_tos_pp_text);
|
||||
tosAndPpText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tosAndPpText.setText(tosTextSS);
|
||||
|
||||
@@ -625,7 +635,8 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
showBraveRewardsOnboarding(root, true);
|
||||
}
|
||||
}));
|
||||
AppCompatImageView modalCloseButton = braveRewardsOnboardingModalView.findViewById(R.id.modal_close);
|
||||
AppCompatImageView modalCloseButton = braveRewardsOnboardingModalView.findViewById(
|
||||
R.id.brave_rewards_onboarding_modal_close);
|
||||
modalCloseButton.setOnClickListener((new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -677,7 +688,8 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
braveRewardsViewPager.setAdapter(braveRewardsOnboardingPagerAdapter);
|
||||
TabLayout braveRewardsTabLayout = braveRewardsOnboardingView.findViewById(R.id.brave_rewards_tab_layout);
|
||||
braveRewardsTabLayout.setupWithViewPager(braveRewardsViewPager, true);
|
||||
AppCompatImageView modalCloseButton = braveRewardsOnboardingView.findViewById(R.id.modal_close);
|
||||
AppCompatImageView modalCloseButton = braveRewardsOnboardingView.findViewById(
|
||||
R.id.brave_rewards_onboarding_layout_modal_close);
|
||||
modalCloseButton.setOnClickListener((new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -710,7 +722,7 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
}
|
||||
}));
|
||||
AppCompatImageView modalCloseButton =
|
||||
braveRewardsWelcomeView.findViewById(R.id.modal_close);
|
||||
braveRewardsWelcomeView.findViewById(R.id.brave_rewards_welcome_modal_close);
|
||||
modalCloseButton.setOnClickListener((new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -796,8 +808,8 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
btRewardsSummary.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.slide_down, 0);
|
||||
if (braveRewardsWelcomeView != null && braveRewardsWelcomeView.isShown()) {
|
||||
braveRewardsWelcomeView.setBackground(
|
||||
ContextUtils.getApplicationContext().getResources().getDrawable(
|
||||
R.drawable.bat_rewards_summary_gradient));
|
||||
ResourcesCompat.getDrawable(ContextUtils.getApplicationContext().getResources(),
|
||||
R.drawable.bat_rewards_summary_gradient, /* theme= */ null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -916,7 +928,7 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
}
|
||||
|
||||
public void ShowWebSiteView() {
|
||||
((TextView)this.root.findViewById(R.id.br_bat_wallet)).setText(String.format(Locale.getDefault(), "%.3f", 0.0));
|
||||
tvBrBatWallet.setText(String.format(Locale.getDefault(), "%.3f", 0.0));
|
||||
String usdText = String.format(this.root.getResources().getString(R.string.brave_ui_usd), "0.00");
|
||||
((TextView)this.root.findViewById(R.id.br_usd_wallet)).setText(usdText);
|
||||
CreateUpdateBalanceTask();
|
||||
@@ -1148,11 +1160,12 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
// 18 digits is a probi min digits count
|
||||
if (splittedValue.length != 0 && splittedValue[0].length() >= 18) {
|
||||
value = BraveRewardsHelper.probiToDouble(args[3]);
|
||||
valueString = Double.isNaN(value) ?
|
||||
ERROR_CONVERT_PROBI : String.format("%.3f", value);
|
||||
valueString = Double.isNaN(value)
|
||||
? ERROR_CONVERT_PROBI
|
||||
: String.format(Locale.getDefault(), "%.3f", value);
|
||||
} else {
|
||||
value = Double.parseDouble(args[3]);
|
||||
valueString = String.format("%.3f", value);
|
||||
valueString = String.format(Locale.getDefault(), "%.3f", value);
|
||||
}
|
||||
|
||||
description = String.format(
|
||||
@@ -1364,8 +1377,9 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
* @param enable
|
||||
*/
|
||||
private void EnableWalletDetails(boolean enable) {
|
||||
View fadein = enable ? root.findViewById(R.id.br_bat_wallet) : root.findViewById(R.id.progress_wallet_update);
|
||||
View fadeout = enable ? root.findViewById(R.id.progress_wallet_update) : root.findViewById(R.id.br_bat_wallet);
|
||||
View progressWalletUpdate = root.findViewById(R.id.progress_wallet_update);
|
||||
View fadein = enable ? tvBrBatWallet : progressWalletUpdate;
|
||||
View fadeout = enable ? progressWalletUpdate : tvBrBatWallet;
|
||||
BraveRewardsHelper.crossfade(fadeout, fadein, View.GONE, 1f, BraveRewardsHelper.CROSS_FADE_DURATION);
|
||||
|
||||
View usd = root.findViewById(R.id.br_usd_wallet_layout);
|
||||
@@ -1586,10 +1600,11 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
public void OnGetPendingContributionsTotal(double amount) {
|
||||
if (amount > 0.0) {
|
||||
String non_verified_summary =
|
||||
String.format(root.getResources().getString(
|
||||
R.string.brave_ui_reserved_amount_text), String.format("%.3f", amount), batPointsText) +
|
||||
" <font color=#73CBFF>" + root.getResources().getString(R.string.learn_more) +
|
||||
".</font>";
|
||||
String.format(
|
||||
root.getResources().getString(R.string.brave_ui_reserved_amount_text),
|
||||
String.format(Locale.getDefault(), "%.3f", amount), batPointsText)
|
||||
+ " <font color=#73CBFF>" + root.getResources().getString(R.string.learn_more)
|
||||
+ ".</font>";
|
||||
Spanned toInsert = BraveRewardsHelper.spannedFromHtmlString(non_verified_summary);
|
||||
tvPublisherNotVerifiedSummary.setText(toInsert);
|
||||
tvPublisherNotVerifiedSummary.setVisibility(View.VISIBLE);
|
||||
@@ -1666,8 +1681,7 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
DecimalFormat df = new DecimalFormat("#.###");
|
||||
df.setRoundingMode(RoundingMode.FLOOR);
|
||||
df.setMinimumFractionDigits(3);
|
||||
((TextView) this.root.findViewById(R.id.br_bat_wallet))
|
||||
.setText(df.format(walletBalance));
|
||||
tvBrBatWallet.setText(df.format(walletBalance));
|
||||
((TextView) this.root.findViewById(R.id.br_bat)).setText(batPointsText);
|
||||
double usdValue = walletBalance * mBraveRewardsNativeWorker.GetWalletRate();
|
||||
String usdText =
|
||||
@@ -1764,8 +1778,9 @@ public class BraveRewardsPanelPopup implements BraveRewardsObserver, BraveReward
|
||||
leftDrawable = R.drawable.uphold_white;
|
||||
text = R.string.brave_ui_wallet_button_disconnected;
|
||||
btnVerifyWallet.setCompoundDrawablesWithIntrinsicBounds(leftDrawable, 0, 0, 0);
|
||||
btnVerifyWallet.setBackgroundDrawable(root.getResources().getDrawable(
|
||||
R.drawable.wallet_disconnected_button));
|
||||
btnVerifyWallet.setBackgroundDrawable(ResourcesCompat.getDrawable(
|
||||
ContextUtils.getApplicationContext().getResources(),
|
||||
R.drawable.wallet_disconnected_button, /* theme= */ null));
|
||||
break;
|
||||
default:
|
||||
Log.e (TAG, "Unexpected external wallet status");
|
||||
|
||||
@@ -4,34 +4,35 @@
|
||||
|
||||
package org.chromium.chrome.browser;
|
||||
|
||||
import org.chromium.chrome.R;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ToggleButton;
|
||||
import android.text.Spanned;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import org.chromium.base.IntentUtils;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.BraveRewardsBalance;
|
||||
import org.chromium.chrome.browser.BraveRewardsHelper;
|
||||
import org.chromium.chrome.browser.BraveRewardsNativeWorker;
|
||||
import org.chromium.chrome.browser.BraveRewardsObserver;
|
||||
import org.chromium.chrome.browser.BraveRewardsPublisher.PublisherStatus;
|
||||
import org.chromium.chrome.browser.app.BraveActivity;
|
||||
import android.graphics.Bitmap;
|
||||
import android.widget.ImageView;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
@@ -48,7 +49,6 @@ public class BraveRewardsSiteBannerActivity extends Activity implements
|
||||
public static final String TIP_AMOUNT_EXTRA="tipAmount";
|
||||
public static final String TIP_MONTHLY_EXTRA="tipMonthly";
|
||||
|
||||
|
||||
private int currentTabId_ = -1;
|
||||
private BraveRewardsNativeWorker mBraveRewardsNativeWorker;
|
||||
private final int PUBLISHER_ICON_SIDE_LEN= 70; //dp
|
||||
@@ -59,6 +59,7 @@ public class BraveRewardsSiteBannerActivity extends Activity implements
|
||||
private boolean mTippingInProgress; //flag preventing multiple tipping processes
|
||||
|
||||
private boolean isAnonWallet;
|
||||
private LinearLayout sendDonationLayout;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -68,6 +69,7 @@ public class BraveRewardsSiteBannerActivity extends Activity implements
|
||||
setContentView(R.layout.brave_rewards_site_banner);
|
||||
|
||||
isAnonWallet = BraveRewardsHelper.isAnonWallet();
|
||||
sendDonationLayout = findViewById(R.id.send_donation_button);
|
||||
|
||||
//change weight of the footer in landscape mode
|
||||
int orientation = this.getResources().getConfiguration().orientation;
|
||||
@@ -204,10 +206,9 @@ public class BraveRewardsSiteBannerActivity extends Activity implements
|
||||
}
|
||||
//not enough funds
|
||||
else {
|
||||
View send_tip = findViewById(R.id.send_donation_button);
|
||||
send_tip.setVisibility(View.INVISIBLE);
|
||||
sendDonationLayout.setVisibility(View.INVISIBLE);
|
||||
View animatedView = findViewById(R.id.not_enough_funds_button);
|
||||
int fromY = findViewById(R.id.send_donation_button).getHeight();
|
||||
int fromY = sendDonationLayout.getHeight();
|
||||
|
||||
TranslateAnimation animate = new TranslateAnimation(0,0,fromY,0);
|
||||
animate.setDuration(FADE_OUT_DURATION);
|
||||
@@ -217,8 +218,7 @@ public class BraveRewardsSiteBannerActivity extends Activity implements
|
||||
}
|
||||
};
|
||||
|
||||
findViewById(R.id.send_donation_button).setOnClickListener (send_tip_clicker);
|
||||
|
||||
sendDonationLayout.setOnClickListener(send_tip_clicker);
|
||||
|
||||
//set 'add funds' button onClick
|
||||
View.OnClickListener add_funds_clicker = new View.OnClickListener() {
|
||||
@@ -234,12 +234,11 @@ public class BraveRewardsSiteBannerActivity extends Activity implements
|
||||
View add_funds_btn = findViewById(R.id.not_enough_funds_button);
|
||||
add_funds_btn.setVisibility(View.INVISIBLE);
|
||||
|
||||
View animatedView = findViewById(R.id.send_donation_button);
|
||||
int fromY = findViewById(R.id.send_donation_button).getHeight();
|
||||
int fromY = sendDonationLayout.getHeight();
|
||||
TranslateAnimation animate = new TranslateAnimation(0,0,fromY,0);
|
||||
animate.setDuration(FADE_OUT_DURATION);
|
||||
animatedView.startAnimation(animate);
|
||||
animatedView.setVisibility(View.VISIBLE);
|
||||
sendDonationLayout.startAnimation(animate);
|
||||
sendDonationLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -316,6 +315,7 @@ public class BraveRewardsSiteBannerActivity extends Activity implements
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private void setPublisherNoteText(@PublisherStatus int pubStatus) {
|
||||
String note_part1 = "";
|
||||
if (pubStatus == BraveRewardsPublisher.CONNECTED) {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
package org.chromium.chrome.browser;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
@@ -14,13 +15,14 @@ import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.BraveRewardsExternalWallet;
|
||||
import org.chromium.chrome.browser.BraveRewardsHelper;
|
||||
import org.chromium.chrome.browser.BraveUphold;
|
||||
import org.chromium.chrome.browser.app.BraveActivity;
|
||||
import org.chromium.chrome.R;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class BraveRewardsVerifyWalletActivity extends Activity {
|
||||
|
||||
@@ -43,6 +45,7 @@ public class BraveRewardsVerifyWalletActivity extends Activity {
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
void SetUpholdLinkHandler() {
|
||||
TextView uphold_link = (TextView)findViewById(R.id.service_provider_txt);
|
||||
final String part1 = getResources().getString(R.string.verify_wallet_service_note);
|
||||
|
||||
@@ -174,6 +174,7 @@ public abstract class BraveActivity<C extends ChromeActivityComponent>
|
||||
if (mBraveRewardsNativeWorker != null) {
|
||||
mBraveRewardsNativeWorker.RemoveObserver(this);
|
||||
}
|
||||
super.onPauseWithNative();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.chromium.chrome.browser.profiles.Profile;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class BraveStatsUtil {
|
||||
public static final short MILLISECONDS_PER_ITEM = 50;
|
||||
@@ -88,7 +89,7 @@ public class BraveStatsUtil {
|
||||
|
||||
public static String getCalculatedDate(String dateFormat, int days) {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
SimpleDateFormat s = new SimpleDateFormat(dateFormat);
|
||||
SimpleDateFormat s = new SimpleDateFormat(dateFormat, Locale.getDefault());
|
||||
cal.add(Calendar.DAY_OF_YEAR, days);
|
||||
return s.format(new Date(cal.getTimeInMillis()));
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
package org.chromium.chrome.browser.custom_layout;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
@@ -34,6 +35,7 @@ public class NonSwipeableViewPager extends ViewPager {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
// Never allow swiping to switch between pages
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
package org.chromium.chrome.browser.custom_layout;
|
||||
|
||||
// https://android.googlesource.com/platform/packages/apps/DeskClock/+/master/src/com/android/deskclock/VerticalViewPager.java
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
@@ -54,6 +55,7 @@ public class VerticalViewPager extends ViewPager {
|
||||
return toIntercept;
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent ev) {
|
||||
final boolean toHandle = super.onTouchEvent(flipXY(ev));
|
||||
|
||||
+2
@@ -8,6 +8,7 @@ package org.chromium.chrome.browser.custom_layout.popup_window_tooltip;
|
||||
|
||||
import static org.chromium.ui.base.ViewUtils.dpToPx;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PointF;
|
||||
@@ -105,6 +106,7 @@ public class PopupWindowTooltip implements PopupWindow.OnDismissListener {
|
||||
mPopupWindow.setOutsideTouchable(true);
|
||||
mPopupWindow.setTouchable(true);
|
||||
mPopupWindow.setTouchInterceptor(new View.OnTouchListener() {
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
final int x = (int) event.getX();
|
||||
|
||||
@@ -30,22 +30,27 @@ public class NTPWidgetManager {
|
||||
private static NTPWidgetManager sInstance;
|
||||
|
||||
private final SharedPreferences mSharedPreferences;
|
||||
private static Context mContext = ContextUtils.getApplicationContext();
|
||||
|
||||
public static Map<String, NTPWidgetItem> mWidgetsMap = new HashMap<String, NTPWidgetItem>() {
|
||||
{
|
||||
put(PREF_PRIVATE_STATS,
|
||||
new NTPWidgetItem(PREF_PRIVATE_STATS,
|
||||
mContext.getResources().getString(R.string.privacy_stats),
|
||||
mContext.getResources().getString(R.string.privacy_stats_text)));
|
||||
ContextUtils.getApplicationContext().getResources().getString(
|
||||
R.string.privacy_stats),
|
||||
ContextUtils.getApplicationContext().getResources().getString(
|
||||
R.string.privacy_stats_text)));
|
||||
put(PREF_FAVORITES,
|
||||
new NTPWidgetItem(PREF_FAVORITES,
|
||||
mContext.getResources().getString(R.string.favorites),
|
||||
mContext.getResources().getString(R.string.favorites_text)));
|
||||
ContextUtils.getApplicationContext().getResources().getString(
|
||||
R.string.favorites),
|
||||
ContextUtils.getApplicationContext().getResources().getString(
|
||||
R.string.favorites_text)));
|
||||
put(PREF_BINANCE,
|
||||
new NTPWidgetItem(PREF_BINANCE,
|
||||
mContext.getResources().getString(R.string.binance),
|
||||
mContext.getResources().getString(R.string.binance_disconnect_text)));
|
||||
ContextUtils.getApplicationContext().getResources().getString(
|
||||
R.string.binance),
|
||||
ContextUtils.getApplicationContext().getResources().getString(
|
||||
R.string.binance_disconnect_text)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+7
-4
@@ -22,6 +22,7 @@ import android.widget.Button;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import org.chromium.base.Log;
|
||||
@@ -112,12 +113,14 @@ public class SearchEngineOnboardingFragment extends Fragment {
|
||||
rdBtn.setPadding(dpToPx(getActivity(), 30), 0, 0, 0);
|
||||
rdBtn.setTextColor(
|
||||
getActivity().getResources().getColor(R.color.onboarding_text_color));
|
||||
rdBtn.setBackgroundDrawable(getActivity().getResources().getDrawable(
|
||||
R.drawable.radiobutton_background));
|
||||
rdBtn.setBackgroundDrawable(
|
||||
ResourcesCompat.getDrawable(getActivity().getResources(),
|
||||
R.drawable.radiobutton_background, /* theme= */ null));
|
||||
rdBtn.setText(searchTextSpan);
|
||||
rdBtn.setCompoundDrawablesWithIntrinsicBounds(
|
||||
getActivity().getResources().getDrawable(searchEngineEnum.getIcon()), null,
|
||||
null, null);
|
||||
ResourcesCompat.getDrawable(getActivity().getResources(),
|
||||
searchEngineEnum.getIcon(), /* theme= */ null),
|
||||
null, null, null);
|
||||
rdBtn.setCompoundDrawablePadding(dpToPx(getActivity(), 16));
|
||||
radioGroup.addView(rdBtn);
|
||||
}
|
||||
|
||||
@@ -7,34 +7,34 @@
|
||||
|
||||
package org.chromium.chrome.browser.onboarding.v2;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.os.Handler;
|
||||
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.view.Gravity;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.airbnb.lottie.LottieAnimationView;
|
||||
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.onboarding.OnboardingPrefManager;
|
||||
import org.chromium.chrome.browser.onboarding.v2.HighlightDialogFragment.HighlightDialogListener;
|
||||
|
||||
import org.chromium.chrome.R;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@@ -154,24 +154,28 @@ public class OnboardingV2Fragment extends Fragment {
|
||||
|
||||
switch (mPosition) {
|
||||
case 0:
|
||||
mIndicator1.setBackground(mContext.getResources().getDrawable(R.drawable.selected_indicator));
|
||||
break;
|
||||
case 1:
|
||||
mIndicator2.setBackground(mContext.getResources().getDrawable(R.drawable.selected_indicator));
|
||||
break;
|
||||
case 2:
|
||||
mIndicator3.setBackground(mContext.getResources().getDrawable(R.drawable.selected_indicator));
|
||||
break;
|
||||
case 3:
|
||||
mIndicator4.setBackground(mContext.getResources().getDrawable(R.drawable.selected_indicator));
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
params.gravity = Gravity.CENTER;
|
||||
mOnboardingLayout.setLayoutParams(params);
|
||||
if (isFromStats)
|
||||
mLearnMoreButton.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
mIndicator1.setBackground(ResourcesCompat.getDrawable(mContext.getResources(),
|
||||
R.drawable.selected_indicator, /* theme= */ null));
|
||||
break;
|
||||
case 1:
|
||||
mIndicator2.setBackground(ResourcesCompat.getDrawable(mContext.getResources(),
|
||||
R.drawable.selected_indicator, /* theme= */ null));
|
||||
break;
|
||||
case 2:
|
||||
mIndicator3.setBackground(ResourcesCompat.getDrawable(mContext.getResources(),
|
||||
R.drawable.selected_indicator, /* theme= */ null));
|
||||
break;
|
||||
case 3:
|
||||
mIndicator4.setBackground(ResourcesCompat.getDrawable(mContext.getResources(),
|
||||
R.drawable.selected_indicator, /* theme= */ null));
|
||||
FrameLayout.LayoutParams params =
|
||||
new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
params.gravity = Gravity.CENTER;
|
||||
mOnboardingLayout.setLayoutParams(params);
|
||||
if (isFromStats) mLearnMoreButton.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
|
||||
+2
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.chromium.chrome.browser.toolbar.bottom;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
@@ -43,6 +44,7 @@ public class BraveScrollingBottomViewResourceFrameLayout
|
||||
return handledEvent || super.onInterceptTouchEvent(event);
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
boolean handledEvent = false;
|
||||
|
||||
+2
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.chromium.chrome.browser.toolbar.bottom;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
@@ -45,6 +46,7 @@ public class BrowsingModeBottomToolbarLinearLayout extends LinearLayout {
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
if (!mTouchEnabled) return true;
|
||||
|
||||
@@ -43,6 +43,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import org.chromium.base.ApiCompatibilityUtils;
|
||||
import org.chromium.base.BraveReflectionUtil;
|
||||
@@ -454,16 +455,16 @@ public abstract class BraveToolbarLayout extends ToolbarLayout
|
||||
}
|
||||
|
||||
private void showTooltip(ShieldsTooltipEnum shieldsTooltipEnum, String tooltipPref) {
|
||||
mShieldsPopupWindowTooltip =
|
||||
new PopupWindowTooltip.Builder(getContext())
|
||||
.anchorView(mBraveShieldsButton)
|
||||
.arrowColor(getResources().getColor(shieldsTooltipEnum.getArrowColor()))
|
||||
.gravity(Gravity.BOTTOM)
|
||||
.dismissOnOutsideTouch(true)
|
||||
.dismissOnInsideTouch(false)
|
||||
.modal(true)
|
||||
.contentView(R.layout.brave_shields_tooltip_layout)
|
||||
.build();
|
||||
mShieldsPopupWindowTooltip = new PopupWindowTooltip.Builder(getContext())
|
||||
.anchorView(mBraveShieldsButton)
|
||||
.arrowColor(getContext().getResources().getColor(
|
||||
shieldsTooltipEnum.getArrowColor()))
|
||||
.gravity(Gravity.BOTTOM)
|
||||
.dismissOnOutsideTouch(true)
|
||||
.dismissOnInsideTouch(false)
|
||||
.modal(true)
|
||||
.contentView(R.layout.brave_shields_tooltip_layout)
|
||||
.build();
|
||||
mShieldsPopupWindowTooltip.findViewById(R.id.shields_tooltip_layout)
|
||||
.setBackgroundDrawable(ContextCompat.getDrawable(
|
||||
getContext(), shieldsTooltipEnum.getTooltipBackground()));
|
||||
@@ -502,16 +503,16 @@ public abstract class BraveToolbarLayout extends ToolbarLayout
|
||||
|
||||
public void showRewardsTooltip() {
|
||||
ShieldsTooltipEnum shieldsTooltipEnum = ShieldsTooltipEnum.BAP_DEPRECATION_TOOLTIP;
|
||||
mRewardsPopupWindowTooltip =
|
||||
new PopupWindowTooltip.Builder(getContext())
|
||||
.anchorView(mBraveRewardsButton)
|
||||
.arrowColor(getResources().getColor(shieldsTooltipEnum.getArrowColor()))
|
||||
.gravity(Gravity.BOTTOM)
|
||||
.dismissOnOutsideTouch(true)
|
||||
.dismissOnInsideTouch(false)
|
||||
.modal(true)
|
||||
.contentView(R.layout.brave_shields_tooltip_layout)
|
||||
.build();
|
||||
mRewardsPopupWindowTooltip = new PopupWindowTooltip.Builder(getContext())
|
||||
.anchorView(mBraveRewardsButton)
|
||||
.arrowColor(getContext().getResources().getColor(
|
||||
shieldsTooltipEnum.getArrowColor()))
|
||||
.gravity(Gravity.BOTTOM)
|
||||
.dismissOnOutsideTouch(true)
|
||||
.dismissOnInsideTouch(false)
|
||||
.modal(true)
|
||||
.contentView(R.layout.brave_shields_tooltip_layout)
|
||||
.build();
|
||||
mRewardsPopupWindowTooltip.findViewById(R.id.shields_tooltip_layout)
|
||||
.setBackgroundDrawable(ContextCompat.getDrawable(
|
||||
getContext(), shieldsTooltipEnum.getTooltipBackground()));
|
||||
@@ -652,7 +653,8 @@ public abstract class BraveToolbarLayout extends ToolbarLayout
|
||||
+ context.getResources().getString(R.string.privacy_policy).length(),
|
||||
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
TextView tosAndPpText = braveRewardsOnboardingModalView.findViewById(R.id.tos_pp_text);
|
||||
TextView tosAndPpText = braveRewardsOnboardingModalView.findViewById(
|
||||
R.id.brave_rewards_onboarding_modal_tos_pp_text);
|
||||
tosAndPpText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tosAndPpText.setText(tosTextSS);
|
||||
|
||||
@@ -676,8 +678,8 @@ public abstract class BraveToolbarLayout extends ToolbarLayout
|
||||
dialog.dismiss();
|
||||
}
|
||||
}));
|
||||
AppCompatImageView modalCloseButton =
|
||||
braveRewardsOnboardingModalView.findViewById(R.id.modal_close);
|
||||
AppCompatImageView modalCloseButton = braveRewardsOnboardingModalView.findViewById(
|
||||
R.id.brave_rewards_onboarding_modal_close);
|
||||
modalCloseButton.setOnClickListener((new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -899,7 +901,7 @@ public abstract class BraveToolbarLayout extends ToolbarLayout
|
||||
public void updateModernLocationBarColorImpl(int color) {
|
||||
if (mShieldsLayout != null && mShieldsLayoutIsColorBackground) {
|
||||
mShieldsLayout.setBackgroundColor(
|
||||
ChromeColors.getDefaultThemeColor(getResources(), isIncognito()));
|
||||
ChromeColors.getDefaultThemeColor(getContext().getResources(), isIncognito()));
|
||||
}
|
||||
if (mCurrentToolbarColor == color) return;
|
||||
mCurrentToolbarColor = color;
|
||||
@@ -1050,11 +1052,13 @@ public abstract class BraveToolbarLayout extends ToolbarLayout
|
||||
String value = Integer.toString(count);
|
||||
if (count > 99) {
|
||||
mBraveRewardsNotificationsCount.setBackground(
|
||||
getResources().getDrawable(R.drawable.brave_rewards_rectangle));
|
||||
ResourcesCompat.getDrawable(getContext().getResources(),
|
||||
R.drawable.brave_rewards_rectangle, /* theme= */ null));
|
||||
value = "99+";
|
||||
} else {
|
||||
mBraveRewardsNotificationsCount.setBackground(
|
||||
getResources().getDrawable(R.drawable.brave_rewards_circle));
|
||||
ResourcesCompat.getDrawable(getContext().getResources(),
|
||||
R.drawable.brave_rewards_circle, /* theme= */ null));
|
||||
}
|
||||
mBraveRewardsNotificationsCount.setText(value);
|
||||
mBraveRewardsNotificationsCount.setVisibility(View.VISIBLE);
|
||||
@@ -1094,15 +1098,15 @@ public abstract class BraveToolbarLayout extends ToolbarLayout
|
||||
if (!shouldShow) return;
|
||||
|
||||
mBraveRewardsNotificationsCount.setText("");
|
||||
mBraveRewardsNotificationsCount.setBackground(
|
||||
getResources().getDrawable(R.drawable.brave_rewards_circle));
|
||||
mBraveRewardsNotificationsCount.setBackground(ResourcesCompat.getDrawable(
|
||||
getContext().getResources(), R.drawable.brave_rewards_circle, /* theme= */ null));
|
||||
mBraveRewardsNotificationsCount.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onThemeColorChanged(int color, boolean shouldAnimate) {
|
||||
final int textBoxColor = ToolbarColors.getTextBoxColorForToolbarBackgroundInNonNativePage(
|
||||
getResources(), color, isIncognito());
|
||||
getContext().getResources(), color, isIncognito());
|
||||
updateModernLocationBarColor(textBoxColor);
|
||||
}
|
||||
|
||||
@@ -1127,8 +1131,8 @@ public abstract class BraveToolbarLayout extends ToolbarLayout
|
||||
} else if (!mIsNotificationPosted) {
|
||||
if (mIsPublisherVerified) {
|
||||
mBraveRewardsNotificationsCount.setVisibility(View.VISIBLE);
|
||||
mBraveRewardsNotificationsCount.setBackground(
|
||||
getResources().getDrawable(R.drawable.bat_verified));
|
||||
mBraveRewardsNotificationsCount.setBackground(ResourcesCompat.getDrawable(
|
||||
getContext().getResources(), R.drawable.bat_verified, /* theme= */ null));
|
||||
} else {
|
||||
mBraveRewardsNotificationsCount.setBackgroundResource(0);
|
||||
mBraveRewardsNotificationsCount.setVisibility(View.INVISIBLE);
|
||||
@@ -1158,7 +1162,7 @@ public abstract class BraveToolbarLayout extends ToolbarLayout
|
||||
mShieldsLayoutIsColorBackground = false;
|
||||
} else {
|
||||
mShieldsLayout.setBackgroundColor(
|
||||
ChromeColors.getDefaultThemeColor(getResources(), isIncognito()));
|
||||
ChromeColors.getDefaultThemeColor(getContext().getResources(), isIncognito()));
|
||||
mShieldsLayoutIsColorBackground = true;
|
||||
}
|
||||
updateModernLocationBarColor(mCurrentToolbarColor);
|
||||
|
||||
@@ -13,18 +13,19 @@ import android.os.Environment;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.SecurityException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import org.chromium.base.ContextUtils;
|
||||
import org.chromium.base.FileUtils;
|
||||
import org.chromium.base.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.SecurityException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class BraveDbUtil {
|
||||
private static final String TAG = "BraveDbUtil";
|
||||
private static final String PUBLISHER_INFO_DB = "publisher_info_db";
|
||||
@@ -58,7 +59,8 @@ public class BraveDbUtil {
|
||||
mRewardsDstDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
|
||||
.getAbsolutePath() + File.separator + REWARDS_DB_DST_DIR;
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("-yyyy-MM-dd-HHmmss");
|
||||
SimpleDateFormat dateFormat =
|
||||
new SimpleDateFormat("-yyyy-MM-dd-HHmmss", Locale.getDefault());
|
||||
mRewardsDst = mRewardsDstDir + File.separator + PUBLISHER_INFO_DB + dateFormat.format(new Date());
|
||||
|
||||
copyRewardsDbThread(dlg, false);
|
||||
|
||||
+26
-12
@@ -45,6 +45,7 @@ import org.chromium.chrome.browser.widget.crypto.binance.CoinNetworkModel;
|
||||
import org.chromium.ui.widget.Toast;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class BinanceDepositFragment extends Fragment {
|
||||
private BinanceNativeWorker mBinanceNativeWorker;
|
||||
@@ -97,7 +98,8 @@ public class BinanceDepositFragment extends Fragment {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
if (networksJson != null && !TextUtils.isEmpty(networksJson)) {
|
||||
showCoinList(networksJson, charSequence.toString().toLowerCase());
|
||||
showCoinList(networksJson,
|
||||
charSequence.toString().toLowerCase(Locale.getDefault()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,18 +125,25 @@ public class BinanceDepositFragment extends Fragment {
|
||||
}
|
||||
for (CoinNetworkModel coinNetworkModel : binanceCoinNetworks.getCoinNetworksList()) {
|
||||
if (filterQuery == null
|
||||
|| (coinNetworkModel.getCoin().toLowerCase().contains(filterQuery)
|
||||
|| coinNetworkModel.getCoinDesc().toLowerCase().contains(
|
||||
filterQuery))) {
|
||||
|| (coinNetworkModel.getCoin()
|
||||
.toLowerCase(Locale.getDefault())
|
||||
.contains(filterQuery)
|
||||
|| coinNetworkModel.getCoinDesc()
|
||||
.toLowerCase(Locale.getDefault())
|
||||
.contains(filterQuery))) {
|
||||
final View view = inflater.inflate(R.layout.binance_deposit_item, null);
|
||||
|
||||
ImageView currencyImageView = view.findViewById(R.id.currency_image);
|
||||
TextView currencyText = view.findViewById(R.id.currency_text);
|
||||
|
||||
currencyText.setText(coinNetworkModel.getCoin()
|
||||
+ (TextUtils.isEmpty(coinNetworkModel.getCoinDesc())
|
||||
? ""
|
||||
: " (" + coinNetworkModel.getCoinDesc() + ")"));
|
||||
String currencyString =
|
||||
new StringBuilder(coinNetworkModel.getCoin())
|
||||
.append((TextUtils.isEmpty(coinNetworkModel.getCoinDesc())
|
||||
? ""
|
||||
: " (" + coinNetworkModel.getCoinDesc() + ")"))
|
||||
.toString();
|
||||
|
||||
currencyText.setText(currencyString);
|
||||
if (coinNetworkModel.getCoinRes() == 0) {
|
||||
currencyImageView.setImageResource(R.drawable.eth);
|
||||
currencyImageView.setVisibility(View.INVISIBLE);
|
||||
@@ -213,10 +222,15 @@ public class BinanceDepositFragment extends Fragment {
|
||||
});
|
||||
|
||||
if (selectedCoinNetworkModel != null) {
|
||||
currencyTitleText.setText(selectedCoinNetworkModel.getCoin()
|
||||
+ (TextUtils.isEmpty(selectedCoinNetworkModel.getCoinDesc())
|
||||
? ""
|
||||
: " (" + selectedCoinNetworkModel.getCoinDesc() + ")"));
|
||||
String currencyTitleString =
|
||||
new StringBuilder(selectedCoinNetworkModel.getCoin())
|
||||
.append((TextUtils.isEmpty(
|
||||
selectedCoinNetworkModel.getCoinDesc())
|
||||
? ""
|
||||
: " (" + selectedCoinNetworkModel.getCoinDesc()
|
||||
+ ")"))
|
||||
.toString();
|
||||
currencyTitleText.setText(currencyTitleString);
|
||||
currencyAddressText.setText(String.format(
|
||||
getActivity().getResources().getString(R.string.currency_address_text),
|
||||
selectedCoinNetworkModel.getCoin()));
|
||||
|
||||
+7
-3
@@ -21,6 +21,8 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
import org.chromium.chrome.R;
|
||||
|
||||
import java.util.List;
|
||||
@@ -76,8 +78,8 @@ public class BinanceSpinnerAdapter extends ArrayAdapter<CoinNetworkModel> {
|
||||
|
||||
Drawable coinDrawable;
|
||||
if (shouldShowIcon && items.get(position).getCoinRes() != 0) {
|
||||
Drawable tempCoinDrawable =
|
||||
getContext().getResources().getDrawable(items.get(position).getCoinRes());
|
||||
Drawable tempCoinDrawable = ResourcesCompat.getDrawable(getContext().getResources(),
|
||||
items.get(position).getCoinRes(), /* theme= */ null);
|
||||
Bitmap bitmap = Bitmap.createBitmap(tempCoinDrawable.getIntrinsicWidth(),
|
||||
tempCoinDrawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
@@ -91,7 +93,9 @@ public class BinanceSpinnerAdapter extends ArrayAdapter<CoinNetworkModel> {
|
||||
}
|
||||
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(coinDrawable, null,
|
||||
getContext().getResources().getDrawable(R.drawable.ic_arrow_drop_down_white), null);
|
||||
ResourcesCompat.getDrawable(getContext().getResources(),
|
||||
R.drawable.ic_arrow_drop_down_white, /* theme= */ null),
|
||||
null);
|
||||
return textView;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user