summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/callcomposer
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-03-15 14:41:07 -0700
committerEric Erfanian <erfanian@google.com>2017-03-15 16:24:23 -0700
commitd5e47f6da5b08b13ecdfa7f1edc7e12aeb83fab9 (patch)
treeb54abbb51fb7d66e7755a1fbb5db023ff601090b /java/com/android/dialer/callcomposer
parent30436e7e6d3f2c8755a91b2b6222b74d465a9e87 (diff)
Update Dialer source from latest green build.
* Refactor voicemail component * Add new enriched calling components Test: treehugger, manual aosp testing Change-Id: I521a0f86327d4b42e14d93927c7d613044ed5942
Diffstat (limited to 'java/com/android/dialer/callcomposer')
-rw-r--r--java/com/android/dialer/callcomposer/AndroidManifest.xml5
-rw-r--r--java/com/android/dialer/callcomposer/CallComposerActivity.java346
-rw-r--r--java/com/android/dialer/callcomposer/CallComposerFragment.java75
-rw-r--r--java/com/android/dialer/callcomposer/CallComposerPagerAdapter.java4
-rw-r--r--java/com/android/dialer/callcomposer/CameraComposerFragment.java43
-rw-r--r--java/com/android/dialer/callcomposer/GalleryComposerFragment.java44
-rw-r--r--java/com/android/dialer/callcomposer/GalleryGridAdapter.java12
-rw-r--r--java/com/android/dialer/callcomposer/GalleryGridItemData.java35
-rw-r--r--java/com/android/dialer/callcomposer/MessageComposerFragment.java8
-rw-r--r--java/com/android/dialer/callcomposer/camera/ImagePersistTask.java4
-rw-r--r--java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml8
-rw-r--r--java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml7
-rw-r--r--java/com/android/dialer/callcomposer/res/layout/fragment_gallery_composer.xml2
-rw-r--r--java/com/android/dialer/callcomposer/res/layout/fragment_message_composer.xml77
-rw-r--r--java/com/android/dialer/callcomposer/res/values-h260dp/values.xml19
-rw-r--r--java/com/android/dialer/callcomposer/res/values-h480dp/values.xml19
-rw-r--r--java/com/android/dialer/callcomposer/res/values-w360dp/values.xml19
-rw-r--r--java/com/android/dialer/callcomposer/res/values-w500dp/values.xml19
-rw-r--r--java/com/android/dialer/callcomposer/res/values/dimens.xml4
-rw-r--r--java/com/android/dialer/callcomposer/res/values/strings.xml6
-rw-r--r--java/com/android/dialer/callcomposer/res/values/styles.xml11
-rw-r--r--java/com/android/dialer/callcomposer/res/values/values.xml20
22 files changed, 460 insertions, 327 deletions
diff --git a/java/com/android/dialer/callcomposer/AndroidManifest.xml b/java/com/android/dialer/callcomposer/AndroidManifest.xml
index c99f22b90..369db6f4a 100644
--- a/java/com/android/dialer/callcomposer/AndroidManifest.xml
+++ b/java/com/android/dialer/callcomposer/AndroidManifest.xml
@@ -20,9 +20,8 @@
<application>
<activity
android:name="com.android.dialer.callcomposer.CallComposerActivity"
- android:exported="false"
+ android:exported="true"
android:theme="@style/Theme.AppCompat.CallComposer"
- android:windowSoftInputMode="adjustResize"
- android:screenOrientation="portrait"/>
+ android:windowSoftInputMode="adjustPan"/>
</application>
</manifest>
diff --git a/java/com/android/dialer/callcomposer/CallComposerActivity.java b/java/com/android/dialer/callcomposer/CallComposerActivity.java
index eef3d210d..f73563ff8 100644
--- a/java/com/android/dialer/callcomposer/CallComposerActivity.java
+++ b/java/com/android/dialer/callcomposer/CallComposerActivity.java
@@ -21,9 +21,9 @@ import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.animation.ValueAnimator;
-import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Configuration;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -35,6 +35,7 @@ import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v4.view.animation.FastOutSlowInInterpolator;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
+import android.util.Base64;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLayoutChangeListener;
@@ -60,6 +61,7 @@ import com.android.dialer.common.LogUtil;
import com.android.dialer.common.UiUtil;
import com.android.dialer.compat.CompatUtils;
import com.android.dialer.constants.Constants;
+import com.android.dialer.enrichedcall.EnrichedCallComponent;
import com.android.dialer.enrichedcall.EnrichedCallManager;
import com.android.dialer.enrichedcall.EnrichedCallManager.State;
import com.android.dialer.enrichedcall.Session;
@@ -70,6 +72,7 @@ import com.android.dialer.multimedia.MultimediaData;
import com.android.dialer.protos.ProtoParsers;
import com.android.dialer.telecom.TelecomUtil;
import com.android.dialer.util.ViewUtil;
+import com.google.protobuf.nano.InvalidProtocolBufferNanoException;
import java.io.File;
/**
@@ -88,18 +91,18 @@ public class CallComposerActivity extends AppCompatActivity
OnPageChangeListener,
CallComposerListener,
OnLayoutChangeListener,
- AnimatorListener,
EnrichedCallManager.StateChangedListener {
- private static final int VIEW_PAGER_ANIMATION_DURATION_MILLIS = 300;
+ public static final String KEY_CONTACT_NAME = "contact_name";
+
private static final int ENTRANCE_ANIMATION_DURATION_MILLIS = 500;
+ private static final int EXIT_ANIMATION_DURATION_MILLIS = 500;
private static final String ARG_CALL_COMPOSER_CONTACT = "CALL_COMPOSER_CONTACT";
private static final String ENTRANCE_ANIMATION_KEY = "entrance_animation_key";
private static final String CURRENT_INDEX_KEY = "current_index_key";
private static final String VIEW_PAGER_STATE_KEY = "view_pager_state_key";
- private static final String LOCATIONS_KEY = "locations_key";
private static final String SESSION_ID_KEY = "session_id_key";
private CallComposerContact contact;
@@ -111,6 +114,7 @@ public class CallComposerActivity extends AppCompatActivity
private RelativeLayout contactContainer;
private Toolbar toolbar;
private View sendAndCall;
+ private TextView sendAndCallText;
private ImageView cameraIcon;
private ImageView galleryIcon;
@@ -125,13 +129,8 @@ public class CallComposerActivity extends AppCompatActivity
private boolean shouldAnimateEntrance = true;
private boolean inFullscreenMode;
private boolean isSendAndCallHidingOrHidden = true;
- private boolean isAnimatingContactBar;
private boolean layoutChanged;
private int currentIndex;
- private int[] locations;
- private int currentLocation;
-
- @NonNull private EnrichedCallManager enrichedCallManager;
public static Intent newIntent(Context context, CallComposerContact contact) {
Intent intent = new Intent(context, CallComposerActivity.class);
@@ -156,6 +155,7 @@ public class CallComposerActivity extends AppCompatActivity
windowContainer = (LinearLayout) findViewById(R.id.call_composer_container);
toolbar = (Toolbar) findViewById(R.id.toolbar);
sendAndCall = findViewById(R.id.send_and_call_button);
+ sendAndCallText = (TextView) findViewById(R.id.send_and_call_text);
interpolator = new FastOutSlowInInterpolator();
adapter =
@@ -166,14 +166,8 @@ public class CallComposerActivity extends AppCompatActivity
pager.addOnPageChangeListener(this);
setActionBar(toolbar);
- toolbar.setNavigationIcon(R.drawable.quantum_ic_arrow_back_white_24);
- toolbar.setNavigationOnClickListener(
- new OnClickListener() {
- @Override
- public void onClick(View v) {
- finish();
- }
- });
+ toolbar.setNavigationIcon(R.drawable.quantum_ic_close_white_24);
+ toolbar.setNavigationOnClickListener(v -> finish());
background.addOnLayoutChangeListener(this);
cameraIcon.setOnClickListener(this);
@@ -183,20 +177,12 @@ public class CallComposerActivity extends AppCompatActivity
onHandleIntent(getIntent());
- enrichedCallManager = EnrichedCallManager.Accessor.getInstance(getApplication());
if (savedInstanceState != null) {
shouldAnimateEntrance = savedInstanceState.getBoolean(ENTRANCE_ANIMATION_KEY);
- locations = savedInstanceState.getIntArray(LOCATIONS_KEY);
pager.onRestoreInstanceState(savedInstanceState.getParcelable(VIEW_PAGER_STATE_KEY));
currentIndex = savedInstanceState.getInt(CURRENT_INDEX_KEY);
- sessionId = savedInstanceState.getLong(SESSION_ID_KEY);
+ sessionId = savedInstanceState.getLong(SESSION_ID_KEY, Session.NO_SESSION_ID);
onPageSelected(currentIndex);
- } else {
- locations = new int[adapter.getCount()];
- for (int i = 0; i < locations.length; i++) {
- locations[i] = CallComposerFragment.CONTENT_TOP_UNSET;
- }
- sessionId = enrichedCallManager.startCallComposerSession(contact.number);
}
// Since we can't animate the views until they are ready to be drawn, we use this listener to
@@ -204,37 +190,39 @@ public class CallComposerActivity extends AppCompatActivity
ViewUtil.doOnPreDraw(
windowContainer,
false,
- new Runnable() {
- @Override
- public void run() {
- runEntranceAnimation();
- }
+ () -> {
+ showFullscreen(inFullscreenMode);
+ runEntranceAnimation();
});
setMediaIconSelected(0);
-
- // This activity is started using startActivityForResult. By default, mark this as succeeded
- // and flip this to RESULT_CANCELED if something goes wrong.
- setResult(RESULT_OK);
-
- if (sessionId == Session.NO_SESSION_ID) {
- LogUtil.w("CallComposerActivity.onCreate", "failed to create call composer session");
- setResult(RESULT_CANCELED);
- finish();
- }
}
@Override
protected void onResume() {
super.onResume();
- enrichedCallManager.registerStateChangedListener(this);
+ getEnrichedCallManager().registerStateChangedListener(this);
+ if (sessionId == Session.NO_SESSION_ID) {
+ LogUtil.i("CallComposerActivity.onResume", "creating new session");
+ sessionId = getEnrichedCallManager().startCallComposerSession(contact.number);
+ } else if (getEnrichedCallManager().getSession(sessionId) == null) {
+ LogUtil.i(
+ "CallComposerActivity.onResume", "session closed while activity paused, creating new");
+ sessionId = getEnrichedCallManager().startCallComposerSession(contact.number);
+ } else {
+ LogUtil.i("CallComposerActivity.onResume", "session still open, using old");
+ }
+ if (sessionId == Session.NO_SESSION_ID) {
+ LogUtil.w("CallComposerActivity.onResume", "failed to create call composer session");
+ setFailedResultAndFinish();
+ }
refreshUiForCallComposerState();
}
@Override
protected void onPause() {
super.onPause();
- enrichedCallManager.unregisterStateChangedListener(this);
+ getEnrichedCallManager().unregisterStateChangedListener(this);
}
@Override
@@ -243,7 +231,7 @@ public class CallComposerActivity extends AppCompatActivity
}
private void refreshUiForCallComposerState() {
- Session session = enrichedCallManager.getSession(sessionId);
+ Session session = getEnrichedCallManager().getSession(sessionId);
if (session == null) {
return;
}
@@ -256,8 +244,7 @@ public class CallComposerActivity extends AppCompatActivity
if (state == EnrichedCallManager.STATE_START_FAILED
|| state == EnrichedCallManager.STATE_CLOSED) {
- setResult(RESULT_CANCELED);
- finish();
+ setFailedResultAndFinish();
}
}
@@ -293,7 +280,7 @@ public class CallComposerActivity extends AppCompatActivity
if (fragment instanceof MessageComposerFragment) {
MessageComposerFragment messageComposerFragment = (MessageComposerFragment) fragment;
- builder.setSubject(messageComposerFragment.getMessage());
+ builder.setText(messageComposerFragment.getMessage());
placeRCSCall(builder);
}
if (fragment instanceof GalleryComposerFragment) {
@@ -351,7 +338,7 @@ public class CallComposerActivity extends AppCompatActivity
}
private boolean sessionReady() {
- Session session = enrichedCallManager.getSession(sessionId);
+ Session session = getEnrichedCallManager().getSession(sessionId);
if (session == null) {
return false;
}
@@ -362,9 +349,10 @@ public class CallComposerActivity extends AppCompatActivity
private void placeRCSCall(MultimediaData.Builder builder) {
LogUtil.i("CallComposerActivity.placeRCSCall", "placing enriched call");
Logger.get(this).logImpression(DialerImpression.Type.CALL_COMPOSER_ACTIVITY_PLACE_RCS_CALL);
- enrichedCallManager.sendCallComposerData(sessionId, builder.build());
+ getEnrichedCallManager().sendCallComposerData(sessionId, builder.build());
TelecomUtil.placeCall(
this, new CallIntentBuilder(contact.number, CallInitiationType.Type.CALL_COMPOSER).build());
+ setResult(RESULT_OK);
finish();
}
@@ -379,24 +367,26 @@ public class CallComposerActivity extends AppCompatActivity
/** Animates {@code contactContainer} to align with content inside viewpager. */
@Override
public void onPageSelected(int position) {
+ if (position == CallComposerPagerAdapter.INDEX_MESSAGE) {
+ sendAndCallText.setText(R.string.send_and_call);
+ } else {
+ sendAndCallText.setText(R.string.share_and_call);
+ }
if (currentIndex == CallComposerPagerAdapter.INDEX_MESSAGE) {
UiUtil.hideKeyboardFrom(this, windowContainer);
- } else if (position == CallComposerPagerAdapter.INDEX_MESSAGE && inFullscreenMode) {
+ } else if (position == CallComposerPagerAdapter.INDEX_MESSAGE
+ && inFullscreenMode
+ && !isLandscapeLayout()) {
UiUtil.openKeyboardFrom(this, windowContainer);
}
currentIndex = position;
CallComposerFragment fragment = (CallComposerFragment) adapter.instantiateItem(pager, position);
- locations[currentIndex] = fragment.getContentTopPx();
- animateContactContainer(locations[currentIndex]);
animateSendAndCall(fragment.shouldHide());
setMediaIconSelected(position);
}
@Override
- public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
- CallComposerFragment fragment = (CallComposerFragment) adapter.instantiateItem(pager, position);
- animateContactContainer(fragment.getContentTopPx());
- }
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {}
@Override
public void onPageScrollStateChanged(int state) {}
@@ -407,13 +397,19 @@ public class CallComposerActivity extends AppCompatActivity
outState.putParcelable(VIEW_PAGER_STATE_KEY, pager.onSaveInstanceState());
outState.putBoolean(ENTRANCE_ANIMATION_KEY, shouldAnimateEntrance);
outState.putInt(CURRENT_INDEX_KEY, currentIndex);
- outState.putIntArray(LOCATIONS_KEY, locations);
outState.putLong(SESSION_ID_KEY, sessionId);
}
@Override
public void onBackPressed() {
- runExitAnimation();
+ if (!isSendAndCallHidingOrHidden) {
+ ((CallComposerFragment) adapter.instantiateItem(pager, currentIndex)).clearComposer();
+ } else {
+ // Unregister first to avoid receiving a callback when the session closes
+ getEnrichedCallManager().unregisterStateChangedListener(this);
+ getEnrichedCallManager().endCallComposerSession(sessionId);
+ runExitAnimation();
+ }
}
@Override
@@ -445,29 +441,9 @@ public class CallComposerActivity extends AppCompatActivity
}
layoutChanged = true;
- if (pager.getTop() < 0 || inFullscreenMode) {
- ViewGroup.LayoutParams layoutParams = pager.getLayoutParams();
- layoutParams.height = background.getHeight() - toolbar.getHeight() - messageIcon.getHeight();
- pager.setLayoutParams(layoutParams);
- }
- }
-
- @Override
- public void onAnimationStart(Animator animation) {
- isAnimatingContactBar = true;
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- isAnimatingContactBar = false;
+ showFullscreen(contactContainer.getTop() < 0 || inFullscreenMode);
}
- @Override
- public void onAnimationCancel(Animator animation) {}
-
- @Override
- public void onAnimationRepeat(Animator animation) {}
-
/**
* Reads arguments from the fragment arguments and populates the necessary instance variables.
* Copied from {@link com.android.contacts.common.dialog.CallSubjectDialog}.
@@ -477,12 +453,26 @@ public class CallComposerActivity extends AppCompatActivity
if (arguments == null) {
throw new RuntimeException("CallComposerActivity.onHandleIntent, Arguments cannot be null.");
}
- contact =
- ProtoParsers.getFromInstanceState(
- arguments, ARG_CALL_COMPOSER_CONTACT, new CallComposerContact());
+ if (arguments.get(ARG_CALL_COMPOSER_CONTACT) instanceof String) {
+ byte[] bytes = Base64.decode(arguments.getString(ARG_CALL_COMPOSER_CONTACT), Base64.DEFAULT);
+ try {
+ contact = CallComposerContact.parseFrom(bytes);
+ } catch (InvalidProtocolBufferNanoException e) {
+ Assert.fail(e.toString());
+ }
+ } else {
+ contact =
+ ProtoParsers.getFromInstanceState(
+ arguments, ARG_CALL_COMPOSER_CONTACT, new CallComposerContact());
+ }
updateContactInfo();
}
+ @Override
+ public boolean isLandscapeLayout() {
+ return getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
+ }
+
/**
* Populates the contact info fields based on the current contact information. Copied from {@link
* com.android.contacts.common.dialog.CallSubjectDialog}.
@@ -552,25 +542,6 @@ public class CallComposerActivity extends AppCompatActivity
}
}
- private void animateContactContainer(int toY) {
- if (toY == CallComposerFragment.CONTENT_TOP_UNSET
- || toY == currentLocation
- || (toY != locations[currentIndex]
- && locations[currentIndex] != CallComposerFragment.CONTENT_TOP_UNSET)
- || isAnimatingContactBar
- || inFullscreenMode) {
- return;
- }
- currentLocation = toY;
- contactContainer
- .animate()
- .translationY(toY)
- .setInterpolator(interpolator)
- .setDuration(VIEW_PAGER_ANIMATION_DURATION_MILLIS)
- .setListener(this)
- .start();
- }
-
/** Animates compose UI into view */
private void runEntranceAnimation() {
if (!shouldAnimateEntrance) {
@@ -578,84 +549,90 @@ public class CallComposerActivity extends AppCompatActivity
}
shouldAnimateEntrance = false;
- int colorFrom = ContextCompat.getColor(this, android.R.color.transparent);
- int colorTo = ContextCompat.getColor(this, R.color.call_composer_background_color);
- ValueAnimator backgroundAnimation =
- ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
- backgroundAnimation.setInterpolator(interpolator);
- backgroundAnimation.setDuration(ENTRANCE_ANIMATION_DURATION_MILLIS); // milliseconds
- backgroundAnimation.addUpdateListener(
- new AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animator) {
- background.setBackgroundColor((int) animator.getAnimatedValue());
- }
- });
-
- ValueAnimator contentAnimation = ValueAnimator.ofFloat(windowContainer.getHeight(), 0);
+ int value = isLandscapeLayout() ? windowContainer.getWidth() : windowContainer.getHeight();
+ ValueAnimator contentAnimation = ValueAnimator.ofFloat(value, 0);
contentAnimation.setInterpolator(interpolator);
contentAnimation.setDuration(ENTRANCE_ANIMATION_DURATION_MILLIS);
contentAnimation.addUpdateListener(
- new AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
+ animation -> {
+ if (isLandscapeLayout()) {
+ windowContainer.setX((Float) animation.getAnimatedValue());
+ } else {
windowContainer.setY((Float) animation.getAnimatedValue());
}
});
- AnimatorSet set = new AnimatorSet();
- set.play(contentAnimation).with(backgroundAnimation);
- set.start();
+ if (!isLandscapeLayout()) {
+ int colorFrom = ContextCompat.getColor(this, android.R.color.transparent);
+ int colorTo = ContextCompat.getColor(this, R.color.call_composer_background_color);
+ ValueAnimator backgroundAnimation =
+ ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
+ backgroundAnimation.setInterpolator(interpolator);
+ backgroundAnimation.setDuration(ENTRANCE_ANIMATION_DURATION_MILLIS); // milliseconds
+ backgroundAnimation.addUpdateListener(
+ animator -> background.setBackgroundColor((int) animator.getAnimatedValue()));
+
+ AnimatorSet set = new AnimatorSet();
+ set.play(contentAnimation).with(backgroundAnimation);
+ set.start();
+ } else {
+ contentAnimation.start();
+ }
}
/** Animates compose UI out of view and ends the activity. */
private void runExitAnimation() {
- int colorTo = ContextCompat.getColor(this, android.R.color.transparent);
- int colorFrom = ContextCompat.getColor(this, R.color.call_composer_background_color);
- ValueAnimator backgroundAnimation =
- ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
- backgroundAnimation.setInterpolator(interpolator);
- backgroundAnimation.setDuration(ENTRANCE_ANIMATION_DURATION_MILLIS); // milliseconds
- backgroundAnimation.addUpdateListener(
- new AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animator) {
- background.setBackgroundColor((int) animator.getAnimatedValue());
- }
- });
-
- ValueAnimator contentAnimation = ValueAnimator.ofFloat(0, windowContainer.getHeight());
+ int value = isLandscapeLayout() ? windowContainer.getWidth() : windowContainer.getHeight();
+ ValueAnimator contentAnimation = ValueAnimator.ofFloat(0, value);
contentAnimation.setInterpolator(interpolator);
- contentAnimation.setDuration(ENTRANCE_ANIMATION_DURATION_MILLIS);
+ contentAnimation.setDuration(EXIT_ANIMATION_DURATION_MILLIS);
contentAnimation.addUpdateListener(
- new AnimatorUpdateListener() {
- @Override
- public void onAnimationUpdate(ValueAnimator animation) {
+ animation -> {
+ if (isLandscapeLayout()) {
+ windowContainer.setX((Float) animation.getAnimatedValue());
+ } else {
windowContainer.setY((Float) animation.getAnimatedValue());
- if (animation.getAnimatedFraction() > .75) {
- finish();
- }
+ }
+ if (animation.getAnimatedFraction() > .95) {
+ finish();
}
});
- AnimatorSet set = new AnimatorSet();
- set.play(contentAnimation).with(backgroundAnimation);
- set.start();
+
+ if (!isLandscapeLayout()) {
+ int colorTo = ContextCompat.getColor(this, android.R.color.transparent);
+ int colorFrom = ContextCompat.getColor(this, R.color.call_composer_background_color);
+ ValueAnimator backgroundAnimation =
+ ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
+ backgroundAnimation.setInterpolator(interpolator);
+ backgroundAnimation.setDuration(EXIT_ANIMATION_DURATION_MILLIS);
+ backgroundAnimation.addUpdateListener(
+ animator -> background.setBackgroundColor((int) animator.getAnimatedValue()));
+
+ AnimatorSet set = new AnimatorSet();
+ set.play(contentAnimation).with(backgroundAnimation);
+ set.start();
+ } else {
+ contentAnimation.start();
+ }
}
@Override
- public void showFullscreen(boolean show) {
- if (inFullscreenMode == show) {
- return;
- }
- inFullscreenMode = show;
- toolbar.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
- contactContainer.setVisibility(show ? View.GONE : View.VISIBLE);
+ public void showFullscreen(boolean fullscreen) {
+ inFullscreenMode = fullscreen;
ViewGroup.LayoutParams layoutParams = pager.getLayoutParams();
- if (show) {
+ if (isLandscapeLayout()) {
+ layoutParams.height = background.getHeight() - messageIcon.getHeight();
+ toolbar.setVisibility(View.INVISIBLE);
+ contactContainer.setVisibility(View.GONE);
+ } else if (fullscreen || getResources().getBoolean(R.bool.show_toolbar)) {
layoutParams.height = background.getHeight() - toolbar.getHeight() - messageIcon.getHeight();
+ toolbar.setVisibility(View.VISIBLE);
+ contactContainer.setVisibility(View.GONE);
} else {
layoutParams.height =
getResources().getDimensionPixelSize(R.dimen.call_composer_view_pager_height);
+ toolbar.setVisibility(View.INVISIBLE);
+ contactContainer.setVisibility(View.VISIBLE);
}
pager.setLayoutParams(layoutParams);
}
@@ -686,35 +663,32 @@ public class CallComposerActivity extends AppCompatActivity
ViewUtil.doOnPreDraw(
sendAndCall,
true,
- new Runnable() {
- @Override
- public void run() {
- Animator animator =
- ViewAnimationUtils.createCircularReveal(
- sendAndCall, centerX, centerY, startRadius, endRadius);
- animator.addListener(
- new AnimatorListener() {
- @Override
- public void onAnimationStart(Animator animation) {
- isSendAndCallHidingOrHidden = shouldHide;
- sendAndCall.setVisibility(View.VISIBLE);
- }
-
- @Override
- public void onAnimationEnd(Animator animation) {
- if (isSendAndCallHidingOrHidden) {
- sendAndCall.setVisibility(View.INVISIBLE);
- }
+ () -> {
+ Animator animator =
+ ViewAnimationUtils.createCircularReveal(
+ sendAndCall, centerX, centerY, startRadius, endRadius);
+ animator.addListener(
+ new AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ isSendAndCallHidingOrHidden = shouldHide;
+ sendAndCall.setVisibility(View.VISIBLE);
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ if (isSendAndCallHidingOrHidden) {
+ sendAndCall.setVisibility(View.INVISIBLE);
}
+ }
- @Override
- public void onAnimationCancel(Animator animation) {}
+ @Override
+ public void onAnimationCancel(Animator animation) {}
- @Override
- public void onAnimationRepeat(Animator animation) {}
- });
- animator.start();
- }
+ @Override
+ public void onAnimationRepeat(Animator animation) {}
+ });
+ animator.start();
});
}
}
@@ -725,4 +699,14 @@ public class CallComposerActivity extends AppCompatActivity
galleryIcon.setAlpha(position == CallComposerPagerAdapter.INDEX_GALLERY ? 1 : alpha);
messageIcon.setAlpha(position == CallComposerPagerAdapter.INDEX_MESSAGE ? 1 : alpha);
}
+
+ private void setFailedResultAndFinish() {
+ setResult(RESULT_FIRST_USER, new Intent().putExtra(KEY_CONTACT_NAME, contact.nameOrNumber));
+ finish();
+ }
+
+ @NonNull
+ private EnrichedCallManager getEnrichedCallManager() {
+ return EnrichedCallComponent.get(this).getEnrichedCallManager();
+ }
}
diff --git a/java/com/android/dialer/callcomposer/CallComposerFragment.java b/java/com/android/dialer/callcomposer/CallComposerFragment.java
index d6f944955..ee1eb462a 100644
--- a/java/com/android/dialer/callcomposer/CallComposerFragment.java
+++ b/java/com/android/dialer/callcomposer/CallComposerFragment.java
@@ -17,13 +17,8 @@
package com.android.dialer.callcomposer;
import android.content.Context;
-import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import com.android.dialer.common.Assert;
import com.android.dialer.common.FragmentUtils;
import com.android.dialer.common.LogUtil;
@@ -34,26 +29,10 @@ public abstract class CallComposerFragment extends Fragment {
protected static final int CAMERA_PERMISSION = 1;
protected static final int STORAGE_PERMISSION = 2;
- private static final String LOCATION_KEY = "location_key";
- public static final int CONTENT_TOP_UNSET = Integer.MAX_VALUE;
-
- private View topView;
- private int contentTopPx = CONTENT_TOP_UNSET;
- private CallComposerListener testListener;
-
- @Nullable
- @Override
- public View onCreateView(
- LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {
- View view = super.onCreateView(layoutInflater, viewGroup, bundle);
- Assert.isNotNull(topView);
- return view;
- }
-
@Override
public void onAttach(Context context) {
super.onAttach(context);
- if (!(context instanceof CallComposerListener) && testListener == null) {
+ if (FragmentUtils.getParent(this, CallComposerListener.class) == null) {
LogUtil.e(
"CallComposerFragment.onAttach",
"Container activity must implement CallComposerListener.");
@@ -61,56 +40,15 @@ public abstract class CallComposerFragment extends Fragment {
}
}
- /** Call this method to declare which view is located at the top of the fragment's layout. */
- public void setTopView(View view) {
- topView = view;
- // For each fragment that extends CallComposerFragment, the heights may vary and since
- // ViewPagers cannot have their height set to wrap_content, we have to adjust the top of our
- // container to match the top of the fragment. This listener populates {@code contentTopPx} as
- // it's available.
- topView
- .getViewTreeObserver()
- .addOnGlobalLayoutListener(
- new OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- topView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
- contentTopPx = topView.getTop();
- }
- });
- }
-
- public int getContentTopPx() {
- return contentTopPx;
- }
-
- public void setParentForTesting(CallComposerListener listener) {
- testListener = listener;
- }
-
+ @Nullable
public CallComposerListener getListener() {
- if (testListener != null) {
- return testListener;
- }
- return FragmentUtils.getParentUnsafe(this, CallComposerListener.class);
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- outState.putInt(LOCATION_KEY, contentTopPx);
- }
-
- @Override
- public void onViewStateRestored(Bundle savedInstanceState) {
- super.onViewStateRestored(savedInstanceState);
- if (savedInstanceState != null) {
- contentTopPx = savedInstanceState.getInt(LOCATION_KEY);
- }
+ return FragmentUtils.getParent(this, CallComposerListener.class);
}
public abstract boolean shouldHide();
+ public abstract void clearComposer();
+
/** Interface used to listen to CallComposeFragments */
public interface CallComposerListener {
/** Let the listener know when a call is ready to be composed. */
@@ -121,5 +59,8 @@ public abstract class CallComposerFragment extends Fragment {
/** True is the listener is in fullscreen. */
boolean isFullscreen();
+
+ /** True if the layout is in landscape mode. */
+ boolean isLandscapeLayout();
}
}
diff --git a/java/com/android/dialer/callcomposer/CallComposerPagerAdapter.java b/java/com/android/dialer/callcomposer/CallComposerPagerAdapter.java
index 4d4058a0a..edf980ee9 100644
--- a/java/com/android/dialer/callcomposer/CallComposerPagerAdapter.java
+++ b/java/com/android/dialer/callcomposer/CallComposerPagerAdapter.java
@@ -18,11 +18,11 @@ package com.android.dialer.callcomposer;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentStatePagerAdapter;
+import android.support.v4.app.FragmentPagerAdapter;
import com.android.dialer.common.Assert;
/** ViewPager adapter for call compose UI. */
-public class CallComposerPagerAdapter extends FragmentStatePagerAdapter {
+public class CallComposerPagerAdapter extends FragmentPagerAdapter {
public static final int INDEX_CAMERA = 0;
public static final int INDEX_GALLERY = 1;
diff --git a/java/com/android/dialer/callcomposer/CameraComposerFragment.java b/java/com/android/dialer/callcomposer/CameraComposerFragment.java
index f2d0a94a7..583fb5446 100644
--- a/java/com/android/dialer/callcomposer/CameraComposerFragment.java
+++ b/java/com/android/dialer/callcomposer/CameraComposerFragment.java
@@ -56,6 +56,9 @@ import com.android.dialer.util.PermissionsUtil;
public class CameraComposerFragment extends CallComposerFragment
implements CameraManagerListener, OnClickListener, CameraManager.MediaCallback {
+ private static final String CAMERA_DIRECTION_KEY = "camera_direction";
+ private static final String CAMERA_URI_KEY = "camera_key";
+
private View permissionView;
private ImageButton exitFullscreen;
private ImageButton fullscreen;
@@ -68,11 +71,13 @@ public class CameraComposerFragment extends CallComposerFragment
private View allowPermission;
private CameraPreviewHost preview;
private ProgressBar loading;
+ private ImageView previewImageView;
private Uri cameraUri;
private boolean processingUri;
private String[] permissions = new String[] {Manifest.permission.CAMERA};
private CameraUriCallback uriCallback;
+ private int cameraDirection = CameraInfo.CAMERA_FACING_BACK;
public static CameraComposerFragment newInstance() {
return new CameraComposerFragment();
@@ -94,6 +99,7 @@ public class CameraComposerFragment extends CallComposerFragment
cancel = (ImageButton) cameraView.findViewById(R.id.camera_cancel_button);
focus = (RenderOverlay) cameraView.findViewById(R.id.focus_visual);
preview = (CameraPreviewHost) cameraView.findViewById(R.id.camera_preview);
+ previewImageView = (ImageView) root.findViewById(R.id.preview_image_view);
exitFullscreen.setOnClickListener(this);
fullscreen.setOnClickListener(this);
@@ -115,10 +121,12 @@ public class CameraComposerFragment extends CallComposerFragment
ContextCompat.getColor(getContext(), R.color.dialer_theme_color));
permissionView.setVisibility(View.VISIBLE);
} else {
+ if (bundle != null) {
+ cameraDirection = bundle.getInt(CAMERA_DIRECTION_KEY);
+ cameraUri = bundle.getParcelable(CAMERA_URI_KEY);
+ }
setupCamera();
}
-
- setTopView(cameraView);
return root;
}
@@ -126,8 +134,8 @@ public class CameraComposerFragment extends CallComposerFragment
CameraManager.get().setListener(this);
preview.setShown();
CameraManager.get().setRenderOverlay(focus);
- CameraManager.get().selectCamera(CameraInfo.CAMERA_FACING_BACK);
- setCameraUri(null);
+ CameraManager.get().selectCamera(cameraDirection);
+ setCameraUri(cameraUri);
}
@Override
@@ -146,10 +154,16 @@ public class CameraComposerFragment extends CallComposerFragment
}
@Override
+ public void clearComposer() {
+ processingUri = false;
+ setCameraUri(null);
+ }
+
+ @Override
public void onClick(View view) {
if (view == capture) {
float heightPercent = 1;
- if (!getListener().isFullscreen()) {
+ if (!getListener().isFullscreen() && !getListener().isLandscapeLayout()) {
heightPercent = Math.min((float) cameraView.getHeight() / preview.getView().getHeight(), 1);
}
@@ -162,8 +176,7 @@ public class CameraComposerFragment extends CallComposerFragment
((Animatable) swapCamera.getDrawable()).start();
CameraManager.get().swapCamera();
} else if (view == cancel) {
- processingUri = false;
- setCameraUri(null);
+ clearComposer();
} else if (view == exitFullscreen) {
getListener().showFullscreen(false);
fullscreen.setVisibility(View.VISIBLE);
@@ -314,6 +327,13 @@ public class CameraComposerFragment extends CallComposerFragment
boolean isCameraAvailable = CameraManager.get().isCameraAvailable();
boolean uriReadyOrProcessing = cameraUri != null || processingUri;
+ if (cameraUri != null) {
+ previewImageView.setImageURI(cameraUri);
+ previewImageView.setVisibility(View.VISIBLE);
+ } else {
+ previewImageView.setVisibility(View.GONE);
+ }
+
if (cameraUri == null && isCameraAvailable) {
CameraManager.get().resetPreview();
cancel.setVisibility(View.GONE);
@@ -328,7 +348,7 @@ public class CameraComposerFragment extends CallComposerFragment
capture.setVisibility(uriReadyOrProcessing ? View.GONE : View.VISIBLE);
cancel.setVisibility(uriReadyOrProcessing ? View.VISIBLE : View.GONE);
- if (uriReadyOrProcessing) {
+ if (uriReadyOrProcessing || getListener().isLandscapeLayout()) {
fullscreen.setVisibility(View.GONE);
exitFullscreen.setVisibility(View.GONE);
} else if (getListener().isFullscreen()) {
@@ -344,6 +364,13 @@ public class CameraComposerFragment extends CallComposerFragment
}
@Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putInt(CAMERA_DIRECTION_KEY, CameraManager.get().getCameraInfo().facing);
+ outState.putParcelable(CAMERA_URI_KEY, cameraUri);
+ }
+
+ @Override
public void onRequestPermissionsResult(
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (permissions.length > 0 && permissions[0].equals(this.permissions[0])) {
diff --git a/java/com/android/dialer/callcomposer/GalleryComposerFragment.java b/java/com/android/dialer/callcomposer/GalleryComposerFragment.java
index 623127945..b53d6a9d6 100644
--- a/java/com/android/dialer/callcomposer/GalleryComposerFragment.java
+++ b/java/com/android/dialer/callcomposer/GalleryComposerFragment.java
@@ -24,6 +24,7 @@ import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
+import android.os.Parcelable;
import android.provider.Settings;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@@ -45,11 +46,17 @@ import com.android.dialer.logging.Logger;
import com.android.dialer.logging.nano.DialerImpression;
import com.android.dialer.util.PermissionsUtil;
import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
/** Fragment used to compose call with image from the user's gallery. */
public class GalleryComposerFragment extends CallComposerFragment
implements LoaderCallbacks<Cursor>, OnClickListener {
+ private static final String SELECTED_DATA_KEY = "selected_data";
+ private static final String IS_COPY_KEY = "is_copy";
+ private static final String INSERTED_IMAGES_KEY = "inserted_images";
+
private static final int RESULT_LOAD_IMAGE = 1;
private static final int RESULT_OPEN_SETTINGS = 2;
@@ -62,6 +69,7 @@ public class GalleryComposerFragment extends CallComposerFragment
private CursorLoader cursorLoader;
private GalleryGridItemData selectedData = null;
private boolean selectedDataIsCopy;
+ private List<GalleryGridItemData> insertedImages = new ArrayList<>();
public static GalleryComposerFragment newInstance() {
return new GalleryComposerFragment();
@@ -89,10 +97,13 @@ public class GalleryComposerFragment extends CallComposerFragment
ContextCompat.getColor(getContext(), R.color.dialer_theme_color));
permissionView.setVisibility(View.VISIBLE);
} else {
+ if (bundle != null) {
+ selectedData = bundle.getParcelable(SELECTED_DATA_KEY);
+ selectedDataIsCopy = bundle.getBoolean(IS_COPY_KEY);
+ insertedImages = bundle.getParcelableArrayList(INSERTED_IMAGES_KEY);
+ }
setupGallery();
}
-
- setTopView(galleryGridView);
return view;
}
@@ -110,6 +121,10 @@ public class GalleryComposerFragment extends CallComposerFragment
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
adapter.swapCursor(cursor);
+ if (insertedImages != null && !insertedImages.isEmpty()) {
+ adapter.insertEntries(insertedImages);
+ }
+ setSelected(selectedData, selectedDataIsCopy);
}
@Override
@@ -147,7 +162,7 @@ public class GalleryComposerFragment extends CallComposerFragment
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(intent, RESULT_LOAD_IMAGE);
} else if (itemView.getData().equals(selectedData)) {
- setSelected(null, false);
+ clearComposer();
} else {
setSelected(new GalleryGridItemData(itemView.getData()), false);
}
@@ -179,7 +194,10 @@ public class GalleryComposerFragment extends CallComposerFragment
selectedData = data;
selectedDataIsCopy = isCopy;
adapter.setSelected(selectedData);
- getListener().composeCall(this);
+ CallComposerListener listener = getListener();
+ if (listener != null) {
+ getListener().composeCall(this);
+ }
}
@Override
@@ -190,6 +208,20 @@ public class GalleryComposerFragment extends CallComposerFragment
}
@Override
+ public void clearComposer() {
+ setSelected(null, false);
+ }
+
+ @Override
+ public void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ outState.putParcelable(SELECTED_DATA_KEY, selectedData);
+ outState.putBoolean(IS_COPY_KEY, selectedDataIsCopy);
+ outState.putParcelableArrayList(
+ INSERTED_IMAGES_KEY, (ArrayList<? extends Parcelable>) insertedImages);
+ }
+
+ @Override
public void onRequestPermissionsResult(
int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (permissions.length > 0 && permissions[0].equals(this.permissions[0])) {
@@ -238,7 +270,9 @@ public class GalleryComposerFragment extends CallComposerFragment
new Callback() {
@Override
public void onCopySuccessful(File file, String mimeType) {
- setSelected(adapter.insertEntry(file.getAbsolutePath(), mimeType), true);
+ GalleryGridItemData data = adapter.insertEntry(file.getAbsolutePath(), mimeType);
+ insertedImages.add(0, data);
+ setSelected(data, true);
}
@Override
diff --git a/java/com/android/dialer/callcomposer/GalleryGridAdapter.java b/java/com/android/dialer/callcomposer/GalleryGridAdapter.java
index 0a7fd769b..84257b2af 100644
--- a/java/com/android/dialer/callcomposer/GalleryGridAdapter.java
+++ b/java/com/android/dialer/callcomposer/GalleryGridAdapter.java
@@ -104,6 +104,18 @@ public class GalleryGridAdapter extends CursorAdapter {
}
}
+ public void insertEntries(@NonNull List<GalleryGridItemData> entries) {
+ Assert.checkArgument(entries.size() != 0);
+ LogUtil.i("GalleryGridAdapter.insertRows", "inserting %d rows", entries.size());
+ MatrixCursor extraRow = new MatrixCursor(GalleryGridItemData.IMAGE_PROJECTION);
+ for (GalleryGridItemData entry : entries) {
+ extraRow.addRow(new Object[] {0L, entry.getFilePath(), entry.getMimeType(), ""});
+ }
+ extraRow.moveToFirst();
+ Cursor extendedCursor = new MergeCursor(new Cursor[] {extraRow, getCursor()});
+ swapCursor(extendedCursor);
+ }
+
public GalleryGridItemData insertEntry(String filePath, String mimeType) {
LogUtil.i("GalleryGridAdapter.insertRow", mimeType + " " + filePath);
diff --git a/java/com/android/dialer/callcomposer/GalleryGridItemData.java b/java/com/android/dialer/callcomposer/GalleryGridItemData.java
index 402c6ce6d..43db96dd5 100644
--- a/java/com/android/dialer/callcomposer/GalleryGridItemData.java
+++ b/java/com/android/dialer/callcomposer/GalleryGridItemData.java
@@ -18,6 +18,8 @@ package com.android.dialer.callcomposer;
import android.database.Cursor;
import android.net.Uri;
+import android.os.Parcel;
+import android.os.Parcelable;
import android.provider.MediaStore.Images.Media;
import android.support.annotation.Nullable;
import android.text.TextUtils;
@@ -26,7 +28,7 @@ import java.io.File;
import java.util.Objects;
/** Provides data for GalleryGridItemView */
-public final class GalleryGridItemData {
+public final class GalleryGridItemData implements Parcelable {
public static final String[] IMAGE_PROJECTION =
new String[] {Media._ID, Media.DATA, Media.MIME_TYPE, Media.DATE_MODIFIED};
@@ -88,4 +90,35 @@ public final class GalleryGridItemData {
public int hashCode() {
return Objects.hash(filePath, mimeType, dateModifiedSeconds);
}
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeString(filePath);
+ dest.writeString(mimeType);
+ dest.writeLong(dateModifiedSeconds);
+ }
+
+ public static final Creator<GalleryGridItemData> CREATOR =
+ new Creator<GalleryGridItemData>() {
+ @Override
+ public GalleryGridItemData createFromParcel(Parcel in) {
+ return new GalleryGridItemData(in);
+ }
+
+ @Override
+ public GalleryGridItemData[] newArray(int size) {
+ return new GalleryGridItemData[size];
+ }
+ };
+
+ private GalleryGridItemData(Parcel in) {
+ filePath = in.readString();
+ mimeType = in.readString();
+ dateModifiedSeconds = in.readLong();
+ }
}
diff --git a/java/com/android/dialer/callcomposer/MessageComposerFragment.java b/java/com/android/dialer/callcomposer/MessageComposerFragment.java
index 521b71402..d8100033f 100644
--- a/java/com/android/dialer/callcomposer/MessageComposerFragment.java
+++ b/java/com/android/dialer/callcomposer/MessageComposerFragment.java
@@ -77,6 +77,7 @@ public class MessageComposerFragment extends CallComposerFragment
customMessage.addTextChangedListener(
new TextWatcher() {
@Override
+
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
@Override
@@ -90,8 +91,6 @@ public class MessageComposerFragment extends CallComposerFragment
}
view.findViewById(R.id.message_chat).setOnClickListener(this);
view.findViewById(R.id.message_question).setOnClickListener(this);
-
- setTopView(urgent);
return view;
}
@@ -140,4 +139,9 @@ public class MessageComposerFragment extends CallComposerFragment
public boolean shouldHide() {
return TextUtils.isEmpty(getMessage());
}
+
+ @Override
+ public void clearComposer() {
+ customMessage.getText().clear();
+ }
}
diff --git a/java/com/android/dialer/callcomposer/camera/ImagePersistTask.java b/java/com/android/dialer/callcomposer/camera/ImagePersistTask.java
index 150009495..a23014bf0 100644
--- a/java/com/android/dialer/callcomposer/camera/ImagePersistTask.java
+++ b/java/com/android/dialer/callcomposer/camera/ImagePersistTask.java
@@ -74,7 +74,9 @@ public class ImagePersistTask extends FallibleAsyncTask<Void, Void, Uri> {
if (mHeightPercent != 1.0f) {
writeClippedBitmap(outputStream);
} else {
- outputStream.write(mBytes, 0, mBytes.length);
+ Bitmap bitmap = BitmapFactory.decodeByteArray(mBytes, 0, mBytes.length);
+ bitmap = CopyAndResizeImageTask.resizeForEnrichedCalling(bitmap);
+ bitmap.compress(Bitmap.CompressFormat.JPEG, 90, outputStream);
}
}
diff --git a/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml b/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml
index 75401b14b..a4198fcf9 100644
--- a/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml
+++ b/java/com/android/dialer/callcomposer/cameraui/res/layout/camera_view.xml
@@ -46,6 +46,14 @@
android:background="@android:color/white"
android:visibility="gone" />
+ <ImageView
+ android:id="@+id/preview_image_view"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:scaleType="centerCrop"
+ android:background="#000000"
+ android:visibility="gone"/>
+
<!-- Need a background on this view in order for the ripple effect to have a place to draw -->
<FrameLayout
android:id="@+id/camera_button_container"
diff --git a/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml b/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml
index 518b53ffd..f687f0b5c 100644
--- a/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml
+++ b/java/com/android/dialer/callcomposer/res/layout/call_composer_activity.xml
@@ -120,13 +120,14 @@
android:visibility="invisible"
android:background="@color/compose_and_call_background">
<TextView
+ android:id="@+id/send_and_call_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:drawableStart="@drawable/quantum_ic_call_white_18"
android:drawablePadding="@dimen/send_and_call_drawable_padding"
android:textAllCaps="true"
- android:text="@string/send_and_call"
+ android:text="@string/share_and_call"
android:textSize="@dimen/send_and_call_text_size"
android:fontFamily="sans-serif-medium"
android:textColor="@color/background_dialer_white"/>
@@ -140,8 +141,8 @@
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:visibility="invisible"
- android:titleTextAppearance="@style/call_composer_toolbar_title_text"
- android:subtitleTextAppearance="@style/call_composer_toolbar_subtitle_text"
+ android:titleTextAppearance="@style/toolbar_title_text"
+ android:subtitleTextAppearance="@style/toolbar_subtitle_text"
android:navigationIcon="@drawable/quantum_ic_close_white_24"
android:background="@color/dialer_theme_color"/>
</FrameLayout> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/res/layout/fragment_gallery_composer.xml b/java/com/android/dialer/callcomposer/res/layout/fragment_gallery_composer.xml
index 58893ba50..a4bd4df03 100644
--- a/java/com/android/dialer/callcomposer/res/layout/fragment_gallery_composer.xml
+++ b/java/com/android/dialer/callcomposer/res/layout/fragment_gallery_composer.xml
@@ -27,7 +27,7 @@
android:paddingLeft="@dimen/gallery_item_padding"
android:paddingRight="@dimen/gallery_item_padding"
android:paddingTop="@dimen/gallery_item_padding"
- android:numColumns="3"/>
+ android:numColumns="@integer/gallery_composer_grid_view_rows"/>
<include
android:id="@+id/permission_view"
diff --git a/java/com/android/dialer/callcomposer/res/layout/fragment_message_composer.xml b/java/com/android/dialer/callcomposer/res/layout/fragment_message_composer.xml
index 97f232b3a..577887be9 100644
--- a/java/com/android/dialer/callcomposer/res/layout/fragment_message_composer.xml
+++ b/java/com/android/dialer/callcomposer/res/layout/fragment_message_composer.xml
@@ -15,43 +15,45 @@
~ limitations under the License
-->
<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="@dimen/call_composer_view_pager_height"
- android:orientation="vertical"
- android:gravity="bottom"
- android:background="@color/background_dialer_white">
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/call_composer_view_pager_height"
+ android:orientation="vertical"
+ android:gravity="bottom"
+ android:background="@color/background_dialer_white">
<TextView
- android:id="@+id/message_urgent"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/urgent"
- style="@style/message_composer_textview"/>
+ android:id="@+id/message_urgent"
+ android:layout_width="match_parent"
+ android:layout_height="56dp"
+ android:layout_marginTop="8dp"
+ android:text="@string/urgent"
+ style="@style/message_composer_textview"/>
<TextView
- android:id="@+id/message_chat"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/want_to_chat"
- style="@style/message_composer_textview"/>
+ android:id="@+id/message_chat"
+ android:layout_width="match_parent"
+ android:layout_height="56dp"
+ android:text="@string/want_to_chat"
+ style="@style/message_composer_textview"/>
<TextView
- android:id="@+id/message_question"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/quick_question"
- style="@style/message_composer_textview"/>
+ android:id="@+id/message_question"
+ android:layout_width="match_parent"
+ android:layout_height="56dp"
+ android:layout_marginBottom="8dp"
+ android:text="@string/quick_question"
+ style="@style/message_composer_textview"/>
<View
- android:layout_width="match_parent"
- android:layout_height="@dimen/message_composer_divider_height"
- android:background="@color/call_composer_divider"/>
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/message_composer_divider_height"
+ android:background="@color/call_composer_divider"/>
<RelativeLayout
- android:orientation="horizontal"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content">
+ android:orientation="horizontal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
<EditText
android:id="@+id/custom_message"
@@ -59,21 +61,22 @@
android:layout_height="wrap_content"
android:padding="@dimen/message_composer_item_padding"
android:textSize="@dimen/message_compose_item_text_size"
- android:hint="@string/custom_message_hint"
+ android:hint="@string/message_composer_custom_message_hint"
android:textColor="@color/dialer_primary_text_color"
android:textColorHint="@color/dialer_edit_text_hint_color"
android:background="@color/background_dialer_white"
android:textCursorDrawable="@drawable/searchedittext_custom_cursor"
- android:layout_toLeftOf="@+id/remaining_characters"/>
+ android:layout_toStartOf="@+id/remaining_characters"
+ android:imeOptions="flagNoExtractUi"/>
<TextView
- android:id="@+id/remaining_characters"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginRight="@dimen/message_composer_item_padding"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:textSize="@dimen/message_compose_remaining_char_text_size"
- android:textColor="@color/dialer_edit_text_hint_color"/>
+ android:id="@+id/remaining_characters"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="@dimen/message_composer_item_padding"
+ android:layout_alignParentEnd="true"
+ android:layout_centerVertical="true"
+ android:textSize="@dimen/message_compose_remaining_char_text_size"
+ android:textColor="@color/dialer_edit_text_hint_color"/>
</RelativeLayout>
</LinearLayout> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/res/values-h260dp/values.xml b/java/com/android/dialer/callcomposer/res/values-h260dp/values.xml
new file mode 100644
index 000000000..c31f3b015
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/res/values-h260dp/values.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <bool name="show_toolbar">true</bool>
+</resources> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/res/values-h480dp/values.xml b/java/com/android/dialer/callcomposer/res/values-h480dp/values.xml
new file mode 100644
index 000000000..77b77a553
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/res/values-h480dp/values.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <bool name="show_toolbar">false</bool>
+</resources> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/res/values-w360dp/values.xml b/java/com/android/dialer/callcomposer/res/values-w360dp/values.xml
new file mode 100644
index 000000000..adff63518
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/res/values-w360dp/values.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <integer name="gallery_composer_grid_view_rows">3</integer>
+</resources> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/res/values-w500dp/values.xml b/java/com/android/dialer/callcomposer/res/values-w500dp/values.xml
new file mode 100644
index 000000000..3ec2b3513
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/res/values-w500dp/values.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <integer name="gallery_composer_grid_view_rows">4</integer>
+</resources> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/res/values/dimens.xml b/java/com/android/dialer/callcomposer/res/values/dimens.xml
index 3ebda7a0f..5571170b2 100644
--- a/java/com/android/dialer/callcomposer/res/values/dimens.xml
+++ b/java/com/android/dialer/callcomposer/res/values/dimens.xml
@@ -17,10 +17,6 @@
<resources>
<dimen name="call_composer_view_pager_height">258dp</dimen>
- <!-- Toolbar -->
- <dimen name="toolbar_title_text_size">16sp</dimen>
- <dimen name="toolbar_subtitle_text_size">14sp</dimen>
-
<!-- Contact bar -->
<dimen name="call_composer_contact_photo_border_thickness">2dp</dimen>
<dimen name="call_composer_contact_photo_size">116dp</dimen>
diff --git a/java/com/android/dialer/callcomposer/res/values/strings.xml b/java/com/android/dialer/callcomposer/res/values/strings.xml
index 35a8cf9da..cc7762b64 100644
--- a/java/com/android/dialer/callcomposer/res/values/strings.xml
+++ b/java/com/android/dialer/callcomposer/res/values/strings.xml
@@ -22,9 +22,11 @@
<!-- A default message to send with a phone call. [CHAR LIMIT=27] -->
<string name="quick_question">Quick question…</string>
<!-- Hint in a text field to compose a custom message to send with a phone call [CHAR LIMIT=27] -->
- <string name="custom_message_hint">Write a custom message</string>
- <!-- Text for a button to make a phone call combined with a picture or text message [CHAR LIMIT=26] -->
+ <string name="message_composer_custom_message_hint">Write a custom message</string>
+ <!-- Text for a button to make a phone call combined with a text message [CHAR LIMIT=26] -->
<string name="send_and_call">Send and call</string>
+ <!-- Text for a button to make a phone call combined with a picture or other media [CHAR LIMIT=26] -->
+ <string name="share_and_call">Share and call</string>
<!-- Accessibility description for each image in the gallery. For example, "image January 17 2015 1 59 pm". -->
<string name="gallery_item_description">image <xliff:g id="date">%1$tB %1$te %1$tY %1$tl %1$tM %1$tp</xliff:g></string>
<!-- Accessibility description for each image in the gallery when no date is present. -->
diff --git a/java/com/android/dialer/callcomposer/res/values/styles.xml b/java/com/android/dialer/callcomposer/res/values/styles.xml
index 891f6397d..29ac4ddaa 100644
--- a/java/com/android/dialer/callcomposer/res/values/styles.xml
+++ b/java/com/android/dialer/callcomposer/res/values/styles.xml
@@ -36,15 +36,6 @@
<item name="android:textColor">@color/dialer_primary_text_color</item>
<item name="android:padding">@dimen/message_composer_item_padding</item>
<item name="android:background">@drawable/item_background_material_light</item>
- </style>
-
- <style name="call_composer_toolbar_title_text">
- <item name="android:textSize">@dimen/toolbar_title_text_size</item>
- <item name="android:textColor">@color/background_dialer_white</item>
- </style>
-
- <style name="call_composer_toolbar_subtitle_text">
- <item name="android:textSize">@dimen/toolbar_subtitle_text_size</item>
- <item name="android:textColor">@color/background_dialer_white</item>
+ <item name="android:gravity">center_vertical</item>
</style>
</resources> \ No newline at end of file
diff --git a/java/com/android/dialer/callcomposer/res/values/values.xml b/java/com/android/dialer/callcomposer/res/values/values.xml
new file mode 100644
index 000000000..39b8e4071
--- /dev/null
+++ b/java/com/android/dialer/callcomposer/res/values/values.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2016 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <integer name="gallery_composer_grid_view_rows">2</integer>
+ <bool name="show_toolbar">false</bool>
+</resources> \ No newline at end of file