Rewards tipping tablet UI
This commit is contained in:
@@ -75,6 +75,7 @@ import org.chromium.chrome.browser.notifications.BravePermissionUtils;
|
||||
import org.chromium.chrome.browser.preferences.BravePref;
|
||||
import org.chromium.chrome.browser.profiles.Profile;
|
||||
import org.chromium.chrome.browser.rewards.onboarding.RewardsOnboarding;
|
||||
import org.chromium.chrome.browser.rewards.tipping.PopupWindowTippingTabletUI;
|
||||
import org.chromium.chrome.browser.rewards.tipping.RewardsTippingBannerActivity;
|
||||
import org.chromium.chrome.browser.tab.Tab;
|
||||
import org.chromium.chrome.browser.util.BraveConstants;
|
||||
@@ -162,7 +163,7 @@ public class BraveRewardsPanel
|
||||
TURN_ON_ADS;
|
||||
}
|
||||
|
||||
private boolean shouldShowOnboardingForConnectAccount;
|
||||
private boolean mShouldShowOnboardingForConnectAccount;
|
||||
|
||||
private final View mAnchorView;
|
||||
private final PopupWindow mPopupWindow;
|
||||
@@ -203,7 +204,7 @@ public class BraveRewardsPanel
|
||||
private View mNotificationLayout;
|
||||
private View mNotificationPermissionLayout;
|
||||
private boolean mClaimInProcess;
|
||||
private boolean notificationShown;
|
||||
private boolean mNotificationShown;
|
||||
|
||||
private View mBraveRewardsOnboardingModalView;
|
||||
private View mRewardsResponseModal;
|
||||
@@ -219,6 +220,8 @@ public class BraveRewardsPanel
|
||||
private View mBalanceDataViewGroups;
|
||||
private View mEstimatedToolTip;
|
||||
private View mVbatUserdrainToolTip;
|
||||
private PopupWindowTippingTabletUI mPopupWindowTippingTabletUI;
|
||||
private boolean mIsTablet;
|
||||
|
||||
public BraveRewardsPanel(View anchorView) {
|
||||
mCurrentNotificationId = "";
|
||||
@@ -336,9 +339,9 @@ public class BraveRewardsPanel
|
||||
mPopupView = (ViewGroup) inflater.inflate(R.layout.brave_rewards_panel_layout, null);
|
||||
|
||||
int deviceWidth = ConfigurationUtils.getDisplayMetrics(mActivity).get("width");
|
||||
boolean isTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(mActivity);
|
||||
mIsTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(mActivity);
|
||||
|
||||
mPopupWindow.setWidth((int) (isTablet ? (deviceWidth * 0.6) : (deviceWidth * 0.95)));
|
||||
mPopupWindow.setWidth((int) (mIsTablet ? (deviceWidth * 0.6) : (deviceWidth * 0.95)));
|
||||
|
||||
mBravePanelShadow = mPopupView.findViewById(R.id.panel_shadow);
|
||||
mBraveRewardsOnboardingView =
|
||||
@@ -413,10 +416,17 @@ public class BraveRewardsPanel
|
||||
|
||||
TextView btnSendTip = mPopupView.findViewById(R.id.btn_send_tip);
|
||||
btnSendTip.setOnClickListener(view -> {
|
||||
Intent intent = new Intent(
|
||||
ContextUtils.getApplicationContext(), RewardsTippingBannerActivity.class);
|
||||
intent.putExtra(RewardsTippingBannerActivity.TAB_ID_EXTRA, mCurrentTabId);
|
||||
mActivity.startActivityForResult(intent, BraveConstants.SITE_BANNER_REQUEST_CODE);
|
||||
if (mIsTablet) {
|
||||
mPopupWindowTippingTabletUI =
|
||||
PopupWindowTippingTabletUI.newInstance(mAnchorView, mCurrentTabId);
|
||||
mPopupWindowTippingTabletUI.show(mBraveActivity.getSupportFragmentManager(),
|
||||
"PopupWindowTippingTabletUITag");
|
||||
} else {
|
||||
Intent intent = new Intent(
|
||||
ContextUtils.getApplicationContext(), RewardsTippingBannerActivity.class);
|
||||
intent.putExtra(RewardsTippingBannerActivity.TAB_ID_EXTRA, mCurrentTabId);
|
||||
mActivity.startActivityForResult(intent, BraveConstants.SITE_BANNER_REQUEST_CODE);
|
||||
}
|
||||
});
|
||||
|
||||
mBtnTip = mPopupView.findViewById(R.id.tip_btn);
|
||||
@@ -839,7 +849,7 @@ public class BraveRewardsPanel
|
||||
mRewardsMainLayout.setForeground(
|
||||
new ColorDrawable(ContextCompat.getColor(mActivity, foregroundColor)));
|
||||
enableControls(false, mRewardsMainLayout);
|
||||
notificationShown = true;
|
||||
mNotificationShown = true;
|
||||
}
|
||||
|
||||
setNotificationButtoClickListener(notificationClickAction);
|
||||
@@ -1197,8 +1207,8 @@ public class BraveRewardsPanel
|
||||
|
||||
@Override
|
||||
public void OnRewardsParameters() {
|
||||
if (shouldShowOnboardingForConnectAccount) {
|
||||
shouldShowOnboardingForConnectAccount = false;
|
||||
if (mShouldShowOnboardingForConnectAccount) {
|
||||
mShouldShowOnboardingForConnectAccount = false;
|
||||
showBraveRewardsOnboarding(true);
|
||||
} else if (mExternalWallet != null) {
|
||||
if (mBraveRewardsNativeWorker.getVbatDeadline() > 0) {
|
||||
@@ -1240,8 +1250,7 @@ public class BraveRewardsPanel
|
||||
try {
|
||||
BraveActivity activity = BraveActivity.getBraveActivity();
|
||||
int deviceWidth = ConfigurationUtils.getDisplayMetrics(activity).get("width");
|
||||
boolean isTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(activity);
|
||||
deviceWidth = (int) (isTablet ? (deviceWidth * 0.6) : (deviceWidth * 0.95));
|
||||
deviceWidth = (int) (mIsTablet ? (deviceWidth * 0.6) : (deviceWidth * 0.95));
|
||||
RewardsOnboarding panel = new RewardsOnboarding(mAnchorView, deviceWidth);
|
||||
panel.showLikePopDownMenu();
|
||||
} catch (BraveActivity.BraveActivityNotFoundException e) {
|
||||
@@ -1373,7 +1382,7 @@ public class BraveRewardsPanel
|
||||
View closeButton = mNotificationPermissionLayout.findViewById(R.id.close_text_button);
|
||||
closeButton.setOnClickListener((v) -> {
|
||||
mNotificationPermissionLayout.setVisibility(View.GONE);
|
||||
if (!notificationShown) {
|
||||
if (!mNotificationShown) {
|
||||
mNotificationLayout.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
@@ -1385,7 +1394,7 @@ public class BraveRewardsPanel
|
||||
turnOnNotification.setOnClickListener((v) -> {
|
||||
mNotificationPermissionLayout.setVisibility(View.GONE);
|
||||
BravePermissionUtils.notificationSettingPage(mAnchorView.getContext());
|
||||
if (!notificationShown) {
|
||||
if (!mNotificationShown) {
|
||||
mNotificationLayout.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
@@ -2171,6 +2180,11 @@ public class BraveRewardsPanel
|
||||
|
||||
public void dismiss() {
|
||||
mPopupWindow.dismiss();
|
||||
if (mPopupWindowTippingTabletUI != null && mPopupWindowTippingTabletUI.getDialog() != null
|
||||
&& mPopupWindowTippingTabletUI.getDialog().isShowing()
|
||||
&& !mPopupWindowTippingTabletUI.isRemoving()) {
|
||||
mPopupWindowTippingTabletUI.getDialog().dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShowing() {
|
||||
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.rewards.tipping;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.text.SpannableString;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.BraveRewardsHelper;
|
||||
import org.chromium.chrome.browser.util.ConfigurationUtils;
|
||||
|
||||
public class PopupWindowTippingTabletUI extends DialogFragment {
|
||||
private static final String TAG = "TippingBanner";
|
||||
private static final String ANCHOR_Y_POSITION = "y_position";
|
||||
|
||||
private int mCurrentTabId = -1;
|
||||
|
||||
public static PopupWindowTippingTabletUI newInstance(View anchorView, int currentTabId) {
|
||||
int[] location = new int[2];
|
||||
anchorView.getLocationOnScreen(location);
|
||||
int popup_y_position = location[1] + anchorView.getHeight() - 40;
|
||||
PopupWindowTippingTabletUI fragment = new PopupWindowTippingTabletUI();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(RewardsTippingBannerActivity.TAB_ID_EXTRA, currentTabId);
|
||||
args.putInt(ANCHOR_Y_POSITION, popup_y_position);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
setDialogParams();
|
||||
}
|
||||
|
||||
private void setDialogParams() {
|
||||
DisplayMetrics displayMetrics = new DisplayMetrics();
|
||||
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
|
||||
int mDeviceWidth = displayMetrics.widthPixels;
|
||||
Window window = getDialog().getWindow();
|
||||
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
boolean isLandscape = ConfigurationUtils.isLandscape(getActivity());
|
||||
double widthRatio = isLandscape ? 0.8 : 0.96;
|
||||
params.width = (int) (widthRatio * mDeviceWidth);
|
||||
params.height = LinearLayout.LayoutParams.WRAP_CONTENT;
|
||||
window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
||||
if (getArguments() != null) {
|
||||
params.y = getArguments().getInt(ANCHOR_Y_POSITION);
|
||||
}
|
||||
|
||||
params.gravity = Gravity.TOP;
|
||||
params.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.activity_tipping_banner_tablet, container, false);
|
||||
|
||||
if (getArguments() != null) {
|
||||
mCurrentTabId = getArguments().getInt(RewardsTippingBannerActivity.TAB_ID_EXTRA);
|
||||
}
|
||||
replace();
|
||||
updateTermsOfServicePlaceHolder(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
private void updateTermsOfServicePlaceHolder(View view) {
|
||||
Resources res = getResources();
|
||||
TextView proceedTextView = view.findViewById(R.id.proceed_terms_of_service);
|
||||
proceedTextView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
String termsOfServiceText = String.format(res.getString(R.string.brave_rewards_tos_text),
|
||||
res.getString(R.string.terms_of_service), res.getString(R.string.privacy_policy));
|
||||
|
||||
SpannableString spannableString = BraveRewardsHelper.tosSpannableString(
|
||||
termsOfServiceText, R.color.terms_of_service_text_color);
|
||||
proceedTextView.setText(spannableString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConfigurationChanged(Configuration newConfig) {
|
||||
super.onConfigurationChanged(newConfig);
|
||||
setDialogParams();
|
||||
}
|
||||
|
||||
public void replace() {
|
||||
RewardsTippingBannerFragment tippingBannerFragment =
|
||||
RewardsTippingBannerFragment.newInstance(mCurrentTabId);
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.tippingBannerFragment, tippingBannerFragment)
|
||||
.commit();
|
||||
RewardsTippingPanelFragment tippingPanelFragment =
|
||||
RewardsTippingPanelFragment.newInstance(mCurrentTabId);
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.tippingPanelFragment2, tippingPanelFragment)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
+11
-258
@@ -7,32 +7,16 @@
|
||||
|
||||
package org.chromium.chrome.browser.rewards.tipping;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
import org.chromium.base.IntentUtils;
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.BraveRewardsHelper;
|
||||
import org.chromium.chrome.browser.BraveRewardsNativeWorker;
|
||||
import org.chromium.chrome.browser.BraveRewardsObserver;
|
||||
import org.chromium.chrome.browser.app.BraveActivity;
|
||||
import org.chromium.chrome.browser.init.AsyncInitializationActivity;
|
||||
import org.chromium.chrome.browser.rewards.BraveRewardsBannerInfo;
|
||||
import org.chromium.chrome.browser.util.TabUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class RewardsTippingBannerActivity
|
||||
extends AsyncInitializationActivity implements BraveRewardsObserver {
|
||||
@@ -40,250 +24,31 @@ public class RewardsTippingBannerActivity
|
||||
public static final String TIP_MONTHLY_EXTRA = "tipMonthly";
|
||||
public static final String TIP_AMOUNT_EXTRA = "tipAmount";
|
||||
private BraveRewardsNativeWorker mBraveRewardsNativeWorker;
|
||||
private final int PUBLISHER_ICON_SIDE_LEN = 64; // dp
|
||||
private static final String TAG = "TippingBanner";
|
||||
private int currentTabId_ = -1;
|
||||
private int mCurrentTabId = -1;
|
||||
private BraveRewardsBannerInfo mBannerInfo;
|
||||
|
||||
private BraveRewardsHelper mIconFetcher;
|
||||
|
||||
private final String TWITTER = "twitter";
|
||||
private final String YOUTUBE = "youtube";
|
||||
private final String TWITCH = "twitch";
|
||||
private final String GITHUB = "github";
|
||||
private final String REDDIT = "reddit";
|
||||
private final String VIMEO = "vimeo";
|
||||
private final String DISCORD = "discord";
|
||||
private final String FACEBOOK = "facebook";
|
||||
private final String INSTAGRAM = "instagram";
|
||||
|
||||
private static final String IMAGE_URL_PREFIX = "chrome://rewards-image/";
|
||||
|
||||
@Override
|
||||
protected void triggerLayoutInflation() {
|
||||
setContentView(R.layout.activity_tipping_banner_mobile);
|
||||
|
||||
mCurrentTabId = IntentUtils.safeGetIntExtra(getIntent(), TAB_ID_EXTRA, -1);
|
||||
showCustomUI();
|
||||
((TextView) findViewById(R.id.tipping_details_description))
|
||||
.setMovementMethod(new ScrollingMovementMethod());
|
||||
currentTabId_ = IntentUtils.safeGetIntExtra(getIntent(), TAB_ID_EXTRA, -1);
|
||||
|
||||
onInitialLayoutInflationComplete();
|
||||
clickOnVerifiedIcon();
|
||||
sendTipButtonClick();
|
||||
closeButtonClick();
|
||||
}
|
||||
|
||||
private void closeButtonClick() {
|
||||
ImageView view = findViewById(R.id.close_it);
|
||||
view.setOnClickListener(v -> { finish(); });
|
||||
}
|
||||
|
||||
private void clickOnVerifiedIcon() {
|
||||
ImageView view = findViewById(R.id.verified_tick_mark);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TippingVerifiedCreatorToolTip toolTip =
|
||||
new TippingVerifiedCreatorToolTip(RewardsTippingBannerActivity.this);
|
||||
toolTip.show(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void background() {
|
||||
if (mBannerInfo == null) return;
|
||||
String background = mBannerInfo.getBackground();
|
||||
if (!TextUtils.isEmpty(background)) {
|
||||
String prefix = IMAGE_URL_PREFIX;
|
||||
if (background.contains(prefix)) {
|
||||
background = background.substring(prefix.length());
|
||||
ImageView iv =
|
||||
(ImageView) findViewById(R.id.top_tipping_banner_ui_background_scenery);
|
||||
Glide.with(this)
|
||||
.load(background)
|
||||
.placeholder(R.drawable.tipping_default_background)
|
||||
.error(R.drawable.tipping_default_background)
|
||||
.into(iv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setDescription() {
|
||||
if (mBannerInfo == null) return;
|
||||
String description = mBannerInfo.getDescription();
|
||||
if (!TextUtils.isEmpty(description)) {
|
||||
TextView descriptionTextView = findViewById(R.id.tipping_details_description);
|
||||
descriptionTextView.setText(description);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldStartGpuProcess() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPublisherBanner(String jsonBannerInfo) {
|
||||
try {
|
||||
mBannerInfo = new BraveRewardsBannerInfo(jsonBannerInfo);
|
||||
setTitle();
|
||||
setDescription();
|
||||
setLogo();
|
||||
background();
|
||||
checkForShowSocialLinkIcons();
|
||||
setWeb3WalletClick();
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "TippingBanner -> CreatorPanel:onAttach JSONException error " + e);
|
||||
}
|
||||
}
|
||||
|
||||
private void setWeb3WalletClick() {
|
||||
if (mBannerInfo == null) return;
|
||||
String web3Url = mBannerInfo.getWeb3Url();
|
||||
if (!TextUtils.isEmpty(web3Url)) {
|
||||
View web3Button = findViewById(R.id.use_web3_wallet_button);
|
||||
web3Button.setVisibility(View.VISIBLE);
|
||||
web3Button.setOnClickListener(v -> {
|
||||
TabUtils.openUrlInNewTab(false, web3Url);
|
||||
setResult(Activity.RESULT_OK);
|
||||
finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void checkForShowSocialLinkIcons() {
|
||||
if (mBannerInfo == null) return;
|
||||
HashMap<String, String> links = mBannerInfo.getLinks();
|
||||
if (links != null) {
|
||||
for (Map.Entry<String, String> element : links.entrySet()) {
|
||||
String name = element.getKey();
|
||||
String url = element.getValue();
|
||||
showSocialLinkIcon(name, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showSocialLinkIcon(String name, String url) {
|
||||
switch (name) {
|
||||
case TWITTER:
|
||||
ImageView twitterIcon = findViewById(R.id.link_twitter);
|
||||
showAndSetListener(twitterIcon, url);
|
||||
break;
|
||||
|
||||
case YOUTUBE:
|
||||
ImageView youtubeIcon = findViewById(R.id.link_youtube);
|
||||
showAndSetListener(youtubeIcon, url);
|
||||
break;
|
||||
|
||||
case TWITCH:
|
||||
ImageView twitchIcon = findViewById(R.id.link_twitch);
|
||||
showAndSetListener(twitchIcon, url);
|
||||
break;
|
||||
|
||||
case GITHUB:
|
||||
ImageView githubIcon = findViewById(R.id.link_github);
|
||||
showAndSetListener(githubIcon, url);
|
||||
break;
|
||||
|
||||
case REDDIT:
|
||||
ImageView redditIcon = findViewById(R.id.link_reddit);
|
||||
showAndSetListener(redditIcon, url);
|
||||
break;
|
||||
|
||||
case VIMEO:
|
||||
ImageView vimeoIcon = findViewById(R.id.link_vimeo);
|
||||
showAndSetListener(vimeoIcon, url);
|
||||
break;
|
||||
|
||||
case DISCORD:
|
||||
ImageView discordIcon = findViewById(R.id.link_discord);
|
||||
showAndSetListener(discordIcon, url);
|
||||
break;
|
||||
|
||||
case FACEBOOK:
|
||||
ImageView facebookIcon = findViewById(R.id.link_facebook);
|
||||
showAndSetListener(facebookIcon, url);
|
||||
break;
|
||||
|
||||
case INSTAGRAM:
|
||||
ImageView instagramIcon = findViewById(R.id.link_instagram);
|
||||
showAndSetListener(instagramIcon, url);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showAndSetListener(ImageView icon, String url) {
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
icon.setTag(url);
|
||||
icon.setOnClickListener(v -> {
|
||||
String openUrl = (String) v.getTag();
|
||||
openLink(openUrl);
|
||||
});
|
||||
}
|
||||
|
||||
private void openLink(String url) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(BraveActivity.OPEN_URL, url);
|
||||
setResult(Activity.RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
private void setLogo() {
|
||||
if (mBannerInfo == null) return;
|
||||
String logo = mBannerInfo.getLogo();
|
||||
if (!TextUtils.isEmpty(logo)) {
|
||||
String prefix = IMAGE_URL_PREFIX;
|
||||
if (logo.contains(prefix)) {
|
||||
logo = logo.substring(prefix.length());
|
||||
ImageView iv = (ImageView) findViewById(R.id.publisher_favicon);
|
||||
Glide.with(this).load(logo).apply(RequestOptions.circleCropTransform()).into(iv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setTitle() {
|
||||
if (mBannerInfo == null) return;
|
||||
String title = mBannerInfo.getName();
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
TextView titleTextView = findViewById(R.id.tipping_publisher_name);
|
||||
String provider = getProvider(mBannerInfo.getProvider());
|
||||
if (!TextUtils.isEmpty(provider)) {
|
||||
title = String.format(
|
||||
getResources().getString(R.string.title_on_provider), title, provider);
|
||||
}
|
||||
titleTextView.setText(title);
|
||||
}
|
||||
}
|
||||
|
||||
private String getProvider(String provider) {
|
||||
if (TextUtils.isEmpty(provider)) {
|
||||
return "";
|
||||
}
|
||||
switch (provider) {
|
||||
case "twitter":
|
||||
return "Twitter";
|
||||
case "youtube":
|
||||
return "YouTube";
|
||||
case "twitch":
|
||||
return "Twitch";
|
||||
case "reddit":
|
||||
return "Reddit";
|
||||
case "vimeo":
|
||||
return "Vimeo";
|
||||
case "github":
|
||||
return "GitHub";
|
||||
default:
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishNativeInitialization() {
|
||||
super.finishNativeInitialization();
|
||||
mBraveRewardsNativeWorker = BraveRewardsNativeWorker.getInstance();
|
||||
mBraveRewardsNativeWorker.AddObserver(this);
|
||||
mBraveRewardsNativeWorker.GetPublisherBanner(
|
||||
mBraveRewardsNativeWorker.GetPublisherId(currentTabId_));
|
||||
RewardsTippingBannerFragment tippingBannerFragment =
|
||||
RewardsTippingBannerFragment.newInstance(mCurrentTabId);
|
||||
getSupportFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.tippingBannerFragment, tippingBannerFragment)
|
||||
.commit();
|
||||
}
|
||||
|
||||
private void showCustomUI() {
|
||||
@@ -292,20 +57,8 @@ public class RewardsTippingBannerActivity
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
|
||||
public void sendTipButtonClick() {
|
||||
View sendTipButton = findViewById(R.id.send_tip_button);
|
||||
sendTipButton.setOnClickListener((v) -> {
|
||||
RewardsTippingPanelFragment.showTippingPanelBottomSheet(
|
||||
this, currentTabId_, mBannerInfo.getWeb3Url());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
if (null != mBraveRewardsNativeWorker) {
|
||||
mBraveRewardsNativeWorker.RemoveObserver(this);
|
||||
}
|
||||
public boolean shouldStartGpuProcess() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+337
@@ -0,0 +1,337 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.rewards.tipping;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.text.method.ScrollingMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.BraveRewardsHelper;
|
||||
import org.chromium.chrome.browser.BraveRewardsNativeWorker;
|
||||
import org.chromium.chrome.browser.BraveRewardsObserver;
|
||||
import org.chromium.chrome.browser.app.BraveActivity;
|
||||
import org.chromium.chrome.browser.app.helpers.ImageLoader;
|
||||
import org.chromium.chrome.browser.rewards.BraveRewardsBannerInfo;
|
||||
import org.chromium.chrome.browser.util.TabUtils;
|
||||
import org.chromium.ui.base.DeviceFormFactor;
|
||||
import org.chromium.ui.base.ViewUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class RewardsTippingBannerFragment extends Fragment implements BraveRewardsObserver {
|
||||
public static final String TAB_ID_EXTRA = "currentTabId";
|
||||
public static final String TIP_MONTHLY_EXTRA = "tipMonthly";
|
||||
public static final String TIP_AMOUNT_EXTRA = "tipAmount";
|
||||
private BraveRewardsNativeWorker mBraveRewardsNativeWorker;
|
||||
private static final String TAG = "TippingBanner";
|
||||
private int mCurrentTabId = -1;
|
||||
private BraveRewardsBannerInfo mBannerInfo;
|
||||
|
||||
private BraveRewardsHelper mIconFetcher;
|
||||
|
||||
private static final String TWITTER = "twitter";
|
||||
private static final String YOUTUBE = "youtube";
|
||||
private static final String TWITCH = "twitch";
|
||||
private static final String GITHUB = "github";
|
||||
private static final String REDDIT = "reddit";
|
||||
private static final String VIMEO = "vimeo";
|
||||
private static final String DISCORD = "discord";
|
||||
private static final String FACEBOOK = "facebook";
|
||||
private static final String INSTAGRAM = "instagram";
|
||||
private static final int LOGO_RADIUS = 60;
|
||||
|
||||
private static final String IMAGE_URL_PREFIX = "chrome://rewards-image/";
|
||||
private AppCompatActivity mActivity;
|
||||
|
||||
public static RewardsTippingBannerFragment newInstance(int currentTabId) {
|
||||
RewardsTippingBannerFragment fragment = new RewardsTippingBannerFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(TAB_ID_EXTRA, currentTabId);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
private View mContentView;
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.rewards_tipping_banner_fragment, container, false);
|
||||
mCurrentTabId = getArguments().getInt(TAB_ID_EXTRA);
|
||||
mBraveRewardsNativeWorker = BraveRewardsNativeWorker.getInstance();
|
||||
mBraveRewardsNativeWorker.AddObserver(this);
|
||||
mBraveRewardsNativeWorker.GetPublisherBanner(
|
||||
mBraveRewardsNativeWorker.GetPublisherId(mCurrentTabId));
|
||||
mContentView = view;
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
mActivity = (AppCompatActivity) getActivity();
|
||||
((TextView) view.findViewById(R.id.tipping_details_description))
|
||||
.setMovementMethod(new ScrollingMovementMethod());
|
||||
|
||||
clickOnVerifiedIcon();
|
||||
sendTipButtonClick();
|
||||
closeButtonClick();
|
||||
}
|
||||
|
||||
private void closeButtonClick() {
|
||||
ImageView view = mContentView.findViewById(R.id.close_it);
|
||||
view.setOnClickListener(v -> { mActivity.finish(); });
|
||||
}
|
||||
|
||||
private void clickOnVerifiedIcon() {
|
||||
ImageView view = mContentView.findViewById(R.id.verified_tick_mark);
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TippingVerifiedCreatorToolTip toolTip =
|
||||
new TippingVerifiedCreatorToolTip(mActivity);
|
||||
toolTip.show(view);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void background() {
|
||||
if (mBannerInfo == null) return;
|
||||
String background = mBannerInfo.getBackground();
|
||||
if (!TextUtils.isEmpty(background)) {
|
||||
String prefix = IMAGE_URL_PREFIX;
|
||||
if (background.contains(prefix)) {
|
||||
background = background.substring(prefix.length());
|
||||
ImageView iv = (ImageView) mContentView.findViewById(
|
||||
R.id.top_tipping_banner_ui_background_scenery);
|
||||
ImageLoader.downloadImage(background, Glide.with(mActivity), false, 1, iv, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private void setDescription() {
|
||||
if (mBannerInfo == null) return;
|
||||
String description = mBannerInfo.getDescription();
|
||||
if (!TextUtils.isEmpty(description)) {
|
||||
TextView descriptionTextView =
|
||||
mContentView.findViewById(R.id.tipping_details_description);
|
||||
descriptionTextView.setText(
|
||||
description + "\n\n"); // Adding two new line to show shadow if more text exist
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPublisherBanner(String jsonBannerInfo) {
|
||||
try {
|
||||
mBannerInfo = new BraveRewardsBannerInfo(jsonBannerInfo);
|
||||
setTitle();
|
||||
setDescription();
|
||||
setLogo();
|
||||
background();
|
||||
checkForShowSocialLinkIcons();
|
||||
setWeb3WalletClick();
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "TippingBanner -> CreatorPanel:onAttach JSONException error " + e);
|
||||
}
|
||||
}
|
||||
|
||||
private void setWeb3WalletClick() {
|
||||
if (mBannerInfo == null) return;
|
||||
String web3Url = mBannerInfo.getWeb3Url();
|
||||
if (!TextUtils.isEmpty(web3Url)) {
|
||||
View web3Button = mContentView.findViewById(R.id.use_web3_wallet_button);
|
||||
web3Button.setVisibility(View.VISIBLE);
|
||||
web3Button.setOnClickListener(v -> {
|
||||
TabUtils.openUrlInNewTab(false, web3Url);
|
||||
dismissRewardsPanel();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void checkForShowSocialLinkIcons() {
|
||||
if (mBannerInfo == null) return;
|
||||
HashMap<String, String> links = mBannerInfo.getLinks();
|
||||
if (links != null) {
|
||||
for (Map.Entry<String, String> element : links.entrySet()) {
|
||||
String name = element.getKey();
|
||||
String url = element.getValue();
|
||||
showSocialLinkIcon(name, url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showSocialLinkIcon(String name, String url) {
|
||||
switch (name) {
|
||||
case TWITTER:
|
||||
ImageView twitterIcon = mContentView.findViewById(R.id.link_twitter);
|
||||
showAndSetListener(twitterIcon, url);
|
||||
break;
|
||||
|
||||
case YOUTUBE:
|
||||
ImageView youtubeIcon = mContentView.findViewById(R.id.link_youtube);
|
||||
showAndSetListener(youtubeIcon, url);
|
||||
break;
|
||||
|
||||
case TWITCH:
|
||||
ImageView twitchIcon = mContentView.findViewById(R.id.link_twitch);
|
||||
showAndSetListener(twitchIcon, url);
|
||||
break;
|
||||
|
||||
case GITHUB:
|
||||
ImageView githubIcon = mContentView.findViewById(R.id.link_github);
|
||||
showAndSetListener(githubIcon, url);
|
||||
break;
|
||||
|
||||
case REDDIT:
|
||||
ImageView redditIcon = mContentView.findViewById(R.id.link_reddit);
|
||||
showAndSetListener(redditIcon, url);
|
||||
break;
|
||||
|
||||
case VIMEO:
|
||||
ImageView vimeoIcon = mContentView.findViewById(R.id.link_vimeo);
|
||||
showAndSetListener(vimeoIcon, url);
|
||||
break;
|
||||
|
||||
case DISCORD:
|
||||
ImageView discordIcon = mContentView.findViewById(R.id.link_discord);
|
||||
showAndSetListener(discordIcon, url);
|
||||
break;
|
||||
|
||||
case FACEBOOK:
|
||||
ImageView facebookIcon = mContentView.findViewById(R.id.link_facebook);
|
||||
showAndSetListener(facebookIcon, url);
|
||||
break;
|
||||
|
||||
case INSTAGRAM:
|
||||
ImageView instagramIcon = mContentView.findViewById(R.id.link_instagram);
|
||||
showAndSetListener(instagramIcon, url);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showAndSetListener(ImageView icon, String url) {
|
||||
icon.setVisibility(View.VISIBLE);
|
||||
icon.setTag(url);
|
||||
icon.setOnClickListener(v -> {
|
||||
String openUrl = (String) v.getTag();
|
||||
openLink(openUrl);
|
||||
});
|
||||
}
|
||||
|
||||
private void openLink(String url) {
|
||||
TabUtils.openUrlInNewTab(false, url);
|
||||
dismissRewardsPanel();
|
||||
}
|
||||
|
||||
private void setLogo() {
|
||||
if (mBannerInfo == null) return;
|
||||
String logo = mBannerInfo.getLogo();
|
||||
if (!TextUtils.isEmpty(logo)) {
|
||||
String prefix = IMAGE_URL_PREFIX;
|
||||
if (logo.contains(prefix)) {
|
||||
logo = logo.substring(prefix.length());
|
||||
ImageView iv = (ImageView) mContentView.findViewById(R.id.publisher_favicon);
|
||||
int radius = ViewUtils.dpToPx(mActivity, LOGO_RADIUS);
|
||||
ImageLoader.downloadImage(logo, Glide.with(mActivity), false, radius, iv, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setTitle() {
|
||||
if (mBannerInfo == null) return;
|
||||
TextView titleTextView = mContentView.findViewById(R.id.tipping_publisher_name);
|
||||
String title = mBannerInfo.getName();
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
String provider = getProvider(mBannerInfo.getProvider());
|
||||
if (!TextUtils.isEmpty(provider)) {
|
||||
title = String.format(
|
||||
getResources().getString(R.string.title_on_provider), title, provider);
|
||||
}
|
||||
titleTextView.setText(title);
|
||||
} else {
|
||||
title = mBannerInfo.getTitle();
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
titleTextView.setText(title);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getProvider(String provider) {
|
||||
if (TextUtils.isEmpty(provider)) {
|
||||
return "";
|
||||
}
|
||||
switch (provider) {
|
||||
case "twitter":
|
||||
return "Twitter";
|
||||
case "youtube":
|
||||
return "YouTube";
|
||||
case "twitch":
|
||||
return "Twitch";
|
||||
case "reddit":
|
||||
return "Reddit";
|
||||
case "vimeo":
|
||||
return "Vimeo";
|
||||
case "github":
|
||||
return "GitHub";
|
||||
default:
|
||||
return provider;
|
||||
}
|
||||
}
|
||||
|
||||
public void sendTipButtonClick() {
|
||||
View sendTipButton = mContentView.findViewById(R.id.send_tip_button);
|
||||
sendTipButton.setOnClickListener((v) -> {
|
||||
RewardsTippingPanelBottomsheet.showTippingPanelBottomSheet(
|
||||
(AppCompatActivity) mActivity, mCurrentTabId, mBannerInfo.getWeb3Url());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (null != mBraveRewardsNativeWorker) {
|
||||
mBraveRewardsNativeWorker.RemoveObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void dismissRewardsPanel() {
|
||||
boolean isTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(getActivity());
|
||||
|
||||
if (isTablet) {
|
||||
try {
|
||||
BraveActivity braveActivity = BraveActivity.getBraveActivity();
|
||||
braveActivity.dismissRewardsPanel();
|
||||
} catch (BraveActivity.BraveActivityNotFoundException e) {
|
||||
Log.e(TAG, "setShareYourSupportClickListener " + e);
|
||||
}
|
||||
} else {
|
||||
mActivity.setResult(Activity.RESULT_OK);
|
||||
mActivity.finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.rewards.tipping;
|
||||
import android.app.Dialog;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.chrome.R;
|
||||
|
||||
public class RewardsTippingPanelBottomsheet extends BottomSheetDialogFragment {
|
||||
public static final String TAG_FRAGMENT = "tipping_bottomsheet_tag";
|
||||
|
||||
private int mCurrentTabId = -1;
|
||||
private String mWeb3Url;
|
||||
private static final String WEB3_URL = "web3_url";
|
||||
private static final String TAG = "TippingBottomsheet";
|
||||
|
||||
public static RewardsTippingPanelBottomsheet newInstance(int tabId, String web3Url) {
|
||||
RewardsTippingPanelBottomsheet fragment = new RewardsTippingPanelBottomsheet();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(RewardsTippingBannerActivity.TAB_ID_EXTRA, tabId);
|
||||
args.putString(WEB3_URL, web3Url);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setStyle(STYLE_NORMAL, R.style.AppBottomSheetDialogTheme);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(@NonNull FragmentManager manager, @Nullable String tag) {
|
||||
try {
|
||||
RewardsTippingPanelBottomsheet fragment =
|
||||
(RewardsTippingPanelBottomsheet) manager.findFragmentByTag(
|
||||
RewardsTippingPanelBottomsheet.TAG_FRAGMENT);
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
if (fragment != null) {
|
||||
transaction.remove(fragment);
|
||||
}
|
||||
transaction.add(this, tag);
|
||||
transaction.commitAllowingStateLoss();
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void replace() {
|
||||
if (getArguments() != null) {
|
||||
mCurrentTabId = getArguments().getInt(RewardsTippingBannerActivity.TAB_ID_EXTRA);
|
||||
}
|
||||
RewardsTippingPanelFragment tippingPanelFragment =
|
||||
RewardsTippingPanelFragment.newInstance(mCurrentTabId);
|
||||
getChildFragmentManager()
|
||||
.beginTransaction()
|
||||
.replace(R.id.tippingPanelFragment, tippingPanelFragment)
|
||||
.commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstance) {
|
||||
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstance);
|
||||
final View view = LayoutInflater.from(getContext())
|
||||
.inflate(R.layout.brave_rewards_tippingpanel_bottomsheet, null);
|
||||
dialog.setContentView(view);
|
||||
replace();
|
||||
setupFullHeight(dialog);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private void setupFullHeight(BottomSheetDialog bottomSheetDialog) {
|
||||
FrameLayout bottomSheet =
|
||||
(FrameLayout) bottomSheetDialog.findViewById(R.id.design_bottom_sheet);
|
||||
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
|
||||
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
}
|
||||
|
||||
public static void showTippingPanelBottomSheet(
|
||||
AppCompatActivity activity, int tabId, String web3Url) {
|
||||
if (activity != null) {
|
||||
RewardsTippingPanelBottomsheet dialog =
|
||||
RewardsTippingPanelBottomsheet.newInstance(tabId, web3Url);
|
||||
dialog.show(activity.getSupportFragmentManager(), TAG_FRAGMENT);
|
||||
}
|
||||
}
|
||||
}
|
||||
+86
-64
@@ -8,7 +8,6 @@
|
||||
package org.chromium.chrome.browser.rewards.tipping;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
@@ -20,6 +19,7 @@ import android.text.TextWatcher;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -28,15 +28,12 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
import org.json.JSONException;
|
||||
|
||||
@@ -51,15 +48,16 @@ import org.chromium.chrome.browser.BraveRewardsNativeWorker;
|
||||
import org.chromium.chrome.browser.BraveRewardsObserver;
|
||||
import org.chromium.chrome.browser.BraveWalletProvider;
|
||||
import org.chromium.chrome.browser.app.BraveActivity;
|
||||
import org.chromium.chrome.browser.rewards.BraveRewardsBannerInfo;
|
||||
import org.chromium.chrome.browser.util.TabUtils;
|
||||
import org.chromium.ui.base.DeviceFormFactor;
|
||||
import org.chromium.ui.text.NoUnderlineClickableSpan;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
public class RewardsTippingPanelFragment
|
||||
extends BottomSheetDialogFragment implements BraveRewardsObserver {
|
||||
final public static String TAG_FRAGMENT = "tipping_panel_tag";
|
||||
public class RewardsTippingPanelFragment extends Fragment implements BraveRewardsObserver {
|
||||
public static final String TAG_FRAGMENT = "tipping_panel_tag";
|
||||
private static final String TAG = "TippingPanelFragment";
|
||||
|
||||
private static final String WEB3_URL = "web3_url";
|
||||
@@ -96,17 +94,18 @@ public class RewardsTippingPanelFragment
|
||||
private boolean mIsBatCurrency;
|
||||
private BraveRewardsExternalWallet mExternalWallet;
|
||||
private ProgressBar mTipProgressBar;
|
||||
private ProgressBar mFetchBalanceProgressBar;
|
||||
|
||||
private TextView mUsdSymbol1;
|
||||
private TextView mUsdSymbol2;
|
||||
private boolean mEnoughFundWarningShown;
|
||||
private TextView mCustodianText;
|
||||
private boolean mIsTablet;
|
||||
|
||||
public static RewardsTippingPanelFragment newInstance(int tabId, String web3Url) {
|
||||
public static RewardsTippingPanelFragment newInstance(int tabId) {
|
||||
RewardsTippingPanelFragment fragment = new RewardsTippingPanelFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(RewardsTippingBannerActivity.TAB_ID_EXTRA, tabId);
|
||||
args.putString(WEB3_URL, web3Url);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
@@ -114,51 +113,34 @@ public class RewardsTippingPanelFragment
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setStyle(STYLE_NORMAL, R.style.AppBottomSheetDialogTheme);
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
mBraveRewardsNativeWorker = BraveRewardsNativeWorker.getInstance();
|
||||
mBraveRewardsNativeWorker.AddObserver(this);
|
||||
mBraveRewardsNativeWorker.GetExternalWallet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(@NonNull FragmentManager manager, @Nullable String tag) {
|
||||
try {
|
||||
RewardsTippingPanelFragment fragment =
|
||||
(RewardsTippingPanelFragment) manager.findFragmentByTag(
|
||||
RewardsTippingPanelFragment.TAG_FRAGMENT);
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
if (fragment != null) {
|
||||
transaction.remove(fragment);
|
||||
}
|
||||
transaction.add(this, tag);
|
||||
transaction.commitAllowingStateLoss();
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstance) {
|
||||
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstance);
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container,
|
||||
@Nullable Bundle savedInstanceState) {
|
||||
final View view = LayoutInflater.from(getContext())
|
||||
.inflate(R.layout.brave_rewards_tippingpanel_fragment, null);
|
||||
dialog.setContentView(view);
|
||||
.inflate(R.layout.brave_rewards_tippingpanel_fragment_base, null);
|
||||
mIsTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(getActivity());
|
||||
if (getArguments() != null) {
|
||||
mCurrentTabId = getArguments().getInt(RewardsTippingBannerActivity.TAB_ID_EXTRA);
|
||||
mWeb3Url = getArguments().getString(WEB3_URL);
|
||||
mBraveRewardsNativeWorker.GetPublisherBanner(
|
||||
mBraveRewardsNativeWorker.GetPublisherId(mCurrentTabId));
|
||||
}
|
||||
mContentView = view;
|
||||
mSendButton = view.findViewById(R.id.send_tip_button);
|
||||
mWeb3WalletButton = view.findViewById(R.id.use_web3_wallet_button);
|
||||
mTipProgressBar = view.findViewById(R.id.send_tip_progress_bar);
|
||||
mFetchBalanceProgressBar = view.findViewById(R.id.fetchBalanceProgressBar);
|
||||
mCustodianText = view.findViewById(R.id.custodian_text);
|
||||
|
||||
init(view);
|
||||
setBalanceText(view);
|
||||
mBraveRewardsNativeWorker.fetchBalance();
|
||||
initTipChoice(mToggle);
|
||||
setAlreadyMonthlyContributionSetMessage();
|
||||
sendTipButtonClick(view);
|
||||
@@ -167,10 +149,21 @@ public class RewardsTippingPanelFragment
|
||||
setCustodianIconAndName(view);
|
||||
updateTermsOfServicePlaceHolder(view);
|
||||
checkEnoughFund();
|
||||
setupFullHeight(dialog);
|
||||
setMonthlyInformationClick(view);
|
||||
|
||||
return dialog;
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBalance(boolean success) {
|
||||
mFetchBalanceProgressBar.setVisibility(View.GONE);
|
||||
if (success) {
|
||||
try {
|
||||
setBalanceText();
|
||||
} catch (NullPointerException e) {
|
||||
Log.e(TAG, "BraveRewardsPanel onBalance " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setMonthlyInformationClick(View view) {
|
||||
@@ -285,11 +278,20 @@ public class RewardsTippingPanelFragment
|
||||
}
|
||||
}
|
||||
|
||||
public void replaceSuccessUI() {
|
||||
new RewardsTippingSuccessContribution(getActivity(), mContentView, mAmountSelected);
|
||||
View tippingSuccessFragment =
|
||||
mContentView.findViewById(R.id.rewards_tipping_success_fragment);
|
||||
View tippingTipFragment = mContentView.findViewById(R.id.rewards_tipping_tip_fragment);
|
||||
tippingTipFragment.setVisibility(View.GONE);
|
||||
|
||||
tippingSuccessFragment.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSendContribution(boolean result) {
|
||||
if (result) {
|
||||
RewardsTippingSuccessContributionFragment.showTippingSuccessContributionUi(
|
||||
(AppCompatActivity) getActivity(), mAmountSelected);
|
||||
replaceSuccessUI();
|
||||
mSendButton.setText(R.string.send);
|
||||
} else {
|
||||
showErrorLayout();
|
||||
@@ -341,8 +343,7 @@ public class RewardsTippingPanelFragment
|
||||
getActivity(), R.color.monthly_contributions_text_color, (textView) -> {
|
||||
TabUtils.openUrlInNewTab(
|
||||
false, BraveActivity.BRAVE_REWARDS_SETTINGS_MONTHLY_URL);
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
dismissRewardsPanel();
|
||||
});
|
||||
|
||||
BraveRewardsHelper.setSpan(getActivity(), text, textSpannableString,
|
||||
@@ -403,8 +404,7 @@ public class RewardsTippingPanelFragment
|
||||
private void web3ButtonClick(View view) {
|
||||
mWeb3WalletButton.setOnClickListener(v -> {
|
||||
TabUtils.openUrlInNewTab(false, mWeb3Url);
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
dismissRewardsPanel();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -413,8 +413,7 @@ public class RewardsTippingPanelFragment
|
||||
if (mIsLogoutState) {
|
||||
if (mExternalWallet != null) {
|
||||
TabUtils.openUrlInNewTab(false, mExternalWallet.getLoginUrl());
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
dismissRewardsPanel();
|
||||
}
|
||||
} else {
|
||||
SwitchCompat isMonthly = view.findViewById(R.id.monthly_switch);
|
||||
@@ -446,7 +445,7 @@ public class RewardsTippingPanelFragment
|
||||
});
|
||||
}
|
||||
|
||||
private TextWatcher textChangeListener = new TextWatcher() {
|
||||
private TextWatcher mTextChangeListener = new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@@ -481,7 +480,7 @@ public class RewardsTippingPanelFragment
|
||||
|
||||
mCurrency1ValueTextView = view.findViewById(R.id.currencyOneEditText1);
|
||||
mCurrency2ValueTextView = view.findViewById(R.id.exchange_amount1);
|
||||
mCurrency1ValueEditTextView.addTextChangedListener(textChangeListener);
|
||||
mCurrency1ValueEditTextView.addTextChangedListener(mTextChangeListener);
|
||||
mRate = mBraveRewardsNativeWorker.GetWalletRate();
|
||||
mRadioTipAmount[0] = view.findViewById(R.id.tipChoice1);
|
||||
mRadioTipAmount[1] = view.findViewById(R.id.tipChoice2);
|
||||
@@ -489,11 +488,11 @@ public class RewardsTippingPanelFragment
|
||||
mRadioTipAmount[3] = view.findViewById(R.id.tipChoiceCustom);
|
||||
|
||||
for (TextView tb : mRadioTipAmount) {
|
||||
tb.setOnClickListener(radio_clicker);
|
||||
tb.setOnClickListener(mRadioClicker);
|
||||
}
|
||||
}
|
||||
|
||||
void setBalanceText(View view) {
|
||||
void setBalanceText() {
|
||||
double balance = DEFAULT_AMOUNT;
|
||||
BraveRewardsBalance rewards_balance = mBraveRewardsNativeWorker.GetWalletBalance();
|
||||
if (rewards_balance != null) {
|
||||
@@ -506,7 +505,7 @@ public class RewardsTippingPanelFragment
|
||||
df.setMinimumFractionDigits(3);
|
||||
String walletAmount = df.format(balance) + " " + BraveRewardsHelper.BAT_TEXT;
|
||||
|
||||
((TextView) view.findViewById(R.id.wallet_amount_text)).setText(walletAmount);
|
||||
((TextView) mContentView.findViewById(R.id.wallet_amount_text)).setText(walletAmount);
|
||||
}
|
||||
|
||||
private void checkEnoughFund() {
|
||||
@@ -588,8 +587,11 @@ public class RewardsTippingPanelFragment
|
||||
}
|
||||
}
|
||||
|
||||
private View.OnClickListener radio_clicker = view -> {
|
||||
mCurrency1ValueEditTextView.removeTextChangedListener(textChangeListener);
|
||||
private View.OnClickListener mRadioClicker = view -> {
|
||||
if (mFetchBalanceProgressBar.getVisibility() == View.VISIBLE) {
|
||||
return;
|
||||
}
|
||||
mCurrency1ValueEditTextView.removeTextChangedListener(mTextChangeListener);
|
||||
|
||||
TextView tb_pressed = (TextView) view;
|
||||
if (!tb_pressed.isSelected()) {
|
||||
@@ -630,32 +632,24 @@ public class RewardsTippingPanelFragment
|
||||
mAmountSelected = selectedAmount();
|
||||
|
||||
checkEnoughFund();
|
||||
mCurrency1ValueEditTextView.addTextChangedListener(textChangeListener);
|
||||
mCurrency1ValueEditTextView.addTextChangedListener(mTextChangeListener);
|
||||
};
|
||||
|
||||
private double selectedAmount() {
|
||||
double amount = 0.0;
|
||||
|
||||
try {
|
||||
if (mIsBatCurrency)
|
||||
if (mIsBatCurrency) {
|
||||
amount = Double.parseDouble(mCurrency1ValueEditTextView.getText().toString());
|
||||
else
|
||||
} else {
|
||||
amount = Double.parseDouble(mCurrency2ValueTextView.getText().toString());
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public static void showTippingPanelBottomSheet(
|
||||
AppCompatActivity activity, int tabId, String web3Url) {
|
||||
if (activity != null) {
|
||||
RewardsTippingPanelFragment dialog =
|
||||
RewardsTippingPanelFragment.newInstance(tabId, web3Url);
|
||||
dialog.show(activity.getSupportFragmentManager(), TAG_FRAGMENT);
|
||||
}
|
||||
}
|
||||
|
||||
private double roundExchangeUp(double batValue) {
|
||||
return Math.ceil(batValue * 100) / 100;
|
||||
}
|
||||
@@ -693,4 +687,32 @@ public class RewardsTippingPanelFragment
|
||||
mBraveRewardsNativeWorker.RemoveObserver(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void dismissRewardsPanel() {
|
||||
if (mIsTablet) {
|
||||
try {
|
||||
BraveActivity braveActivity = BraveActivity.getBraveActivity();
|
||||
braveActivity.dismissRewardsPanel();
|
||||
} catch (BraveActivity.BraveActivityNotFoundException e) {
|
||||
Log.e(TAG, "setShareYourSupportClickListener " + e);
|
||||
}
|
||||
} else {
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPublisherBanner(String jsonBannerInfo) {
|
||||
try {
|
||||
BraveRewardsBannerInfo bannerInfo = new BraveRewardsBannerInfo(jsonBannerInfo);
|
||||
mWeb3Url = bannerInfo.getWeb3Url();
|
||||
if (!TextUtils.isEmpty(mWeb3Url)) {
|
||||
mWeb3WalletButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mBraveRewardsNativeWorker.GetExternalWallet();
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "TippingBanner -> CreatorPanel:onAttach JSONException error " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.rewards.tipping;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.chrome.R;
|
||||
import org.chromium.chrome.browser.app.BraveActivity;
|
||||
import org.chromium.ui.base.DeviceFormFactor;
|
||||
|
||||
public class RewardsTippingSuccessContribution {
|
||||
private static final String AMOUNT_SELECTED = "amount_selected";
|
||||
private static final String TAG = "TippingSuccess";
|
||||
private View mContentView;
|
||||
private double mAmountSelected;
|
||||
private Activity mActivity;
|
||||
private boolean mIsTablet;
|
||||
|
||||
public RewardsTippingSuccessContribution(
|
||||
@NonNull Activity activity, View rootView, double amountSelected) {
|
||||
mContentView = rootView;
|
||||
mAmountSelected = amountSelected;
|
||||
mActivity = activity;
|
||||
setShareYourSupportClickListener();
|
||||
setGoBackClick();
|
||||
mIsTablet = DeviceFormFactor.isNonMultiDisplayContextOnTablet(mActivity);
|
||||
}
|
||||
|
||||
private void setGoBackClick() {
|
||||
View goBackButton = mContentView.findViewById(R.id.go_back_button);
|
||||
goBackButton.setOnClickListener(v -> { dismissRewardsPanel(); });
|
||||
}
|
||||
|
||||
private void dismissRewardsPanel() {
|
||||
if (mIsTablet) {
|
||||
try {
|
||||
BraveActivity braveActivity = BraveActivity.getBraveActivity();
|
||||
braveActivity.dismissRewardsPanel();
|
||||
} catch (BraveActivity.BraveActivityNotFoundException e) {
|
||||
Log.e(TAG, "setShareYourSupportClickListener " + e);
|
||||
}
|
||||
} else {
|
||||
mActivity.setResult(Activity.RESULT_OK);
|
||||
mActivity.finish();
|
||||
}
|
||||
}
|
||||
|
||||
private void setShareYourSupportClickListener() {
|
||||
View shareYourSupportButton = mContentView.findViewById(R.id.share_your_support);
|
||||
shareYourSupportButton.setOnClickListener(v -> {
|
||||
double amount = mAmountSelected;
|
||||
|
||||
String tweetUrl = getTipSuccessTweetUrl(amount);
|
||||
Uri uri = Uri.parse(tweetUrl);
|
||||
mActivity.startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
dismissRewardsPanel();
|
||||
});
|
||||
}
|
||||
|
||||
private String getTipSuccessTweetUrl(double amount) {
|
||||
Uri.Builder builder = new Uri.Builder();
|
||||
builder.scheme("https")
|
||||
.authority("twitter.com")
|
||||
.appendPath("intent")
|
||||
.appendPath("tweet")
|
||||
.appendQueryParameter("text",
|
||||
String.format(mActivity.getString(R.string.brave_rewards_tip_success_tweet),
|
||||
amount));
|
||||
return builder.build().toString();
|
||||
}
|
||||
}
|
||||
-132
@@ -1,132 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2023 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.rewards.tipping;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetBehavior;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
import org.chromium.base.Log;
|
||||
import org.chromium.chrome.R;
|
||||
|
||||
public class RewardsTippingSuccessContributionFragment extends BottomSheetDialogFragment {
|
||||
final public static String TAG_FRAGMENT = "tipping_success_contribution";
|
||||
private static final String AMOUNT_SELECTED = "amount_selected";
|
||||
private static final String TAG = "TippingSuccess";
|
||||
|
||||
public static RewardsTippingSuccessContributionFragment newInstance(double amountSelected) {
|
||||
RewardsTippingSuccessContributionFragment fragment =
|
||||
new RewardsTippingSuccessContributionFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putDouble(AMOUNT_SELECTED, amountSelected);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setStyle(STYLE_NORMAL, R.style.AppBottomSheetDialogTheme);
|
||||
}
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstance) {
|
||||
BottomSheetDialog dialog = (BottomSheetDialog) super.onCreateDialog(savedInstance);
|
||||
final View view =
|
||||
LayoutInflater.from(getContext())
|
||||
.inflate(R.layout.rewards_tipping_success_contribution_fragment, null);
|
||||
dialog.setContentView(view);
|
||||
setShareYourSupportClickListener(view);
|
||||
setupFullHeight(dialog);
|
||||
setGoBackClick(view);
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private void setGoBackClick(View view) {
|
||||
View goBackButton = view.findViewById(R.id.go_back_button);
|
||||
goBackButton.setOnClickListener(v -> {
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
});
|
||||
}
|
||||
|
||||
private void setupFullHeight(BottomSheetDialog bottomSheetDialog) {
|
||||
FrameLayout bottomSheet =
|
||||
(FrameLayout) bottomSheetDialog.findViewById(R.id.design_bottom_sheet);
|
||||
BottomSheetBehavior behavior = BottomSheetBehavior.from(bottomSheet);
|
||||
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
|
||||
}
|
||||
|
||||
private void setShareYourSupportClickListener(View view) {
|
||||
View shareYourSupportButton = view.findViewById(R.id.share_your_support);
|
||||
shareYourSupportButton.setOnClickListener(v -> {
|
||||
double amount = 0.0;
|
||||
|
||||
if (getArguments() != null) {
|
||||
amount = getArguments().getDouble(AMOUNT_SELECTED);
|
||||
}
|
||||
|
||||
String tweetUrl = getTipSuccessTweetUrl(amount);
|
||||
Uri uri = Uri.parse(tweetUrl);
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||
getActivity().setResult(Activity.RESULT_OK);
|
||||
getActivity().finish();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(@NonNull FragmentManager manager, @Nullable String tag) {
|
||||
try {
|
||||
RewardsTippingSuccessContributionFragment fragment =
|
||||
(RewardsTippingSuccessContributionFragment) manager.findFragmentByTag(
|
||||
RewardsTippingSuccessContributionFragment.TAG_FRAGMENT);
|
||||
FragmentTransaction transaction = manager.beginTransaction();
|
||||
if (fragment != null) {
|
||||
transaction.remove(fragment);
|
||||
}
|
||||
transaction.add(this, tag);
|
||||
transaction.commitAllowingStateLoss();
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e(TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void showTippingSuccessContributionUi(
|
||||
AppCompatActivity activity, double amountSelected) {
|
||||
if (activity != null) {
|
||||
RewardsTippingSuccessContributionFragment braveAskPlayStoreRatingDialog =
|
||||
RewardsTippingSuccessContributionFragment.newInstance(amountSelected);
|
||||
braveAskPlayStoreRatingDialog.show(activity.getSupportFragmentManager(), TAG_FRAGMENT);
|
||||
}
|
||||
}
|
||||
|
||||
private String getTipSuccessTweetUrl(double amount) {
|
||||
Uri.Builder builder = new Uri.Builder();
|
||||
builder.scheme("https")
|
||||
.authority("twitter.com")
|
||||
.appendPath("intent")
|
||||
.appendPath("tweet")
|
||||
.appendQueryParameter("text",
|
||||
String.format(getString(R.string.brave_rewards_tip_success_tweet), amount));
|
||||
return builder.build().toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="28dp" />
|
||||
<solid android:color="@color/rewards_background_gradient_end_color"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:bottom="100dp"
|
||||
android:drawable="@drawable/tipping_background_success"/>
|
||||
</layer-list>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="28dp" />
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="@color/rewards_background_gradient_start_color"
|
||||
android:endX="270"
|
||||
android:endY="254"
|
||||
android:startColor="@color/rewards_background_gradient_end_color"
|
||||
android:startX="90"
|
||||
android:startY="254"
|
||||
android:type="linear" />>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:bottom="100dp">
|
||||
<shape>
|
||||
<corners android:topLeftRadius="28dp"
|
||||
android:topRightRadius="28dp"/>
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="@color/rewards_background_gradient_end_color"
|
||||
android:endX="270"
|
||||
android:endY="254"
|
||||
android:startColor="@color/rewards_background_gradient_start_color"
|
||||
android:startX="90"
|
||||
android:startY="254"
|
||||
android:type="linear" />>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:bottomLeftRadius="40dp"
|
||||
android:bottomRightRadius="40dp" />
|
||||
<solid android:color="@color/tipping_rewards_background_color"/>
|
||||
<stroke
|
||||
android:width="4dp"
|
||||
android:color="@color/rewards_background_gradient_end_color" />
|
||||
</shape>
|
||||
@@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="20"
|
||||
android:viewportHeight="20">
|
||||
<path
|
||||
android:pathData="M16.726,12.776L17.09,12.501C17.881,11.899 18.333,10.984 18.333,9.99C18.331,8.996 17.876,8.083 17.084,7.483L16.719,7.207L16.781,6.755C16.903,5.853 16.631,4.944 16.034,4.261C15.339,3.464 14.307,3.063 13.228,3.211L12.776,3.274L12.499,2.909C11.899,2.12 10.985,1.667 9.993,1.667C8.997,1.667 8.082,2.123 7.482,2.916L7.207,3.281L6.753,3.219C5.681,3.071 4.646,3.477 3.953,4.272C3.356,4.958 3.085,5.869 3.21,6.771L3.272,7.223L2.909,7.501C2.117,8.102 1.665,9.017 1.666,10.011C1.667,11.005 2.122,11.919 2.915,12.518L3.279,12.794L3.218,13.246C3.095,14.147 3.367,15.056 3.964,15.741C4.658,16.536 5.689,16.938 6.77,16.791L7.222,16.727L7.499,17.091C8.099,17.882 9.013,18.334 10.005,18.334C11.001,18.334 11.916,17.879 12.517,17.085L12.792,16.72L13.245,16.781C14.324,16.931 15.353,16.525 16.046,15.729C16.643,15.042 16.914,14.132 16.789,13.229L16.726,12.776Z"
|
||||
android:fillColor="@color/verification_tick_mark_background"/>
|
||||
<path
|
||||
android:pathData="M9.337,12.778C9.532,12.769 9.713,12.678 9.839,12.528L13.312,8.362C13.557,8.067 13.517,7.629 13.223,7.384C12.927,7.138 12.49,7.178 12.244,7.473L9.258,11.055L7.713,9.509C7.442,9.238 7.003,9.238 6.731,9.509C6.459,9.78 6.459,10.22 6.731,10.491L8.815,12.575C8.944,12.705 9.122,12.778 9.306,12.778C9.315,12.778 9.326,12.778 9.337,12.778Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
</vector>
|
||||
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bottomsheet_rewards_background_tablet"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottomsheet_top_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/bottomsheet_top_bar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/support_this_creator"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/support_this_creator"
|
||||
android:textColor="@color/rewards_panel_notification_text_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/send_tip_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/tipping_send_button_background_selector"
|
||||
android:enabled="true"
|
||||
android:text="@string/send"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="13sp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
app:layout_goneMarginBottom="32dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/use_web3_wallet_button"
|
||||
app:layout_constraintTop_toBottomOf="@+id/constraintLayout"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/use_web3_wallet_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:background="@drawable/brave_rewards_use_web3_background"
|
||||
android:text="@string/use_web3_wallet"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/use_web3_wallet_button_text_color"
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/send_tip_button"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/processing_fee"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center"
|
||||
android:text="@string/processing_fee"
|
||||
android:textColor="@color/terms_of_service_text_color_default"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@id/proceed_terms_of_service"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/use_web3_wallet_button" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/proceed_terms_of_service"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/terms_of_service_text_color_default"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/processing_fee" />
|
||||
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:background="@drawable/p2p_rewards_inside_background"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/support_this_creator">
|
||||
|
||||
<include layout="@layout/tipping_banner_tipping_panel_inside_layout" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/send_tip_progress_bar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerInParent="true"
|
||||
app:layout_constraintTop_toTopOf="@id/send_tip_button"
|
||||
app:layout_constraintStart_toStartOf="@id/send_tip_button"
|
||||
app:layout_constraintEnd_toEndOf="@id/send_tip_button"
|
||||
app:layout_constraintBottom_toBottomOf="@id/send_tip_button"
|
||||
android:indeterminateTint="@android:color/white"
|
||||
android:visibility="gone"
|
||||
android:elevation="9dp"
|
||||
/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/fetchBalanceProgressBar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerInParent="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:indeterminateTint="@color/rewards_tipping_progress_bar"
|
||||
android:elevation="9dp"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@android:color/transparent">
|
||||
|
||||
<include
|
||||
android:id="@+id/rewards_tipping_success_fragment"
|
||||
layout="@layout/rewards_tipping_success_contribution_fragment"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
android:id="@+id/rewards_tipping_tip_fragment"
|
||||
layout="@layout/brave_rewards_tippingpanel_fragment" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,278 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/publisher_info_root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/top_tipping_banner_ui_background_scenery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="223dp"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/tipping_default_background"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipping_publisher_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="36dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textColor="@color/rewards_panel_notification_text_color"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/top_tipping_banner_ui_background_scenery" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/verified_tick_mark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/tipping_publisher_name"
|
||||
app:layout_constraintStart_toEndOf="@+id/tipping_publisher_name"
|
||||
app:layout_constraintTop_toTopOf="@+id/tipping_publisher_name"
|
||||
app:srcCompat="@drawable/verification_tick_mark" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipping_details_description"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginStart="32dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginEnd="392dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:paddingEnd="32dp"
|
||||
android:scrollbars="vertical"
|
||||
android:textColor="@color/tipping_details_description_text_color"
|
||||
android:textSize="14sp"
|
||||
app:layout_constrainedHeight="true"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHeight_max="262dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tipping_publisher_name" />
|
||||
|
||||
<View
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="@drawable/transparent_shadow_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tipping_details_description"
|
||||
app:layout_constraintEnd_toEndOf="@+id/tipping_details_description"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/align_other_social"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginBottom="32dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_discord"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_discord_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_discord"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_facebook"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/align_other_social"
|
||||
app:layout_constraintTop_toTopOf="@id/align_other_social"
|
||||
app:srcCompat="@drawable/social_discord_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_facebook"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_instagram"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_discord"
|
||||
app:layout_constraintTop_toTopOf="@id/align_other_social"
|
||||
app:srcCompat="@drawable/social_facebook_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_instagram"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_twitter"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_facebook"
|
||||
app:layout_constraintTop_toTopOf="@id/align_other_social"
|
||||
app:srcCompat="@drawable/social_instagram_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_twitter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_youtube"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_instagram"
|
||||
app:layout_constraintTop_toTopOf="@id/align_other_social"
|
||||
app:srcCompat="@drawable/social_twitter_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_youtube"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_github"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_twitter"
|
||||
app:layout_constraintTop_toTopOf="@id/align_other_social"
|
||||
app:srcCompat="@drawable/social_youtube_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_github"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_reddit"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_youtube"
|
||||
app:layout_constraintTop_toTopOf="@id/align_other_social"
|
||||
app:srcCompat="@drawable/social_github_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_reddit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_vimeo"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_github"
|
||||
app:layout_constraintTop_toTopOf="@id/align_other_social"
|
||||
app:srcCompat="@drawable/social_reddit_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_vimeo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_twitch"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_reddit"
|
||||
app:layout_constraintTop_toTopOf="@id/align_other_social"
|
||||
app:srcCompat="@drawable/social_vimeo_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_twitch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_vimeo"
|
||||
app:layout_constraintTop_toTopOf="@id/align_other_social"
|
||||
app:srcCompat="@drawable/social_twitch_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/publisher_favicon"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="120dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="120dp"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="fitXY"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/top_tipping_banner_ui_background_scenery"
|
||||
/>
|
||||
|
||||
<View
|
||||
android:id="@+id/placeholder_background1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="192dp"
|
||||
android:layout_marginVertical="16dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:background="@drawable/tipping_banner_view_background"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_it"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="72dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_twitch"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_twitter"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_youtube_color" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/send_tip_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="72dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_twitch"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_twitter"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_youtube_color" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/use_web3_wallet_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="72dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/link_twitch"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@+id/link_twitter"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_youtube_color" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bottomsheet_rewards_tipping_success_background"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottomsheet_top_bar1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/bottomsheet_top_bar" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/contribution_sent_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="242dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/contribution_sent"
|
||||
android:textColor="@color/contribution_sent_text_color"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/thanks_for_supporting_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="40dp"
|
||||
android:layout_marginTop="17dp"
|
||||
android:layout_marginEnd="40dp"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center"
|
||||
android:text="@string/thanks_for_supporting_your_favorite_creators"
|
||||
android:textColor="@color/thanks_for_supporting_text_color"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/contribution_sent_text" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/share_your_support"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="16dp"
|
||||
android:layout_marginTop="81dp"
|
||||
android:background="@drawable/tipping_send_button_background"
|
||||
android:text="@string/share_your_support"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="13sp"
|
||||
android:layout_marginBottom="40dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/thanks_for_supporting_text" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/go_back_button"
|
||||
style="?android:attr/borderlessButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:text="@string/go_back"
|
||||
android:textAllCaps="false"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/go_back_text_color"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/share_your_support" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -2,294 +2,19 @@
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/publisher_info_root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/tipping_rewards_background_color"
|
||||
tools:context=".rewards.tipping.RewardsTippingBannerActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/top_tipping_banner_ui_background_scenery"
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/tippingBannerFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="105dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/tipping_default_background" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_it"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintBottom_toBottomOf="@id/close_it_background"
|
||||
app:layout_constraintEnd_toEndOf="@id/close_it_background"
|
||||
app:layout_constraintStart_toStartOf="@id/close_it_background"
|
||||
app:layout_constraintTop_toTopOf="@id/close_it_background"
|
||||
app:srcCompat="@drawable/ic_baseline_close_24"
|
||||
app:tint="#D9D9D9" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_it_background"
|
||||
android:layout_width="40dp"
|
||||
android:contentDescription="@null"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="56dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/rewards_tipping_close_button_background"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scroll_view_tipping"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/placeholder_background1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/publisher_favicon">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipping_publisher_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textColor="@color/rewards_panel_notification_text_color"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/verified_tick_mark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tipping_publisher_name"
|
||||
app:layout_constraintStart_toEndOf="@id/tipping_publisher_name"
|
||||
app:layout_constraintTop_toTopOf="@id/tipping_publisher_name"
|
||||
app:srcCompat="@drawable/rewards_verified_tick_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipping_details_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="@string/rewards_tip_default_creator_description"
|
||||
android:textColor="@color/tipping_details_description_text_color"
|
||||
android:textSize="14sp"
|
||||
android:lineSpacingExtra="3sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_publisher_name" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_discord"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="72dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_facebook"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_discord_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_facebook"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_instagram"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_discord"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_facebook_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_instagram"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_twitter"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_facebook"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_instagram_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_twitter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_youtube"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_instagram"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_twitter_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_youtube"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_github"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_twitter"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_youtube_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_github"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_reddit"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_youtube"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_github_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_reddit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_vimeo"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_github"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_reddit_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_vimeo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_twitch"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_reddit"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_vimeo_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_twitch"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_vimeo"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:srcCompat="@drawable/social_twitch_color"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/publisher_favicon"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:contentDescription="@null"
|
||||
android:layout_marginTop="48dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/top_tipping_banner_ui_background_scenery"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/placeholder_background1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/tipping_banner_view_background"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:padding="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/support_this_creator"
|
||||
android:textColor="@color/rewards_panel_notification_text_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/send_tip_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/tipping_send_button_background"
|
||||
android:text="@string/use_brave_rewards"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView4"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/use_web3_wallet_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/brave_rewards_use_web3_background"
|
||||
android:text="@string/use_web3_wallet"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/use_web3_wallet_button_text_color"
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/send_tip_button"
|
||||
app:layout_goneMarginTop="24dp"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/transparent_shadow_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:background="@drawable/transparent_shadow_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/scroll_view_tipping" />
|
||||
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
tools:layout="@layout/rewards_tipping_banner_fragment" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/parent1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:background="@drawable/tipping_banner_tablet_ui_background">
|
||||
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/tippingBannerFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_bias="1.0"
|
||||
tools:layout="@layout/rewards_tipping_banner_fragment" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/tipping_panel_view"
|
||||
android:layout_width="360dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/tippingPanelFragment2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:layout="@layout/brave_rewards_tippingpanel_fragment"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/processing_fee"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center"
|
||||
android:text="@string/processing_fee"
|
||||
android:textColor="@color/terms_of_service_text_color_default"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/proceed_terms_of_service"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:layout_marginBottom="14dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/terms_of_service_text_color_default"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/tippingPanelFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
tools:layout="@layout/brave_rewards_tippingpanel_fragment"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -125,5 +125,17 @@
|
||||
android:visibility="gone"
|
||||
android:elevation="9dp"
|
||||
/>
|
||||
<ProgressBar
|
||||
android:id="@+id/fetchBalanceProgressBar"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_centerInParent="true"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:indeterminateTint="@color/rewards_tipping_progress_bar"
|
||||
android:elevation="9dp"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bottomsheet_rewards_background"
|
||||
>
|
||||
|
||||
<include
|
||||
android:id="@+id/rewards_tipping_success_fragment"
|
||||
layout="@layout/rewards_tipping_success_contribution_fragment"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include
|
||||
android:id="@+id/rewards_tipping_tip_fragment"
|
||||
layout="@layout/brave_rewards_tippingpanel_fragment"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,296 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/publisher_info_root_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/tipping_rewards_background_color"
|
||||
tools:context=".rewards.tipping.RewardsTippingBannerActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/top_tipping_banner_ui_background_scenery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="105dp"
|
||||
android:scaleType="fitXY"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/tipping_default_background" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_it"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintBottom_toBottomOf="@id/close_it_background"
|
||||
app:layout_constraintEnd_toEndOf="@id/close_it_background"
|
||||
app:layout_constraintStart_toStartOf="@id/close_it_background"
|
||||
app:layout_constraintTop_toTopOf="@id/close_it_background"
|
||||
app:srcCompat="@drawable/ic_baseline_close_24"
|
||||
app:tint="#D9D9D9" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/close_it_background"
|
||||
android:layout_width="40dp"
|
||||
android:contentDescription="@null"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="56dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:background="@drawable/rewards_tipping_close_button_background"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ScrollView
|
||||
android:id="@+id/scroll_view_tipping"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/placeholder_background1"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/publisher_favicon">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipping_publisher_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:textColor="@color/rewards_panel_notification_text_color"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/verified_tick_mark"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintBottom_toBottomOf="@id/tipping_publisher_name"
|
||||
app:layout_constraintStart_toEndOf="@id/tipping_publisher_name"
|
||||
app:layout_constraintTop_toTopOf="@id/tipping_publisher_name"
|
||||
app:srcCompat="@drawable/rewards_verified_tick_icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tipping_details_description"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:fontFamily="sans-serif"
|
||||
android:text="@string/rewards_tip_default_creator_description"
|
||||
android:textColor="@color/tipping_details_description_text_color"
|
||||
android:textSize="14sp"
|
||||
android:lineSpacingExtra="3sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_publisher_name" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_discord"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="40dp"
|
||||
android:layout_marginBottom="72dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_facebook"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_discord_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_facebook"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_instagram"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_discord"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_facebook_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_instagram"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_twitter"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_facebook"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_instagram_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_twitter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_youtube"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_instagram"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_twitter_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_youtube"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_github"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_twitter"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_youtube_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_github"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_reddit"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_youtube"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_github_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_reddit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_vimeo"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_github"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_reddit_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_vimeo"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
app:layout_constraintEnd_toStartOf="@id/link_twitch"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_reddit"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:srcCompat="@drawable/social_vimeo_color" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/link_twitch"
|
||||
android:layout_width="22dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:contentDescription="@null"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toEndOf="@id/link_vimeo"
|
||||
android:layout_marginTop="40dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/tipping_details_description"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:srcCompat="@drawable/social_twitch_color"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</ScrollView>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/publisher_favicon"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:contentDescription="@null"
|
||||
android:layout_marginTop="48dp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/top_tipping_banner_ui_background_scenery"
|
||||
/>
|
||||
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/placeholder_background1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/tipping_banner_view_background"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginHorizontal="8dp"
|
||||
android:padding="24dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:text="@string/support_this_creator"
|
||||
android:textColor="@color/rewards_panel_notification_text_color"
|
||||
android:textSize="16sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/send_tip_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/tipping_send_button_background"
|
||||
android:text="@string/use_brave_rewards"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="13sp"
|
||||
app:layout_constraintTop_toBottomOf="@id/textView4"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/use_web3_wallet_button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:background="@drawable/brave_rewards_use_web3_background"
|
||||
android:text="@string/use_web3_wallet"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/use_web3_wallet_button_text_color"
|
||||
android:textSize="13sp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@id/send_tip_button"
|
||||
app:layout_goneMarginTop="24dp"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/transparent_shadow_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="47dp"
|
||||
android:background="@drawable/transparent_shadow_background"
|
||||
app:layout_constraintBottom_toBottomOf="@id/scroll_view_tipping" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -8,7 +8,7 @@
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottomsheet_top_bar"
|
||||
android:id="@+id/bottomsheet_top_bar1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
@@ -240,4 +240,6 @@
|
||||
<color name="rewards_private_ads_icon_color12">#AF1769</color>
|
||||
<color name="rewards_private_ads_icon_color13">#0C5FA3</color>
|
||||
<color name="rewards_estimated_earning_close_color">#EDEEF1</color>
|
||||
<color name="rewards_tipping_progress_bar">@android:color/white</color>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -210,6 +210,8 @@
|
||||
<color name="topsite_bg_color">#DADCE8</color>
|
||||
|
||||
<color name="white_alpha_50">#80FFFFFF</color>
|
||||
<color name="verification_tick_mark_background">#5F5CF1</color>
|
||||
|
||||
|
||||
<color name="brave_rewards_modal_text_color">#495057</color>
|
||||
<color name="brave_rewards_modal_theme_color">#4C54D2</color>
|
||||
@@ -362,4 +364,6 @@
|
||||
<color name="rewards_private_ads_icon_color13">#6AB6F4</color>
|
||||
<color name="rewards_manage_ads_color">#3F39E8</color>
|
||||
<color name="rewards_estimated_earning_close_color">#697284</color>
|
||||
<color name="rewards_tipping_progress_bar">@android:color/black</color>
|
||||
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user