Skip to content

Commit

Permalink
Remove AC layout from rewards panel
Browse files Browse the repository at this point in the history
Remove unused resources

Improve format
  • Loading branch information
deeppandya committed Jan 9, 2025
1 parent 41bb32e commit 4262133
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -739,20 +739,33 @@ interface Natives {
double[] getTipChoices(long nativeBraveRewardsNativeWorker);

double getWalletRate(long nativeBraveRewardsNativeWorker);

void getPublisherInfo(long nativeBraveRewardsNativeWorker, int tabId, String host);

String getPublisherURL(long nativeBraveRewardsNativeWorker, int tabId);

String getCaptchaSolutionURL(
long nativeBraveRewardsNativeWorker, String paymentId, String captchaId);

String getAttestationURL(long nativeBraveRewardsNativeWorker);

String getAttestationURLWithPaymentId(
long nativeBraveRewardsNativeWorker, String paymentId);

String getPublisherFavIconURL(long nativeBraveRewardsNativeWorker, int tabId);

String getPublisherName(long nativeBraveRewardsNativeWorker, int tabId);

String getPublisherId(long nativeBraveRewardsNativeWorker, int tabId);

int getPublisherPercent(long nativeBraveRewardsNativeWorker, int tabId);

boolean getPublisherExcluded(long nativeBraveRewardsNativeWorker, int tabId);

int getPublisherStatus(long nativeBraveRewardsNativeWorker, int tabId);

void removePublisherFromMap(long nativeBraveRewardsNativeWorker, int tabId);

void getCurrentBalanceReport(long nativeBraveRewardsNativeWorker);

void donate(
Expand Down Expand Up @@ -797,11 +810,17 @@ boolean isCurrentPublisherInRecurrentDonations(
void recordPanelTrigger(long nativeBraveRewardsNativeWorker);

void createRewardsWallet(long nativeBraveRewardsNativeWorker, String countryCode);

void getRewardsParameters(long nativeBraveRewardsNativeWorker);

double getVbatDeadline(long nativeBraveRewardsNativeWorker);

void getUserType(long nativeBraveRewardsNativeWorker);

void fetchBalance(long nativeBraveRewardsNativeWorker);

void getAdsAccountStatement(long nativeBraveRewardsNativeWorker);

String getPayoutStatus(long nativeBraveRewardsNativeWorker);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,13 @@
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;

import androidx.appcompat.widget.AppCompatImageView;
import androidx.appcompat.widget.SwitchCompat;
import androidx.cardview.widget.CardView;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
Expand Down Expand Up @@ -173,7 +170,6 @@ public enum NotificationClickAction {
private LinearLayout mBtnSummary;
private ImageView mImgSummary;
private TextView mTextSummary;
private SwitchCompat mSwitchAutoContribute;

private Timer mPublisherFetcher;
private int mPublisherFetchesCount;
Expand Down Expand Up @@ -395,10 +391,10 @@ public void onClick(View v) {
mBtnSummary = mPopupView.findViewById(R.id.summary_btn);
mImgSummary = mPopupView.findViewById(R.id.summary_img);
mTextSummary = mPopupView.findViewById(R.id.summary_text);
mBtnSummary.setOnClickListener(view -> { showSummarySection(); });

mSwitchAutoContribute = mPopupView.findViewById(R.id.auto_contribution_switch);
mSwitchAutoContribute.setOnCheckedChangeListener(mAutoContributeSwitchListener);
mBtnSummary.setOnClickListener(
view -> {
showSummarySection();
});

showSummarySection();
mBtnTip.setEnabled(false);
Expand Down Expand Up @@ -1208,14 +1204,6 @@ private void showViewsBasedOnExternalWallet() {
}

// Generic UI changes
OnCheckedChangeListener mAutoContributeSwitchListener =
new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

}
};

View.OnClickListener mBraveRewardsOnboardingClickListener =
new View.OnClickListener() {
@Override
Expand Down Expand Up @@ -1992,12 +1980,6 @@ public void onPublisherInfo(int tabId) {
Integer.toString(mBraveRewardsNativeWorker.getPublisherPercent(mCurrentTabId))
+ "%";
mPublisherAttention.setText(percent);
if (mSwitchAutoContribute != null) {
mSwitchAutoContribute.setOnCheckedChangeListener(null);
mSwitchAutoContribute.setChecked(
!mBraveRewardsNativeWorker.getPublisherExcluded(mCurrentTabId));
mSwitchAutoContribute.setOnCheckedChangeListener(mAutoContributeSwitchListener);
}
updatePublisherStatus(mBraveRewardsNativeWorker.getPublisherStatus(mCurrentTabId));
}

Expand Down
27 changes: 0 additions & 27 deletions android/java/res/layout/brave_rewards_panel_tip_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,6 @@
android:layout_height="1dp"
android:background="@color/rewards_divider_color" />

<LinearLayout
android:id="@+id/auto_contribution_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:visibility="gone"
android:orientation="horizontal">

<TextView
android:id="@+id/auto_contribution_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_weight="1"
android:text="@string/include_auto_contribute"
android:fontFamily="sans-serif-medium"
android:textColor="@color/rewards_panel_secondary_text_color"
android:textSize="16sp" />

<androidx.appcompat.widget.SwitchCompat
android:id="@+id/auto_contribution_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:theme="@style/BraveRewardsSwitchTheme" />

</LinearLayout>

<LinearLayout
android:id="@+id/monthly_contribution_layout"
android:layout_width="match_parent"
Expand Down
6 changes: 0 additions & 6 deletions android/java/res/values/brave_styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@
<item name="colorControlNormal">@color/schemes_on_surface_variant</item>
<item name="colorControlActivated">@color/schemes_primary</item>
</style>
<style name="BraveRewardsSwitchTheme">
<item name="colorControlActivated">@color/rewards_panel_action_color</item>
<item name="colorSwitchThumbNormal">@color/modern_grey_600</item>
<item name="android:colorForeground">@color/modern_grey_600</item>
<item name="switchStyle">@style/Widget.MaterialComponents.CompoundButton.Switch</item>
</style>

<style name="TippingSwitchTheme">
<item name="colorControlActivated">@color/rewards_panel_action_color</item>
Expand Down
3 changes: 0 additions & 3 deletions browser/ui/android/strings/android_brave_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -2815,9 +2815,6 @@ If you don't accept this request, VPN will not reconnect and your internet conne
<message name="IDS_TIP" desc="Text for `Tip` button in Brave rewards panel">
Contribute
</message>
<message name="IDS_INCLUDE_AUTO_CONTRIBUTE" desc="Title text for `Include in Auto-Contribute` switch in Brave rewards panel">
Include in Auto-Contribute
</message>
<message name="IDS_SET" desc="Brave rewards panel text">
Set
</message>
Expand Down

0 comments on commit 4262133

Please sign in to comment.