java类android.annotation.SuppressLint的实例源码

AutoFocusManager.java 文件源码 项目:Espresso 阅读 20 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
DateDeserializer.java 文件源码 项目:Ghost-Android 阅读 28 收藏 0 点赞 0 评论 0
@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();
    }
}
DevicesActivity.java 文件源码 项目:ITagAntiLost 阅读 26 收藏 0 点赞 0 评论 0
@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();
}
SimpleUploadDataStoreTest.java 文件源码 项目:RxUploader 阅读 20 收藏 0 点赞 0 评论 0
@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);
}
AbsHListView.java 文件源码 项目:exciting-app 阅读 20 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
AddPrefixMemberAdapter.java 文件源码 项目:XERUNG 阅读 18 收藏 0 点赞 0 评论 0
/**
 * 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;

}
UnlockDeviceAndroidJUnitRunner.java 文件源码 项目:GongXianSheng 阅读 28 收藏 0 点赞 0 评论 0
@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();
}
QMUILinkTextView.java 文件源码 项目:qmui 阅读 16 收藏 0 点赞 0 评论 0
@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;
}
SwipeBackActivityHelper.java 文件源码 项目:boohee_v5.6 阅读 26 收藏 0 点赞 0 评论 0
@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) {
    }
}
BeerProductHolder.java 文件源码 项目:nongbeer-mvp-android-demo 阅读 23 收藏 0 点赞 0 评论 0
@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 );
    }
}
FileUtil.java 文件源码 项目:Utils 阅读 28 收藏 0 点赞 0 评论 0
/**
 * 获取磁盘可用空间.
 */
@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;
}
CameraConnectionFragment.java 文件源码 项目:face-landmark-android 阅读 34 收藏 0 点赞 0 评论 0
/**
 * 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 );
    }
}
ChildViewHolder.java 文件源码 项目:Go-RxJava 阅读 20 收藏 0 点赞 0 评论 0
@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();
    }
}
FloatingActionButton.java 文件源码 项目:Hitalk 阅读 28 收藏 0 点赞 0 评论 0
@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();
}
InAppBrowser.java 文件源码 项目:cordova-plugin-themeablebrowser-diy 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 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);
            }*/
        }
    });
}
MediaController.java 文件源码 项目:airgram 阅读 23 收藏 0 点赞 0 评论 0
@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;
}
ContactIdentityManagerICS.java 文件源码 项目:PeSanKita-android 阅读 17 收藏 0 点赞 0 评论 0
@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;
}
StickyListHeadersListView.java 文件源码 项目:Swface 阅读 18 收藏 0 点赞 0 评论 0
@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);
        }
    }
}
TGToolbarPlayRateDialog.java 文件源码 项目:tuxguitar 阅读 24 收藏 0 点赞 0 评论 0
@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();
}
SearChContactListFragment.java 文件源码 项目:GCSApp 阅读 18 收藏 0 点赞 0 评论 0
@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);
    }
AudioCapabilities.java 文件源码 项目:Exoplayer2Radio 阅读 17 收藏 0 点赞 0 评论 0
@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));
}
adpDrawerPrincipal.java 文件源码 项目:PokerBankroll 阅读 21 收藏 0 点赞 0 评论 0
@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;
}
MoneyMeterListViewAdapter.java 文件源码 项目:LucaHome-AndroidApplication 阅读 19 收藏 0 点赞 0 评论 0
@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;
}
IamWebViewProvider.java 文件源码 项目:android-mobile-engage-sdk 阅读 15 收藏 0 点赞 0 评论 0
@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");
        }
    });
}
MainActivity.java 文件源码 项目:AllHuaji 阅读 20 收藏 0 点赞 0 评论 0
@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);
        }
    });

}
ToodooCamera.java 文件源码 项目:Toodoo 阅读 20 收藏 0 点赞 0 评论 0
/**
 * 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();
}
CameraController.java 文件源码 项目:PlusGram 阅读 35 收藏 0 点赞 0 评论 0
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);
            }
        }
    });
}
MessageDialog.java 文件源码 项目:GitHub 阅读 27 收藏 0 点赞 0 评论 0
@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();
}
TDialog.java 文件源码 项目:letv 阅读 21 收藏 0 点赞 0 评论 0
@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);
}
PrefStore.java 文件源码 项目:GitHub 阅读 76 收藏 0 点赞 0 评论 0
/**
 * 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;
}


问题


面经


文章

微信
公众号

扫码关注公众号