Java Code Examples for android.util.Log

The following are top voted examples for showing how to use android.util.Log. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: keepass2android   File: BaseFileAdapter.java   Source Code and License 8 votes vote down vote up
@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;
}
 
Example 2
Project: Sense-Hub-Android-Things   File: nRF51822SensorEntity.java   Source Code and License 6 votes vote down vote up
@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){

            }
        }
    }
}
 
Example 3
Project: FordOpenXCHackathon   File: MainActivity.java   Source Code and License 6 votes vote down vote up
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);


}
 
Example 4
Project: My-Android-Base-Code   File: HtmlTagHandler.java   Source Code and License 6 votes vote down vote up
@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);
        }
    }

}
 
Example 5
Project: Cable-Android   File: AudioCodec.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 6
Project: UpdogFarmer   File: SteamService.java   Source Code and License 6 votes vote down vote up
@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"));
}
 
Example 7
Project: yaacc-code   File: UpnpClientTest.java   Source Code and License 6 votes vote down vote up
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);
		}

	}

}
 
Example 8
Project: CXJPadProject   File: ReserveOrderDetailFragment.java   Source Code and License 6 votes vote down vote up
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();
                }
            });
}
 
Example 9
Project: xlight_android_native   File: GlanceMainFragment.java   Source Code and License 6 votes vote down vote up
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);
    }
 
Example 10
Project: android-slideshow   File: MainActivity.java   Source Code and License 6 votes vote down vote up
/**
 * 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;
	}
}
 
Example 11
Project: SlotNSlot_Android   File: APKExpansionPolicy.java   Source Code and License 6 votes vote down vote up
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;
}
 
Example 12
Project: weex-3d-map   File: WeexUiTestCaseTCAHrefStyle.java   Source Code and License 6 votes vote down vote up
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);
    }
 
Example 13
Project: GogoNew   File: MapsActivity.java   Source Code and License 6 votes vote down vote up
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();

        }
 
Example 14
Project: SERC-ENERYGY-METERING-MOBILE-APP   File: GraphActivity.java   Source Code and License 6 votes vote down vote up
@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");
}
 
Example 15
Project: ObjectPool   File: TestInvocationHandler.java   Source Code and License 6 votes vote down vote up
@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;
}
 
Example 16
Project: weex-svg   File: WXSvgPath.java   Source Code and License 6 votes vote down vote up
@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();
  }
}
 
Example 17
Project: ShangHanLun   File: MainActivity.java   Source Code and License 6 votes vote down vote up
@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();
}
 
Example 18
Project: GitHub   File: MainActivity.java   Source Code and License 6 votes vote down vote up
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();
}
 
Example 19
Project: NeoTerm   File: Clipboard.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 20
Project: egma-handwriting-numbers   File: MediaPlayerHelper.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 21
Project: popomusic   File: MusicNotification.java   Source Code and License 5 votes vote down vote up
/**
 * 获取自定义通知对象,饿汉式实现单例模式
 * @return
 */
public static MusicNotification getMusicNotification(){
    Log.e(TAG,"获取MusicNotification对象");
    if (musicNotification == null){
        musicNotification = new MusicNotification();
    }
    return musicNotification;
}
 
Example 22
Project: GodotSQL   File: KeyValDatabase.java   Source Code and License 5 votes vote down vote up
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;
}
 
Example 23
Project: keepass2android   File: Kp2aFileProvider.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 24
Project: IgniteGreenhouseGateway   File: IotIgniteHandler.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 25
Project: TinyPlanetMaker   File: FpsMeter.java   Source Code and License 5 votes vote down vote up
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 26
Project: RoundChoiceView   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@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);
}
 
Example 27
Project: AndroidGeneralUtils   File: BLog.java   Source Code and License 5 votes vote down vote up
public static String ef(String msg) {
    if (sShowError) {
        Log.e(getCallerClassName(), msg);
        forceWriteToFile(getCallerClassName() + " : " + msg);
    }
    return msg;
}
 
Example 28
Project: GitHub   File: LivePlayerHolder.java   Source Code and License 5 votes vote down vote up
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);
            }
        }
 
Example 29
Project: face-landmark-android   File: CameraUtils.java   Source Code and License 5 votes vote down vote up
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];
    }
}
 
Example 30
Project: AC2RD   File: PurgeServiceManager.java   Source Code and License 5 votes vote down vote up
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;
	}
}
 
Example 31
Project: MegviiFacepp-Android-SDK   File: MediaRecorderUtil.java   Source Code and License 5 votes vote down vote up
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;
	}
}
 
Example 32
Project: AndroidInAppBilling   File: BillingManager.java   Source Code and License 5 votes vote down vote up
/**
 * 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);
    }
}
 
Example 33
Project: MultiplicationBasile   File: MyApplication.java   Source Code and License 5 votes vote down vote up
/***********************************************************
 * 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);
}
 
Example 34
Project: AndroidThings-BurglarAlarm   File: BurglarService.java   Source Code and License 5 votes vote down vote up
@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());
    }
}
 
Example 35
Project: BlogBookApp   File: WebSocket.java   Source Code and License 5 votes vote down vote up
/**
 * 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;
}
 
Example 36
Project: mtoolbox   File: HongBaoService.java   Source Code and License 5 votes vote down vote up
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);
}
 
Example 37
Project: omnicrow-android   File: BeaconService.java   Source Code and License 5 votes vote down vote up
@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();

}
 
Example 38
Project: ImageClassify   File: TagImagePresenter.java   Source Code and License 5 votes vote down vote up
/**
 * 更新用户设置的标签
 *
 * @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);
}
 
Example 39
Project: open-rmbt   File: RMBTMainActivity.java   Source Code and License 5 votes vote down vote up
/**
 * 
 */
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);
    }
}
 
Example 40
Project: FlickLauncher   File: RemoteShortcuts.java   Source Code and License 5 votes vote down vote up
/**
 * 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.");
    }
}
 
Example 41
Project: GitHub   File: TestFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void onDetach() {
    super.onDetach();
    printState();
    Log.v(TAG, "onDetach");
    printState();

    mAddedState.onCompleted();
    mDetachedState.onCompleted();
    mRemovingState.onCompleted();
    mIsActivityChangingConfigState.onCompleted();
    mIsActivityFinishingState.onCompleted();
}
 
Example 42
Project: boohee_v5.6   File: MediaBrowserCompat.java   Source Code and License 5 votes vote down vote up
public void onConnectionFailed(Messenger callback) {
    Log.e(MediaBrowserCompat.TAG, "onConnectFailed for " + this.mServiceComponent);
    if (!isCurrent(callback, "onConnectFailed")) {
        return;
    }
    if (this.mState != 1) {
        Log.w(MediaBrowserCompat.TAG, "onConnect from service while mState=" + getStateLabel(this.mState) + "... ignoring");
        return;
    }
    forceCloseConnection();
    this.mCallback.onConnectionFailed();
}
 
Example 43
Project: buildAPKsSamples   File: MidiPortConnector.java   Source Code and License 5 votes vote down vote up
private void safeClose() {
    try {
        close();
    } catch (IOException e) {
        Log.e(MidiConstants.TAG, "could not close resources", e);
    }
}
 
Example 44
Project: accelerator-sample-apps-android   File: MainActivity.java   Source Code and License 5 votes vote down vote up
@Override
public void onStartedPublishingMedia(OTWrapper otWrapper, boolean screensharing) throws ListenerException {
    Log.i(LOG_TAG, "Local started streaming video.");

    if (screensharing) {
        screenAnnotations();
    }

    mActionBarFragment.setCallButtonEnabled(true);
}
 
Example 45
Project: PLDroidShortVideo   File: VideoComposeActivity.java   Source Code and License 5 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (resultCode == Activity.RESULT_OK) {
        String selectedFilepath = GetPathFromUri.getPath(this, data.getData());
        Log.i(TAG, "Select file: " + selectedFilepath);
        if (selectedFilepath != null && !"".equals(selectedFilepath)) {
            mVideoListAdapter.addVideoFile(selectedFilepath);
            mVideoListAdapter.notifyDataSetChanged();
        }
    }
}
 
Example 46
Project: crockpod   File: AlarmDataRepository.java   Source Code and License 5 votes vote down vote up
private Alarm buildAlarm(String intentUri) {
    try {
        return new Alarm(mContext, parseIntentUri(intentUri));
    } catch (URISyntaxException e) {
        Log.e(REPO_KEY, "Error parsing Intent URI: " + intentUri);
        return null;
    }
}
 
Example 47
Project: ProgressManager   File: a.java   Source Code and License 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @return The default implementation returns true.
 */
public boolean onMenuOpened(int featureId, Menu menu) {
    if (featureId == Window.FEATURE_ACTION_BAR) {
        initWindowDecorActionBar();
        if (mActionBar != null) {
            mActionBar.dispatchMenuVisibilityChanged(true);
        } else {
            Log.e(TAG, "Tried to open action bar menu with no action bar");
        }
    }
    return true;
}
 
Example 48
Project: text_converter   File: DLog.java   Source Code and License 5 votes vote down vote up
/**
 * debug log
 */
public static void d(String TAG, Object msg) {
    if (DEBUG) {
        if (ANDROID) {
            Log.d(TAG, msg.toString());
        } else {
            System.out.println(TAG + ": " + msg.toString());
        }
    }
}
 
Example 49
Project: Recyclerview-Gallery   File: RecyclerAdapter.java   Source Code and License 5 votes vote down vote up
@Override
public void onBindViewHolder(MyHolder holder, int position) {
    Log.d(TAG, "onBindViewHolder" + "--> position = " + position);
    // 需要增加此代码修改每一页的宽高
    //GalleryAdapterHelper.newInstance().setItemLayoutParams(mParent, holder.itemView, position, getItemCount());
    holder.mView.setImageResource(mDatas.get(position));
}
 
Example 50
Project: RxJava2-Android-Sample   File: ReduceExampleActivity.java   Source Code and License 5 votes vote down vote up
private MaybeObserver<Integer> getObserver() {
    return new MaybeObserver<Integer>() {
        @Override
        public void onSubscribe(Disposable d) {
            Log.d(TAG, " onSubscribe : " + d.isDisposed());
        }

        @Override
        public void onSuccess(Integer value) {
            textView.append(" onSuccess : value : " + value);
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onSuccess : value : " + value);
        }

        @Override
        public void onError(Throwable e) {
            textView.append(" onError : " + e.getMessage());
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onError : " + e.getMessage());
        }

        @Override
        public void onComplete() {
            textView.append(" onComplete");
            textView.append(AppConstant.LINE_SEPARATOR);
            Log.d(TAG, " onComplete");
        }
    };
}
 
Example 51
Project: home-automation   File: DeviceActionsResolver.java   Source Code and License 5 votes vote down vote up
private void getActions(final DeviceDAO device) {
    Log.d(TAG, "TODO getActions");
    String uri = Uri.parse(String.format("http://%s:%s/", device.getIP(), device.getPort()))
            .buildUpon().build().toString();
    String credentials = device.getUsername() + ":" + device.getPassword();
    byte[] t = credentials.getBytes();
    byte[] auth = Base64.encode(t, Base64.DEFAULT);
    final String basicAuthValue = new String(auth);
    requestQueue.add(new StringRequest(Request.Method.POST, uri, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {

        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
        }
    }) {
        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            Map<String, String> params = new HashMap<>();
            params.put("Authorization", "Basic " + basicAuthValue);
            params.put("Connection", "close");
            return params;
        }
    });
}
 
Example 52
Project: Mobike   File: CameraConfigurationManager.java   Source Code and License 5 votes vote down vote up
/**
 * Sets the camera up to take preview images which are used for both preview and decoding.
 * We detect the preview format here so that buildLuminanceSource() can build an appropriate
 * LuminanceSource subclass. In the future we may want to force YUV420SP as it's the smallest,
 * and the planar Y can be used for barcode scanning without getUrl copy in some cases.
 */
void setDesiredCameraParameters(Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Log.d(TAG, "Setting preview size: " + cameraResolution);
    parameters.setPreviewSize(cameraResolution.x, cameraResolution.y);
    setFlash(parameters);
    setZoom(parameters);
    //setSharpness(parameters);
    //modify here
    camera.setDisplayOrientation(getDisplayOrientation());
    camera.setParameters(parameters);


}
 
Example 53
Project: NaiveDemos   File: BleOperationService.java   Source Code and License 5 votes vote down vote up
/**
 * 翻译:清空内部的缓存记录,并且命令远程设备上强制刷新所有的 services
 * 用法:暂时不知
 *
 * @return 是否刷新成功
 */
private boolean refreshDeviceCache() {
    try {
        final Method refresh = BluetoothGatt.class.getMethod("refresh");
        if (refresh != null && mBluetoothGatt != null) {
            final boolean success = (Boolean) refresh.invoke(mBluetoothGatt);
            LogUtils.i(TAG, "gatt.refresh()刷新结果: " + success);
            return success;
        }
    } catch (Exception e) {
        Log.w(TAG, "gatt.refresh()执行异常\n", e);
    }
    return false;
}
 
Example 54
Project: Android-Code-Demos   File: CameraGLRendererBase.java   Source Code and License 5 votes vote down vote up
@Override
public void onSurfaceChanged(GL10 gl, int surfaceWidth, int surfaceHeight) {
    Log.i(LOGTAG, "onSurfaceChanged("+surfaceWidth+"x"+surfaceHeight+")");
    mHaveSurface = true;
    updateState();
    setPreviewSize(surfaceWidth, surfaceHeight);
}
 
Example 55
Project: HabitUp   File: LoginActivityTest.java   Source Code and License 5 votes vote down vote up
@Test
//Test if the user can enter main page after login using a valid user name
public void testLogin() {
    LoginActivity activity = (LoginActivity) solo.getCurrentActivity();
    solo.assertCurrentActivity("Wrong Activity", LoginActivity.class);

    while (true){
        Random rand = new Random();
        testName = Integer.toString(rand.nextInt(9999));
        ElasticSearchController.GetUser getUser = new ElasticSearchController.GetUser();
        getUser.execute(testName);
        ArrayList<UserAccount> users = new ArrayList<>();
        try {
            users = getUser.get();
        } catch (Exception e) {
            Log.i("Error", "Failed to get the User from the async object");
        }
        if (users.size() == 0) {
            break;
        }

    }
    UserAccount u1 = new UserAccount(testName, "usernametest", null);

    HabitUpApplication.addUserAccount(u1);

    SystemClock.sleep(10000);


    //check whether we add that user
    solo.enterText((EditText) solo.getView(R.id.login_edit), testName);
    solo.clickOnButton("Login");
    solo.assertCurrentActivity("Wrong Activity", MainActivity.class);

}
 
Example 56
Project: EsperantoRadio   File: QueueListViewFragment.java   Source Code and License 5 votes vote down vote up
private void onContainerClicked(View view) {
    RemoteMediaClient remoteMediaClient = getRemoteMediaClient();
    if (remoteMediaClient == null) {
        return;
    }
    MediaQueueItem item = (MediaQueueItem) view.getTag(R.string.queue_tag_item);
    if (mProvider.isQueueDetached()) {
        Log.d(TAG, "Is detached: itemId = " + item.getItemId());

        int currentPosition = mProvider.getPositionByItemId(item.getItemId());
        MediaQueueItem[] items = Utils.rebuildQueue(mProvider.getItems());
        remoteMediaClient.queueLoad(items, currentPosition,
                MediaStatus.REPEAT_MODE_REPEAT_OFF, null);
    } else {
        int currentItemId = mProvider.getCurrentItemId();
        if (currentItemId == item.getItemId()) {
            // We selected the one that is currently playing so we take the user to the
            // full screen controller
            CastSession castSession = CastContext.getSharedInstance(
                    getContext().getApplicationContext())
                    .getSessionManager().getCurrentCastSession();
            if (castSession != null) {
                Intent intent = new Intent(getActivity(), ExpandedControlsActivity.class);
                startActivity(intent);
            }
        } else {
            // a different item in the queue was selected so we jump there
            remoteMediaClient.queueJumpToItem(item.getItemId(), null);
        }
    }
}
 
Example 57
Project: remoter   File: RemoterClientToRemoterServerTest.java   Source Code and License 5 votes vote down vote up
@Before
public void setup() throws InterruptedException {
    synchronized (objectLock) {
        Intent remoterServiceIntent = new Intent(INTENT_REMOTER_SERVICE);
        remoterServiceIntent.setClassName("util.remoter.remoterservice", INTENT_REMOTER_SERVICE);

        mActivityRule.getActivity().startService(remoterServiceIntent);
        mActivityRule.getActivity().bindService(remoterServiceIntent, serviceConnection, 0);

        objectLock.wait();
        Log.i(TAG, "Service connected");
    }
}
 
Example 58
Project: localcloud_fe   File: AdvancedGeolocation.java   Source Code and License 5 votes vote down vote up
@Override
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    _cordova = cordova;
    _cordovaActivity = cordova.getActivity();
    _sharedPreferences = PreferenceManager.getDefaultSharedPreferences(_cordovaActivity);
    _permissionsController = new PermissionsController(_cordovaActivity, _cordova);
    _permissionsController.handleOnInitialize();
    removeActionPreferences();
    Log.d(TAG, "Initialized");
}
 
Example 59
Project: IO_Classic_WatchFace   File: IOClassicWatchFaceService.java   Source Code and License 5 votes vote down vote up
/**
 * Init the backgrounds and circle
 */
private void initializeBackground() {
    Log.d(TAG, "Init background");

    mBackgroundPaint = new Paint();
    mBackgroundPaint.setColor(mCenterCircleColor);
    mBackgroundPaint.setAntiAlias(true);

    //Circle that holds the ticks
    mCircleAndTickPaint = new Paint();
    mCircleAndTickPaint.setColor(mCircleAndTickColor);
    mCircleAndTickPaint.setStyle(Paint.Style.STROKE);
    mCircleAndTickPaint.setStrokeWidth(THICK_STROKE);
    mCircleAndTickPaint.setAntiAlias(true);

    //Minute ticks
    mMinuteTickPaint = new Paint();
    mMinuteTickPaint.setColor(mCircleAndTickColor);
    mMinuteTickPaint.setStyle(Paint.Style.STROKE);
    mMinuteTickPaint.setStrokeWidth(MINUTE_TICK_STROKE);
    mMinuteTickPaint.setAntiAlias(true);

    mOuterBackgroundPaint = new Paint();
    mOuterBackgroundPaint.setColor(mOuterCircleColor);
    mOuterBackgroundPaint.setAntiAlias(true);

    mHourLabelTextPaint = new TextPaint();
    mHourLabelTextPaint.setColor(mHourLabelsColor);
    mHourLabelTextPaint.setTextAlign(Paint.Align.CENTER);
    mHourLabelTextPaint.setTypeface(mHourLabelFont);
    mHourLabelTextPaint.setAntiAlias(true);
}
 
Example 60
Project: encdroidMC   File: EDDBHelper.java   Source Code and License 5 votes vote down vote up
public void renameVolume(EDVolume volume, String newName) {
	SQLiteDatabase db = getWritableDatabase();

	Log.d(TAG, "renameVolume() " + volume.getName() + " to " + newName);

	ContentValues values = new ContentValues();
	values.put(DB_COL_NAME, newName);
	db.update(DB_TABLE, values, DB_COL_NAME + "=? AND " + DB_COL_PATH
			+ "=?", new String[] { volume.getName(), volume.getPath() });
	
}