mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-26 04:22:30 -10:00
#!/bin/bash set -x pushd mobile/android/base # Can't be present in glob below. rm -rf java/org/mozilla/gecko for i in */ ; do # But is necessary to copy into. mkdir -p java/org/mozilla/gecko hg mv $i java/org/mozilla/gecko ; done hg mv *.java java/org/mozilla/gecko # Move back stuff we didn't want to move. hg mv java/org/mozilla/gecko/crashreporter crashreporter hg mv java/org/mozilla/gecko/docs docs hg mv java/org/mozilla/gecko/locales locales hg mv java/org/mozilla/gecko/resources resources popd
40 lines
1.5 KiB
Java
40 lines
1.5 KiB
Java
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package org.mozilla.gecko;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import org.mozilla.gecko.util.ActivityResultHandler;
|
|
import org.mozilla.gecko.util.EventCallback;
|
|
import org.mozilla.gecko.util.InputOptionsUtils;
|
|
|
|
/**
|
|
* Supports the DevTools WiFi debugging authentication flow by invoking a QR decoder.
|
|
*/
|
|
public class DevToolsAuthHelper {
|
|
|
|
public static void scan(Context context, final EventCallback callback) {
|
|
final Intent intent = InputOptionsUtils.createQRCodeReaderIntent();
|
|
|
|
intent.putExtra("PROMPT_MESSAGE", context.getString(R.string.devtools_auth_scan_header));
|
|
|
|
Activity activity = GeckoAppShell.getGeckoInterface().getActivity();
|
|
ActivityHandlerHelper.startIntentForActivity(activity, intent, new ActivityResultHandler() {
|
|
@Override
|
|
public void onActivityResult(int resultCode, Intent intent) {
|
|
if (resultCode == Activity.RESULT_OK) {
|
|
String text = intent.getStringExtra("SCAN_RESULT");
|
|
callback.sendSuccess(text);
|
|
} else {
|
|
callback.sendError(resultCode);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
}
|