Java Log类代码示例
示例1: onTouch
▲ 点赞 4 ▼
import android.util.Log; @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;
}
示例2: measure
▲ 点赞 3 ▼
import android.util.Log; 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);
}
}
}
示例3: onCreate
▲ 点赞 3 ▼
import android.util.Log; @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);
}
示例4: chooseOptimalSize
▲ 点赞 3 ▼
import android.util.Log; private static Size chooseOptimalSize( final Size[] choices, final int width, final int height, final Size aspectRatio) { 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());
}
} 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];
}
}
示例5: connect
▲ 点赞 3 ▼
import android.util.Log; public Thread connect() throws IOException { this.running = true; this.readyState = WEBSOCKET_STATE_CONNECTING; socketChannel = SocketChannel.open();
socketChannel.configureBlocking(false); socketChannel.connect(new InetSocketAddress(uri.getHost(), port)); 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 th;
}
示例6: getAllHongBao
▲ 点赞 3 ▼
import android.util.Log; 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);
}
示例7: updateData
▲ 点赞 3 ▼
import android.util.Log; @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){
}
}
}
}
示例8: onServiceConnected
▲ 点赞 3 ▼
import android.util.Log; public void onServiceConnected(ComponentName className, IBinder service) { Log.i(TAG, "Bound to VehicleManager"); mVehicleManager = ((VehicleManager.VehicleBinder) service)
.getService(); mVehicleManager.addListener(EngineSpeed.class, mSpeedListener);
mVehicleManager.addListener(VehicleSpeed.class, mVehicleSpeedListener); setConnectionState(openXcState, true);
}
示例9: handleTag
▲ 点赞 3 ▼
import android.util.Log; @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);
}
}
}
示例10: createMediaCodec
▲ 点赞 3 ▼
import android.util.Log; 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;
}
示例11: onCreate
▲ 点赞 3 ▼
import android.util.Log; @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); 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) { createChannel();
} if (BuildConfig.DEBUG) {
DebugLog.addListener(new LogcatDebugListener());
}
startForeground(NOTIF_ID, buildNotification("Steam service started"));
}
示例12: testRetrieveContentDirectoryContent
▲ 点赞 3 ▼
import android.util.Log; 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);
}
}
}
示例13: loadDate
▲ 点赞 3 ▼
import android.util.Log; 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();
}
});
}
示例14: getBaseInfo
▲ 点赞 3 ▼
import android.util.Log; public void getBaseInfo(PtrFrameLayout ptrFrame) { if (!NetworkUtils.isNetworkAvaliable(getActivity())) {
ToastUtil.showToast(getActivity(), R.string.net_error); 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;
} refreshDeviceInfo(ptrFrame);
}
示例15: isStoragePermissionGranted
▲ 点赞 3 ▼
import android.util.Log; 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 { Log.v(TAG,"Permission is granted"); return true;
}
}
郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。