小编Bla*_*ack的帖子

event.getSource() 返回 null android 中的可访问性

我尝试使用 DashLane 等辅助服务或其他一些使用辅助服务的应用程序来填充 EditText 字段。

我正在使用聚焦事件视图。当 EditText 获得焦点时,事件开始但getSource()返回 null。

代码:

  AccessibilityNodeInfo source = event.getSource();

if (source != null) {
        ClipboardManager clipboard = (ClipboardManager)  context.getSystemService(Context.CLIPBOARD_SERVICE);
        ClipData clip = ClipData.newPlainText("label", "TEST DATA");
        clipboard.setPrimaryClip(clip);
        source.performAction(AccessibilityNodeInfo.ACTION_PASTE);
        Toast.makeText(MyAccessibilityService.this, "Pasted Successfully", Toast.LENGTH_LONG);
}
Run Code Online (Sandbox Code Playgroud)

...我已经尝试了一些其他方法,但出现了错误。那么这里有一个问题是为什么它返回 null?

Android清单

            <uses-permission android:name="android.permission.BIND_ACCESSIBILITY_SERVICE"/>
            <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
            <application
                android:icon="@drawable/ic_launcher"
                android:label="@string/app_name" 
                android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
                <service android:name=".MyAccessibilityService" android:label="@string/app_name" android:enabled="true" android:exported="true">
                <intent-filter>
                    <action android:name="android.accessibilityservice.AccessibilityService" android:resource="@xml/accessibility" />
                </intent-filter>  
Run Code Online (Sandbox Code Playgroud)

辅助功能.xml

        <accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
            android:description="@string/accessibility_service_description"
            android:packageNames="com.test.toasts2"
            android:accessibilityEventTypes="typeAllMask"
            android:accessibilityFlags="flagDefault"
            android:accessibilityFeedbackType="feedbackSpoken"
            android:notificationTimeout="100"
            android:canRetrieveWindowContent="true"
            android:settingsActivity="com.example.android.accessibility.ServiceSettingsActivity"
        />
Run Code Online (Sandbox Code Playgroud)

android accessibility accessibility-api android-activity

4
推荐指数
1
解决办法
2496
查看次数

如何使用 php 代理将网站加载到 iframe 中?

我尝试将我在 URL 中设置的随机页面加载到 iframe 中。假设我尝试在 iframe 中加载“ https://www.google.de ”。

<iframe src="<?php echo $_GET['URL'];?>" width="600" height="500"></iframe>
Run Code Online (Sandbox Code Playgroud)

这是我设置 URL 的方法:

localhost/test/index.php?URL=https://www.google.de
Run Code Online (Sandbox Code Playgroud)

仅加载空白页。我知道其原因是 Google 正在发送“X-Frame-Options: SAMEORIGIN”响应标头。

但是,我尝试找到一种方法来加载它,有人告诉我使用 PHP 代理脚本来执行此操作,但我进行了研究,发现没有任何帮助。

我该如何解决这个问题?

html javascript php iframe web

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

view 和 view:make 有什么区别?

我开始学习 Laravel 并看到了两种返回视图的方法。

1.

return View::make('login');
Run Code Online (Sandbox Code Playgroud)

2.

return view('login');
Run Code Online (Sandbox Code Playgroud)

我不确定这样做的好处View::make是什么。即使在阅读了 API 文档之后。https://laravel.com/api/5.4/Illuminate/View/Factory.html#method_make

php laravel blade

4
推荐指数
1
解决办法
1853
查看次数

PHPUnit - 版本3.7.21而不是版本6安装

我按照官方PHPUnit页面上的说明安装PHPUnit 6.

composer require --dev phpunit/phpunit ^6.0
Run Code Online (Sandbox Code Playgroud)

但是,如果我转到项目文件夹并执行,phpunit --version那么我得到PHPUnit 3.7.21 by Sebastian Bergmann..

为什么安装PHPUnit 3.7.21而不是PHPUnit 6?

php phpunit

4
推荐指数
2
解决办法
1715
查看次数

PhpStorm 部署 - 每次都要求提供登录凭据

我设置部署以将我的项目代码与存储我的网站的 FTP 服务器上的项目同步。

但是,每次尝试同步时,我总是必须登录。我什至检查记得,但它不起作用!

在此处输入图片说明

我正在使用最新的 PhpStorm 2017.1.4

我通过sftp和ftp尝试过,结果是一样的。

“部署”的设置页面至少需要 2 分钟来加载 btw!

更新:我注意到凭据没有被保存!我输入了用户名和密码,然后单击保存密码,然后单击应用并确定。然后我关闭设置菜单。如果我再次打开它,则用户名和密码字段再次为空!

在此处输入图片说明

phpstorm phpstorm-2017.1

4
推荐指数
1
解决办法
875
查看次数

Laravel Migrations - 删除列

我需要UserDomainName从数据库表中删除列clients.

起初我doctrine/dbal通过执行composer require doctrine/dbal后安装composer update,如文档中所述.

然后我创建了我想用来删除列的迁移:

php artisan make:migration remove_user_domain_name_from_clients --table=clients
Run Code Online (Sandbox Code Playgroud)

我添加Schema::dropColumn('UserDomainName');down()方法:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class RemoveDomainName extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('clients', function (Blueprint $table) {
            //
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('clients', function (Blueprint $table) …
Run Code Online (Sandbox Code Playgroud)

php symfony doctrine-orm laravel

4
推荐指数
1
解决办法
1万
查看次数

制作`git stash show`,打印完整文件路径

我尝试从存储中恢复单个文件,因此我需要文件的完整路径。但是如果我执行,git stash show那么通常只显示一条短路径。

例如

$ git stash show
 .idea/deployment.xml                               |   4 +-
 .idea/test.iml                                     |   4 +-
 .idea/workspace.xml                                | 635 +++++++++++++++------
 .../local/Black/NewsletterPopup/Block/Show.php    |  13 +
 .../local/Black/NewsletterPopup/etc/config.xml    |  15 +
 .../frontend/venedor/default/layout/popup.xml      |   9 +
 .../default/template/black/popup/index.phtml      |   1 +
 app/etc/modules/Black_NewsletterPopup.xml         |   9 +
 8 files changed, 505 insertions(+), 185 deletions(-)
Run Code Online (Sandbox Code Playgroud)

有没有办法显示完整路径?

如果我执行 git checkout stash@{0} -- .../local/Black/NewsletterPopup/Block/Show.php

然后我得到 error: pathspec '.../local/Black/NewsletterPopup/Block/Show.php' did not match any file(s) known to git.

我已经是CTRL+F文档path但没有找到相关的内容。

git

4
推荐指数
1
解决办法
1147
查看次数

Newsletter2Go REST API - 如何将新收件人添加到列表中?

是否可以通过Newsletter2Go的REST API添加新的收件人?

我试过这个(片段):

public function subscribeAction()
{
    $this->init();

    $email = $this->getRequest()->getParam('email');
    $gender = $this->getRequest()->getParam('gender');
    $first_name = $this->getRequest()->getParam('first_name');
    $last_name = $this->getRequest()->getParam('last_name');

    $endpoint = "/recipients";
    $data = array(
        "list_id" => $this->listId,
        "email" => $email,
        "gender" => $gender,
        "first_name" => $first_name,
        "last_name" => $last_name,
    );

    $response = $this->curl($endpoint, $data);

    var_dump($response);
}

/**
 * @param $endpoint string the endpoint to call (see docs.newsletter2go.com)
 * @param $data array tha data to submit. In case of POST and PATCH its submitted as the body of the …
Run Code Online (Sandbox Code Playgroud)

php api rest newsletter2go

4
推荐指数
1
解决办法
139
查看次数

Magento 2 - observables 在常见的 Knockoutjs 和 magento 2 框架中的工作方式有区别吗?

普通knockoutjs和Magento 2中的observables有什么区别?

任何人都可以通过举一些例子来区分

observable knockout.js magento2

4
推荐指数
1
解决办法
2735
查看次数

如何在git中设置默认遥控器?

我的git储存库中有多个遥控器。如果我执行git pull,那么它将要求我一位同事的密码。

How can I change the remote to black?

git branch git-pull

4
推荐指数
2
解决办法
1820
查看次数