Skip to content

Commit

Permalink
Merge pull request #7985 from brave/bap_modal_update_android
Browse files Browse the repository at this point in the history
Bap modal update android
  • Loading branch information
deeppandya authored Feb 17, 2021
2 parents 7d777c6 + 640b230 commit 24b6ca2
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
package org.chromium.chrome.browser;

import android.content.DialogInterface;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.LinearLayout;
Expand Down Expand Up @@ -50,6 +52,19 @@ public boolean onKey(android.content.DialogInterface dialog, int keyCode,
setDialogParams();
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NO_TITLE, 0);
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

@Override
public void onDestroyView() {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
super.onDestroyView();
}

@Override
public View onCreateView(
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,15 @@ public boolean isRewardsPanelOpened() {
return false;
}

public boolean isShieldsTooltipShown() {
BraveToolbarLayout layout = (BraveToolbarLayout) findViewById(R.id.toolbar);
assert layout != null;
if (layout != null) {
return layout.isShieldsTooltipShown();
}
return false;
}

public Tab selectExistingTab(String url) {
Tab tab = getActivityTab();
if (tab != null && tab.getUrlString().equals(url)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ public void onPageLoadFinished(final Tab tab, GURL url) {
OnboardingPrefManager.getInstance().setTimeSavedNotificationStarted(true);
}
if (mBraveShieldsButton != null && mBraveShieldsButton.isShown()
&& mBraveShieldsHandler != null && !mBraveShieldsHandler.isShowing()) {
&& mBraveShieldsHandler != null && !mBraveShieldsHandler.isShowing()
&& !isRewardsTooltipShown() && !isRewardsPanelOpened()) {
checkForTooltip(tab);
}
}
Expand Down Expand Up @@ -565,6 +566,13 @@ public void dismissRewardsTooltip() {
}
}

public boolean isRewardsTooltipShown() {
if (mRewardsPopupWindowTooltip != null) {
return mRewardsPopupWindowTooltip.isShowing();
}
return false;
}

@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Expand Down Expand Up @@ -990,6 +998,13 @@ public boolean isRewardsPanelOpened() {
return false;
}

public boolean isShieldsTooltipShown() {
if (mShieldsPopupWindowTooltip != null) {
return mShieldsPopupWindowTooltip.isShowing();
}
return false;
}

@Override
public void OnNotificationAdded(String id, int type, long timestamp, String[] args) {
if (mBraveRewardsNativeWorker == null) {
Expand Down
113 changes: 61 additions & 52 deletions android/java/res/layout/fragment_deprecate_bap_modal_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,75 @@
You can obtain one at http://mozilla.org/MPL/2.0/.
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical">
android:fadeScrollbars="false"
android:scrollbars="vertical">

<FrameLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rewards_modal_background">

<ImageView
android:layout_width="wrap_content"
android:background="@android:color/white"
android:orientation="vertical">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:src="@drawable/ic_warning_triangle_2"
android:contentDescription="@null" />
android:background="@drawable/rewards_modal_background">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="24dp"
android:layout_marginTop="24dp"
android:src="@drawable/ic_warning_triangle_2"
android:contentDescription="@null" />

</FrameLayout>
</FrameLayout>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/rewards_tooltip_title"
android:textSize="20sp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:textColor="@android:color/black"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/rewards_tooltip_title"
android:textSize="20sp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:textColor="@android:color/black"
android:textStyle="bold"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="16sp"
android:text="@string/rewards_modal_text"
android:layout_marginBottom="24dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:textColor="@color/brave_rewards_modal_text_color"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:textSize="16sp"
android:text="@string/rewards_modal_text"
android:layout_marginBottom="24dp"
android:layout_marginStart="24dp"
android:layout_marginEnd="24dp"
android:textColor="@color/brave_rewards_modal_text_color"/>

<Button
android:id="@+id/btn_done"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/blue_rounded_button"
android:text="@string/brave_android_sync_disabled_ok"
android:layout_marginStart="80dp"
android:layout_marginEnd="80dp"
android:layout_marginBottom="24dp"
android:textAllCaps="false"
android:textColor="@android:color/white"
android:textSize="16sp"
style="?android:attr/borderlessButtonStyle"/>
<Button
android:id="@+id/btn_done"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@drawable/blue_rounded_button"
android:text="@string/brave_android_sync_disabled_ok"
android:layout_marginStart="80dp"
android:layout_marginEnd="80dp"
android:layout_marginBottom="24dp"
android:textAllCaps="false"
android:textColor="@android:color/white"
android:textSize="16sp"
style="?android:attr/borderlessButtonStyle"/>

</LinearLayout>

</LinearLayout>
</ScrollView>

0 comments on commit 24b6ca2

Please sign in to comment.