Java 类android.util.Log 实例源码

项目:keepass2android    文件:BaseFileAdapter.java   
@Override
public boolean onTouch(View v, MotionEvent event) {
    if (Utils.doLog())
        Log.d(CLASSNAME,
                "mImageIconOnTouchListener.onTouch() >> ACTION = "
                        + event.getAction());

    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
        v.setBackgroundResource(R.drawable.afc_image_button_dark_pressed);
        break;
    case MotionEvent.ACTION_UP:
    case MotionEvent.ACTION_CANCEL:
        v.setBackgroundResource(0);
        break;
    }
    return false;
}
项目:RoundChoiceView    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    rippleChoiceView = (RoundChoiceView) findViewById(R.id.choicview);
    rippleChoiceView.setEnabled(false);
    RoundChoiceView rippleChoiceView2 = (RoundChoiceView) findViewById(R.id.choicview2);
    rippleChoiceView2.setOnCheckedChangeListener(new RoundChoiceView.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RoundChoiceView view, boolean isChecked) {
            Log.i("onCheckedChanged", "onCheckedChanged:" + isChecked);
            Toast.makeText(getApplicationContext(), "isChecked:"+isChecked, Toast.LENGTH_SHORT).show();
        }
    });
    handler.postDelayed(runnable, 2000);
}
项目:face-landmark-android    文件:CameraUtils.java   
private static Size chooseOptimalSize(
        final Size[] choices, final int width, final int height, final Size aspectRatio) {
    // Collect the supported resolutions that are at least as big as the preview Surface
    final List<Size> bigEnough = new ArrayList<>();
    for (final Size option : choices) {
        if (option.getHeight() >= MINIMUM_PREVIEW_SIZE && option.getWidth() >= MINIMUM_PREVIEW_SIZE) {
            Log.i(TAG, "Adding size: " + option.getWidth() + "x" + option.getHeight());
            bigEnough.add(option);
        } else {
            Log.i(TAG, "Not adding size: " + option.getWidth() + "x" + option.getHeight());
        }
    }

    // Pick the smallest of those, assuming we found any
    if (bigEnough.size() > 0) {
        final Size chosenSize = Collections.min(bigEnough, new CompareSizesByArea());
        Log.i(TAG, "Chosen size: " + chosenSize.getWidth() + "x" + chosenSize.getHeight());
        return chosenSize;
    } else {
        Log.e(TAG, "Couldn't find any suitable preview size");
        return choices[0];
    }
}
项目:BlogBookApp    文件:WebSocket.java   
/**
 * Starts a new Thread and connects to server
 *
 * @throws IOException
 */
public Thread connect() throws IOException {
    this.running = true;
    this.readyState = WEBSOCKET_STATE_CONNECTING;
    // open socket
    socketChannel = SocketChannel.open();
    socketChannel.configureBlocking(false);
    // set address
    socketChannel.connect(new InetSocketAddress(uri.getHost(), port));
    // start a thread to make connection

    // More info:
    // http://groups.google.com/group/android-developers/browse_thread/thread/45a8b53e9bf60d82
    // http://stackoverflow.com/questions/2879455/android-2-2-and-bad-address-family-on-socket-connect
    System.setProperty("java.net.preferIPv4Stack", "true");
    System.setProperty("java.net.preferIPv6Addresses", "false");

    selector = Selector.open();
    socketChannel.register(selector, SelectionKey.OP_CONNECT);
    Log.v("websocket", "Starting a new thread to manage data reading/writing");

    Thread th = new Thread(this);
    th.start();
    // return thread object for explicit closing, if needed
    return th;
}
项目:mtoolbox    文件:HongBaoService.java   
private void getAllHongBao(AccessibilityNodeInfo info){
    runState=true;
    Log.i(TAG,"获取所有红包");
    time=System.currentTimeMillis();
    List<AccessibilityNodeInfo> list=new ArrayList<AccessibilityNodeInfo>();
    //查找出当前页面所有的红包,包括手气红包和口令红包
    for(String word:QQ_KEYWORD_HONGBAO){
        List<AccessibilityNodeInfo> infolist  = info.findAccessibilityNodeInfosByText(word);
        if(!infolist.isEmpty()){
            for(AccessibilityNodeInfo node:infolist){
                //这里进行过滤可点击的红包,放到后面去过滤的话感觉非常操蛋
                if(node.getText()==null||
                    //过滤出包含关键字的节点,只取和关键字相同的
                    !node.getText().toString().equals(word)||
                    /**
                     * 下面这个条件是过滤已拆开的红包
                     * 如果口令红包的口令设置成"口令红包"
                     * 会让插件陷入死循环,所以必须加个新的判断条件
                     * 不过这样会耗费更多的时间,所以口令尽量不要设置成关键字
                     */
                    node.getParent().getChildCount()!=3||
                   !node.getParent().findAccessibilityNodeInfosByText(CAIKAI).isEmpty()||
                   !node.getParent().findAccessibilityNodeInfosByText(CHAKANXIANGQING).isEmpty())
                continue;
                list.add(node);
            }
        }
    }
    if(list.size()==0) {
        runState=false;
        return ;
    }
    Toast.makeText(this,"连续抢到红包数量:"+list.size(),1000).show();
    clickAction(list);
}
项目:Sense-Hub-Android-Things    文件:nRF51822SensorEntity.java   
@Override
public void updateData() {
    mIsConnecting = true;
    BluetoothDevice device = BLEManager.instance.getBleAdapter().getRemoteDevice(getMacAddress());
    mGatt = device.connectGatt(BLEManager.instance.getContext(), false, mGattCallback);
    if(mGatt == null){
        Log.d(mTAG, "Can't connect to " + getMacAddress());
        mIsConnecting = false;
    }
    else{
        while(mIsConnecting){
            try{
                Thread.sleep(500);
            }catch (Exception e){

            }
        }
    }
}
项目:FordOpenXCHackathon    文件:MainActivity.java   
public void onServiceConnected(ComponentName className, IBinder service) {
    Log.i(TAG, "Bound to VehicleManager");
    // When the VehicleManager starts up, we store a reference to it
    // here in "mVehicleManager" so we can call functions on it
    // elsewhere in our code.
    mVehicleManager = ((VehicleManager.VehicleBinder) service)
            .getService();

    // We want to receive updates whenever the EngineSpeed changes. We
    // have an EngineSpeed.Listener (see above, mSpeedListener) and here
    // we request that the VehicleManager call its receive() method
    // whenever the EngineSpeed changes
    mVehicleManager.addListener(EngineSpeed.class, mSpeedListener);
    mVehicleManager.addListener(VehicleSpeed.class, mVehicleSpeedListener);
    //mVehicleManager.addListener(Longitude.class,longitudeListener);
    //mVehicleManager.addListener(Latitude.class,latitudeListener);

    setConnectionState(openXcState, true);


}
项目:My-Android-Base-Code    文件:HtmlTagHandler.java   
@Override
public void handleTag(final boolean opening, final String tag, Editable output, final XMLReader xmlReader) {

    if (tag.equals("ul") || tag.equals("ol") || tag.equals("dd")) {
        if (opening) {
            mListParents.add(tag);
        } else mListParents.remove(tag);

        mListItemCount = 0;
    } else if (tag.equals("li") && !opening) {
        handleListTag(output);
    }
    else if(tag.equalsIgnoreCase("code")) {
        if(opening) {
            output.setSpan(new TypefaceSpan("monospace"), output.length(), output.length(), Spannable.SPAN_MARK_MARK);
        } else {
            Log.d("COde Tag","Code tag encountered");
            Object obj = getLast(output, TypefaceSpan.class);
            int where = output.getSpanStart(obj);

            output.setSpan(new TypefaceSpan("monospace"), where, output.length(), 0);
        }
    }

}
项目:Cable-Android    文件:AudioCodec.java   
private MediaCodec createMediaCodec(int bufferSize) throws IOException {
  MediaCodec  mediaCodec  = MediaCodec.createEncoderByType("audio/mp4a-latm");
  MediaFormat mediaFormat = new MediaFormat();

  mediaFormat.setString(MediaFormat.KEY_MIME, "audio/mp4a-latm");
  mediaFormat.setInteger(MediaFormat.KEY_SAMPLE_RATE, SAMPLE_RATE);
  mediaFormat.setInteger(MediaFormat.KEY_CHANNEL_COUNT, CHANNELS);
  mediaFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, bufferSize);
  mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE);
  mediaFormat.setInteger(MediaFormat.KEY_AAC_PROFILE, MediaCodecInfo.CodecProfileLevel.AACObjectLC);

  try {
    mediaCodec.configure(mediaFormat, null, null, MediaCodec.CONFIGURE_FLAG_ENCODE);
  } catch (Exception e) {
    Log.w(TAG, e);
    mediaCodec.release();
    throw new IOException(e);
  }

  return mediaCodec;
}
项目:UpdogFarmer    文件:SteamService.java   
@Override
public void onCreate() {
    Log.i(TAG, "Service created");
    super.onCreate();
    steamClient = new SteamClient();
    steamUser = steamClient.getHandler(SteamUser.class);
    steamFriends = steamClient.getHandler(SteamFriends.class);
    steamClient.addHandler(new FreeLicense());
    freeLicense = steamClient.getHandler(FreeLicense.class);
    // Detect Huawei devices running Lollipop which have a bug with MediaStyle notifications
    isHuawei = (android.os.Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP_MR1 ||
            android.os.Build.VERSION.SDK_INT == Build.VERSION_CODES.LOLLIPOP) &&
            Build.MANUFACTURER.toLowerCase(Locale.getDefault()).contains("huawei");
    if (PrefsManager.stayAwake()) {
        acquireWakeLock();
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        // Create notification channel
        createChannel();
    }
    if (BuildConfig.DEBUG) {
        DebugLog.addListener(new LogcatDebugListener());
    }
    startForeground(NOTIF_ID, buildNotification("Steam service started"));
}
项目:yaacc-code    文件:UpnpClientTest.java   
public void testRetrieveContentDirectoryContent() throws Exception {
    UpnpClient upnpClient = new UpnpClient();
    final List<Device<?, ?, ?>> devices = searchDevices(upnpClient);
    ContentDirectoryBrowser browse = null;
    for (Device<?, ?, ?> device : devices) {
        Log.d(getClass().getName(),
                "#####Device: " + device.getDisplayString());
        Service service = device.findService(new UDAServiceId(
                "ContentDirectory"));
        if (service != null) {
            browse = new ContentDirectoryBrowser(service, "0",
                    BrowseFlag.DIRECT_CHILDREN);
            upnpClient.getUpnpService().getControlPoint().execute(browse);
            while (browse != null && browse.getStatus() != Status.OK)
                ;
            browseContainer(upnpClient, browse.getContainers(), service, 0);
        }

    }

}
项目:CXJPadProject    文件:ReserveOrderDetailFragment.java   
private void loadDate() {
    showProgress();
    String reserveOrderId = getArguments().getString(KEY_RESERVE_ORDER_ID);
    RetrofitFactory.getInstance()
            .create(BService.ReserveOrderService.class)
            .queryReserveDetail(reserveOrderId)
            .enqueue(new RMCallback<RMResponse<ReserveOrderModel>>(activity) {
                @Override
                protected void onSuccess(RMResponse<ReserveOrderModel> result) {
                    Log.d("RetrofitFactory----", "onSuccess: ");
                    dismissProgress();

                    reserveOrderModel = result.content;
                    binding.setReserveOrderModel(reserveOrderModel);
                    updateDate();
                }

                @Override
                protected void onFail(String errorCode, String errorInfo) {
                    Log.d("RetrofitFactory----", "onFail: " + errorCode + "  " + errorInfo);
                    dismissProgress();
                    showToast(errorInfo);
                    activity.popFragment();
                }
            });
}
项目:xlight_android_native    文件:GlanceMainFragment.java   
public void getBaseInfo(PtrFrameLayout ptrFrame) {
        if (!NetworkUtils.isNetworkAvaliable(getActivity())) {
            ToastUtil.showToast(getActivity(), R.string.net_error);
            //TODO
            List<Rows> devices = (List<Rows>) SharedPreferencesUtils.getObject(getActivity(), SharedPreferencesUtils.KEY_DEVICE_LIST, null);
            if (null != devices && devices.size() > 0) {
                deviceList.clear();
                deviceList.addAll(devices);
            }
            if (devicesListAdapter != null) {
                //更新数据
                Log.d("XLight", "update device list");
                codeChange = true;
                devicesListAdapter.notifyDataSetChanged();
                codeChange = false;
            }
            addDeviceMapsSDK(deviceList);
            return;
        }
//        if (!UserUtils.isLogin(getActivity())) {
//            return;
//        }
        refreshDeviceInfo(ptrFrame);
    }
项目:android-slideshow    文件:MainActivity.java   
/**
 * Permissions checker
 */
private boolean isStoragePermissionGranted() {
    if (Build.VERSION.SDK_INT >= 23) {
        if (checkSelfPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
            Log.v(TAG,"Permission is granted");
            return true;
        } else {
            Log.v(TAG,"Permission is revoked");
            requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 1);
            return false;
        }
    } else {
        // Permission is automatically granted on sdk<23 upon installation
        Log.v(TAG,"Permission is granted");
        return true;
    }
}
项目:SlotNSlot_Android    文件:APKExpansionPolicy.java   
private Map<String, String> decodeExtras(String extras) {
    Map<String, String> results = new HashMap<String, String>();
    try {
        URI rawExtras = new URI("?" + extras);
        List<NameValuePair> extraList = URLEncodedUtils.parse(rawExtras, "UTF-8");
        for (NameValuePair item : extraList) {
            String name = item.getName();
            int i = 0;
            while (results.containsKey(name)) {
                name = item.getName() + ++i;
            }
            results.put(name, item.getValue());
        }
    } catch (URISyntaxException e) {
        Log.w(TAG, "Invalid syntax error while decoding extras data from server.");
    }
    return results;
}
项目:weex-3d-map    文件:WeexUiTestCaseTCAHrefStyle.java   
public void setUp() throws Exception{

        Log.e("TestScript_Guide", "setUp  test!!");
        setActivityInitialTouchMode(false);
        weappApplication = new WeappJsBaseTestCase();
        mInstrumentation = getInstrumentation();

        Intent intent = new Intent();
        intent.putExtra("bundleUrl", Constants.BUNDLE_URL);
        launchActivityWithIntent("com.alibaba.weex", WXPageActivity.class, intent);
        waTestPageActivity = getActivity();
//        waTestPageActivity.getIntent().getData().toString();
        Log.e(TAG, "activity1=" + waTestPageActivity.toString());
        Thread.sleep(3000);

        mViewGroup = (ViewGroup) waTestPageActivity.findViewById(R.id.container);
        setViewGroup(mViewGroup);

        mCaseListIndexView = ViewUtil.findViewWithText(mViewGroup, "TC_");
        setUpToFindComponet("TC_", this);
        Thread.sleep(3000);
    }
项目:GogoNew    文件:MapsActivity.java   
private void resetPassword() {

                new AlertDialog.Builder(this)
                        .setIcon(android.R.drawable.ic_dialog_alert)
                        .setTitle("Reset Password")
                        .setMessage("Are you sure you want to reset your password ?")
                        .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                        FirebaseAuth.getInstance().sendPasswordResetEmail(userEmail)
                                                .addOnCompleteListener(new OnCompleteListener<Void>() {
                                                        @Override
                                                        public void onComplete(@NonNull Task<Void> task) {
                                                                if (task.isSuccessful()) {
                                                                        Log.d(TAG, "Email sent.");
                                                                        Toast.makeText(MapsActivity.this, "Email Sent to " + userEmail, Toast.LENGTH_SHORT).show();
                                                                }
                                                        }
                                                });
                                }
                        })
                        .setNegativeButton("No", null)
                        .show();

        }
项目:SERC-ENERYGY-METERING-MOBILE-APP    文件:GraphActivity.java   
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
    // Sets the value chosen to the global variable (so as to update the link to be sent)
    hour_start = hourOfDay;
    minute_start = minute;

    // Set TextView textview_set_start_time to show the current chosen start time
    startTimeTextView.setText(hour_start+":"+minute_start+"hrs");

    // Setting the UNIX timestamp that will be sent in the link for startTime
    Calendar chosenStart = Calendar.getInstance();
    chosenStart.set(year_start, month_start, day_start, hour_start, minute_start);
    startTime = String.valueOf(chosenStart.getTimeInMillis());
    setLink();
    Log.i("Chosen Start Time", startTime);
    Log.i("Start and End Time", "Start: " + hour_start+":"+minute_start+"hrs" + " End:" + hour_end+":"+minute_end+"hrs");
}
项目:ObjectPool    文件:TestInvocationHandler.java   
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    // 被代理方法被执行前处理
    long startMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
    long startTime = System.currentTimeMillis();

    // 以target作为主调来执行method方法
    Object result = method.invoke(target, args);

    // 被代理方法被执行后处理
    long endMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
    long endTime = System.currentTimeMillis();

    Log.e(TAG, "#memory cost " + (endMemory - startMemory)/1024 + " Byte");
    Log.e(TAG, "#time cost " + (endTime - startTime) + " ms");
    return result;
}
项目:weex-svg    文件:WXSvgPath.java   
@Override
public void draw(Canvas canvas, Paint paint, float opacity) {
  opacity *= mOpacity;
  Log.v(TAG, "WXSvgPath draw " + mWXDomObject.getRef() + " dom attr " + mD);
  if (opacity > MIN_OPACITY_FOR_DRAW) {
    int count = saveAndSetupCanvas(canvas);
    if (mPath == null) {
      Log.v(TAG, "Paths should have a valid path (d) prop");
    }

    if (mPath != null) {
      clip(canvas, paint);

      if (setupFillPaint(paint, opacity * mFillOpacity, null)) {
        canvas.drawPath(mPath, paint);
      }
      if (setupStrokePaint(paint, opacity * mStrokeOpacity, null)) {
        canvas.drawPath(mPath, paint);
      }
    }
    restoreCanvas(canvas, count);
    //markUpdateSeen();
  }
}
项目:ShangHanLun    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.e("MainActivity", "onCreate!!!!!");
    MyApplication.activity = this;
    SingletonData.getInstance();
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.tabcontroller);

    isFang = getIntent().getExtras().getString("isFang");
    int tranId = R.id.firstContentTab;
    if (isFang != null && isFang.equals("true")) {
        tranId = R.id.fangYaoTab;
    }

    // mContainer = (ViewGroup) findViewById(R.id.content);
    fragmentManager = getFragmentManager();
    radioGroup = (RadioGroup) findViewById(R.id.rg_tab);
    radioGroup.check(tranId);
    radioGroup.setVisibility(ViewGroup.GONE);
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    Fragment fragment = FragmentFactory
            .getInstanceByIndex(tranId);
    transaction.replace(R.id.content, fragment);
    transaction.commit();
}
项目:GitHub    文件:MainActivity.java   
void check(boolean isManual, final boolean hasUpdate, final boolean isForce, final boolean isSilent, final boolean isIgnorable, final int
        notifyId) {
    UpdateManager.create(this).setChecker(new IUpdateChecker() {
        @Override
        public void check(ICheckAgent agent, String url) {
            Log.e("ezy.update", "checking");
            agent.setInfo("");
        }
    }).setUrl(mCheckUrl).setManual(isManual).setNotifyId(notifyId).setParser(new IUpdateParser() {
        @Override
        public UpdateInfo parse(String source) throws Exception {
            UpdateInfo info = new UpdateInfo();
            info.hasUpdate = hasUpdate;
            info.updateContent = "• 支持文字、贴纸、背景音乐,尽情展现欢乐气氛;\n• 两人视频通话支持实时滤镜,丰富滤镜,多彩心情;\n• 图片编辑新增艺术滤镜,一键打造文艺画风;\n• 资料卡新增点赞排行榜,看好友里谁是魅力之王。";
            info.versionCode = 587;
            info.versionName = "v5.8.7";
            info.url = mUpdateUrl;
            info.md5 = "56cf48f10e4cf6043fbf53bbbc4009e3";
            info.size = 10149314;
            info.isForce = isForce;
            info.isIgnorable = isIgnorable;
            info.isSilent = isSilent;
            return info;
        }
    }).check();
}
项目:NeoTerm    文件:Clipboard.java   
public String get(final Context context)
{
    String ret = "";
    try {
        android.text.ClipboardManager clipboard = (android.text.ClipboardManager) context.getSystemService(context.CLIPBOARD_SERVICE);
        if( clipboard != null && clipboard.getText() != null )
            ret = clipboard.getText().toString();
    } catch (Exception e) {
        Log.i("SDL", "getClipboardText() exception: " + e.toString());
    }
    return ret;
}
项目:egma-handwriting-numbers    文件:MediaPlayerHelper.java   
public static MediaPlayer playLessonFailed(Context context){
    Log.i(context.getClass().getName(), "playLessonFailed");

    List<String> lessonFailedList = new ArrayList<>();
    lessonFailedList.add(LESSON_FAILED_1);

    return playRandomResource(context, lessonFailedList);
}
项目:popomusic    文件:MusicNotification.java   
/**
 * 获取自定义通知对象,饿汉式实现单例模式
 * @return
 */
public static MusicNotification getMusicNotification(){
    Log.e(TAG,"获取MusicNotification对象");
    if (musicNotification == null){
        musicNotification = new MusicNotification();
    }
    return musicNotification;
}
项目:GodotSQL    文件:KeyValDatabase.java   
public synchronized String getKeyVal(String key) {
    Cursor cursor = mStoreDB.query(KEYVAL_TABLE_NAME, KEYVAL_COLUMNS,
        KEYVAL_COLUMN_KEY + "='" + key + "'", null, null, null, null);

    if (cursor != null && cursor.moveToNext()) {
        int valColIdx = cursor.getColumnIndexOrThrow(KEYVAL_COLUMN_VAL);
        String ret = cursor.getString(valColIdx);
        cursor.close();
        return ret;
    } else { Log.i(TAG, "return Null.!"); }

    if(cursor != null) { cursor.close(); }

    return null;
}
项目:keepass2android    文件:Kp2aFileProvider.java   
/**
 * Checks ancestor with {@link BaseFile#CMD_IS_ANCESTOR_OF},
 * {@link BaseFile#PARAM_SOURCE} and {@link BaseFile#PARAM_TARGET}.
 * 
 * @param uri
 *            the original URI from client.
 * @return {@code null} if source is not ancestor of target; or a
 *         <i>non-null but empty</i> cursor if the source is.
 */
private MatrixCursor doCheckAncestor(Uri uri) {
    String source = Uri.parse(
            uri.getQueryParameter(BaseFile.PARAM_SOURCE)).toString();
    String target = Uri.parse(
            uri.getQueryParameter(BaseFile.PARAM_TARGET)).toString();
    if (source == null || target == null)
        return null;

    boolean validate = ProviderUtils.getBooleanQueryParam(uri,
            BaseFile.PARAM_VALIDATE, true);
    if (validate) {
     //not supported
    }

    if (!source.endsWith("/"))
        source += "/";


    String targetParent = getParentPath(target);
    if (targetParent != null && targetParent.startsWith(source))
    {
        if (Utils.doLog())
            Log.d("KP2A_FC_P", source+" is parent of "+target);
        return BaseFileProviderUtils.newClosedCursor();
    }
    if (Utils.doLog())
        Log.d("KP2A_FC_P", source+" is no parent of "+target);

    return null;
}
项目:IgniteGreenhouseGateway    文件:IotIgniteHandler.java   
/**
 * Deletes all registered "node" and "thing"
 */
public void clearAllThing() {
    try {
        for (Node mNode : IotIgniteManager.getNodeList()) {
            if (mNode != null) {
                connectionClosedOperation(mNode, CLEAR_ALL_THING_NUMBER);
                mNode.setConnected(false, Constant.APPLICATION_DESTROYED_STRING);
                mNode.unregister();
            }
        }
        registerConfigurator();
    } catch (AuthenticationException e) {
        Log.e(TAG, "clearAllThing Error : " + e);
    }
}
项目:AndroidGeneralUtils    文件:BLog.java   
public static String ef(String msg) {
    if (sShowError) {
        Log.e(getCallerClassName(), msg);
        forceWriteToFile(getCallerClassName() + " : " + msg);
    }
    return msg;
}
项目:GitHub    文件:LivePlayerHolder.java   
public void onVideoSizeChanged(PLMediaPlayer mp, int width, int height) {
            Log.i(TAG, "onVideoSizeChanged, width = " + width + ",height = " + height);
            // resize the display window to fit the screen
            if (width != 0 && height != 0) {
                float ratioW = (float) width / (float) mSurfaceWidth;
                float ratioH = (float) height / (float) mSurfaceHeight;
                float ratio = Math.max(ratioW, ratioH);
                width = (int) Math.ceil((float) width / ratio);
                height = (int) Math.ceil((float) height / ratio);
//                FrameLayout.LayoutParams layout = new FrameLayout.LayoutParams(width, height);
//                layout.gravity = Gravity.CENTER;
//                mSurfaceView.setLayoutParams(layout);
            }
        }
项目:AC2RD    文件:PurgeServiceManager.java   
public boolean stopService(Context context)
{
    try
    {
        if(isRunning(context) == true)
        {
            Boolean purgeServiceStopped = context.stopService(new Intent(context, PurgeService.class));

            if(purgeServiceStopped == false)
            {
                int stopRetry = 10;

                while((purgeServiceStopped == false) && (stopRetry >= 0))
                {
                    purgeServiceStopped = context.stopService(new Intent(context, PurgeService.class));
                    stopRetry = stopRetry - 1;
                }
            }
            else
            {
                return purgeServiceStopped;
            }
        }

        return true;
    }
    catch (Exception e)
    {
        Log.e("PurgeServiceManager", "stopService : " + context.getString(R.string.log_purge_service_manager_error_stop) + " : " + e);
        databaseManager.insertLog(context, "" + context.getString(R.string.log_purge_service_manager_error_stop), new Date().getTime(), 1, false);

        return false;
    }
}
项目:MegviiFacepp-Android-SDK    文件:MediaRecorderUtil.java   
public void releaseMediaRecorder() {
    if (mMediaRecorder != null) {
        Log.w("ceshi", "mMediaRecorder.reset(");
        // clear recorder configuration
        mMediaRecorder.reset();
        // release the recorder object
        mMediaRecorder.release();
        mMediaRecorder = null;
        // Lock camera for later use i.e taking it back from MediaRecorder.
        // MediaRecorder doesn't need it anymore and we will release it if
        // the activity pauses.
        mCamera.lock();
        mCamera = null;
    }
}
项目:AndroidInAppBilling    文件:BillingManager.java   
/**
 * Handle a callback that purchases were updated from the Billing library
 */
@Override
public void onPurchasesUpdated(int resultCode, List<Purchase> purchases) {
    if (resultCode == BillingResponse.OK) {
        for (Purchase purchase : purchases) {
            handlePurchase(purchase);
        }
        mBillingUpdatesListener.onPurchasesUpdated(mPurchases);
    } else if (resultCode == BillingResponse.USER_CANCELED) {
        Log.i(TAG, "onPurchasesUpdated() - user cancelled the purchase flow - skipping");
    } else {
        Log.w(TAG, "onPurchasesUpdated() got unknown resultCode: " + resultCode);
    }
}
项目:MultiplicationBasile    文件:MyApplication.java   
/***********************************************************
 * Managing Life Cycle
 **********************************************************/
@Override
public void onCreate() {
    super.onCreate();
    instance=this;
    assService=AssesmentService.getInstance();
    Log.e("MyAppInitializer","Second choices, a log is enough to prove the concept: MyApplication");
    Log.e("MyAppInitializer","Gradle Variable resValues.hidden_string ="+R.string.hidden_string);
    Log.e("MyAppInitializer","Gradle Variable resValues.isBoolAllowed="+R.bool.isBoolAllowed);
    Log.e("MyAppInitializer","Gradle Variable resValues.color_var="+R.color.color_var);
    Log.e("MyAppInitializer","Gradle Variable BuildConfig.isallowed="+BuildConfig.isallowed);
    Log.e("MyAppInitializer","Gradle Variable BuildConfig.isStringallowed="+BuildConfig.isStringallowed);
    Log.e("MyAppInitializer","Gradle Variable BuildConfig.intAllowed="+BuildConfig.intAllowed);
}
项目:AndroidThings-BurglarAlarm    文件:BurglarService.java   
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onLoginFailure(LoginFailedEvent event) {
    int tryCount = checker.getAndAdd(1);
    Log.w(TAG, "Could not login, try again #" + tryCount);
    if (tryCount < 3) {
        getDevice();
    } else {
        EventBus.getDefault().post(new ConnectionFailedEvent());
    }
}
项目:omnicrow-android    文件:BeaconService.java   
@Override
public void onCreate() {
    super.onCreate();
    Log.d("SERV", "onCreate: STARTED SERVICE");
    mBeaconManager = BeaconManager.getInstanceForApplication(getApplicationContext());
    mRegion = new Region(PreferencesUtil.getDefaultRegionName(getApplicationContext()), null, null, null);
    mBeaconManager.bind(this);
    mBeaconManager.addRangeNotifier(this);

    setupTimer();

}
项目:ImageClassify    文件:TagImagePresenter.java   
/**
 * 更新用户设置的标签
 *
 * @param viewFlipper
 * @param manualTagGridView
 */
private void updateInputedTags(final ViewFlipper viewFlipper, final GridView manualTagGridView, int index) {
    Log.d(TAG, "updateInputedTags: ");
    for (List<Label> li : inputedManualTagList) {
        Log.d(TAG, "updateInputedTags: li " + li.size());
    }

    List<Label> labelList = new ArrayList<>(inputedManualTagList.get(index));
    final CommonAdapter<Label> adapter = new CommonAdapter<Label>(mContext, R.layout.category_textview_item, labelList) {
        @Override
        protected void convert(ViewHolder viewHolder, final Label item, int position) {
            if (viewFlipper.getDisplayedChild() == mTaskAmount) {
                return;
            }
            if (!TextUtils.isEmpty(item.getLabel_name())){
                viewHolder.setText(R.id.id_label_name_tv, item.getLabel_name());
                viewHolder.setOnLongClickListener(R.id.id_label_name_tv, new View.OnLongClickListener() {
                    @Override
                    public boolean onLongClick(View v) {
                        inputedManualTagList.get(viewFlipper.getDisplayedChild()).remove(item);
                        updateInputedTags(viewFlipper, manualTagGridView, viewFlipper.getDisplayedChild());
                        //只执行长按动作
                        return true;
                    }
                });
            }

        }
    };
    //设置用户输入的标签
    manualTagGridView.setAdapter(adapter);
}
项目:open-rmbt    文件:RMBTMainActivity.java   
/**
 * 
 */
private void preferencesUpdate()
{
    final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

    //remove control server version on start
    ConfigHelper.setControlServerVersion(this, null);

    final Context context = getApplicationContext();
    final PackageInfo pInfo;
    final int clientVersion;
    try
    {
        pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        clientVersion = pInfo.versionCode;

        final int lastVersion = preferences.getInt("LAST_VERSION_CODE", -1);
        if (lastVersion == -1 || lastVersion <= 17)
        {
            preferences.edit().clear().commit();
            Log.d(DEBUG_TAG, "preferences cleared");
        }

        if (lastVersion != clientVersion)
            preferences.edit().putInt("LAST_VERSION_CODE", clientVersion).commit();
    }
    catch (final NameNotFoundException e)
    {
        Log.e(DEBUG_TAG, "version of the application cannot be found", e);
    }
}
项目:FlickLauncher    文件:RemoteShortcuts.java   
/**
 * Make request permission
 * @param activity Activity
 */
private static void requestPermission(Activity activity) {

    if (ActivityCompat.shouldShowRequestPermissionRationale(activity, android.Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
        Log.d(TAG, "Write External Storage permission allows us to do store shortcuts data. Please allow this permission in App Settings.");
    } else {
        ActivityCompat.requestPermissions(activity, new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, 111);
        Log.d(TAG, "Write External Storage permission allows us to do store shortcuts data.");
    }
}