Commit c6f9e608 authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

[Android] Interconnect consent bump fragments

This CL connects together ConsentBumpFragment and
ConsentBumpMoreOptionsFragment. It also adds slide_out_left and
slide_in_right animations resources used for the transition between
two fragments.

Bug: 869426
Change-Id: I1ff4f6fc1a3585bdd667bb24d567365a60ec9468
Reviewed-on: https://chromium-review.googlesource.com/1159074Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580487}
parent 1934a2ec
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="50%p"
android:toXDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2018 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:fromXDelta="0"
android:toXDelta="-50%p"
android:duration="@android:integer/config_mediumAnimTime"/>
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="@android:integer/config_mediumAnimTime"/>
</set>
......@@ -5,7 +5,10 @@
package org.chromium.chrome.browser.signin;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.StringRes;
import android.support.v4.app.FragmentTransaction;
import android.view.ViewGroup;
import org.chromium.chrome.R;
......@@ -29,7 +32,14 @@ public class ConsentBumpFragment extends SigninFragmentBase {
@Override
protected void onSigninRefused() {
// TODO(https://crbug.com/869426): Show ConsentBumpMoreOptionsFragment.
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left,
android.R.anim.slide_in_left, android.R.anim.slide_out_right);
// Get the id of the view that contains this fragment and replace the fragment.
@IdRes int containerId = ((ViewGroup) getView().getParent()).getId();
transaction.replace(containerId, new ConsentBumpMoreOptionsFragment());
transaction.addToBackStack(null);
transaction.commit();
}
@Override
......
......@@ -6,10 +6,13 @@ package org.chromium.chrome.browser.signin;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.widget.RadioButtonWithDescription;
......@@ -31,6 +34,13 @@ public class ConsentBumpMoreOptionsFragment extends Fragment {
noChanges.setDescriptionText(getText(R.string.consent_bump_no_changes_description));
RadioButtonWithDescription turnOn = view.findViewById(R.id.consent_bump_turn_on);
turnOn.setDescriptionText(getText(R.string.consent_bump_turn_on_description));
Button button = view.findViewById(R.id.back_button);
button.setOnClickListener(btn -> {
FragmentManager fragmentManager =
ApiCompatibilityUtils.requireNonNull(getFragmentManager());
fragmentManager.popBackStack();
});
return view;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment