小编Mar*_*tyn的帖子

使用Ant中的文件名过滤器复制最新文件

我正在尝试使用Ant从目录中复制最新文件,理想情况下我也想对文件名进行过滤(例如:'*file.java'),但我不知道如何做这个

到目前为止,我已经包含了我的脚本,但它在JavaScript中突破,我没有足够的经验知道原因.

<project name="test1" basedir=".">

    <property file="../local.properties" />
    <property file="../build.properties" />
    <property file="../default.properties" />

    <target name="init">        
        <copy todir=".">
            <fileset dir="/path/to/files">
                <scriptselector language="javascript">
                    var files = basedir.list();
                    var mostRecent = true;
                    for(var i = 0; i < files.size(); i++) {
                        mostRecent = mostRecent && (filename >= files[i]);
                    }
                    self.setSelected(mostRecent);
                </scriptselector>
            </fileset>
        </copy>
    </target>
</project>
Run Code Online (Sandbox Code Playgroud)

编辑:刚刚意识到网站我从上面得到了上面的JavaScript代码,这个选择器是"只选择目录的最新文件,其中每个文件都有一个时间戳作为其文件名",所以我的例子不起作用,因为它使用了将名称命名为修改日期.这导致了如何使用JavaScript(或任何其他适用于Ant的语言)获取文件的修改日期的问题

ant copy

3
推荐指数
1
解决办法
3978
查看次数

Android:无论如何要知道是否检查了"未知来源"?

有没有办法找出用户是否已选中"应用程序设置"菜单中的"未知来源"复选框?

android application-settings

2
推荐指数
1
解决办法
1135
查看次数

ICS模拟器无法加载

我正在尝试使用ICS(Android 4.0)操作系统运行Android模拟器,但在快速四核机器上等待15分钟之后,它仍然没有做任何事情.我知道它正在模仿arm cpu,因此速度很慢 - 但这还没有从加载屏幕上消失!有没有人设法让它运行?有小费吗?

android android-emulator android-4.0-ice-cream-sandwich

2
推荐指数
1
解决办法
3778
查看次数

android - 英镑标志被腐蚀

我有例程根据输入的国家代码传回货币符号,但英镑符号已损坏,我不知道为什么.我传入时accountCurrency="GBP",而不是预期的"£" ,而是返回"£".怎么了?

public static String findCurrencySymbol(String accountCurrency) {
    if (accountCurrency == null || accountCurrency.trim().length() == 0) {
        return "";
    }

    String curr = accountCurrency.toUpperCase();
    if ("GBP".equals(curr)) {
        return "£";
    } else if ("USD".equals(curr)
            || "AUD".equals(curr)
            || "CAD".equals(curr)
            || "SGD".equals(curr)) {
        return "$";
    } else if ("EUR".equals(curr)) {
        return "€";
    } else {
        // return raw currency code with whitespace attached
        // should lead to display like: "YPY 12440.00"
        return accountCurrency + " ";
    }
}
Run Code Online (Sandbox Code Playgroud)

编辑:其他值按预期返回.

java encoding android

0
推荐指数
1
解决办法
1376
查看次数

背景淡入淡出

我正在尝试创建一种获取视图背景的方式来响应显示它已注册用户触摸,但我希望它看起来不错,所以希望背景颜色在触摸时更改为高亮颜色然后返回再来一次.

到目前为止,我已经创建了一个过渡动画,可以在触摸视图的背景上进行动画制作:

animatedBackgroundView.setBackgroundResource(R.anim.background_touch);
animatedBackgroundView.setOnTouchListener(new View.OnTouchListener() {
    @Override
    public boolean onTouch(View view, MotionEvent motionEvent) {
        TransitionDrawable transition = (TransitionDrawable) view.getBackground();
        transition.startTransition(500);
    }
});
Run Code Online (Sandbox Code Playgroud)

使用后台动画资源文件:

<?xml version="1.0" encoding="UTF-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="#22ffffff" />
    <item android:drawable="#00ffffff" />
</transition>
Run Code Online (Sandbox Code Playgroud)

这很好用,但如果视图已经有背景那么就会被破坏.

有没有办法在不破坏现有背景的情况下动态创建类似的过渡动画效果?

animation android view

0
推荐指数
1
解决办法
1779
查看次数