summaryrefslogtreecommitdiffstats
path: root/java/com/android/dialer/callcomposer/CallComposerActivity.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/callcomposer/CallComposerActivity.java')
-rw-r--r--java/com/android/dialer/callcomposer/CallComposerActivity.java73
1 files changed, 19 insertions, 54 deletions
diff --git a/java/com/android/dialer/callcomposer/CallComposerActivity.java b/java/com/android/dialer/callcomposer/CallComposerActivity.java
index 074fc6de1..bc20c7314 100644
--- a/java/com/android/dialer/callcomposer/CallComposerActivity.java
+++ b/java/com/android/dialer/callcomposer/CallComposerActivity.java
@@ -37,10 +37,8 @@ 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;
@@ -56,6 +54,7 @@ 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;
@@ -86,7 +85,6 @@ public class CallComposerActivity extends AppCompatActivity
implements OnClickListener,
OnPageChangeListener,
CallComposerListener,
- OnLayoutChangeListener,
EnrichedCallManager.StateChangedListener {
public static final String KEY_CONTACT_NAME = "contact_name";
@@ -102,7 +100,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 CallComposerContact contact;
+ private DialerContact contact;
private Long sessionId = Session.NO_SESSION_ID;
private TextView nameView;
@@ -126,10 +124,9 @@ 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, CallComposerContact contact) {
+ public static Intent newIntent(Context context, DialerContact contact) {
Intent intent = new Intent(context, CallComposerActivity.class);
ProtoParsers.put(intent, ARG_CALL_COMPOSER_CONTACT, contact);
return intent;
@@ -140,19 +137,19 @@ public class CallComposerActivity extends AppCompatActivity
super.onCreate(savedInstanceState);
setContentView(R.layout.call_composer_activity);
- 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);
+ 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);
sendAndCall = findViewById(R.id.send_and_call_button);
- sendAndCallText = (TextView) findViewById(R.id.send_and_call_text);
+ sendAndCallText = findViewById(R.id.send_and_call_text);
interpolator = new FastOutSlowInInterpolator();
adapter =
@@ -162,7 +159,6 @@ public class CallComposerActivity extends AppCompatActivity
pager.setAdapter(adapter);
pager.addOnPageChangeListener(this);
- background.addOnLayoutChangeListener(this);
cameraIcon.setOnClickListener(this);
galleryIcon.setOnClickListener(this);
messageIcon.setOnClickListener(this);
@@ -178,11 +174,6 @@ 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(
@@ -264,7 +255,7 @@ public class CallComposerActivity extends AppCompatActivity
} else if (view == sendAndCall) {
sendAndCall();
} else {
- Assert.fail();
+ throw Assert.createIllegalStateFailException("View on click not implemented: " + view);
}
}
@@ -340,11 +331,7 @@ public class CallComposerActivity extends AppCompatActivity
private boolean sessionReady() {
Session session = getEnrichedCallManager().getSession(sessionId);
- if (session == null) {
- return false;
- }
-
- return session.getState() == EnrichedCallManager.STATE_STARTED;
+ return session != null && session.getState() == EnrichedCallManager.STATE_STARTED;
}
private void placeRCSCall(MultimediaData.Builder builder) {
@@ -424,28 +411,6 @@ 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}.
@@ -456,14 +421,14 @@ public class CallComposerActivity extends AppCompatActivity
byte[] bytes =
Base64.decode(intent.getStringExtra(ARG_CALL_COMPOSER_CONTACT_BASE64), Base64.DEFAULT);
try {
- contact = CallComposerContact.parseFrom(bytes);
+ contact = DialerContact.parseFrom(bytes);
} catch (InvalidProtocolBufferException e) {
throw Assert.createAssertionFailException(e.toString());
}
} else {
contact =
ProtoParsers.getTrusted(
- intent, ARG_CALL_COMPOSER_CONTACT, CallComposerContact.getDefaultInstance());
+ intent, ARG_CALL_COMPOSER_CONTACT, DialerContact.getDefaultInstance());
}
updateContactInfo();
}