diff options
author | Tobias Thierer <tobiast@google.com> | 2017-06-09 14:16:05 +0000 |
---|---|---|
committer | Tobias Thierer <tobiast@google.com> | 2017-06-09 14:16:05 +0000 |
commit | cded3beaf28a703e1ef8f71bbc6836e6806c3736 (patch) | |
tree | c1b5e8199b5996fc848e7455d04126b9cdbb3c39 /java/com/android/dialer/callcomposer/CallComposerActivity.java | |
parent | c67d658e7daa453fe9ad9fd1a37f81eaf2048c44 (diff) |
Revert "Update AOSP Dialer source from internal google3 repository at cl/158012278. am: 91ce7d2a47"
This reverts commit c67d658e7daa453fe9ad9fd1a37f81eaf2048c44.
Reason for revert: This CL broke the sailfish-userdebug_javac-all target on master.
Change-Id: I9b54333a654c00154ca84f4ece84bea4f07cc19b
Diffstat (limited to 'java/com/android/dialer/callcomposer/CallComposerActivity.java')
-rw-r--r-- | java/com/android/dialer/callcomposer/CallComposerActivity.java | 73 |
1 files changed, 54 insertions, 19 deletions
diff --git a/java/com/android/dialer/callcomposer/CallComposerActivity.java b/java/com/android/dialer/callcomposer/CallComposerActivity.java index bc20c7314..074fc6de1 100644 --- a/java/com/android/dialer/callcomposer/CallComposerActivity.java +++ b/java/com/android/dialer/callcomposer/CallComposerActivity.java @@ -37,8 +37,10 @@ import android.text.TextUtils; import android.util.Base64; import android.view.View; import android.view.View.OnClickListener; +import android.view.View.OnLayoutChangeListener; import android.view.ViewAnimationUtils; import android.view.ViewGroup; +import android.view.WindowManager.LayoutParams; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; @@ -54,7 +56,6 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.common.UiUtil; import com.android.dialer.common.concurrent.DialerExecutors; import com.android.dialer.constants.Constants; -import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.enrichedcall.EnrichedCallComponent; import com.android.dialer.enrichedcall.EnrichedCallManager; import com.android.dialer.enrichedcall.EnrichedCallManager.State; @@ -85,6 +86,7 @@ public class CallComposerActivity extends AppCompatActivity implements OnClickListener, OnPageChangeListener, CallComposerListener, + OnLayoutChangeListener, EnrichedCallManager.StateChangedListener { public static final String KEY_CONTACT_NAME = "contact_name"; @@ -100,7 +102,7 @@ public class CallComposerActivity extends AppCompatActivity private static final String VIEW_PAGER_STATE_KEY = "view_pager_state_key"; private static final String SESSION_ID_KEY = "session_id_key"; - private DialerContact contact; + private CallComposerContact contact; private Long sessionId = Session.NO_SESSION_ID; private TextView nameView; @@ -124,9 +126,10 @@ public class CallComposerActivity extends AppCompatActivity private boolean shouldAnimateEntrance = true; private boolean inFullscreenMode; private boolean isSendAndCallHidingOrHidden = true; + private boolean layoutChanged; private int currentIndex; - public static Intent newIntent(Context context, DialerContact contact) { + public static Intent newIntent(Context context, CallComposerContact contact) { Intent intent = new Intent(context, CallComposerActivity.class); ProtoParsers.put(intent, ARG_CALL_COMPOSER_CONTACT, contact); return intent; @@ -137,19 +140,19 @@ public class CallComposerActivity extends AppCompatActivity super.onCreate(savedInstanceState); setContentView(R.layout.call_composer_activity); - nameView = findViewById(R.id.contact_name); - numberView = findViewById(R.id.phone_number); - contactPhoto = findViewById(R.id.contact_photo); - cameraIcon = findViewById(R.id.call_composer_camera); - galleryIcon = findViewById(R.id.call_composer_photo); - messageIcon = findViewById(R.id.call_composer_message); - contactContainer = findViewById(R.id.contact_bar); - pager = findViewById(R.id.call_composer_view_pager); - background = findViewById(R.id.background); - windowContainer = findViewById(R.id.call_composer_container); - toolbar = findViewById(R.id.toolbar); + nameView = (TextView) findViewById(R.id.contact_name); + numberView = (TextView) findViewById(R.id.phone_number); + contactPhoto = (QuickContactBadge) findViewById(R.id.contact_photo); + cameraIcon = (ImageView) findViewById(R.id.call_composer_camera); + galleryIcon = (ImageView) findViewById(R.id.call_composer_photo); + messageIcon = (ImageView) findViewById(R.id.call_composer_message); + contactContainer = (RelativeLayout) findViewById(R.id.contact_bar); + pager = (ViewPager) findViewById(R.id.call_composer_view_pager); + background = (FrameLayout) findViewById(R.id.background); + windowContainer = (LinearLayout) findViewById(R.id.call_composer_container); + toolbar = (DialerToolbar) findViewById(R.id.toolbar); sendAndCall = findViewById(R.id.send_and_call_button); - sendAndCallText = findViewById(R.id.send_and_call_text); + sendAndCallText = (TextView) findViewById(R.id.send_and_call_text); interpolator = new FastOutSlowInInterpolator(); adapter = @@ -159,6 +162,7 @@ public class CallComposerActivity extends AppCompatActivity pager.setAdapter(adapter); pager.addOnPageChangeListener(this); + background.addOnLayoutChangeListener(this); cameraIcon.setOnClickListener(this); galleryIcon.setOnClickListener(this); messageIcon.setOnClickListener(this); @@ -174,6 +178,11 @@ public class CallComposerActivity extends AppCompatActivity onPageSelected(currentIndex); } + int adjustMode = + isLandscapeLayout() + ? LayoutParams.SOFT_INPUT_ADJUST_PAN + : LayoutParams.SOFT_INPUT_ADJUST_RESIZE; + getWindow().setSoftInputMode(adjustMode); // Since we can't animate the views until they are ready to be drawn, we use this listener to // track that and animate the call compose UI as soon as it's ready. ViewUtil.doOnPreDraw( @@ -255,7 +264,7 @@ public class CallComposerActivity extends AppCompatActivity } else if (view == sendAndCall) { sendAndCall(); } else { - throw Assert.createIllegalStateFailException("View on click not implemented: " + view); + Assert.fail(); } } @@ -331,7 +340,11 @@ public class CallComposerActivity extends AppCompatActivity private boolean sessionReady() { Session session = getEnrichedCallManager().getSession(sessionId); - return session != null && session.getState() == EnrichedCallManager.STATE_STARTED; + if (session == null) { + return false; + } + + return session.getState() == EnrichedCallManager.STATE_STARTED; } private void placeRCSCall(MultimediaData.Builder builder) { @@ -411,6 +424,28 @@ public class CallComposerActivity extends AppCompatActivity animateSendAndCall(fragment.shouldHide()); } + // To detect when the keyboard changes. + @Override + public void onLayoutChange( + View view, + int left, + int top, + int right, + int bottom, + int oldLeft, + int oldTop, + int oldRight, + int oldBottom) { + // To prevent infinite layout change loops + if (layoutChanged) { + layoutChanged = false; + return; + } + + layoutChanged = true; + showFullscreen(contactContainer.getTop() < 0 || inFullscreenMode); + } + /** * Reads arguments from the fragment arguments and populates the necessary instance variables. * Copied from {@link com.android.contacts.common.dialog.CallSubjectDialog}. @@ -421,14 +456,14 @@ public class CallComposerActivity extends AppCompatActivity byte[] bytes = Base64.decode(intent.getStringExtra(ARG_CALL_COMPOSER_CONTACT_BASE64), Base64.DEFAULT); try { - contact = DialerContact.parseFrom(bytes); + contact = CallComposerContact.parseFrom(bytes); } catch (InvalidProtocolBufferException e) { throw Assert.createAssertionFailException(e.toString()); } } else { contact = ProtoParsers.getTrusted( - intent, ARG_CALL_COMPOSER_CONTACT, DialerContact.getDefaultInstance()); + intent, ARG_CALL_COMPOSER_CONTACT, CallComposerContact.getDefaultInstance()); } updateContactInfo(); } |