我正在使用NineOldAndroids的ObjectAnimators来淡化Android Map v2标记,其代码如下:
mMarkerSelected = mMap.addMarker(new MarkerOptions()
.position(location.getLatLng())
.title(location.getName())
.snippet(location.getId())
.icon(BitmapDescriptorFactory.defaultMarker(location.getMarkerHue())));
mMarkerSelected.setAlpha(0.0f);
ObjectAnimator.ofFloat(mMarkerSelected, "alpha", 0.0f, 1.f)
.setDuration(300).start();
Run Code Online (Sandbox Code Playgroud)
这与apk的可调试版本完美配合.
然而,当我签我的APK,并搭配使用ProGuard,突然标记不褪色.我的猜测是,阿尔法属性已经被混淆,使传递"alpha"
到ObjectAnimator.ofFloat
不符合的混淆的阿尔法属性相匹配Marker
.使用ProGuard时如何让动画工作?
为了完整起见,这是我的proguard-rules.txt的唯一内容
-dontwarn com.squareup.okhttp.**
Run Code Online (Sandbox Code Playgroud) 我已经注册了CursorLoader
,但它没有收到我的更新ContentProvider
事件的顺序是:
在a中Fragment
,注册CursorLoader:
getLoaderManager().initLoader(LOADER_FAVS_ID, null, this);
Run Code Online (Sandbox Code Playgroud)
注意我使用的是支持库版本,所以这个方法是 android.support.v4.app.Fragment.getLoaderManager()
该CursorLoader
注册,并且Cursor
在加载onLoadFinished
:
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
Log.i(TAG, "onLoadFinished");
switch (loader.getId()) {
case LOADER_FAVS_ID:
Log.i(TAG,
"cursor notification uri: " + cursor.getNotificationUri());
mCursorAdapter.swapCursor(cursor);
break;
}
}
Run Code Online (Sandbox Code Playgroud)
cursor notification uri: content://com.myapp.mylocation/db_locations
例如,哪个日志.这是因为我确保cursor.setNotificationUri(getContext().getContentResolver(), uri);
在从ContentProvider返回Cursor之前调用.另请注意,我的内容提供商返回了一个MergeCursor
.
一段时间后,update()
在我的电话中进行了调用ContentProvider
,并执行以下行:
Log.i(TAG,
"Notifying uri: " + uri.toString());
getContext().getContentResolver().notifyChange(
uri, null);
Run Code Online (Sandbox Code Playgroud)
哪个日志Notifying loc uri: content://com.myapp.mylocation/db_locations
,与上面相同的uri.
但是onLoadFinished
永远不会被召唤,而我Cursor …