Merge "Remove hardware layers. Replace alpha by colors-with-alpha"
diff --git a/res/layout-sw580dp-w1000dp/contact_detail_fragment.xml b/res/layout-sw580dp-w1000dp/contact_detail_fragment.xml
index f4c95f8..b8328ef 100644
--- a/res/layout-sw580dp-w1000dp/contact_detail_fragment.xml
+++ b/res/layout-sw580dp-w1000dp/contact_detail_fragment.xml
@@ -21,7 +21,8 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@drawable/panel_content">
+ android:background="@color/background_primary"
+ android:padding="16dip">
<!-- Placeholder for empty list -->
<include
@@ -40,10 +41,7 @@
android:scaleType="centerCrop"
android:layout_width="@dimen/detail_contact_photo_size"
android:layout_height="@dimen/detail_contact_photo_size"
- android:layout_marginLeft="@dimen/detail_contact_photo_margin"
- android:layout_marginRight="@dimen/detail_contact_photo_margin"
- android:layout_marginTop="@dimen/detail_contact_photo_margin"
- android:layout_marginBottom="@dimen/detail_contact_photo_margin"/>
+ android:layout_marginRight="@dimen/detail_contact_photo_margin"/>
<ListView android:id="@android:id/list"
android:layout_width="0dip"
diff --git a/res/layout-sw580dp-w1000dp/detail_header_contact_with_updates.xml b/res/layout-sw580dp-w1000dp/detail_header_contact_with_updates.xml
index 1a1a3bb..dce00ac 100644
--- a/res/layout-sw580dp-w1000dp/detail_header_contact_with_updates.xml
+++ b/res/layout-sw580dp-w1000dp/detail_header_contact_with_updates.xml
@@ -24,8 +24,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:padding="20dip">
+ android:orientation="horizontal">
<ImageView
android:id="@+id/photo"
@@ -37,8 +36,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:paddingLeft="10dip"
- android:paddingRight="10dip">
+ android:paddingLeft="16dip"
+ android:paddingRight="16dip">
<TextView
android:id="@+id/name"
diff --git a/res/layout-sw580dp-w1000dp/detail_header_contact_without_updates.xml b/res/layout-sw580dp-w1000dp/detail_header_contact_without_updates.xml
index 415bbbf..486b7c2 100644
--- a/res/layout-sw580dp-w1000dp/detail_header_contact_without_updates.xml
+++ b/res/layout-sw580dp-w1000dp/detail_header_contact_without_updates.xml
@@ -23,8 +23,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingTop="20dip">
+ android:orientation="vertical">
<TextView
android:id="@+id/name"
diff --git a/res/layout-sw580dp/contact_detail_fragment.xml b/res/layout-sw580dp/contact_detail_fragment.xml
index cd559fe..c9dad2a 100644
--- a/res/layout-sw580dp/contact_detail_fragment.xml
+++ b/res/layout-sw580dp/contact_detail_fragment.xml
@@ -20,8 +20,7 @@
android:id="@+id/contact_detail"
android:orientation="vertical"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@drawable/panel_content">
+ android:layout_height="match_parent">
<!-- Placeholder for empty list -->
<include
@@ -30,23 +29,12 @@
android:visibility="gone" />
<!-- Real list -->
- <com.android.contacts.widget.InterpolatingLayout
+ <ListView android:id="@android:id/list"
android:layout_width="match_parent"
- android:layout_height="0px"
- android:layout_weight="1">
- <ListView android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- ex:layout_wideParentWidth="800dip"
- ex:layout_wideMarginLeft="64dip"
- ex:layout_widePaddingRight="48dip"
- ex:layout_narrowParentWidth="300dip"
- ex:layout_narrowMarginLeft="5dip"
- ex:layout_narrowPaddingRight="16dip"
- android:cacheColorHint="#00000000"
- android:divider="@null"
- />
- </com.android.contacts.widget.InterpolatingLayout>
+ android:layout_height="match_parent"
+ android:cacheColorHint="#00000000"
+ android:divider="@null"
+ />
<!-- "QuickFix"- button (Copy to local contact, add to group) -->
<Button
diff --git a/res/layout-sw580dp/detail_header_contact_without_updates.xml b/res/layout-sw580dp/detail_header_contact_without_updates.xml
index 4ae31c8..04fbad9 100644
--- a/res/layout-sw580dp/detail_header_contact_without_updates.xml
+++ b/res/layout-sw580dp/detail_header_contact_without_updates.xml
@@ -22,8 +22,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingTop="20dip">
+ android:orientation="vertical">
<ImageView
android:id="@+id/photo"
diff --git a/res/layout-sw580dp/people_activity.xml b/res/layout-sw580dp/people_activity.xml
index 87bb3b5..13adfa9 100644
--- a/res/layout-sw580dp/people_activity.xml
+++ b/res/layout-sw580dp/people_activity.xml
@@ -67,8 +67,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
ex:layout_narrowParentWidth="800dip"
+ ex:layout_narrowMarginLeft="0dip"
ex:layout_narrowMarginRight="0dip"
ex:layout_wideParentWidth="1280dip"
+ ex:layout_wideMarginLeft="0dip"
ex:layout_wideMarginRight="0dip"
ex:clipMarginLeft="0dip"
ex:clipMarginTop="3dip"
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index 8356aa8..e436fcb 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -57,12 +57,7 @@
android:layout_height="wrap_content"
android:layout_below="@id/contact_background_sizer"
>
- <fragment
- class="com.android.contacts.voicemail.VoicemailPlaybackFragment"
- android:id="@+id/voicemail_playback_fragment"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- />
+ <!-- The voicemail fragment will be put here. -->
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
diff --git a/res/layout/contact_detail_container.xml b/res/layout/contact_detail_container.xml
index 0b5b85a..3991e5c 100644
--- a/res/layout/contact_detail_container.xml
+++ b/res/layout/contact_detail_container.xml
@@ -26,13 +26,14 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:orientation="vertical">
+ android:orientation="vertical"
+ android:background="@color/background_primary"
+ android:padding="16dip">
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
- android:paddingTop="20dip"
android:layout_width="match_parent"
android:layout_height="match_parent" />
@@ -42,10 +43,7 @@
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingTop="20dip"
- android:paddingLeft="10dip"
- android:paddingRight="10dip"/>
+ android:layout_height="wrap_content"/>
<fragment
android:id="@+id/contact_detail_fragment"
diff --git a/res/values-sw580dp/dimens.xml b/res/values-sw580dp/dimens.xml
index 4de6bb7..a10d234 100644
--- a/res/values-sw580dp/dimens.xml
+++ b/res/values-sw580dp/dimens.xml
@@ -22,7 +22,7 @@
<dimen name="editor_round_button_padding_right">8dip</dimen>
<dimen name="editor_field_top_padding">12dip</dimen>
<dimen name="editor_field_bottom_padding">12dip</dimen>
- <dimen name="detail_item_side_margin">19dip</dimen>
+ <dimen name="detail_item_side_margin">0dip</dimen>
<dimen name="contact_name_text_size">26sp</dimen>
<dimen name="action_bar_filter_min_width">120dip</dimen>
<dimen name="action_bar_filter_max_width">120dip</dimen>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index cbac941..0264087 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -116,7 +116,7 @@
<dimen name="detail_update_section_internal_padding">16dip</dimen>
<!-- Margin around the contact's photo on the contact card -->
- <dimen name="detail_contact_photo_margin">15dip</dimen>
+ <dimen name="detail_contact_photo_margin">16dip</dimen>
<!-- Width and height of the contact photo on the contact detail page -->
<dimen name="detail_contact_photo_size">256dip</dimen>
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index 813ebb1..e9a693e 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -25,7 +25,6 @@
import com.android.contacts.voicemail.VoicemailStatusHelperImpl;
import android.app.ActionBar;
-import android.app.FragmentManager;
import android.app.ListActivity;
import android.content.ContentResolver;
import android.content.ContentUris;
@@ -179,16 +178,22 @@
*/
private void optionallyHandleVoicemail() {
if (hasVoicemail()) {
- // Has voicemail: leave the fragment visible. Optionally start the playback.
+ // Has voicemail: add the voicemail fragment. Add suitable arguments to set the uri
+ // to play and optionally start the playback.
// Do a query to fetch the voicemail status messages.
- boolean startPlayback = getIntent().getBooleanExtra(
- EXTRA_VOICEMAIL_START_PLAYBACK, false);
+ VoicemailPlaybackFragment playbackFragment = new VoicemailPlaybackFragment();
+ Bundle fragmentArguments = new Bundle();
Uri voicemailUri = getIntent().getParcelableExtra(EXTRA_VOICEMAIL_URI);
- getVoicemailPlaybackFragment().setVoicemailUri(voicemailUri, startPlayback);
+ fragmentArguments.putParcelable(EXTRA_VOICEMAIL_URI, voicemailUri);
+ if (getIntent().getBooleanExtra(EXTRA_VOICEMAIL_START_PLAYBACK, false)) {
+ fragmentArguments.putBoolean(EXTRA_VOICEMAIL_START_PLAYBACK, true);
+ }
+ playbackFragment.setArguments(fragmentArguments);
+ getFragmentManager().beginTransaction()
+ .add(R.id.voicemail_container, playbackFragment).commit();
mAsyncQueryHandler.startVoicemailStatusQuery(voicemailUri);
} else {
- // No voicemail uri: hide the voicemail fragment and the status view.
- getFragmentManager().beginTransaction().hide(getVoicemailPlaybackFragment()).commit();
+ // No voicemail uri: hide the status view.
mStatusMessageView.setVisibility(View.GONE);
}
}
@@ -197,12 +202,6 @@
return getIntent().getParcelableExtra(EXTRA_VOICEMAIL_URI) != null;
}
- private VoicemailPlaybackFragment getVoicemailPlaybackFragment() {
- FragmentManager manager = getFragmentManager();
- return (VoicemailPlaybackFragment) manager.findFragmentById(
- R.id.voicemail_playback_fragment);
- }
-
/**
* Returns the list of URIs to show.
* <p>
diff --git a/src/com/android/contacts/calllog/CallDetailHistoryAdapter.java b/src/com/android/contacts/calllog/CallDetailHistoryAdapter.java
index e55020c..26275af 100644
--- a/src/com/android/contacts/calllog/CallDetailHistoryAdapter.java
+++ b/src/com/android/contacts/calllog/CallDetailHistoryAdapter.java
@@ -84,7 +84,7 @@
DateUtils.FORMAT_SHOW_WEEKDAY | DateUtils.FORMAT_SHOW_YEAR);
dateView.setText(dateValue);
// Set the duration
- if (callType == Calls.MISSED_TYPE) {
+ if (callType == Calls.MISSED_TYPE || callType == Calls.VOICEMAIL_TYPE) {
durationView.setVisibility(View.GONE);
} else {
durationView.setVisibility(View.VISIBLE);
diff --git a/src/com/android/contacts/list/ContactTileAdapter.java b/src/com/android/contacts/list/ContactTileAdapter.java
index 57ae072..5850a4a 100644
--- a/src/com/android/contacts/list/ContactTileAdapter.java
+++ b/src/com/android/contacts/list/ContactTileAdapter.java
@@ -236,7 +236,7 @@
@Override
public int getCount() {
- if (mContactCursor == null || mContactCursor.getCount() == 0) {
+ if (mContactCursor == null) {
return 0;
}
@@ -466,22 +466,7 @@
final ContactTileView contactTile;
if (getChildCount() <= tileIndex) {
- switch (mItemViewType) {
- case ViewTypes.STARRED_WITH_SECONDARY_ACTION:
- contactTile = (ContactTileSecondaryTargetView)
- inflate(mContext, mLayoutResId, null);
- break;
- case ViewTypes.STARRED:
- contactTile =
- (ContactTileStarredView) inflate(mContext, mLayoutResId, null);
- break;
- case ViewTypes.FREQUENT:
- contactTile = (ContactTileView) inflate(mContext, mLayoutResId, null);
- break;
- default:
- throw new IllegalStateException(
- "Unrecognized ViewType " + mItemViewType);
- }
+ contactTile = (ContactTileView) inflate(mContext, mLayoutResId, null);
contactTile.setLayoutParams(new LinearLayout.LayoutParams(0,
LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f));
contactTile.setPhotoManager(mPhotoManager);
diff --git a/src/com/android/contacts/model/ExternalAccountType.java b/src/com/android/contacts/model/ExternalAccountType.java
index caf311b..e5af8f8 100644
--- a/src/com/android/contacts/model/ExternalAccountType.java
+++ b/src/com/android/contacts/model/ExternalAccountType.java
@@ -23,6 +23,7 @@
import android.content.Context;
import android.content.Intent;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;
@@ -74,6 +75,7 @@
private int mInviteActionLabelResId;
private String mAccountTypeLabelAttribute;
private String mAccountTypeIconAttribute;
+ private boolean mInitSuccessful;
public ExternalAccountType(Context context, String resPackageName) {
this.resPackageName = resPackageName;
@@ -81,17 +83,18 @@
// Handle unknown sources by searching their package
final PackageManager pm = context.getPackageManager();
- final Intent syncAdapter = new Intent(ACTION_SYNC_ADAPTER);
- final List<ResolveInfo> matches = pm.queryIntentServices(syncAdapter,
- PackageManager.GET_META_DATA);
- for (ResolveInfo info : matches) {
- ServiceInfo serviceInfo = info.serviceInfo;
- if (serviceInfo.packageName.equals(resPackageName)) {
+ try {
+ PackageInfo packageInfo = pm.getPackageInfo(resPackageName,
+ PackageManager.GET_SERVICES|PackageManager.GET_META_DATA);
+ for (ServiceInfo serviceInfo : packageInfo.services) {
final XmlResourceParser parser = serviceInfo.loadXmlMetaData(pm,
METADATA_CONTACTS);
if (parser == null) continue;
inflate(context, parser);
}
+ } catch (NameNotFoundException nnfe) {
+ // If the package name is not found, we can't initialize this account type.
+ return;
}
mExtensionPackageNames = new ArrayList<String>();
@@ -107,6 +110,9 @@
addDataKindDisplayName(context);
addDataKindPhoneticName(context);
addDataKindPhoto(context);
+
+ // If we reach this point, the account type has been successfully initialized.
+ mInitSuccessful = true;
}
@Override
@@ -114,6 +120,14 @@
return true;
}
+ /**
+ * Whether this account type was able to be fully initialized. This may be false if
+ * (for example) the package name associated with the account type could not be found.
+ */
+ public boolean isInitialized() {
+ return mInitSuccessful;
+ }
+
@Override
public String getEditContactActivityClassName() {
return mEditContactActivityClassName;
diff --git a/src/com/android/contacts/model/GoogleAccountType.java b/src/com/android/contacts/model/GoogleAccountType.java
index c3dbd79..a5fab96 100644
--- a/src/com/android/contacts/model/GoogleAccountType.java
+++ b/src/com/android/contacts/model/GoogleAccountType.java
@@ -35,6 +35,9 @@
protected static final int FLAGS_RELATION = EditorInfo.TYPE_CLASS_TEXT
| EditorInfo.TYPE_TEXT_FLAG_CAP_WORDS | EditorInfo.TYPE_TEXT_VARIATION_PERSON_NAME;
+ private static final List<String> mExtensionPackages =
+ Lists.newArrayList("com.google.android.apps.plus");
+
public GoogleAccountType(Context context, String resPackageName) {
this.accountType = ACCOUNT_TYPE;
this.resPackageName = null;
@@ -60,8 +63,7 @@
@Override
public List<String> getExtensionPackageNames() {
- // TODO: Return the Google+ package name once it has the XML for an ExternalAccountType.
- return super.getExtensionPackageNames();
+ return mExtensionPackages;
}
@Override
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index d236e01..1ef40db 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -68,6 +68,7 @@
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
+import android.view.WindowManager;
import android.widget.HorizontalScrollView;
import android.widget.ImageButton;
import android.widget.ImageView;
@@ -163,6 +164,10 @@
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
+ // Show QuickContact in front of soft input
+ getWindow().setFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
+ WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
+
setContentView(R.layout.quickcontact_activity);
mFloatingLayout = (FloatingChildLayout) findViewById(R.id.floating_layout);
diff --git a/src/com/android/contacts/socialwidget/SocialWidgetProvider.java b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
index 4686c81..ee41332 100644
--- a/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
+++ b/src/com/android/contacts/socialwidget/SocialWidgetProvider.java
@@ -202,7 +202,7 @@
sb.setSpan(sizeSpan, 0, name.length(), 0);
sb.setSpan(styleSpan, 0, name.length(), 0);
- if (streamItems.isEmpty()) {
+ if (streamItems == null || streamItems.isEmpty()) {
views.setTextViewText(R.id.name, sb);
views.setViewVisibility(R.id.name, View.VISIBLE);
views.setViewVisibility(R.id.name_and_snippet, View.GONE);
diff --git a/src/com/android/contacts/voicemail/VoicemailPlaybackFragment.java b/src/com/android/contacts/voicemail/VoicemailPlaybackFragment.java
index b1da1a1..edc1bb4 100644
--- a/src/com/android/contacts/voicemail/VoicemailPlaybackFragment.java
+++ b/src/com/android/contacts/voicemail/VoicemailPlaybackFragment.java
@@ -16,9 +16,13 @@
package com.android.contacts.voicemail;
+import static com.android.contacts.CallDetailActivity.EXTRA_VOICEMAIL_START_PLAYBACK;
+import static com.android.contacts.CallDetailActivity.EXTRA_VOICEMAIL_URI;
+
import com.android.contacts.R;
import com.android.ex.variablespeed.MediaPlayerProxy;
import com.android.ex.variablespeed.VariableSpeed;
+import com.google.common.base.Preconditions;
import android.app.Fragment;
import android.content.Context;
@@ -71,7 +75,7 @@
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.playback_layout, container);
+ View view = inflater.inflate(R.layout.playback_layout, null);
mPlaybackSeek = (SeekBar) view.findViewById(R.id.playback_seek);
mPlaybackSeek = (SeekBar) view.findViewById(R.id.playback_seek);
mStartStopButton = (ImageButton) view.findViewById(R.id.playback_start_stop);
@@ -88,8 +92,14 @@
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
mScheduledExecutorService = createScheduledExecutorService();
+ Bundle arguments = getArguments();
+ Preconditions.checkNotNull(arguments, "fragment must be started with arguments");
+ Uri voicemailUri = arguments.getParcelable(EXTRA_VOICEMAIL_URI);
+ Preconditions.checkNotNull(voicemailUri, "fragment must contain EXTRA_VOICEMAIL_URI");
+ boolean startPlayback = arguments.getBoolean(EXTRA_VOICEMAIL_START_PLAYBACK, false);
mPresenter = new VoicemailPlaybackPresenter(new PlaybackViewImpl(),
- createMediaPlayer(mScheduledExecutorService), mScheduledExecutorService);
+ createMediaPlayer(mScheduledExecutorService), voicemailUri,
+ mScheduledExecutorService, startPlayback);
mPresenter.onCreate(savedInstanceState);
}
@@ -106,11 +116,6 @@
super.onDestroy();
}
- /** Call this from the Activity containing this fragment to set the voicemail to play. */
- public void setVoicemailUri(Uri voicemailUri, boolean startPlaying) {
- mPresenter.setVoicemailUri(voicemailUri, startPlaying);
- }
-
private MediaPlayerProxy createMediaPlayer(ExecutorService executorService) {
return VariableSpeed.createVariableSpeed(executorService);
}
diff --git a/src/com/android/contacts/voicemail/VoicemailPlaybackPresenter.java b/src/com/android/contacts/voicemail/VoicemailPlaybackPresenter.java
index 5e7b707..0e7470a 100644
--- a/src/com/android/contacts/voicemail/VoicemailPlaybackPresenter.java
+++ b/src/com/android/contacts/voicemail/VoicemailPlaybackPresenter.java
@@ -119,13 +119,18 @@
private final MediaPlayerProxy mPlayer;
private final PositionUpdater mPositionUpdater;
- /** Voicemail uri to play, will be set with a call to {@link #setVoicemailUri(Uri, boolean)}. */
- private Uri mVoicemailUri;
+ /** Voicemail uri to play. */
+ private final Uri mVoicemailUri;
+ /** Start playing in onCreate iff this is true. */
+ private final boolean mStartPlayingImmediately;
public VoicemailPlaybackPresenter(PlaybackView view, MediaPlayerProxy player,
- ScheduledExecutorService executorService) {
+ Uri voicemailUri, ScheduledExecutorService executorService,
+ boolean startPlayingImmediately) {
mView = view;
mPlayer = player;
+ mVoicemailUri = voicemailUri;
+ mStartPlayingImmediately = startPlayingImmediately;
mPositionUpdater = new PositionUpdater(executorService, SLIDER_UPDATE_PERIOD_MILLIS);
}
@@ -141,6 +146,9 @@
mView.setRateIncreaseButtonListener(createRateIncreaseListener());
mView.setClipPosition(0, 0);
mView.playbackStopped();
+ if (mStartPlayingImmediately) {
+ resetPrepareStartPlaying(0);
+ }
// TODO: Now I'm ignoring the bundle, when previously I was checking for contains against
// the PAUSED_STATE_KEY, and CLIP_POSITION_KEY.
}
@@ -157,13 +165,6 @@
mPlayer.release();
}
- public void setVoicemailUri(Uri voicemailUri, boolean startPlaying) {
- mVoicemailUri = voicemailUri;
- if (startPlaying) {
- resetPrepareStartPlaying(0);
- }
- }
-
private class MediaPlayerErrorListener implements MediaPlayer.OnErrorListener {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
@@ -334,7 +335,13 @@
private final Runnable mSetClipPostitionRunnable = new Runnable() {
@Override
public void run() {
- mView.setClipPosition(mPlayer.getCurrentPosition(), mDuration.get());
+ int currentPosition = 0;
+ synchronized (mLock) {
+ if (mScheduledFuture != null) {
+ currentPosition = mPlayer.getCurrentPosition();
+ }
+ }
+ mView.setClipPosition(currentPosition, mDuration.get());
}
};
@@ -345,11 +352,7 @@
@Override
public void run() {
- synchronized (mLock) {
- if (mScheduledFuture != null) {
- mView.runOnUiThread(mSetClipPostitionRunnable);
- }
- }
+ mView.runOnUiThread(mSetClipPostitionRunnable);
}
public void startUpdating(int beginPosition, int endPosition) {