Java 类android.annotation.SuppressLint 实例源码

项目:Espresso    文件:AutoFocusManager.java   
@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);
        }
    }
}
项目:Ghost-Android    文件:DateDeserializer.java   
@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();
    }
}
项目:ITagAntiLost    文件:DevicesActivity.java   
@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();
}
项目:RxUploader    文件:SimpleUploadDataStoreTest.java   
@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);
}
项目:exciting-app    文件:AbsHListView.java   
@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);
        }
    }
}
项目:XERUNG    文件:AddPrefixMemberAdapter.java   
/**
 * 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;

}
项目:GongXianSheng    文件:UnlockDeviceAndroidJUnitRunner.java   
@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();
}
项目:qmui    文件:QMUILinkTextView.java   
@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;
}
项目:boohee_v5.6    文件:SwipeBackActivityHelper.java   
@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) {
    }
}
项目:nongbeer-mvp-android-demo    文件:BeerProductHolder.java   
@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 );
    }
}
项目:Utils    文件:FileUtil.java   
/**
 * 获取磁盘可用空间.
 */
@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;
}
项目:face-landmark-android    文件:CameraConnectionFragment.java   
/**
 * 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 );
    }
}
项目:Go-RxJava    文件:ChildViewHolder.java   
@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();
    }
}
项目:Hitalk    文件:FloatingActionButton.java   
@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();
}
项目:cordova-plugin-themeablebrowser-diy    文件:InAppBrowser.java   
/**
 * 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);
            }*/
        }
    });
}
项目:airgram    文件:MediaController.java   
@SuppressLint("NewApi")
public static MediaCodecInfo selectCodec(String mimeType) {
    int numCodecs = MediaCodecList.getCodecCount();
    MediaCodecInfo lastCodecInfo = null;
    for (int i = 0; i < numCodecs; i++) {
        MediaCodecInfo codecInfo = MediaCodecList.getCodecInfoAt(i);
        if (!codecInfo.isEncoder()) {
            continue;
        }
        String[] types = codecInfo.getSupportedTypes();
        for (String type : types) {
            if (type.equalsIgnoreCase(mimeType)) {
                lastCodecInfo = codecInfo;
                if (!lastCodecInfo.getName().equals("OMX.SEC.avc.enc")) {
                    return lastCodecInfo;
                } else if (lastCodecInfo.getName().equals("OMX.SEC.AVC.Encoder")) {
                    return lastCodecInfo;
                }
            }
        }
    }
    return lastCodecInfo;
}
项目:PeSanKita-android    文件:ContactIdentityManagerICS.java   
@SuppressLint("NewApi")
@Override
public Uri getSelfIdentityUri() {
  String[] PROJECTION = new String[] {
      PhoneLookup.DISPLAY_NAME,
      PhoneLookup.LOOKUP_KEY,
      PhoneLookup._ID,
  };

  Cursor cursor = null;

  try {
    cursor = context.getContentResolver().query(ContactsContract.Profile.CONTENT_URI,
                                                  PROJECTION, null, null, null);

    if (cursor != null && cursor.moveToFirst()) {
      return Contacts.getLookupUri(cursor.getLong(2), cursor.getString(1));
    }
  } finally {
    if (cursor != null)
      cursor.close();
  }

  return null;
}
项目:Swface    文件:StickyListHeadersListView.java   
@SuppressLint("NewApi")
private void setHeaderOffet(int offset) {
    if (mHeaderOffset == null || mHeaderOffset != offset) {
        mHeaderOffset = offset;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
            mHeader.setTranslationY(mHeaderOffset);
        } else {
            MarginLayoutParams params = (MarginLayoutParams) mHeader.getLayoutParams();
            params.topMargin = mHeaderOffset;
            mHeader.setLayoutParams(params);
        }
        if (mOnStickyHeaderOffsetChangedListener != null) {
            mOnStickyHeaderOffsetChangedListener.onStickyHeaderOffsetChanged(this, mHeader, -mHeaderOffset);
        }
    }
}
项目:tuxguitar    文件:TGToolbarPlayRateDialog.java   
@SuppressLint("InflateParams")
public Dialog onCreateDialog() {
    tgPlayRateList = generatePercent();

    final View view = getActivity().getLayoutInflater().inflate(R.layout.view_toolbar_playrate_dialog, null);
    this.seekBar = (SeekBar) view.findViewById(R.id.toolbar_percent_seekbar);
    this.textView = (TextView) view.findViewById(R.id.toolbar_percent_textview);

    this.seekBar.setMax(tgPlayRateList.size() - 1);
    this.initPlayRate();
    this.appendListeners(seekBar);

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.toolbar_playrate_dlg_title);
    builder.setView(view);
    return builder.create();
}
项目:GCSApp    文件:SearChContactListFragment.java   
@SuppressLint("InflateParams")
    @Override
    protected void initView() {
        super.initView();
//        @SuppressLint("InflateParams")
//        View headerView = LayoutInflater.from(getActivity()).inflate(R.layout.em_contacts_header, null);
//        HeaderItemClickListener clickListener = new HeaderItemClickListener();
//        applicationItem = (ContactItemView) headerView.findViewById(R.id.application_item);
//        applicationItem.setVisibility(View.GONE);
//        applicationItem.setOnClickListener(clickListener);
//        headerView.findViewById(R.id.group_item).setOnClickListener(clickListener);
//        headerView.findViewById(R.id.chat_room_item).setOnClickListener(clickListener);
//        headerView.findViewById(R.id.robot_item).setOnClickListener(clickListener);
//        listView.addHeaderView(headerView);
        //add loading view
        loadingView = LayoutInflater.from(getActivity()).inflate(R.layout.em_layout_loading_data, null);
        contentContainer.addView(loadingView);
//        getView().findViewById(R.id.search_bar_view).setVisibility(View.GONE);
        registerForContextMenu(listView);
    }
项目:Exoplayer2Radio    文件:AudioCapabilities.java   
@SuppressLint("InlinedApi")
/* package */ static AudioCapabilities getCapabilities(Intent intent) {
  if (intent == null || intent.getIntExtra(AudioManager.EXTRA_AUDIO_PLUG_STATE, 0) == 0) {
    return DEFAULT_AUDIO_CAPABILITIES;
  }
  return new AudioCapabilities(intent.getIntArrayExtra(AudioManager.EXTRA_ENCODINGS),
      intent.getIntExtra(AudioManager.EXTRA_MAX_CHANNEL_COUNT, 0));
}
项目:PokerBankroll    文件:adpDrawerPrincipal.java   
@SuppressLint("InflateParams")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        convertView = mInflater.inflate(R.layout.list_drawer_principal, null);
    }

    ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon);
    TextView txtTitle = (TextView) convertView.findViewById(R.id.txtTitulo);

    imgIcon.setImageResource(navDrawerItems.get(position).getIcon());
    txtTitle.setText(navDrawerItems.get(position).getTitle());

    return convertView;
}
项目:LucaHome-AndroidApplication    文件:MoneyMeterListViewAdapter.java   
@SuppressLint({"InflateParams", "ViewHolder"})
@Override
public View getView(final int index, View convertView, ViewGroup parent) {
    final Holder holder = new Holder();

    View rowView = _inflater.inflate(R.layout.listview_card_moneymeterdata, null);

    holder._dateText = rowView.findViewById(R.id.moneymeterdata_date_text_view);
    holder._valueText = rowView.findViewById(R.id.moneymeterdata_value_text_view);
    holder._unitText = rowView.findViewById(R.id.moneymeterdata_unit_text_view);
    holder._updateButton = rowView.findViewById(R.id.moneymeterdata_card_update_button);
    holder._deleteButton = rowView.findViewById(R.id.moneymeterdata_card_delete_button);

    final MoneyMeterData moneyMeterData = _listViewItems.getValue(index);

    holder._dateText.setText(moneyMeterData.GetSaveDate().DDMMYYYY());
    holder._valueText.setText(String.valueOf(moneyMeterData.GetAmount()));
    holder._unitText.setText(moneyMeterData.GetUnit());

    holder._updateButton.setOnClickListener(view -> holder.navigateToEditActivity(moneyMeterData));
    holder._deleteButton.setOnClickListener(view -> holder.displayDeleteDialog(moneyMeterData));

    rowView.setVisibility((moneyMeterData.GetServerDbAction() == ILucaClass.LucaServerDbAction.Delete) ? View.GONE : View.VISIBLE);

    return rowView;
}
项目:android-mobile-engage-sdk    文件:IamWebViewProvider.java   
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
public void loadMessageAsync(final String html, final IamJsBridge jsBridge, final MessageLoadedListener messageLoadedListener) {
    Assert.notNull(html, "Html must not be null!");
    Assert.notNull(messageLoadedListener, "MessageLoadedListener must not be null!");
    Assert.notNull(jsBridge, "JsBridge must not be null!");

    new Handler(Looper.getMainLooper()).post(new Runnable() {
        @SuppressLint({"JavascriptInterface", "AddJavascriptInterface"})
        @Override
        public void run() {
            Context context = MobileEngage.getConfig().getApplication();
            webView = new WebView(context);

            jsBridge.setWebView(webView);

            webView.getSettings().setJavaScriptEnabled(true);
            webView.addJavascriptInterface(jsBridge, "Android");
            webView.setBackgroundColor(Color.TRANSPARENT);
            webView.setWebViewClient(new IamWebViewClient(messageLoadedListener));

            webView.loadData(html, "text/html", "UTF-8");
        }
    });
}
项目:AllHuaji    文件:MainActivity.java   
@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_demo);
    setting = new Settings(this);
    s = (Switch) findViewById(R.id.switch1);
    s.setChecked(setting.isStarted());
    s.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO 自动生成的方法存根
            setting.setStarted(isChecked);
        }
    });

}
项目:Toodoo    文件:ToodooCamera.java   
/**
 * Creates and starts the camera.  Note that this uses a higher resolution in comparison
 * to other detection examples to enable the ocr detector to detect small text samples
 * at long distances.
 *
 * Suppressing InlinedApi since there is a check that the minimum version is met before using
 * the constant.
 */
@SuppressLint("InlinedApi")
private void createCameraSource(boolean autoFocus, boolean useFlash) {
    Context context = getApplicationContext();

    // A text recognizer is created to find text.  An associated multi-processor instance
    // is set to receive the text recognition results, track the text, and maintain
    // graphics for each text block on screen.  The factory is used by the multi-processor to
    // create a separate tracker instance for each text block.
    TextRecognizer textRecognizer = new TextRecognizer.Builder(context).build();
    textRecognizer.setProcessor(new OcrDetectorProcessor(mGraphicOverlay));

    if (!textRecognizer.isOperational()) {
        // Note: The first time that an app using a Vision API is installed on a
        // device, GMS will download a native libraries to the device in order to do detection.
        // Usually this completes before the app is run for the first time.  But if that
        // download has not yet completed, then the above call will not detect any text,
        // barcodes, or faces.
        //
        // isOperational() can be used to check if the required native libraries are currently
        // available.  The detectors will automatically become operational once the library
        // downloads complete on device.
        Log.w(TAG, "Detector dependencies are not yet available.");

        // Check for low storage.  If there is low storage, the native library will not be
        // downloaded, so detection will not become operational.
        IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
        boolean hasLowStorage = registerReceiver(null, lowstorageFilter) != null;

        if (hasLowStorage) {
            Toast.makeText(this, R.string.low_storage_error, Toast.LENGTH_LONG).show();
            Log.w(TAG, getString(R.string.low_storage_error));
        }
    }

    // Creates and starts the camera.  Note that this uses a higher resolution in comparison
    // to other detection examples to enable the text recognizer to detect small pieces of text.
    mCameraSource =
            new CameraSource.Builder(getApplicationContext(), textRecognizer)
                    .setFacing(CameraSource.CAMERA_FACING_BACK)
                    .setRequestedPreviewSize(1280, 1024)
                    .setRequestedFps(2.0f)
                    .setFlashMode(useFlash ? Camera.Parameters.FLASH_MODE_TORCH : null)
                    .setFocusMode(autoFocus ? Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE : null)
                    .build();
}
项目:PlusGram    文件:CameraController.java   
public void startPreview(final CameraSession session) {
    if (session == null) {
        return;
    }
    threadPool.execute(new Runnable() {
        @SuppressLint("NewApi")
        @Override
        public void run() {
            Camera camera = session.cameraInfo.camera;
            try {
                if (camera == null) {
                    camera = session.cameraInfo.camera = Camera.open(session.cameraInfo.cameraId);
                }
                camera.startPreview();
            } catch (Exception e) {
                session.cameraInfo.camera = null;
                if (camera != null) {
                    camera.release();
                }
                FileLog.e("tmessages", e);
            }
        }
    });
}
项目:GitHub    文件:MessageDialog.java   
@SuppressLint("InflateParams")
@Override
public AlertDialog onCreateDialog(Bundle savedInstanceState) {
    View dialogView = LayoutInflater.from(getActivity())
            .inflate(R.layout.dialog_message, null);

    TextView messageView = (TextView) dialogView.findViewById(R.id.message);
    messageView.setMovementMethod(LinkMovementMethod.getInstance());
    messageView.setText(Html.fromHtml(getArguments().getString(ARG_MESSAGE)));

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppTheme_AlertDialog);
    builder.setTitle(getArguments().getString(ARG_TITLE))
            .setIcon(getArguments().getInt(ARG_ICON))
            .setView(dialogView)
            .setPositiveButton(R.string.OK, new OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });

    return builder.create();
}
项目:letv    文件:TDialog.java   
@SuppressLint({"SetJavaScriptEnabled"})
private void b() {
    this.i.setVerticalScrollBarEnabled(false);
    this.i.setHorizontalScrollBarEnabled(false);
    this.i.setWebViewClient(new FbWebViewClient());
    this.i.setWebChromeClient(this.mChromeClient);
    this.i.clearFormData();
    WebSettings settings = this.i.getSettings();
    settings.setSavePassword(false);
    settings.setSaveFormData(false);
    settings.setCacheMode(-1);
    settings.setNeedInitialFocus(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);
    if (!(this.c == null || this.c.get() == null)) {
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(((Context) this.c.get()).getApplicationContext().getDir("databases", 0).getPath());
    }
    settings.setDomStorageEnabled(true);
    this.jsBridge.a(new JsListener(), "sdk_js_if");
    this.i.loadUrl(this.e);
    this.i.setLayoutParams(a);
    this.i.setVisibility(4);
    this.i.getSettings().setSavePassword(false);
}
项目:GitHub    文件:PrefStore.java   
/**
 * Get height of device screen
 *
 * @param c context
 * @return screen height
 */
@SuppressLint("NewApi")
static Integer getScreenHeight(Context c) {
    int height = 0;
    WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    if (Build.VERSION.SDK_INT > 12) {
        Point size = new Point();
        display.getSize(size);
        height = size.y;
    } else {
        height = display.getHeight(); // deprecated
    }
    return height;
}
项目:APIJSON-Android-RxJava    文件:GridAdapter.java   
/**标记List<String>中的值是否已被选中。
 * 不需要可以删除,但“this.list = list;”这句
 * 要放到constructor【这个adapter只有ModleAdapter(Context context, List<Object> list)这一个constructor】里去
 * @param list
 * @return
 */
@SuppressLint("UseSparseArrays")
private void initList(List<Entry<String, String>> list) {
    this.list = list;
    if (hasCheck) {
        hashMap = new HashMap<Integer, Boolean>();
        if (list != null) {
            for (int i = 0; i < list.size(); i++) {
                hashMap.put(i, false);
            }
        }
    }
}
项目:LeCatApp    文件:InactivityTimer.java   
/**
 * 首先终止之前的监控任务,然后新起一个监控任务
 */
@SuppressWarnings("unchecked")
@SuppressLint("NewApi")
public synchronized void onActivity() {
    cancel();
    inactivityTask = new InactivityAsyncTask();
    inactivityTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
项目:orgzly-android    文件:SyncFragment.java   
@SuppressLint("StaticFieldLeak")
public void createFilter(final Filter filter) {
    new AsyncTask<Void, Void, Void>() {
        @Override
        protected Void doInBackground(Void... params) {
            mShelf.createFilter(filter);
            return null;
        }
    }.execute();
}
项目:AndiCar    文件:BaseEditFragment.java   
@SuppressLint("WrongConstant")
void initDateTimeFields() {
    mDateTimeCalendar.setTimeInMillis(mlDateTimeInMillis);
    if (isTimeOnly) {
        mDateTimeCalendar.set(1970, Calendar.JANUARY, 1);
    }
    mYear = mDateTimeCalendar.get(Calendar.YEAR);
    mMonth = mDateTimeCalendar.get(Calendar.MONTH);
    mDay = mDateTimeCalendar.get(Calendar.DAY_OF_MONTH);
    mHour = mDateTimeCalendar.get(Calendar.HOUR_OF_DAY);
    mMinute = mDateTimeCalendar.get(Calendar.MINUTE);
    mDateTimeCalendar.set(mYear, mMonth, mDay, mHour, mMinute, 0); //reset seconds to 0
    mlDateTimeInMillis = mDateTimeCalendar.getTimeInMillis();
}
项目:ObjectBoxDebugBrowser    文件:NetworkUtils.java   
public static String getAddressLog(Context context, int port) {
    WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
    int ipAddress = wifiManager.getConnectionInfo().getIpAddress();
    @SuppressLint("DefaultLocale")
    final String formattedIpAddress = String.format("%d.%d.%d.%d",
            (ipAddress & 0xff),
            (ipAddress >> 8 & 0xff),
            (ipAddress >> 16 & 0xff),
            (ipAddress >> 24 & 0xff));
    return "Open http://" + formattedIpAddress + ":" + port + " in your browser";
}
项目:encryptedprefs    文件:SecureSharedPreferencesTest.java   
@SuppressLint("CommitPrefEdits")
@Test
public void secureEditor_putFloat_ShouldStoreToBackingEditor() {

    SharedPreferences.Editor editor = mockPutValue(String.valueOf(Float.MAX_VALUE));

    EncryptedSharedPreferences.SecureEditor secureEditor = (EncryptedSharedPreferences.SecureEditor) prefs.edit();
    SharedPreferences.Editor returnedEditor = secureEditor.putFloat(KEY, Float.MAX_VALUE);

    secureEditor_verifyPutValue(editor, secureEditor, returnedEditor);
}
项目:OSchina_resources_android    文件:ShareNewsActivity.java   
@SuppressLint("SetTextI18n")
@Override
protected void initData() {
    super.initData();
    mTextTitle.setText(mBean.getTitle());
    mTextPubDate.setText("发布于 " + StringUtils.formatYearMonthDay(mBean.getPubDate()));
    Author author = mBean.getAuthor();
    if (author != null) {
        mTextAuthor.setText("@" + author.getName());
    }
}
项目:letv    文件:SyncUserStateUtil.java   
@SuppressLint({"AddJavascriptInterface"})
public synchronized void syncUserStateByAsync(Context context) {
    LogInfo.log("wlx", "通知WebView客户端登录登出状态");
    mIsSyncUserStateSuccessWithH5 = false;
    WebView webView = new WebView(context);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.addJavascriptInterface(new JSHandler(), "jshandler");
    webView.setVisibility(8);
    webView.loadUrl(getSyncUserStateUrl());
    webView.setWebViewClient(new 1(this));
}
项目:simplewallet-api-java    文件:SimpleWallet.java   
@SuppressLint("DefaultLocale")
public static String AmountToString(long amount){
  String res = "";
  DecimalFormat df = new DecimalFormat("#.00##########");
  res = df.format(amount * 0.000000000001);
  return res;
}
项目:UpdateLibrary    文件:X5WebView.java   
@SuppressLint("SetJavaScriptEnabled")
public X5WebView(Context arg0, AttributeSet arg1) {
    super(arg0, arg1);
    this.setWebViewClient(client);
    initWebViewSettings();
    this.getView().setClickable(true);
}