Java Code Examples for android.util.Log.i()

The following are Jave code examples for showing how to use i() of the android.util.Log class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: LueansRead   File: GankPresenterImpl.java   View Source Code Vote up 6 votes
@Override
public void onSuccess(boolean isTop, GankBean data) {
    Log.i(TAG, "onSuccess: ----------------------------------");
    if (isTop) {
        mView.setRefreshData(data);
    } else {
        mView.setMoreGankData(data);
    }
    Observable.timer(2, TimeUnit.SECONDS)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Action1<Long>() {
                @Override
                public void call(Long aLong) {
                    mView.hideLoading();
                }
            });
}
 
Example 2
Project: TinyPlanetMaker   File: FpsMeter.java   View Source Code Vote up 6 votes
public void measure() {
    if (!mIsInitialized) {
        init();
        mIsInitialized = true;
    } else {
        mFramesCouner++;
        if (mFramesCouner % 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 3
Project: react-native-pili-live   File: PiliStreamingViewManager.java   View Source Code Vote up 6 votes
@Override
public boolean onSingleTapUp(MotionEvent e) {
    Log.i(TAG, "onSingleTapUp X:" + e.getX() + ",Y:" + e.getY());

    if (mIsReady && focus) {
        setFocusAreaIndicator();
        try {
            mMediaStreamingManager.doSingleTapUp((int) e.getX(), (int) e.getY());
        } catch (Exception ex) {
            Log.e(TAG, ex.getMessage());
        }

        return true;
    }
    return false;
}
 
Example 4
Project: MKAPP   File: ActivityLog.java   View Source Code Vote up 6 votes
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String name) {
    Log.i(TAG, "Preference " + name + "=" + prefs.getAll().get(name));
    if ("log".equals(name)) {
        // Get enabled
        boolean log = prefs.getBoolean(name, false);

        // Display disabled warning
        TextView tvDisabled = (TextView) findViewById(R.id.tvDisabled);
        tvDisabled.setVisibility(log ? View.GONE : View.VISIBLE);

        // Check switch state
        SwitchCompat swEnabled = (SwitchCompat) getSupportActionBar().getCustomView().findViewById(R.id.swEnabled);
        if (swEnabled.isChecked() != log)
            swEnabled.setChecked(log);

        ServiceSinkhole.reload("changed " + name, ActivityLog.this);
    }
}
 
Example 5
Project: letv   File: LetvUtils.java   View Source Code Vote up 5 votes
private static String dealDotZero(BigDecimal bd) {
    String origString = bd + "";
    Log.i("fornia", "check size origString:" + origString);
    String result = origString;
    if (origString.indexOf(".") > 0) {
        return origString.replaceAll("0+?$", "").replaceAll("[.]$", "");
    }
    return result;
}
 
Example 6
Project: android-ponewheel   File: OWDevice.java   View Source Code Vote up 5 votes
public void processUnknownUuid(String incomingUuid, byte[] incomingValue) {
    StringBuilder sb = new StringBuilder();
    for (byte b : incomingValue) {
        sb.append(String.format("%02x", b));
    }
    //this.unknownUUID.set(c_uuid);
    //this.unknownValue.set("hex:" + sb.toString() + " (" + Integer.toString(unsignedShort(c_value)) + ")");
    EventBus.getDefault().post(new DeviceStatusEvent("UNKNOWN " + incomingUuid + ":" +
            "hex:" + sb.toString() + " (" + Integer.toString(unsignedShort(incomingValue)) + ")"));
    Log.i(TAG, "UNKNOWN Device characteristic:" + incomingUuid + " value=" + sb.toString() + "|" + Integer.toString(unsignedShort(incomingValue)));
}
 
Example 7
Project: accelerator-sample-apps-android   File: MainActivity.java   View Source Code Vote up 5 votes
@Override
public void onRemoteViewDestroyed(OTWrapper otWrapper, View remoteView, String remoteId) throws ListenerException {
    Log.i(LOG_TAG, "Remote view is destroyed");
    if (remoteId == mScreenRemoteId) {
        mScreenRemoteId = null;
        removeRemoteScreenSharing();
    } else {
        removeParticipant(Participant.Type.REMOTE, remoteId);
    }
}
 
Example 8
Project: black-mirror   File: HomePresenter.java   View Source Code Vote up 5 votes
/**
 * Metoda wywoływana kiedy rozpoznana zostanie komenda pokazania widżetu wiadomości.
 * Pokazuje widżet.
 */
@Override
public void onShowNewsCommandRecognized() {
    Log.i(TAG, "Text command interpreter recognized show all news command.");
    callPolsatNews();
    callTvnNews();
}
 
Example 9
Project: boohee_v5.6   File: MultiDexExtractor.java   View Source Code Vote up 5 votes
private static void extract(ZipFile apk, ZipEntry dexFile, File extractTo, String extractedFilePrefix) throws IOException, FileNotFoundException {
    Throwable th;
    InputStream in = apk.getInputStream(dexFile);
    File tmp = File.createTempFile(extractedFilePrefix, EXTRACTED_SUFFIX, extractTo.getParentFile());
    Log.i(TAG, "Extracting " + tmp.getPath());
    try {
        ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(tmp)));
        try {
            ZipEntry classesDex = new ZipEntry("classes.dex");
            classesDex.setTime(dexFile.getTime());
            out.putNextEntry(classesDex);
            byte[] buffer = new byte[16384];
            for (int length = in.read(buffer); length != -1; length = in.read(buffer)) {
                out.write(buffer, 0, length);
            }
            out.closeEntry();
            out.close();
            Log.i(TAG, "Renaming to " + extractTo.getPath());
            if (tmp.renameTo(extractTo)) {
                closeQuietly(in);
                tmp.delete();
                return;
            }
            throw new IOException("Failed to rename \"" + tmp.getAbsolutePath() + "\" to \"" + extractTo.getAbsolutePath() + a.e);
        } catch (Throwable th2) {
            th = th2;
            ZipOutputStream zipOutputStream = out;
            closeQuietly(in);
            tmp.delete();
            throw th;
        }
    } catch (Throwable th3) {
        th = th3;
        closeQuietly(in);
        tmp.delete();
        throw th;
    }
}
 
Example 10
Project: Sense-Hub-Android-Things   File: MqttIoTPublisher.java   View Source Code Vote up 5 votes
private void initializeMqttClient()
    throws MqttException, IOException, NoSuchAlgorithmException, InvalidKeySpecException {

    mqttClient = new MqttClient(mMqttOptions.getBrokerUrl(),
            mMqttOptions.getClientId(), new MemoryPersistence());

    MqttConnectOptions options = new MqttConnectOptions();
    // Note that the the Google Cloud IoT only supports MQTT 3.1.1, and Paho requires that we
    // explicitly set this. If you don't set MQTT version, the server will immediately close its
    // connection to your device.
    options.setMqttVersion(MqttConnectOptions.MQTT_VERSION_3_1_1);
    options.setUserName(CloudIotCoreOptions.UNUSED_ACCOUNT_NAME);
    options.setAutomaticReconnect(true);

    // generate the jwt password
    options.setPassword(mqttAuth.createJwt(mMqttOptions.getProjectId()));

    mqttClient.setCallback(this);
    mqttClient.connect(options);

    if(mqttClient.isConnected()) {
        try{
            mSubTopic = "/devices/sense_hub_2.0_android_things/config";// + NetworkUtils.getMACAddress(mContext);
            Log.i(TAG, "initializeMqttClient subscribe topic=" + mSubTopic);
            mqttClient.subscribe(mSubTopic, 1);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    mReady.set(true);
}
 
Example 11
Project: ROKOmoji.Emoji.Keyboard.App-Android   File: Stickers.java   View Source Code Vote up 5 votes
private File downloadFile(String url, String localeFileName) {
    final File outputFile = new File(KeyboardService.imagesDir, localeFileName);
    if (outputFile.exists()) {
        return outputFile;
    }
    try {
        InputStream resourceReader = (InputStream) new URL(url).getContent();
        final byte[] buffer = new byte[4096];
        OutputStream dataWriter = new FileOutputStream(outputFile);
        try {
            while (true) {
                final int numRead = resourceReader.read(buffer);
                if (numRead <= 0) {
                    break;
                }
                dataWriter.write(buffer, 0, numRead);
            }
            if (outputFile.length() > 0) {
                Log.i(TAG, "load file: " + outputFile.getName() + ": " + outputFile.length() + " bytes");
                return outputFile;
            } else {
                outputFile.delete();
                return null;
            }
        } finally {
            if (dataWriter != null) {
                dataWriter.flush();
                dataWriter.close();
            }
            if (resourceReader != null) {
                resourceReader.close();
            }
        }

    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}
 
Example 12
Project: Android-Music-Player   File: musicHandler.java   View Source Code Vote up 5 votes
public void addSongsNext(int[] Id) {
	String str = "";
	for(int i = 0;i < Id.length;i++){
		Log.i("My","ADD NEXT : " + Id[i]) ;
		str += MediaStore.Audio.Media._ID + " = " + Id[i];
		if(Id.length-1 != i){
			str += " OR ";
		}
	}

	String[] projection = {MediaStore.Audio.Media.TITLE,MediaStore.Audio.Media._ID,MediaStore.Audio.Media.DURATION};
	Cursor DataCursor = Gh.getContentResolver().query(
			MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection,
			str, null, MediaStore.Audio.Media.TITLE +" COLLATE NOCASE ASC ");
	int from = PID + 1;
	if(PID == 0  || PID == -1){
		from = list.size();
	}
	while (DataCursor.moveToNext()) {
		list.add(from,new String[] {DataCursor.getString(0),DataCursor.getString(1),DataCursor.getString(2),""});
		from++;
	}

	DataCursor.close();

	mEvent.trigger(playerEvents.SONGS_ADDED);

	playlist.save(list, playlist.listName);
}
 
Example 13
Project: CS4160-trustchain-android   File: Communication.java   View Source Code Vote up 5 votes
/**
 * Send a crawl request to the peer.
 * @param peer The peer.
 * @param publicKey Public key of me.
 * @param seqNum Requested sequence number.
 */
public void sendCrawlRequest(Peer peer, byte[] publicKey, int seqNum) {
    int sq = seqNum;
    if (seqNum == 0) {
        MessageProto.TrustChainBlock block = dbHelper.getBlock(publicKey,
                dbHelper.getMaxSeqNum(publicKey));
        if (block != null) {
            sq = block.getSequenceNumber();
        } else {
            sq = GENESIS_SEQ;
        }
    }

    if (sq >= 0) {
        sq = Math.max(GENESIS_SEQ, sq);
    }

    Log.i(TAG, "Requesting crawl of node " + bytesToHex(publicKey) + ":" + sq);

    MessageProto.CrawlRequest crawlRequest =
            MessageProto.CrawlRequest.newBuilder()
                    .setPublicKey(ByteString.copyFrom(getMyPublicKey()))
                    .setRequestedSequenceNumber(sq)
                    .setLimit(100).build();

    // send the crawl request
    MessageProto.Message message = newBuilder().setCrawlRequest(crawlRequest).build();

    listener.updateLog("Sending crawl request to " + peer.getName() + "\n");
    sendMessage(peer, message);
}
 
Example 14
Project: android-fido   File: CustomItemAnimator.java   View Source Code Vote up 4 votes
@Override
public void endAnimations() {
    Log.i(TAG, "endAnimations");
}
 
Example 15
Project: MuslimMateAndroid   File: PrayingFragment.java   View Source Code Vote up 4 votes
private void checkActiveView() {
    if (fajrDate == null || sunriseDate == null || duhrDate == null || asrDate == null || maghrebDate == null || ishaDate == null) return;
    removeActiveViews();
    Date current = Calendar.getInstance().getTime();



    if (current.after(fajrDate) && current.before(sunriseDate)){
        pray2.setBackgroundColor(Color.argb(255, 73, 138, 127));
        nextPray = getString(R.string.sunrise);
        lastDate = fajrDate;
        nextDate = sunriseDate;
    }else if (current.after(sunriseDate) && current.before(duhrDate)){
        pray3.setBackgroundColor(Color.argb(255, 73, 138, 127));
        nextPray = getString(R.string.zuhr);
        lastDate = sunriseDate;
        nextDate = duhrDate;
    }else if (current.after(duhrDate) && current.before(asrDate)){
        pray4.setBackgroundColor(Color.argb(255, 73, 138, 127));
        nextPray = getString(R.string.asr);
        lastDate = duhrDate;
        nextDate = asrDate;
    }else if (current.after(asrDate) && current.before(maghrebDate)){
        pray5.setBackgroundColor(Color.argb(255, 73, 138, 127));
        nextPray = getString(R.string.magrib);
        lastDate = asrDate;
        nextDate = maghrebDate;
    }else if (current.after(maghrebDate) && current.before(ishaDate)){
        pray6.setBackgroundColor(Color.argb(255, 73, 138, 127));
        nextPray = getString(R.string.isha);
        lastDate = maghrebDate;
        nextDate = ishaDate;
    }else {

        if (current.after(midNightDate) && current.before(fajrDate)){
            lastDate = getPrayerforPreviousDay().get()[5];
            nextDate = fajrDate;
        }else {

            lastDate = ishaDate;
            nextDate = getPrayerforNextDay().get()[0];
        }
        pray1.setBackgroundColor(Color.argb(255, 73, 138, 127));
        nextPray = getString(R.string.fajr);


    }

    salahNow.setText(NumbersLocal.convertNumberType(getContext(), nextPray + " " + format.format(nextDate)));


    Log.i("DATE_TAg" ,"last : "+format.format(lastDate));
    Log.i("DATE_TAg" ,"current : "+format.format(current));
    Log.i("DATE_TAg" ,"end : "+format.format(nextDate));



    updateTimer(current);

}
 
Example 16
Project: notify-me   File: SpeechListener.java   View Source Code Vote up 4 votes
@Override
public void onBeginningOfSpeech() {
    Log.i(TAG, "onBeginningOfSpeech: ");
    Message message = mHandler.obtainMessage(SUCCESS, "BeginningOfSpeech");
    mHandler.sendMessage(message);
}
 
Example 17
Project: weex-3d-map   File: DecodeThread.java   View Source Code Vote up 4 votes
DecodeThread(CaptureActivity activity,
             Collection<BarcodeFormat> decodeFormats,
             Map<DecodeHintType,?> baseHints,
             String characterSet,
             ResultPointCallback resultPointCallback) {

  this.activity = activity;
  handlerInitLatch = new CountDownLatch(1);

  hints = new EnumMap<>(DecodeHintType.class);
  if (baseHints != null) {
    hints.putAll(baseHints);
  }

  // The prefs can't change while the thread is running, so pick them up once here.
  if (decodeFormats == null || decodeFormats.isEmpty()) {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    decodeFormats = EnumSet.noneOf(BarcodeFormat.class);
    if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D_PRODUCT, true)) {
      decodeFormats.addAll(DecodeFormatManager.PRODUCT_FORMATS);
    }
    if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_1D_INDUSTRIAL, true)) {
      decodeFormats.addAll(DecodeFormatManager.INDUSTRIAL_FORMATS);
    }
    if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_QR, true)) {
      decodeFormats.addAll(DecodeFormatManager.QR_CODE_FORMATS);
    }
    if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_DATA_MATRIX, true)) {
      decodeFormats.addAll(DecodeFormatManager.DATA_MATRIX_FORMATS);
    }
    if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_AZTEC, false)) {
      decodeFormats.addAll(DecodeFormatManager.AZTEC_FORMATS);
    }
    if (prefs.getBoolean(PreferencesActivity.KEY_DECODE_PDF417, false)) {
      decodeFormats.addAll(DecodeFormatManager.PDF417_FORMATS);
    }
  }
  hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);

  if (characterSet != null) {
    hints.put(DecodeHintType.CHARACTER_SET, characterSet);
  }
  hints.put(DecodeHintType.NEED_RESULT_POINT_CALLBACK, resultPointCallback);
  Log.i("DecodeThread", "Hints: " + hints);
}
 
Example 18
Project: DoApp   File: FuzzerService.java   View Source Code Vote up 4 votes
@Override
protected void onHandleIntent(Intent intent) {
    if (intent != null) {

        //estraggo il nome dell'app su cui fare fuzzing
        String pkgname = intent.getStringExtra(Commons.pkgName);
        if(pkgname!=null && !pkgname.isEmpty()) {

            Log.i("DoAppLOG", "Start fuzzing to "+pkgname);

            //pulisco il logcat
            UnixCommands.killAll("logcat");
            UnixCommands.clearLogCat();


            fuzz(pkgname);


            SystemClock.sleep(100);

            //avvio l'activity finale

            if(crashedComponents.size()>0) {

                //condivido i reports con tutta l'applicazione
                GlobalClass.reports = results;

                //avvio l'activity per mostrare i risultati
                Intent intentResult = new Intent(this, CrashedListActivity.class);
                intentResult.putStringArrayListExtra("crashedComponents", (ArrayList<String>) crashedComponents);
                intentResult.putExtra("numberCrashedComponents", crashedComponents.size());
                intentResult.putExtra("numberTotalComponents", totalComponents);
                intentResult.putExtra(Commons.pathFile, pathFile);
                intentResult.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intentResult);
            }
            else{
                Intent end = new Intent(this, EndActivity.class);
                end.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                end.putExtra(Commons.pathFile, pathFile);
                startActivity(end);
            }
        }
    }
}
 
Example 19
Project: OpenCV   File: CameraGLSurfaceView.java   View Source Code Vote up 4 votes
@Override
public void onResume() {
    Log.i(LOGTAG, "onResume");
    super.onResume();
    mRenderer.onResume();
}
 
Example 20
Project: low-battery-alert   File: BatteryLevelReceiver.java   View Source Code Vote up 4 votes
@Override
public void onReceive(Context context, Intent intent) {

    preferences = PreferenceManager.getDefaultSharedPreferences(context);

    Intent batteryStatusIntent = context.getApplicationContext()
            .registerReceiver(null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
    int level = batteryStatusIntent.getIntExtra("level", 0);
    //Toast.makeText(context, preferences.getString("batterylevel", null) + "-" + level, Toast.LENGTH_SHORT).show();
    if (preferences.getString("batterylevel", null) != null) {

        sms_status = preferences.getBoolean("sms_status", false);
        Log.i("1.sms_status=", "" + sms_status);
        //Toast.makeText(context, level + "-" + sms_status + "-" + preferences.getString("batterylevel", null), Toast.LENGTH_SHORT).show();
        if ((Integer.parseInt(preferences.getString("batterylevel", null)) > level) && sms_status) {
            sms_status = false;
            editor = preferences.edit();
            editor.putBoolean("sms_status", false);
            editor.apply();
        }
        if (level > (Integer.parseInt(preferences.getString("batterylevel", null)))) {
            sms_status = false;
            editor = preferences.edit();
            editor.putBoolean("sms_status", false);
            editor.apply();
        }
        Log.i("2.sms_status=", "" + sms_status);

        String switchCompat = preferences.getString("radio_btn", null);
        if ((level == Integer.parseInt(preferences.getString("batterylevel", null))) && !sms_status) {
            if (switchCompat.equalsIgnoreCase("on")) {
                Log.i("switchCompat=", preferences.getString("radio_btn", null));
                Log.i("batterylevel=", preferences.getString("batterylevel", null));
                Log.i("level=", "" + level);

                if (level == Integer.parseInt(preferences.getString("batterylevel", null))) {

                    int size = preferences.getInt("phno_size", 0);
                    Log.i("batterylevel=", size + "--" + Integer.parseInt(preferences.getString("batterylevel", null)));
                    if (preferences.getBoolean("notify_bool", false)) {
                        notification(context);
                    } else {
                        if (size != 0) {
                            SmsManager smsManager = SmsManager.getDefault();
                            for (int i = 0; i < size; i++) {
                                String msg = preferences.getString("alert_msg", null);
                                String phno1 = preferences.getString("phno_size" + i, null);
                                smsManager.sendTextMessage(phno1, null, msg, null, null);

                            }
                            sms_status = true;
                            editor = preferences.edit();
                            editor.putBoolean("sms_status", true);
                            editor.apply();

                            Toast.makeText(context, "SMS send successfully", Toast.LENGTH_SHORT).show();


                        } else {
                            Toast.makeText(context, "Please add Contacts", Toast.LENGTH_SHORT).show();
                        }


                    }

                }
            }
        }
    }


}