Skip to content

Commit

Permalink
Fix NLPs for release app
Browse files Browse the repository at this point in the history
  • Loading branch information
deeppandya committed Nov 21, 2020
1 parent 3e504be commit ec30a92
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ private void checkForNotificationData() {
case RetentionNotificationUtil.BRAVE_STATS_ADS_TRACKERS:
case RetentionNotificationUtil.BRAVE_STATS_DATA:
case RetentionNotificationUtil.BRAVE_STATS_TIME:
if (!NewTabPage.isNTPUrl(getActivityTab().getUrlString())) {
if (getActivityTab() != null
&& getActivityTab().getUrlString() != null
&& !NewTabPage.isNTPUrl(getActivityTab().getUrlString())) {
getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI);
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ protected void onPostExecute(Void result) {
Pair<String, String> adsTrackersPair =
BraveStatsUtil.getBraveStatsStringFormNumberPair(adsTrackersCount, false);
adsTrackersCountText.setText(
String.format(getResources().getString(R.string.ntp_stat_text),
String.format(mContext.getResources().getString(R.string.ntp_stat_text),
adsTrackersPair.first, adsTrackersPair.second));

Pair<String, String> dataSavedPair =
Expand All @@ -253,7 +253,7 @@ protected void onPostExecute(Void result) {
Pair<String, String> timeSavedPair =
BraveStatsUtil.getBraveStatsStringFromTime(timeSavedCount / 1000);
timeSavedCountText.setText(
String.format(getResources().getString(R.string.ntp_stat_text),
String.format(mContext.getResources().getString(R.string.ntp_stat_text),
timeSavedPair.first, timeSavedPair.second));
timeSavedText.setText(mContext.getResources().getString(R.string.time_saved_text));

Expand Down Expand Up @@ -331,10 +331,10 @@ protected void onPostExecute(Void result) {

mTrackerCountText.setText(String.valueOf(statPair.second));
mTrackerCountText.setTextColor(
getResources().getColor(R.color.brave_stats_text_color));
mContext.getResources().getColor(R.color.brave_stats_text_color));
mSiteText.setText(statPair.first);
mSiteText.setTextColor(
getResources().getColor(R.color.brave_stats_text_color));
mContext.getResources().getColor(R.color.brave_stats_text_color));

rootView.addView(layout);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public void onReceive(Context context, Intent intent) {
case RetentionNotificationUtil.BRAVE_STATS_ADS_TRACKERS:
case RetentionNotificationUtil.BRAVE_STATS_DATA:
case RetentionNotificationUtil.BRAVE_STATS_TIME:
if (!NewTabPage.isNTPUrl(braveActivity.getActivityTab().getUrlString())) {
if (braveActivity.getActivityTab() != null
&& braveActivity.getActivityTab().getUrlString() != null
&& !NewTabPage.isNTPUrl(braveActivity.getActivityTab().getUrlString())) {
braveActivity.getTabCreator(false).launchUrl(UrlConstants.NTP_URL, TabLaunchType.FROM_CHROME_UI);
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,9 @@ private void returnResult() {
}
}
if (isFromSettings) {
BraveActivity.getBraveActivity().getActivityTab().reloadIgnoringCache();
if (BraveActivity.getBraveActivity() != null && BraveActivity.getBraveActivity().getActivityTab() != null) {
BraveActivity.getBraveActivity().getActivityTab().reloadIgnoringCache();
}
} else {
Intent intent = new Intent();
setResult(BraveNewTabPageLayout.NTP_WIDGET_STACK_CODE, intent);
Expand Down

0 comments on commit ec30a92

Please sign in to comment.