Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -326,4 +326,23 @@ public void shouldDisableNews() {
mActivityRule.getActivity().preferenceManager.setShouldShowNews(true);
}
}

@Test
public void shouldNavigateToWhatIsHumanWeb() {
onView(withText(R.string.humanweb)).perform(click());
onView(withText(R.string.what_is_humanweb)).perform(click());
WebHelpers.onWebView(withClassName(equalTo(CliqzWebView.class.getName())))
.withTimeout(1, TimeUnit.MINUTES)
.check(WebViewAssertions.webMatches(getCurrentUrl(), containsString("human-web")));
}

@Test
public void shouldNavigateToAboutMyOffrz() {
onView(withText(R.string.settings_general)).perform(click());
onView(withId(android.R.id.content)).perform(swipeUp());
onView(withText(R.string.settings_about_my_offrz)).perform(click());
WebHelpers.onWebView(withClassName(equalTo(CliqzWebView.class.getName())))
.withTimeout(1, TimeUnit.MINUTES)
.check(WebViewAssertions.webMatches(getCurrentUrl(), containsString("cliqz-angebote")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

import com.cliqz.browser.R;
import com.cliqz.browser.app.BrowserApp;
import com.cliqz.browser.main.search.SearchView;
import com.cliqz.browser.telemetry.Telemetry;
import com.cliqz.browser.telemetry.TelemetryKeys;
import com.cliqz.nove.Bus;
Expand Down Expand Up @@ -101,9 +100,6 @@ public class QuickAccessBar extends FrameLayout {
@Inject
Bus bus;

@Inject
SearchView searchView;

public QuickAccessBar(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs,0);
}
Expand Down Expand Up @@ -314,9 +310,7 @@ private void safeBusPost(Object msg) {

private void safeTelemetry(@Nullable String target) {
if (telemetry != null) {
final String view = searchView != null && searchView.isFreshTabVisible() ?
TelemetryKeys.HOME : TelemetryKeys.CARDS;
telemetry.sendQuickAccessBarSignal(TelemetryKeys.CLICK, target, view);
telemetry.sendQuickAccessBarSignal(TelemetryKeys.CLICK, target, TelemetryKeys.HOME);
}
}

Expand Down
54 changes: 18 additions & 36 deletions app/src/main/java/com/cliqz/browser/main/TabFragment2.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
import com.cliqz.utils.FragmentUtilsV4;
import com.cliqz.utils.NoInstanceException;
import com.cliqz.utils.StringUtils;
import com.cliqz.utils.ViewUtils;
import com.google.android.material.appbar.AppBarLayout;
import com.readystatesoftware.systembartint.SystemBarTintManager;

Expand Down Expand Up @@ -127,7 +126,10 @@ public class TabFragment2 extends FragmentWithBus implements LightningView.Light

private static final int KEYBOARD_ANIMATION_DELAY = 200;

private FrameLayout mContainer;

private ControlCenterHelper mControlCenterHelper;

private Unbinder mUnbinder;

@BindView(R.id.statusbar)
Expand All @@ -139,8 +141,8 @@ public class TabFragment2 extends FragmentWithBus implements LightningView.Light
@BindView(R.id.search_edit_text)
AutocompleteEditText searchEditText;

@BindView(R.id.search_view_container)
FrameLayout searchViewContainer;
@BindView(R.id.search_view)
SearchView searchView2;

@BindView(R.id.progress_view)
AnimatedProgressBar progressBar;
Expand Down Expand Up @@ -186,9 +188,6 @@ public class TabFragment2 extends FragmentWithBus implements LightningView.Light
@BindView(R.id.webview_container)
LightningView lightningView;

@Inject
SearchView searchView2;

@Inject
SubscriptionsManager subscriptionsManager;

Expand Down Expand Up @@ -250,9 +249,17 @@ public void onAttach(Context context) {
@NotNull
@Override
public final View onCreateView(@NotNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mContainer = new FrameLayout(container.getContext());
return mContainer;
}

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final int themeResId = getFragmentTheme();
final LayoutInflater inflater = LayoutInflater.from(getActivity());

final Activity activity = Objects.requireNonNull(getActivity());
final MainActivity activity = (MainActivity) Objects.requireNonNull(getActivity());
final Resources.Theme theme = activity.getTheme();
final TypedValue value = new TypedValue();
theme.resolveAttribute(R.attr.colorPrimaryDark, value, true);
Expand All @@ -272,23 +279,15 @@ public final View onCreateView(@NotNull LayoutInflater inflater, ViewGroup conta
localInflater = inflater;
}

final View view = localInflater.inflate(R.layout.fragment_tab, container, false);
final View view = localInflater.inflate(R.layout.fragment_tab, mContainer, true);
if (BuildConfig.IS_NOT_LUMEN) {
final ViewStub stub = view.findViewById(R.id.quick_access_bar_stub);
stub.inflate();
}
return view;
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mUnbinder = ButterKnife.bind(this, view);
searchBar.setSearchEditText(searchEditText);
searchBar.setProgressBar(progressBar);
final MainActivity activity = (MainActivity) getActivity();
final FlavoredActivityComponent component = activity != null ?
BrowserApp.getActivityComponent(activity) : null;
final FlavoredActivityComponent component = BrowserApp.getActivityComponent(activity);
if (component != null) {
component.inject(this);
}
Expand All @@ -309,7 +308,6 @@ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceStat

TabFragmentListener.create(this);
searchView2.setCurrentTabState(tab);
ViewUtils.safelyAddView(searchViewContainer, searchView2);
searchBar.setTrackerCount(mTrackerCount);
if (quickAccessBar != null) {
quickAccessBar.hide();
Expand Down Expand Up @@ -485,7 +483,7 @@ public void onResume() {

void bringSearchToFront() {
lightningView.setVisibility(View.GONE);
searchViewContainer.setVisibility(View.VISIBLE);
searchView2.setVisibility(View.VISIBLE);
disableUrlBarScrolling();
searchView2.refresh();
}
Expand Down Expand Up @@ -704,7 +702,7 @@ public void updateUrl(BrowserEvents.UpdateUrl event) {

private void bringWebViewToFront(Animation animation) {
lightningView.setVisibility(View.VISIBLE);
searchViewContainer.setVisibility(View.INVISIBLE);
searchView2.setVisibility(View.INVISIBLE);
enableUrlBarScrolling();
searchBar.showTitleBar();
searchBar.showProgressBar();
Expand All @@ -724,10 +722,6 @@ private void bringWebViewToFront(Animation animation) {
}
}

LightningView getLightningView() {
return lightningView;
}

private boolean isHttpsUrl(@Nullable String url) {
return url != null && url.startsWith("https://");
}
Expand Down Expand Up @@ -794,18 +788,6 @@ public void openLink(String eventUrl, boolean reset, boolean fromHistory, Animat
if (telemetry != null) {
telemetry.resetNavigationVariables(eventUrl.length());
}

/* final Uri.Builder builder = Uri.parse(eventUrl).buildUpon();
builder.appendQueryParameter(TrampolineConstants.TRAMPOLINE_COMMAND_PARAM_NAME,
TrampolineConstants.TRAMPOLINE_COMMAND_GOTO)
.appendQueryParameter(TrampolineConstants.TRAMPOLINE_QUERY_PARAM_NAME, lastQuery);
if (reset) {
builder.appendQueryParameter(TrampolineConstants.TRAMPOLINE_RESET_PARAM_NAME, "true");
}
if (fromHistory) {
builder.appendQueryParameter(TrampolineConstants.TRAMPOLINE_FROM_HISTORY_PARAM_NAME, "true");
}
final String url = builder.build().toString(); */
final String url = eventUrl;
lightningView.loadUrl(url);
searchBar.setTitle(eventUrl);
Expand Down
8 changes: 1 addition & 7 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/normal_tab_primary_color">
<com.cliqz.browser.main.search.SearchView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/search_view"
android:visibility="invisible" />
</com.cliqz.browser.widget.ReverseFrameLayout>
android:background="@color/normal_tab_primary_color"/>

4 changes: 2 additions & 2 deletions app/src/main/res/layout/fragment_tab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@

</com.google.android.material.appbar.AppBarLayout>

<FrameLayout
android:id="@+id/search_view_container"
<com.cliqz.browser.main.search.SearchView
android:id="@+id/search_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/actionBarSize" />
Expand Down