当前位置: 首页>>代码示例>>Java>>正文


Java SuppressLint类代码示例

本文整理汇总了Java中android.annotation.SuppressLint的典型用法代码示例。如果您正苦于以下问题:Java SuppressLint类的具体用法?Java SuppressLint怎么用?Java SuppressLint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SuppressLint类属于android.annotation包,在下文中一共展示了SuppressLint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deserialize

import android.annotation.SuppressLint; //导入依赖的package包/类
@Override
public Date deserialize(JsonElement element, Type type, JsonDeserializationContext context)
        throws JsonParseException {
    String date = element.getAsString();

    @SuppressLint("SimpleDateFormat")
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
    formatter.setTimeZone(TimeZone.getTimeZone("UTC"));

    try {
        return formatter.parse(date);
    } catch (ParseException e) {
        Log.e(TAG, "Date parsing failed");
        Log.exception(e);
        return new Date();
    }
}
 
开发者ID:TryGhost,项目名称:Ghost-Android,代码行数:18,代码来源:DateDeserializer.java

示例2: convertActivityToTranslucent

import android.annotation.SuppressLint; //导入依赖的package包/类
@SuppressLint({"NewApi"})
public void convertActivityToTranslucent() {
    try {
        Class<?> translucentConversionListenerClazz = null;
        for (Class<?> clazz : Activity.class.getDeclaredClasses()) {
            if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
                translucentConversionListenerClazz = clazz;
            }
        }
        Method method;
        if (VERSION.SDK_INT > 19) {
            method = Activity.class.getDeclaredMethod("convertToTranslucent", new
                    Class[]{translucentConversionListenerClazz, ActivityOptions.class});
            method.setAccessible(true);
            method.invoke(this.mActivity, new Object[]{null, null});
            return;
        }
        method = Activity.class.getDeclaredMethod("convertToTranslucent", new
                Class[]{translucentConversionListenerClazz});
        method.setAccessible(true);
        method.invoke(this.mActivity, new Object[]{null});
    } catch (Throwable th) {
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:25,代码来源:SwipeBackActivityHelper.java

示例3: onRename

import android.annotation.SuppressLint; //导入依赖的package包/类
@Override
public void onRename(Device device) {
  @SuppressLint("InflateParams")
  EditText edit = (EditText) LayoutInflater.from(this).inflate(R.layout.layout_edit_name, null);
  new AlertDialog.Builder(this)
      .setTitle(R.string.change_name)
      .setView(edit)
      .setNegativeButton(android.R.string.cancel, (dialog, which) -> dialog.dismiss())
      .setPositiveButton(android.R.string.ok, (dialog, which) -> {
        if (edit.getText().toString().trim().length() > 0) {
          device.setName(edit.getText().toString().trim());
          updateDeviceSubject.onNext(device);
        }
        dialog.dismiss();
      })
      .show();
}
 
开发者ID:drfonfon,项目名称:ITagAntiLost,代码行数:18,代码来源:DevicesActivity.java

示例4: testGetInvalidJobId

import android.annotation.SuppressLint; //导入依赖的package包/类
@SuppressLint("ApplySharedPref")
@Test
public void testGetInvalidJobId() throws Exception {
    final Job test = createTestJob();
    final String json = gson.toJson(test);
    final String key = SimpleUploadDataStore.jobIdKey(test.id());
    final Set<String> keys = new HashSet<>();
    keys.add(key);

    final SharedPreferences.Editor editor = sharedPreferences.edit();
    editor.putStringSet(SimpleUploadDataStore.KEY_JOB_IDS, keys);
    editor.putString(key, json);
    editor.commit();

    final TestSubscriber<Job> ts = TestSubscriber.create();
    dataStore.get("bad_id").subscribe(ts);

    ts.awaitTerminalEvent(1, TimeUnit.SECONDS);
    ts.assertNoErrors();
    ts.assertValueCount(1);
    ts.assertValue(Job.INVALID_JOB);
}
 
开发者ID:jsaund,项目名称:RxUploader,代码行数:23,代码来源:SimpleUploadDataStoreTest.java

示例5: onInitializeAccessibilityNodeInfo

import android.annotation.SuppressLint; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@SuppressLint("Override")
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
	super.onInitializeAccessibilityNodeInfo(info);

	info.setClassName(AbsHListView.class.getName());
	if (isEnabled()) {
		if (getFirstVisiblePosition() > 0) {
			info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_BACKWARD);
		}
		if (getLastVisiblePosition() < getCount() - 1) {
			info.addAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD);
		}
	}
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:17,代码来源:AbsHListView.java

示例6: getView

import android.annotation.SuppressLint; //导入依赖的package包/类
/**
 * Main mathod used to display view in list
 */
@SuppressLint("InflateParams")
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
	// TODO Auto-generated method stub
	ViewHolder viewHolder = null;
	LayoutInflater inflate = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	final ContactBean tb = data.get(position);
	if(convertView == null){

		viewHolder = new ViewHolder();
		convertView = inflate.inflate(R.layout.add_prefix_member_list_item, null);
		viewHolder.txtName = (TextView)convertView.findViewById(R.id.txtContactName);
		viewHolder.spCountry = (MaterialSpinner)convertView.findViewById(R.id.spCountry);
		viewHolder.txtName.setTypeface(ManagerTypeface.getTypeface(context, R.string.typeface_roboto_regular));
		convertView.setTag(viewHolder);
		convertView.setTag(R.id.txtContactName, viewHolder.txtName);
	}else{
		viewHolder = (ViewHolder)convertView.getTag();
	}
	viewHolder.txtName.setTypeface(fontBauhus);
	viewHolder.txtName.setText(tb.getName());
	return convertView;

}
 
开发者ID:mityung,项目名称:XERUNG,代码行数:28,代码来源:AddPrefixMemberAdapter.java

示例7: onStart

import android.annotation.SuppressLint; //导入依赖的package包/类
@SuppressLint("MissingPermission")
@Override
public void onStart() {
    Application application = (Application) getTargetContext().getApplicationContext();
    String simpleName = UnlockDeviceAndroidJUnitRunner.class.getSimpleName();
    // Unlock the device so that the tests can input keystrokes.
    ((KeyguardManager) application.getSystemService(KEYGUARD_SERVICE))
            .newKeyguardLock(simpleName)
            .disableKeyguard();
    // Wake up the screen.
    PowerManager powerManager = ((PowerManager) application.getSystemService(POWER_SERVICE));
    mWakeLock = powerManager.newWakeLock(FULL_WAKE_LOCK | ACQUIRE_CAUSES_WAKEUP |
            ON_AFTER_RELEASE, simpleName);
    mWakeLock.acquire();
    super.onStart();
}
 
开发者ID:ebridfighter,项目名称:GongXianSheng,代码行数:17,代码来源:UnlockDeviceAndroidJUnitRunner.java

示例8: onTouchEvent

import android.annotation.SuppressLint; //导入依赖的package包/类
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event) {
    switch (event.getAction() & MotionEvent.ACTION_MASK) {
        case MotionEvent.ACTION_DOWN:
            boolean hasSingleTap = mSingleTapConfirmedHandler.hasMessages(MSG_CHECK_DOUBLE_TAP_TIMEOUT);
            Log.w(TAG, "onTouchEvent hasSingleTap: " + hasSingleTap);
            if (!hasSingleTap) {
                mDownMillis = SystemClock.uptimeMillis();
            } else {
                Log.w(TAG, "onTouchEvent disallow onSpanClick mSingleTapConfirmedHandler because of DOUBLE TAP");
                disallowOnSpanClickInterrupt();
            }
            break;
    }
    boolean ret = super.onTouchEvent(event);
    if (mNeedForceEventToParent) {
        return mTouchSpanHit;
    }
    return ret;
}
 
开发者ID:coopese,项目名称:qmui,代码行数:22,代码来源:QMUILinkTextView.java

示例9: onBind

import android.annotation.SuppressLint; //导入依赖的package包/类
@SuppressLint( "SetTextI18n" )
public void onBind( BeerProductItem item ){
    setBeerImage( item.getImage() );
    tvBeerName.setText( item.getName() );
    tvBeerPercent.setText( item.getAlcohol() );
    tvBeerVolume.setText( item.getVolume() );
    tvBeerPrice.setText( StringUtils.getCommaPriceWithBaht( getContext(), item.getPrice() ) );

    if( item.isAdded() ){
        btnAdded.setVisibility( View.VISIBLE );
        btnAddToCart.setVisibility( View.GONE );
    }else{
        btnAdded.setVisibility( View.GONE );
        btnAddToCart.setVisibility( View.VISIBLE );
    }
}
 
开发者ID:TheKhaeng,项目名称:nongbeer-mvp-android-demo,代码行数:17,代码来源:BeerProductHolder.java

示例10: getSDCardAvailaleSize

import android.annotation.SuppressLint; //导入依赖的package包/类
/**
 * 获取磁盘可用空间.
 */
@SuppressWarnings("deprecation")
@SuppressLint({"NewApi", "ObsoleteSdkInt"})
public static long getSDCardAvailaleSize() {
    File path = getRootPath();
    StatFs stat = new StatFs(path.getPath());
    long blockSize, availableBlocks;
    if (Build.VERSION.SDK_INT >= 18) {
        blockSize = stat.getBlockSizeLong();
        availableBlocks = stat.getAvailableBlocksLong();
    } else {
        blockSize = stat.getBlockSize();
        availableBlocks = stat.getAvailableBlocks();
    }
    return availableBlocks * blockSize;
}
 
开发者ID:ChunweiDu,项目名称:Utils,代码行数:19,代码来源:FileUtil.java

示例11: stopBackgroundThread

import android.annotation.SuppressLint; //导入依赖的package包/类
/**
 * Stops the background thread and its {@link Handler}.
 */
@SuppressLint("LongLogTag")
@DebugLog
private void stopBackgroundThread() {
    backgroundThread.quitSafely();
    inferenceThread.quitSafely();
    try {
        backgroundThread.join();
        backgroundThread = null;
        backgroundHandler = null;

        inferenceThread.join();
        inferenceThread = null;
        inferenceThread = null;
    } catch (final InterruptedException e) {
        Log.e(TAG, "error" ,e );
    }
}
 
开发者ID:SimonCherryGZ,项目名称:face-landmark-android,代码行数:21,代码来源:CameraConnectionFragment.java

示例12: fileExt

import android.annotation.SuppressLint; //导入依赖的package包/类
@SuppressLint("DefaultLocale")
private String fileExt(String url) {
    if (url.indexOf("?") > -1) {
        url = url.substring(0, url.indexOf("?"));
    }
    if (url.lastIndexOf(".") == -1) {
        return null;
    } else {
        String ext = url.substring(url.lastIndexOf("."));
        if (ext.indexOf("%") > -1) {
            ext = ext.substring(0, ext.indexOf("%"));
        }
        if (ext.indexOf("/") > -1) {
            ext = ext.substring(0, ext.indexOf("/"));
        }
        return ext.toLowerCase();
    }
}
 
开发者ID:Aiushtha,项目名称:Go-RxJava,代码行数:19,代码来源:ChildViewHolder.java

示例13: init

import android.annotation.SuppressLint; //导入依赖的package包/类
@SuppressLint("NewApi")
private void init(Context context, AttributeSet attributeSet) {
    mVisible = true;
    mColorNormal = getColor(R.color.material_blue_500);
    mColorPressed = darkenColor(mColorNormal);
    mColorRipple = lightenColor(mColorNormal);
    mColorDisabled = getColor(android.R.color.darker_gray);
    mType = TYPE_NORMAL;
    mShadow = true;
    mScrollThreshold = getResources().getDimensionPixelOffset(R.dimen.fab_scroll_threshold);
    mShadowSize = getDimension(R.dimen.fab_shadow_size);
    if (hasLollipopApi()) {
        StateListAnimator stateListAnimator = AnimatorInflater.loadStateListAnimator(context,
                R.animator.fab_press_elevation);
        setStateListAnimator(stateListAnimator);
    }
    if (attributeSet != null) {
        initAttributes(context, attributeSet);
    }
    updateBackground();
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:22,代码来源:FloatingActionButton.java

示例14: autoFocusAgainLater

import android.annotation.SuppressLint; //导入依赖的package包/类
@SuppressLint("NewApi")
private synchronized void autoFocusAgainLater() {
	if (!stopped && outstandingTask == null) {
		AutoFocusTask newTask = new AutoFocusTask();
		try {
			// Unnecessary, our app's min sdk is higher than 11.
			// if (Build.VERSION.SDK_INT >= 11) {
			// 	newTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
			// } else {
			//
			// }
			newTask.execute();
			outstandingTask = newTask;
		} catch (RejectedExecutionException ree) {
			Log.w(TAG, "Could not request auto focus", ree);
		}
	}
}
 
开发者ID:TonnyL,项目名称:Espresso,代码行数:19,代码来源:AutoFocusManager.java

示例15: injectDeferredObject

import android.annotation.SuppressLint; //导入依赖的package包/类
/**
 * Inject an object (script or style) into the InAppBrowser AmazonWebView.
 *
 * This is a helper method for the inject{Script|Style}{Code|File} API calls, which
 * provides a consistent method for injecting JavaScript code into the document.
 *
 * If a wrapper string is supplied, then the source string will be JSON-encoded (adding
 * quotes) and wrapped using string formatting. (The wrapper string should have a single
 * '%s' marker)
 *
 * @param source      The source object (filename or script/style text) to inject into
 *                    the document.
 * @param jsWrapper   A JavaScript string to wrap the source string in, so that the object
 *                    is properly injected, or null if the source string is JavaScript text
 *                    which should be executed directly.
 */
private void injectDeferredObject(String source, String jsWrapper) {
    final String scriptToInject;
    if (jsWrapper != null) {
        org.json.JSONArray jsonEsc = new org.json.JSONArray();
        jsonEsc.put(source);
        String jsonRepr = jsonEsc.toString();
        String jsonSourceString = jsonRepr.substring(1, jsonRepr.length()-1);
        scriptToInject = String.format(jsWrapper, jsonSourceString);
    } else {
        scriptToInject = source;
    }
    final String finalScriptToInject = scriptToInject;
    this.cordova.getActivity().runOnUiThread(new Runnable() {
        @SuppressLint("NewApi")
        @Override
        public void run() {
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
                // This action will have the side-effect of blurring the currently focused element
                inAppWebView.loadUrl("javascript:" + finalScriptToInject);
            } /*else {
                inAppWebView.evaluateJavascript(finalScriptToInject, null);
            }*/
        }
    });
}
 
开发者ID:nighthary,项目名称:cordova-plugin-themeablebrowser-diy,代码行数:42,代码来源:InAppBrowser.java


注:本文中的android.annotation.SuppressLint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。