我正在尝试实现滑动删除和ListView使用SwipeToDismissUndoList库扩展Roman Nurik的SwipeToDismiss示例.
我的问题在于删除动画.由于ListView由a支持CursorAdapter,动画会触发onDismiss回调,onAnimationEnd但这意味着动画已经运行并在CursorAdapter使用删除更新之前重置自身.
这最终看起来像是一个闪烁的用户,他们通过滑动它删除一个音符,然后视图返回一瞬间然后消失,因为CursorAdapter已经拾取数据更改.
这是我的OnDismissCallback:
private SwipeDismissList.OnDismissCallback dismissCallback =
new SwipeDismissList.OnDismissCallback() {
@Override
public SwipeDismissList.Undoable onDismiss(ListView listView, final int position) {
Cursor c = mAdapter.getCursor();
c.moveToPosition(position);
final int id = c.getInt(Query._ID);
final Item item = Item.findById(getActivity(), id);
if (Log.LOGV) Log.v("Deleting item: " + item);
final ContentResolver cr = getActivity().getContentResolver();
cr.delete(Items.buildItemUri(id), null, null);
mAdapter.notifyDataSetChanged();
return new SwipeDismissList.Undoable() {
public void undo() …Run Code Online (Sandbox Code Playgroud) 我已经更新了我的项目以使用新的基于Gradle的构建系统,很大程度上是因为我因为使用设备进行开发而无法在我的设备上安装我的应用程序而感到恼火.我packageNameSuffix在新构建系统的提供中看到了很多承诺.
我遇到的问题涉及清单中包名称以外的其他内容.还有其他部分必须是唯一的,包括权限(特别是对于GCM)和ContentProvider权限.当尝试使用.debug后缀进行安装时,我得到的错误是该程序包的GCM权限尚未定义,并且我正在尝试安装重复的提供程序.
是否有一个变量,我可以放在我的清单而不是这些字符串,以便构建系统也将适当地替换它们?
我正在开发一个包含两个Android库项目的项目.当我将这些库上传到我的Maven仓库(Nexus)时,生成的pom不包含<type>aar</type>依赖项中的元素.
这是我的依赖树
* App1
\
* lib1
|\
| * lib2
* Other libs
Run Code Online (Sandbox Code Playgroud)
您可以在此图中看到我的app依赖lib1,这取决于lib2.这两个库都是Android库项目,因此是AAR.
LIB1 /的build.gradle
apply plugin: 'com.android.library'
apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
provided project(':lib2')
compile 'com.squareup.picasso:picasso:2.3.3'
}
Run Code Online (Sandbox Code Playgroud)
LIB2 /的build.gradle
apply plugin: 'com.android.library'
apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion …Run Code Online (Sandbox Code Playgroud) 我一直在寻找Java的SOAP客户端库,并且已经基于构建基于WSDL的存根和代理类的想法找到了大量的库.我有兴趣允许用户在运行时输入WSDL,解析WSDL,然后允许用户在Web服务上执行操作.
有谁知道一个好的SOAP客户端库,它将允许这个运行时使用?或者有没有办法可以使用axis2 wsdl2java功能将存根构建到类加载器中并在运行时使用它们?
我正在为我的Octopress网站制作一个Jekyll标签插件,以帮助我创建一个"注释"元素.我只是希望能够在我的博客上突出显示一条信息作为旁注,就像这样.

问题是,我无法弄清楚如何处理这个标签的内容(即Markdown或Textile).上面的图片只是实现了我实际上用html代码制作我的链接.以下是我在内容中使用markdown时最终结果的结果.

在我的帖子中,我正在写这样的内容.
{% note %}
This is the third post in my Start to Finish series. Last time I talked about [Git](/blog/2013/09/25/getting-started-with-git/).
{% endnote %}
Run Code Online (Sandbox Code Playgroud)
这是我的插件代码.它基于图像标记代码,并且它真的不是很多.
module Jekyll
class NoteTag < Liquid::Block
@title = nil
def initialize(tag_name, markup, tokens)
@title = markup
super
end
def render(context)
output = super(context)
title = "Note"
if !@title.empty?
title += ": #{@title}"
end
"</section>\n<div class=\"note\"><span class=\"title\">#{title}</span>#{output}</div>\n<section>"
end
end
end
Liquid::Template.register_tag('note', Jekyll::NoteTag)
Run Code Online (Sandbox Code Playgroud)
你知道如何在这个标签的内容上使用转换器吗?我通常使用Markdown作为我的帖子,但我想为其他人发布这个插件,所以我希望它像Jekyll的其余部分一样充满活力.
在Android培训文档中有一篇关于有效加载大位图的文章,该文章讨论了inSampleSize在加载图像时计算下采样图像.这是共享的代码示例.
public static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
// Raw height and width of image
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {
final int halfHeight = height / 2;
final int halfWidth = width / 2;
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
// height …Run Code Online (Sandbox Code Playgroud) 我NoClassDefFoundError在尝试调用类Foo.serializer()上的方法时得到了一个@Serializable。
这是我的测试用例:
@Serializable
data class Foo(val data: String)
val jsonString = json.stringify(
Foo.serializer(), // <= Error happens here
Foo(data = "foo")
)
Run Code Online (Sandbox Code Playgroud)
尝试运行代码会导致以下堆栈跟踪:
java.lang.NoSuchMethodError: 'void kotlinx.serialization.internal.SerialClassDescImpl.<init>(java.lang.String, kotlinx.serialization.internal.GeneratedSerializer, int)'
at com.example.Foo$$serializer.<clinit>(Foo.kt:7)
at com.example.Foo$Companion.serializer(Foo.kt)
Run Code Online (Sandbox Code Playgroud) 我有一个首选项屏幕,向用户显示一个禁用广告的复选框.当用户首次点击此选项时,会向他们显示"应用内结算"购买选项以停用广告.
我在这里遇到的问题是我无法看到任何方法将onActivityResult回调到片段中.
所以我有一个PreferenceActivity加载PreferenceFragment(我似乎无法获得参考).在App Billing中,需要调用startIntentSenderForResultFragments不具有的活动.
当我启动购买流程时startIntentSenderForResult,onActivityResult会调用Activity ,但我需要在片段中使用它.
因为我使用以下内容将PreferenceFragment加载到PreferenceActivity中,所以我认为我不能获得对Fragment的引用来传递调用.
@Override
public void onBuildHeaders(List<Header> target) {
loadHeadersFromResource(R.layout.preferences_headers, target);
}
@Override
public Intent getIntent() {
final Intent modIntent = new Intent(super.getIntent());
modIntent.putExtra(EXTRA_SHOW_FRAGMENT, SyncPreferencesFragment.class.getName());
modIntent.putExtra(EXTRA_NO_HEADERS, true);
return modIntent;
}
Run Code Online (Sandbox Code Playgroud)
我在这里错过了什么?我不想分开我所有的购买逻辑,那么如何让我的Fragment onActivityForResult接听电话呢?