Java Code Examples for android.util.Log

The following examples show how to use android.util.Log. These examples are extracted from open source projects.
Example 1
Project: android_external_MicroGUiTools   File: PermissionCheckGroup.java    License: Apache License 2.0 6 votes vote down vote up
private void doPermissionCheck(Context context, ResultCollector collector, final String permission) {
    PackageManager pm = context.getPackageManager();
    try {
        PermissionInfo info = pm.getPermissionInfo(permission, 0);
        PermissionGroupInfo groupInfo = info.group != null ? pm.getPermissionGroupInfo(info.group, 0) : null;
        CharSequence permLabel = info.loadLabel(pm);
        CharSequence groupLabel = groupInfo != null ? groupInfo.loadLabel(pm) : permLabel;
        collector.addResult(context.getString(R.string.self_check_name_permission, permLabel),
                context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED ? Positive : Negative,
                context.getString(R.string.self_check_resolution_permission, groupLabel),
                new SelfCheckGroup.CheckResolver() {

                    @Override
                    public void tryResolve(Fragment fragment) {
                        fragment.requestPermissions(new String[]{permission}, 0);
                    }
                });
    } catch (PackageManager.NameNotFoundException e) {
        Log.w(TAG, e);
    }
}
 
Example 2
Project: 600SeriesAndroidUploader   File: NightscoutUploadProcess.java    License: MIT License 6 votes vote down vote up
private int deleteTreatments(Response<List<TreatmentsEndpoints.Treatment>> response) throws Exception {
    cheanupCheckCount++;
    int result = 0;
    if (response.isSuccessful()) {
        List<TreatmentsEndpoints.Treatment> list = response.body();
        for (TreatmentsEndpoints.Treatment item : list) {
            cheanupDeleteCount++;
            Response<ResponseBody> responseBody = dataStore.isNightscoutUseQuery()
                    ? treatmentsEndpoints.deleteID(item.getCreated_at(), item.get_id()).execute()
                    : treatmentsEndpoints.deleteID(item.get_id()).execute();
            if (responseBody.isSuccessful()) {
                Log.d(TAG, String.format("deleted treatment ID: %s with KEY: %s MAC: %s DATE: %s QUERY: %s",
                        item.get_id(), item.getKey600(), item.getPumpMAC600(), item.getCreated_at(), dataStore.isNightscoutUseQuery()));
            } else {
                Log.d(TAG, "no DELETE response from nightscout site");
                return -1;
            }
            result++;
        }
    } else return -1;
    return result;
}
 
Example 3
Project: MobileInfo   File: SimCardInfo.java    License: Apache License 2.0 6 votes vote down vote up
static JSONObject getMobSimInfo(Context context) {
        SimCardBean simCardBean = new SimCardBean();
        try {
            simCardBean.setHaveCard(hasSimCard(context));
//            SimCardUtils.SimCardInfo simCardInfo = SimCardUtils.instance().getmSimCardInfo(context.getApplicationContext());
//            simCardBean.setSim1Imsi(simCardInfo.getSim1Imsi());
//            simCardBean.setSim2Imsi(simCardInfo.getSim2Imsi());
//            simCardBean.setOperator(getOperators(simCardInfo.getOperator(simSlotIndex)));
//            simCardBean.setSim1ImsiOperator(getOperators(simCardInfo.getSim1Imsi()));
//            simCardBean.setSim2ImsiOperator(getOperators(simCardInfo.getSim2Imsi()));

            MobCardUtils.mobGetCardInfo(context, simCardBean);


        } catch (Exception e) {
            Log.e(TAG, e.toString());
        }
        return simCardBean.toJSONObject();

    }
 
Example 4
Project: UpdogFarmer   File: SteamService.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Resume farming/idling
 */
private void resumeFarming() {
    if (paused || waiting) {
        return;
    }

    if (farming) {
        Log.i(TAG, "Resume farming");
        executor.execute(farmTask);
    } else if (currentGames.size() == 1) {
        Log.i(TAG, "Resume playing");
        new Handler(Looper.getMainLooper()).post(() -> idleSingle(currentGames.get(0)));
    } else if (currentGames.size() > 1) {
        Log.i(TAG, "Resume playing (multiple)");
        idleMultiple(currentGames);
    }
}
 
Example 5
Project: 600SeriesAndroidUploader   File: MasterService.java    License: MIT License 6 votes vote down vote up
private boolean checkUsbDevice() {
    if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_USB_HOST)) {
        Log.e(TAG, "Device does not support USB OTG");
        statusNotification.updateNotification(StatusNotification.NOTIFICATION.ERROR);
        UserLogMessage.send(mContext, UserLogMessage.TYPE.WARN, R.string.ul_usb__no_support);
        return false;
    }

    UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);

    if (usbManager == null) {
        Log.e(TAG, "USB connection error. mUsbManager == null");
        statusNotification.updateNotification(StatusNotification.NOTIFICATION.ERROR);
        UserLogMessage.send(mContext, UserLogMessage.TYPE.WARN, R.string.ul_usb__no_connection);
        return false;
    }

    if (UsbHidDriver.getUsbDevice(usbManager, MedtronicCnlService.USB_VID, MedtronicCnlService.USB_PID) == null) {
        Log.w(TAG, "USB connection error. Is the CNL plugged in?");
        statusNotification.updateNotification(StatusNotification.NOTIFICATION.ERROR);
        UserLogMessage.send(mContext, UserLogMessage.TYPE.WARN, R.string.ul_usb__no_connection);
        return false;
    }

    return true;
}
 
Example 6
Project: SimpleBluetoothLeTerminal   File: SerialSocket.java    License: MIT License 6 votes vote down vote up
@Override
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
    delegate.onDescriptorWrite(gatt, descriptor, status);
    if(canceled)
        return;
    if(descriptor.getCharacteristic() == readCharacteristic) {
        Log.d(TAG,"writing read characteristic descriptor finished, status="+status);
        if (status != BluetoothGatt.GATT_SUCCESS) {
            onSerialConnectError(new IOException("write descriptor failed"));
        } else {
            // onCharacteristicChanged with incoming data can happen after writeDescriptor(ENABLE_INDICATION/NOTIFICATION)
            // before confirmed by this method, so receive data can be shown before device is shown as 'Connected'.
            onSerialConnect();
            connected = true;
            Log.d(TAG, "connected");
        }
    }
}
 
Example 7
Project: esp-idf-provisioning-android   File: ESPDevice.java    License: Apache License 2.0 6 votes vote down vote up
private void getFullWiFiList() {

        Log.e(TAG, "Total count : " + totalCount + " and start index is : " + startIndex);

        if (totalCount < 4) {

            getWiFiScanList(0, totalCount);

        } else {

            int temp = totalCount - startIndex;

            if (temp > 0) {

                if (temp > 4) {
                    getWiFiScanList(startIndex, 4);
                } else {
                    getWiFiScanList(startIndex, temp);
                }

            } else {
                Log.d(TAG, "Nothing to do. Wifi list completed.");
                completeWifiList();
            }
        }
    }
 
Example 8
Project: android_9.0.0_r45   File: WallpaperService.java    License: Apache License 2.0 6 votes vote down vote up
void reportVisibility() {
    if (!mDestroyed) {
        mDisplayState = mDisplay == null ? Display.STATE_UNKNOWN : mDisplay.getState();
        boolean visible = mVisible && mDisplayState != Display.STATE_OFF;
        if (mReportedVisible != visible) {
            mReportedVisible = visible;
            if (DEBUG) Log.v(TAG, "onVisibilityChanged(" + visible
                    + "): " + this);
            if (visible) {
                // If becoming visible, in preview mode the surface
                // may have been destroyed so now we need to make
                // sure it is re-created.
                doOffsetsChanged(false);
                updateSurface(false, false, false);
            }
            onVisibilityChanged(visible);
        }
    }
}
 
Example 9
Project: android_9.0.0_r45   File: BluetoothMapClient.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Returns true if the specified Bluetooth device is connected.
 * Returns false if not connected, or if this proxy object is not
 * currently connected to the Map service.
 */
public boolean isConnected(BluetoothDevice device) {
    if (VDBG) Log.d(TAG, "isConnected(" + device + ")");
    final IBluetoothMapClient service = mService;
    if (service != null) {
        try {
            return service.isConnected(device);
        } catch (RemoteException e) {
            Log.e(TAG, e.toString());
        }
    } else {
        Log.w(TAG, "Proxy not attached to service");
        if (DBG) Log.d(TAG, Log.getStackTraceString(new Throwable()));
    }
    return false;
}
 
Example 10
Project: hayoou-wechat-export   File: MomentStatActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void shareToTimeLine() {
    generateShareImage();
    File file = new File(Config.EXT_DIR + "/share_image.jpg");
    try {
        Intent intent = new Intent();
        ComponentName comp = new ComponentName("com.tencent.mm",
                "com.tencent.mm.ui.tools.ShareToTimeLineUI");
        intent.setComponent(comp);
        intent.setAction("android.intent.action.SEND");
        intent.setType("image/*");
        //intent.setFlags(0x3000001);
        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
        startActivity(intent);
    } catch (Exception e) {
        Log.e("wechatmomentstat", "exception", e);
    }
}
 
Example 11
Project: LPR   File: FpsMeter.java    License: Apache License 2.0 6 votes vote down vote up
public void measure() {
    if (!mIsInitialized) {
        init();
        mIsInitialized = true;
    } else {
        mFramesCounter++;
        if (mFramesCounter % STEP == 0) {
            long time = Core.getTickCount();
            double fps = STEP * mFrequency / (time - mprevFrameTime);
            mprevFrameTime = time;
            if (mWidth != 0 && mHeight != 0)
                mStrfps = FPS_FORMAT.format(fps) + " [email protected]" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight);
            else
                mStrfps = FPS_FORMAT.format(fps) + " FPS";
            Log.i(TAG, mStrfps);
        }
    }
}
 
Example 12
Project: xDrip   File: Forecast.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setValues(double[] y, double[] x) {
    if (x.length != y.length) {
        throw new IllegalArgumentException(String.format("The numbers of y and x values must be equal (%d != %d)", y.length, x.length));
    }
    double[][] xData = new double[x.length][];
    for (int i = 0; i < x.length; i++) {
        // the implementation determines how to produce a vector of predictors from a single x
        xData[i] = xVector(x[i]);
    }
    if (logY()) { // in some models we are predicting ln y, so we replace each y with ln y
        y = Arrays.copyOf(y, y.length); // user might not be finished with the array we were given
        for (int i = 0; i < x.length; i++) {
            y[i] = Math.log(y[i]);
        }
    }
    final OLSMultipleLinearRegression ols = new OLSMultipleLinearRegression();
    ols.setNoIntercept(true); // let the implementation include a constant in xVector if desired
    ols.newSampleData(y, xData); // provide the data to the model
    coef = MatrixUtils.createColumnRealMatrix(ols.estimateRegressionParameters()); // get our coefs
    last_error_rate = ols.estimateErrorVariance();
    Log.d(TAG, getClass().getSimpleName() + " Forecast Error rate: errorvar:"
            + JoH.qs(last_error_rate, 4)
            + " regssionvar:" + JoH.qs(ols.estimateRegressandVariance(), 4)
            + "  stderror:" + JoH.qs(ols.estimateRegressionStandardError(), 4));
}
 
Example 13
Project: android_9.0.0_r45   File: PlaybackActivityMonitor.java    License: Apache License 2.0 6 votes vote down vote up
void addDuck(@NonNull AudioPlaybackConfiguration apc, boolean skipRamp) {
    final int piid = new Integer(apc.getPlayerInterfaceId());
    if (mDuckedPlayers.contains(piid)) {
        if (DEBUG) { Log.v(TAG, "player piid:" + piid + " already ducked"); }
        return;
    }
    try {
        sEventLogger.log((new DuckEvent(apc, skipRamp)).printLog(TAG));
        apc.getPlayerProxy().applyVolumeShaper(
                DUCK_VSHAPE,
                skipRamp ? PLAY_SKIP_RAMP : PLAY_CREATE_IF_NEEDED);
        mDuckedPlayers.add(piid);
    } catch (Exception e) {
        Log.e(TAG, "Error ducking player piid:" + piid + " uid:" + mUid, e);
    }
}
 
Example 14
Project: cythara   File: AndroidFFMPEGLocator.java    License: GNU General Public License v3.0 6 votes vote down vote up
private String getFFMPEGFileName(CPUArchitecture architecture){
    final String ffmpegFileName;
    switch (architecture){
        case X86:
            ffmpegFileName = "x86_ffmpeg";
            break;
        case ARMEABI_V7A:
            ffmpegFileName = "armeabi-v7a_ffmpeg";
            break;
        case ARMEABI_V7A_NEON:
            ffmpegFileName = "armeabi-v7a-neon_ffmpeg";
            break;
        default:
            ffmpegFileName = null;
            String message= "Could not determine your processor architecture correctly, no ffmpeg binary available.";
            Log.e(TAG,message);
            throw new Error(message);
    }
    return ffmpegFileName;
}
 
Example 15
Project: BiliShare   File: BaseQQShareHandler.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * 必须在主线程分享
 *
 * @param activity
 * @param params
 */
protected void doShareToQQ(final Activity activity, final Bundle params) {
    doOnMainThread(new Runnable() {
        @Override
        public void run() {
            Log.d(TAG, "real start share");
            postProgressStart();
            onShare(activity, mTencent, params, mUiListener);
            if (activity != null && !isMobileQQSupportShare(activity.getApplicationContext())) {
                Log.d(TAG, "qq has not install");
                String msg = activity.getString(R.string.bili_share_sdk_not_install_qq);
                Toast.makeText(activity, msg, Toast.LENGTH_SHORT).show();
                if (getShareListener() != null) {
                    getShareListener().onError(getShareMedia(), BiliShareStatusCode.ST_CODE_SHARE_ERROR_NOT_INSTALL, new ShareException(msg));
                }
            }
        }
    });
}
 
Example 16
Project: android-unicode   File: Utf7ImeService.java    License: MIT License 6 votes vote down vote up
@Override
public View onCreateInputView() {
    Log.d(TAG, "onCreateInputView()");
    View mInputView = getLayoutInflater().inflate(R.layout.keyboard, null);

    if (mReceiver == null) {
        IntentFilter filter = new IntentFilter(IME_MESSAGE);
        filter.addAction(IME_CHARS);
        filter.addAction(IME_KEYCODE);
        filter.addAction(IME_EDITORCODE);
        mReceiver = new AdbReceiver();
        registerReceiver(mReceiver, filter);
    }

    return mInputView; 
}
 
Example 17
Project: react-native-twilio-programmable-voice   File: TwilioVoiceModule.java    License: MIT License 6 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();
    if (action.equals(ACTION_INCOMING_CALL)) {
        if (BuildConfig.DEBUG) {
            Log.d(TAG, "VoiceBroadcastReceiver.onReceive ACTION_INCOMING_CALL. Intent "+ intent.getExtras());
        }
        handleIncomingCallIntent(intent);
    } else if (action.equals(ACTION_MISSED_CALL)) {
        SharedPreferences sharedPref = getReactApplicationContext().getSharedPreferences(PREFERENCE_KEY, Context.MODE_PRIVATE);
        SharedPreferences.Editor sharedPrefEditor = sharedPref.edit();
        sharedPrefEditor.remove(MISSED_CALLS_GROUP);
        sharedPrefEditor.commit();
    } else {
        Log.e(TAG, "received broadcast unhandled action " + action);
    }
}
 
Example 18
Project: android_9.0.0_r45   File: FragmentManager.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Marks a fragment as shown to be later animated in with
 * {@link #completeShowHideFragment(Fragment)}.
 *
 * @param fragment The fragment to be shown.
 */
public void showFragment(Fragment fragment) {
    if (DEBUG) Log.v(TAG, "show: " + fragment);
    if (fragment.mHidden) {
        fragment.mHidden = false;
        // Toggle hidden changed so that if a fragment goes through show/hide/show
        // it doesn't go through the animation.
        fragment.mHiddenChanged = !fragment.mHiddenChanged;
    }
}
 
Example 19
Project: monkeyboard-radio-android   File: RadioPlayerService.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onAdjustVolume(int direction) {
    super.onAdjustVolume(direction);
    if (direction != 0) {
        setPlayerVolume(getPlayerVolume() + direction);
        Log.v(TAG, "Volume adjusted: " + getPlayerVolume());
        notifyPlayerVolumeChanged(getPlayerVolume());
    }
}
 
Example 20
Project: polling-station-app   File: TesseractOCRTest.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Test
public void testOCRInputPassport2() throws Exception {
    Bitmap mrzImage = BitmapFactory.decodeStream(InstrumentationRegistry.getInstrumentation().getTargetContext().getAssets().open(image2));
    assertNotNull(mrzImage);
    double similarity = stringSimilarity(image2Result, tesseractOCR.ocr(mrzImage).getText());
    Log.e(TAG, "Similarity passport2: " + similarity);
    assertTrue(similarity > MINIMUM_ACCURACY);
}
 
Example 21
Project: IncDec   File: IncDecImageButton.java    License: Apache License 2.0 5 votes vote down vote up
/** Rx Java **/

    private void startIncrementObserver(){

        _Incrementsubscriber=new DisposableSubscriber<Long>() {

            @Override
            public void onNext(Long aLong) {
                if(isLeftButtonLongPressed||isRightButtonLongPressed) {
                    IncrementAction();
                }
                else
                    _Incrementsubscriber.dispose();

            }

            @Override
            public void onError(Throwable t) {
                Log.i(TAG,t.getMessage());
            }

            @Override
            public void onComplete() {

            }
        };

        Flowable.interval(0,seconds, TimeUnit.MILLISECONDS)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(_Incrementsubscriber);

    }
 
Example 22
Project: OpenYOLO-Android   File: CredentialPickerActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Log.i(LOG_TAG, "Picker invoked by " + getCallingPackage());

    setContentView(R.layout.credential_picker_layout);
    ButterKnife.bind(this);

    mCredentialView.setAdapter(new CredentialPickerAdapter(getCredentials()));
    mCredentialView.setLayoutManager(new LinearLayoutManager(this));
}
 
Example 23
Project: xDrip-plus   File: JoH.java    License: GNU General Public License v3.0 5 votes vote down vote up
public static boolean refreshDeviceCache(String thisTAG, BluetoothGatt gatt){
    try {
        final Method method = gatt.getClass().getMethod("refresh", new Class[0]);
        if (method != null) {
            return (Boolean) method.invoke(gatt, new Object[0]);
        }
    }
    catch (Exception e) {
        Log.e(thisTAG, "An exception occured while refreshing gatt device cache: "+e);
    }
    return false;
}
 
Example 24
Project: x5webview-cordova-plugin   File: X5WebViewEngine.java    License: Apache License 2.0 5 votes vote down vote up
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
    if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
        // Bug being that Java Strings do not get converted to JS strings automatically.
        // This isn't hard to work-around on the JS side, but it's easier to just
        // use the prompt bridge instead.
        return;
    }
    X5ExposedJsApi exposedJsApi = new X5ExposedJsApi(bridge);
    webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
 
Example 25
Project: MobileInfo   File: AudioBean.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected JSONObject toJSONObject() {
    try {
        jsonObject.put(BaseData.Aduio.MAX_VOICE_CALL, maxVoiceCall);
        jsonObject.put(BaseData.Aduio.MIN_VOICE_CALL, minVoiceCall);
        jsonObject.put(BaseData.Aduio.CURRENT_VOICE_CALL, currentVoiceCall);
        jsonObject.put(BaseData.Aduio.MAX_SYSTEM, maxSystem);
        jsonObject.put(BaseData.Aduio.MIN_SYSTEM, minSystem);
        jsonObject.put(BaseData.Aduio.CURRENT_SYSTEM, currentSystem);
        jsonObject.put(BaseData.Aduio.MAX_RING, maxRing);
        jsonObject.put(BaseData.Aduio.MIN_RING, minRing);
        jsonObject.put(BaseData.Aduio.CURRENT_RING, currentRing);
        jsonObject.put(BaseData.Aduio.MAX_MUSIC, maxMusic);
        jsonObject.put(BaseData.Aduio.MIN_MUSIC, minMusic);
        jsonObject.put(BaseData.Aduio.CURRENT_MUSIC, currentMusic);
        jsonObject.put(BaseData.Aduio.MAX_ALARM, maxAlarm);
        jsonObject.put(BaseData.Aduio.MIN_ALARM, minAlarm);
        jsonObject.put(BaseData.Aduio.CURRENT_ALARM, currentAlarm);
        jsonObject.put(BaseData.Aduio.MAX_NOTIFICATIONS, maxNotifications);
        jsonObject.put(BaseData.Aduio.MIN_NOTIFICATIONS, minNotifications);
        jsonObject.put(BaseData.Aduio.CURRENT_NOTIFICATIONS, currentNotifications);
        jsonObject.put(BaseData.Aduio.MAX_ACCESSIBILITY, maxAccessibility);
        jsonObject.put(BaseData.Aduio.MIN_ACCESSIBILITY, minAccessibility);
        jsonObject.put(BaseData.Aduio.CURRENT_ACCESSIBILITY, currentAccessibility);
        jsonObject.put(BaseData.Aduio.MAX_DTMF, maxDTMF);
        jsonObject.put(BaseData.Aduio.MIN_DTMF, minDTMF);
        jsonObject.put(BaseData.Aduio.CURRENT_DTMF, currentDTMF);


    } catch (Exception e) {
        Log.e(TAG, e.toString());
    }
    return super.toJSONObject();
}
 
Example 26
Project: Android-Bluetooth-Fingerprint   File: BluetoothService.java    License: Apache License 2.0 5 votes vote down vote up
public ConnectThread(BluetoothDevice device) {
    mmDevice = device;
    BluetoothSocket tmp = null;

    // Get a BluetoothSocket for a connection with the
    // given BluetoothDevice
    try {
        tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
    } catch (IOException e) {
        Log.e(TAG, "create() failed", e);
    }
    mmSocket = tmp;
}
 
Example 27
Project: wear-os-samples   File: InteractiveWatchFaceService.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onPeekCardPositionUpdate(Rect bounds) {
    super.onPeekCardPositionUpdate(bounds);
    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log.d(TAG, "onPeekCardPositionUpdate: " + bounds);
    }
    super.onPeekCardPositionUpdate(bounds);
    if (!bounds.equals(mCardBounds)) {
        mCardBounds.set(bounds);
        invalidate();
    }
}
 
Example 28
Project: letv   File: ItemTouchHelper.java    License: Apache License 2.0 5 votes vote down vote up
public void startDrag(ViewHolder viewHolder) {
    if (!this.mCallback.hasDragFlag(this.mRecyclerView, viewHolder)) {
        Log.e(TAG, "Start drag has been called but swiping is not enabled");
    } else if (viewHolder.itemView.getParent() != this.mRecyclerView) {
        Log.e(TAG, "Start drag has been called with a view holder which is not a child of the RecyclerView which is controlled by this ItemTouchHelper.");
    } else {
        obtainVelocityTracker();
        this.mDy = 0.0f;
        this.mDx = 0.0f;
        select(viewHolder, 2);
    }
}
 
Example 29
Project: Ezalor   File: LogUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static void logv(String tag, String msg) {
    if (disableAllLog()) {
        return;
    }
    Log.v(getCurrentAppTag() + POINT + tag, msg);
    saveLogIfNeeded(tag, msg, "V");
}
 
Example 30
Project: owt-client-android   File: ConferenceClientObserver.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onParticipantJoined(Participant participant) {
    Log.d(TAG, "onParticipantJoined.");
    userJoinedTriggered = true;
    TestObserver participantObserver = new TestObserver(this.name, participant.id);
    participant.addObserver(participantObserver);
    participants.add(participant);
    participantObservers.put(participant.id, participantObserver);
    onResult();
}
 
Example 31
Project: libcommon   File: AbstractEncoder.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * エラー発生時に呼び出す
 * @param e
 */
protected void callOnError(final Exception e) {
	try {
		mListener.onError(e);
      	} catch (final Exception e2) {
		Log.w(TAG, e2);
       }
}
 
Example 32
Project: GotoBrowser   File: BrowserGestureListener.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) {
    Log.e("GOTO", "onFling: ");
    Log.e("GOTO", event1.toString());
    Log.e("GOTO", event2.toString());
    Log.e("GOTO", velocityX + " " + velocityY);
    if (event1.getX() < 200 && velocityX > 2000) {
        browserPanel.setVisibility(View.VISIBLE);
        activity.setPanelVisibleValue(true);
    } else if (event1.getX() < 1500 && velocityX < -2000) {
        browserPanel.setVisibility(View.GONE);
        activity.setPanelVisibleValue(false);
    }
    return super.onFling(event1, event2, velocityX, velocityY);
}
 
Example 33
Project: letv   File: SlidingPaneLayout.java    License: Apache License 2.0 5 votes vote down vote up
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
    boolean result;
    LayoutParams lp = (LayoutParams) child.getLayoutParams();
    int save = canvas.save(2);
    if (!(!this.mCanSlide || lp.slideable || this.mSlideableView == null)) {
        canvas.getClipBounds(this.mTmpRect);
        if (isLayoutRtlSupport()) {
            this.mTmpRect.left = Math.max(this.mTmpRect.left, this.mSlideableView.getRight());
        } else {
            this.mTmpRect.right = Math.min(this.mTmpRect.right, this.mSlideableView.getLeft());
        }
        canvas.clipRect(this.mTmpRect);
    }
    if (VERSION.SDK_INT >= 11) {
        result = super.drawChild(canvas, child, drawingTime);
    } else if (!lp.dimWhenOffset || this.mSlideOffset <= 0.0f) {
        if (child.isDrawingCacheEnabled()) {
            child.setDrawingCacheEnabled(false);
        }
        result = super.drawChild(canvas, child, drawingTime);
    } else {
        if (!child.isDrawingCacheEnabled()) {
            child.setDrawingCacheEnabled(true);
        }
        Bitmap cache = child.getDrawingCache();
        if (cache != null) {
            canvas.drawBitmap(cache, (float) child.getLeft(), (float) child.getTop(), lp.dimPaint);
            result = false;
        } else {
            Log.e(TAG, "drawChild: child view " + child + " returned null drawing cache");
            result = super.drawChild(canvas, child, drawingTime);
        }
    }
    canvas.restoreToCount(save);
    return result;
}
 
Example 34
Project: CameraDemo   File: Camera2GLSurfaceView.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    mTextureId = OpenGLUtils.getExternalOESTextureID();
    mSurfaceTexture = new SurfaceTexture(mTextureId);
    mSurfaceTexture.setOnFrameAvailableListener(this);
    mCameraProxy.setPreviewSurface(mSurfaceTexture);
    mDrawer = new CameraDrawer();
    Log.d(TAG, "onSurfaceCreated. width: " + getWidth() + ", height: " + getHeight());
    mCameraProxy.openCamera(getWidth(), getHeight());
}
 
Example 35
Project: android_9.0.0_r45   File: Vpn.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onReceive(Context context, Intent intent) {
    final Uri data = intent.getData();
    final String packageName = data == null ? null : data.getSchemeSpecificPart();
    if (packageName == null) {
        return;
    }

    synchronized (Vpn.this) {
        // Avoid race where always-on package has been unset
        if (!packageName.equals(getAlwaysOnPackage())) {
            return;
        }

        final String action = intent.getAction();
        Log.i(TAG, "Received broadcast " + action + " for always-on VPN package "
                + packageName + " in user " + mUserHandle);

        switch(action) {
            case Intent.ACTION_PACKAGE_REPLACED:
                // Start vpn after app upgrade
                startAlwaysOnVpn();
                break;
            case Intent.ACTION_PACKAGE_REMOVED:
                final boolean isPackageRemoved = !intent.getBooleanExtra(
                        Intent.EXTRA_REPLACING, false);
                if (isPackageRemoved) {
                    setAlwaysOnPackage(null, false);
                }
                break;
        }
    }
}
 
Example 36
Project: TikTok   File: AnimationEngine.java    License: Apache License 2.0 5 votes vote down vote up
public void startTogetherByLink(Animator.AnimatorListener listener, AnimatorValue...animatorValues){
	if(animationSet==null){
		Log.d(TAG, "δ�ܳ�ʼ��");
		return;
	}
	animationSet.removeAllListeners();
	if(listener!=null){
		animationSet.addListener(listener);
	}
	if (animatorValues != null) {
		AnimatorSet.Builder lastBuilder=null;
           for (int i = 0; i < animatorValues.length; i++) {
           	AnimatorSet.Builder curBuilder = animationSet.play(animatorValues[i].getAnimator());
               if(animatorValues[i].getBeforeAnimator()!=null){
               	curBuilder.after(animatorValues[i].getBeforeAnimator());
               }else if(lastBuilder!=null){
               	lastBuilder.with(animatorValues[i].getAnimator());		
               }
               	lastBuilder=curBuilder;
           }
       }else{
       	Log.d(TAG, "���������ǿ�");
		return;
       }
	//animationSet.setDuration(duration/animatorValues.length);
	animationSet.setInterpolator(interpolator);
	animationSet.start();
}
 
Example 37
Project: TextOcrExample   File: MainActivity.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 获取Camera实例
 */
private Camera getCamera(int id) {
    Camera camera = null;
    try {
        camera = Camera.open(id);
    } catch (Exception e) {
        Log.d(this.getClass().getSimpleName(), e.toString());
    }
    return camera;
}
 
Example 38
Project: bridgefy-android-samples   File: DevicesActivity.java    License: MIT License 5 votes vote down vote up
@Override
public void onRegistrationFailed(int errorCode, String message) {
    Log.e(TAG, "onRegistrationFailed: failed with ERROR_CODE: " + errorCode + ", MESSAGE: " + message);
    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast.makeText(DevicesActivity.this, "Bridgefy registration did not succeed.", Toast.LENGTH_LONG).show();
        }
    });
}
 
Example 39
Project: LiTr   File: TrackTranscoderException.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
@NonNull
private String convertMediaCodecInfoToString(@NonNull MediaCodec mediaCodec) {
    try {
        return convertMediaCodecInfoToString(mediaCodec.getCodecInfo());
    } catch (IllegalStateException e) {
        Log.e(TAG, "Failed to retrieve media codec info.");
    }
    return "";
}
 
Example 40
Project: FaceFilter   File: FaceFilterActivity.java    License: MIT License 5 votes vote down vote up
/**
 * Callback for the result from requesting permissions. This method
 * is invoked for every call on {@link #requestPermissions(String[], int)}.
 * <p>
 * <strong>Note:</strong> It is possible that the permissions request interaction
 * with the user is interrupted. In this case you will receive empty permissions
 * and results arrays which should be treated as a cancellation.
 * </p>
 *
 * @param requestCode  The request code passed in {@link #requestPermissions(String[], int)}.
 * @param permissions  The requested permissions. Never null.
 * @param grantResults The grant results for the corresponding permissions
 *                     which is either {@link PackageManager#PERMISSION_GRANTED}
 *                     or {@link PackageManager#PERMISSION_DENIED}. Never null.
 * @see #requestPermissions(String[], int)
 */
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    if (requestCode != RC_HANDLE_CAMERA_PERM) {
        Log.d(TAG, "Got unexpected permission result: " + requestCode);
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        return;
    }

    if (grantResults.length != 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
        Log.d(TAG, "Camera permission granted - initialize the camera source");
        // we have permission, so create the camerasource
        createCameraSource();
        return;
    }

    Log.e(TAG, "Permission not granted: results len = " + grantResults.length +
            " Result code = " + (grantResults.length > 0 ? grantResults[0] : "(empty)"));

    DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            finish();
        }
    };

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Face Tracker sample")
            .setMessage(R.string.no_camera_permission)
            .setPositiveButton(R.string.ok, listener)
            .show();
}