Java Code Examples for android.annotation.SuppressLint

The following examples show how to use android.annotation.SuppressLint. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: InviZible   Source File: MainFragment.java    License: GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("SetTextI18n")
@Override
public void setTorLogViewText() {
    if (getActivity() != null && tvTorLog == null && svTorLog == null && !orientationLandscape) {
        tvTorLog = getActivity().findViewById(R.id.tvTorLog);
        svTorLog = getActivity().findViewById(R.id.svTorLog);

        if (svTorLog != null) {
            svTorLog.getViewTreeObserver().addOnScrollChangedListener(this);
        }
    }

    if (tvTorLog != null && svTorLog != null) {
        tvTorLog.setText(getText(R.string.tvTorDefaultLog) + " " + TorVersion);
        tvTorLog.setGravity(Gravity.CENTER);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.gravity = Gravity.CENTER;
        svTorLog.setLayoutParams(params);
    }
}
 
Example 2
Source Project: ZadakNotification   Source File: Wear.java    License: MIT License 6 votes vote down vote up
@SuppressLint("ResourceType")
public Wear button(@DrawableRes int icon, String title, PendingIntent pendingIntent) {
    if (icon < 0) {
        throw new IllegalArgumentException("Resource ID Should Not Be Less Than Or Equal To Zero!");
    }

    if (title == null) {
        throw new IllegalStateException("Title Must Not Be Null!");
    }
    if (pendingIntent == null) {
        throw new IllegalArgumentException("PendingIntent Must Not Be Null.");
    }

    this.wearableExtender.addAction(new NotificationCompat.Action(icon, title, pendingIntent));
    return this;
}
 
Example 3
private MyObserver<List<RecommendBookBean>> getImportObserver() {
    return new MyObserver<List<RecommendBookBean>>() {
        @SuppressLint("DefaultLocale")
        @Override
        public void onNext(List<RecommendBookBean> bookSourceBeans) {
            if (bookSourceBeans.size() > 0) {
                adapter.replaceAll(bookSourceBeans);
               // mView.refreshBookList(bookSourceBeans.get(0).getList());
                // mView.showSnackBar(String.format("导入成功%d个书源", bookSourceBeans.size()), Snackbar.LENGTH_SHORT);
                // mView.setResult(RESULT_OK);
            } else {
                //mView.showSnackBar("格式不对", Snackbar.LENGTH_SHORT);
            }
        }

        @Override
        public void onError(Throwable e) {
            //mView.showSnackBar(e.getMessage(), Snackbar.LENGTH_SHORT);
        }
    };
}
 
Example 4
Source Project: a   Source File: CoverImageView.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onDraw(Canvas canvas) {
    if (width >= 10 && height > 10) {
        @SuppressLint("DrawAllocation")
        Path path = new Path();
        //四个圆角
        path.moveTo(10, 0);
        path.lineTo(width - 10, 0);
        path.quadTo(width, 0, width, 10);
        path.lineTo(width, height - 10);
        path.quadTo(width, height, width - 10, height);
        path.lineTo(10, height);
        path.quadTo(0, height, 0, height - 10);
        path.lineTo(0, 10);
        path.quadTo(0, 0, 10, 0);

        canvas.clipPath(path);
    }
    super.onDraw(canvas);
}
 
Example 5
Source Project: react-native-tcp-socket   Source File: TcpSocketModule.java    License: MIT License 6 votes vote down vote up
@SuppressLint("StaticFieldLeak")
@SuppressWarnings("unused")
@ReactMethod
public void listen(final Integer cId, final ReadableMap options) {
    new GuardedAsyncTask<Void, Void>(mReactContext.getExceptionHandler()) {
        @Override
        protected void doInBackgroundGuarded(Void... params) {
            try {
                TcpSocketServer server = new TcpSocketServer(socketClients, TcpSocketModule.this, cId, options);
                socketClients.put(cId, server);
                int port = options.getInt("port");
                String host = options.getString("host");
                onConnect(cId, host, port);
            } catch (Exception uhe) {
                onError(cId, uhe.getMessage());
            }
        }
    }.executeOnExecutor(executorService);
}
 
Example 6
Source Project: a   Source File: MyMainActivity.java    License: GNU General Public License v3.0 6 votes vote down vote up
private View tab_icon(String name, Integer iconID) {
    @SuppressLint("InflateParams")
    View tabView = LayoutInflater.from(this).inflate(R.layout.tab_view_icon_right, null);
    TextView tv = tabView.findViewById(R.id.tabtext);
    //tv.setHeight(14);
    tv.setText(name);
    tv.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));//加粗
    ImageView im = tabView.findViewById(R.id.tabicon);
    if (iconID != null) {
        im.setVisibility(View.VISIBLE);
        im.setImageResource(iconID);
    } else {
        im.setVisibility(View.GONE);
    }
    return tabView;
}
 
Example 7
Source Project: XMiTools   Source File: StorageUtils.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * Set file world readable
 */
@SuppressLint("SetWorldReadable")
public static void setFileWorldReadable(File file, int parentDepth) {
    if (!file.exists()) {
        return;
    }

    for (int i = 0; i < parentDepth; i++) {
        file.setReadable(true, false);
        file.setExecutable(true, false);
        file = file.getParentFile();
        if (file == null) {
            break;
        }
    }
}
 
Example 8
Source Project: FimiX8-RE   Source File: FimiMediaPlayer.java    License: MIT License 6 votes vote down vote up
@SuppressLint({"Wakelock"})
public void setWakeMode(Context context, int mode) {
    boolean washeld = false;
    if (this.mWakeLock != null) {
        if (this.mWakeLock.isHeld()) {
            washeld = true;
            this.mWakeLock.release();
        }
        this.mWakeLock = null;
    }
    this.mWakeLock = ((PowerManager) context.getSystemService("power")).newWakeLock(NTLMConstants.FLAG_NEGOTIATE_128_BIT_ENCRYPTION | mode, FimiMediaPlayer.class.getName());
    this.mWakeLock.setReferenceCounted(false);
    if (washeld) {
        this.mWakeLock.acquire();
    }
}
 
Example 9
@SuppressLint("ClickableViewAccessibility")
private void setTouchListener(@NonNull RecyclerView recyclerView,
                              @NonNull RecyclerView.ViewHolder viewHolder,
                              float dx)
{
  recyclerView.setOnTouchListener((v, event) -> {
    switch (event.getAction()) {
      case MotionEvent.ACTION_DOWN:
        shouldTriggerSwipeFeedback = true;
        break;
      case MotionEvent.ACTION_UP:
        handleTouchActionUp(recyclerView, viewHolder, dx);
      case MotionEvent.ACTION_CANCEL:
        swipeBack = true;
        shouldTriggerSwipeFeedback = false;
        resetProgressIfAnimationsDisabled(viewHolder);
        break;
    }
    return false;
  });
}
 
Example 10
Source Project: react-native-arcgis-mapview   Source File: RNAGSMapView.java    License: MIT License 6 votes vote down vote up
@SuppressLint("ClickableViewAccessibility")
public void setUpMap() {
    mapView.setMap(new ArcGISMap(Basemap.Type.STREETS_VECTOR, 34.057, -117.196, 17));
    mapView.setOnTouchListener(new OnSingleTouchListener(getContext(),mapView));
    routeGraphicsOverlay = new GraphicsOverlay();
    mapView.getGraphicsOverlays().add(routeGraphicsOverlay);
    mapView.getMap().addDoneLoadingListener(() -> {
        ArcGISRuntimeException e = mapView.getMap().getLoadError();
        Boolean success = e != null;
        String errorMessage = !success ? "" : e.getMessage();
        WritableMap map = Arguments.createMap();
        map.putBoolean("success",success);
        map.putString("errorMessage",errorMessage);

        emitEvent("onMapDidLoad",map);
    });
}
 
Example 11
Source Project: a   Source File: AnalyzeRule.java    License: GNU General Public License v3.0 6 votes vote down vote up
/**
 * 替换JS
 */
@SuppressLint("DefaultLocale")
private String replaceJs(String ruleStr) throws Exception {
    if (ruleStr.contains("{{") && ruleStr.contains("}}")) {
        Object jsEval;
        StringBuffer sb = new StringBuffer(ruleStr.length());
        Matcher expMatcher = EXP_PATTERN.matcher(ruleStr);
        while (expMatcher.find()) {
            jsEval = evalJS(expMatcher.group(1), object);
            if (jsEval instanceof String) {
                expMatcher.appendReplacement(sb, (String) jsEval);
            } else if (jsEval instanceof Double && ((Double) jsEval) % 1.0 == 0) {
                expMatcher.appendReplacement(sb, String.format("%.0f", (Double) jsEval));
            } else {
                expMatcher.appendReplacement(sb, String.valueOf(jsEval));
            }
        }
        expMatcher.appendTail(sb);
        ruleStr = sb.toString();
    }
    return ruleStr;
}
 
Example 12
@SuppressLint("StaticFieldLeak")
private void handleClearKey() {
  Log.i(TAG, "handleClearKey");

  pendingAlarm = false;

  if (ApplicationMigrations.isUpdate(this)) {
    Log.w(TAG, "Cannot clear key during update.");
    return;
  }

  KeyCachingService.locking = true;

  sendPackageBroadcast(CLEAR_KEY_EVENT);

  new AsyncTask<Void, Void, Void>() {
    @Override
    protected Void doInBackground(Void... params) {
      ApplicationDependencies.getMessageNotifier().clearNotifications(KeyCachingService.this, true);
      return null;
    }
  }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
 
Example 13
@SuppressLint("StaticFieldLeak")
private void initializeBackupDetection(@NonNull View view) {
  searchForBackup(backup -> {
    Context context = getContext();
    if (context == null) {
      Log.i(TAG, "No context on fragment, must have navigated away.");
      return;
    }

    if (backup == null) {
      Log.i(TAG, "Skipping backup detection. No backup found, or permission revoked since.");
      Navigation.findNavController(view)
                .navigate(RestoreBackupFragmentDirections.actionNoBackupFound());
    } else {
      restoreBackupSize.setText(getString(R.string.RegistrationActivity_backup_size_s, Util.getPrettyFileSize(backup.getSize())));
      restoreBackupTime.setText(getString(R.string.RegistrationActivity_backup_timestamp_s, DateUtils.getExtendedRelativeTimeSpanString(requireContext(), Locale.getDefault(), backup.getTimestamp())));

      restoreButton.setOnClickListener((v) -> handleRestore(v.getContext(), backup));
    }
  });
}
 
Example 14
Source Project: HttpInfo   Source File: NetWork.java    License: Apache License 2.0 6 votes vote down vote up
public static boolean isNetworkAvailable(Context context) {
    try {
        ConnectivityManager mgr = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        if (mgr == null) {
            return false;
        }
        @SuppressLint("MissingPermission") @SuppressWarnings("deprecation") NetworkInfo[] info = mgr.getAllNetworkInfo();
        if (info != null) {
            for (NetworkInfo anInfo : info) {
                if (anInfo.getState() == NetworkInfo.State.CONNECTED) {
                    return true;
                }
            }
        }
    } catch (Exception e) {
        //ignore

    }
    return false;
}
 
Example 15
@SuppressLint("CheckResult")
@Override
public void initData() {
    try {
        Intent intent = getIntent();
        BaseInvokeModel baseInvokeModel = new BaseInvokeModel();
        baseInvokeModel.setPackageName(intent.getStringExtra("packageName"));
        baseInvokeModel.setClassName(intent.getStringExtra("className"));
        baseInvokeModel.setAppName(intent.getStringExtra("appName"));
        baseInvokeModel.setAction(intent.getStringExtra("action"));
        Uri uri = intent.getData();
        if (uri != null) {
            baseInvokeModel.setParam(uri.getQueryParameter("param"));
        }
        Bundle bundle = new Bundle();
        bundle.putSerializable(IntentKeyGlobal.INVOKE_SENDER_INFO, baseInvokeModel);
        ARouter.getInstance().build(RouterActivityPath.ACTIVITY_MAIN_PATH).with(bundle).navigation();
        finish();
    } catch (Exception e) {
        ARouter.getInstance().build(RouterActivityPath.ACTIVITY_MAIN_PATH).navigation();
        finish();
    }
}
 
Example 16
Source Project: QNotified   Source File: ExfriendManager.java    License: GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("MissingPermission")
public void doNotifyDelFlAndSave(Object[] ptr) {
    dirtySerializedFlag = true;
    fileData.putLong("lastUpdateFl", lastUpdateTimeSec);
    //log("Friendlist updated @" + lastUpdateTimeSec);
    saveConfigure();
    try {
        if (isNotifyWhenDeleted() && ((int) ptr[0]) > 0) {
            Intent inner = new Intent(getApplication(), ExfriendListActivity.class);
            inner.putExtra(ACTIVITY_PROXY_ACTION, ACTION_EXFRIEND_LIST);
            Intent wrapper = new Intent();
            wrapper.setClassName(getApplication().getPackageName(), ActProxyMgr.STUB_ACTIVITY);
            wrapper.putExtra(ActProxyMgr.ACTIVITY_PROXY_INTENT, inner);
            PendingIntent pi = PendingIntent.getActivity(getApplication(), 0, wrapper, 0);
            NotificationManager nm = (NotificationManager) Utils.getApplication().getSystemService(Context.NOTIFICATION_SERVICE);
            Notification n = createNotiComp(nm, (String) ptr[1], (String) ptr[2], (String) ptr[3], new long[]{100, 200, 200, 100}, pi);
            nm.notify(ID_EX_NOTIFY, n);
            setRedDot();
        }
    } catch (Exception e) {
        log(e);
    }
}
 
Example 17
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(e);
            }
        }
    });
}
 
Example 18
Source Project: HttpInfo   Source File: HttpBean.java    License: Apache License 2.0 6 votes vote down vote up
@SuppressLint("DefaultLocale")
@Override
protected JSONObject toJSONObject() {
    try {
        jsonObject.put(isChina() ? HttpData.ERROR_CN : HttpData.ERROR, error);
        jsonObject.put(isChina() ? HttpData.ADDRESS_CN : HttpData.ADDRESS, address);
        jsonObject.put(isChina() ? HttpData.TIME_CN : HttpData.TIME, time + "ms");
        jsonObject.put(isChina() ? HttpData.TOTALTIME_CN : HttpData.TOTALTIME, totalTime + "ms");
        jsonObject.put(isChina() ? HttpData.SPEED_CN : HttpData.SPEED, speed + "kbps");
        jsonObject.put(isChina() ? HttpData.RESPONSECODE_CN : HttpData.RESPONSECODE, responseCode);
        jsonObject.put(isChina() ? HttpData.SIZE_CN : HttpData.SIZE, String.format("%.1fKB", new BigDecimal(size)));
        jsonObject.put(isChina() ? HttpData.HEADER_SERVER_CN : HttpData.HEADER_SERVER, headerServer);
        jsonObject.put(isChina() ? HttpData.CHECK_HEADER_SERVER_CN : HttpData.CHECK_HEADER_SERVER, checkHeaderServer);
        jsonObject.put(isChina() ? HttpData.ISJUMP_CN : HttpData.ISJUMP, isJump);
        jsonObject.put(isChina() ? HttpData.HEADER_CN : HttpData.HEADER, new JSONArray(header));
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return super.toJSONObject();
}
 
Example 19
Source Project: InviZible   Source File: MainFragment.java    License: GNU General Public License v3.0 6 votes vote down vote up
@SuppressLint("SetTextI18n")
@Override
public void setDNSCryptLogViewText() {
    if (getActivity() != null && tvDNSCryptLog == null && svDNSCryptLog == null && !orientationLandscape) {
        tvDNSCryptLog = getActivity().findViewById(R.id.tvDNSCryptLog);
        svDNSCryptLog = getActivity().findViewById(R.id.svDNSCryptLog);

        if (svDNSCryptLog != null) {
            svDNSCryptLog.getViewTreeObserver().addOnScrollChangedListener(this);
        }
    }

    if (tvDNSCryptLog != null && svDNSCryptLog != null) {
        tvDNSCryptLog.setText(getText(R.string.tvDNSDefaultLog) + " " + DNSCryptVersion);
        tvDNSCryptLog.setGravity(Gravity.CENTER);
        FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.gravity = Gravity.CENTER;
        svDNSCryptLog.setLayoutParams(params);
    }
}
 
Example 20
Source Project: InviZible   Source File: Registration.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void showEnterCodeDialog() {

        LayoutInflater inflater = ((Activity)context).getLayoutInflater();
        @SuppressLint("InflateParams") final View inputView = inflater.inflate(R.layout.edit_text_for_dialog, null, false);
        final EditText editText = inputView.findViewById(R.id.etForDialog);
        editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);

        AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.CustomAlertDialogTheme);
        builder .setTitle(R.string.enter_code)
                .setPositiveButton(R.string.ok, (dialog, which) -> {
                    new PrefManager(context).setStrPref("registrationCode",editText.getText().toString().trim());

                    wrongRegistrationCode = false;

                    TopFragment topFragment = (TopFragment) ((MainActivity)context).getSupportFragmentManager().findFragmentByTag("topFragmentTAG");
                    if (topFragment!=null) {
                        topFragment.checkNewVer();
                        MainActivity.modernDialog = ((MainActivity)context).modernProgressDialog();
                    }
                    dialog.dismiss();
                })
                .setNegativeButton(R.string.cancel, (dialog, id) -> dialog.dismiss())
                .setCancelable(false)
                .setView(inputView);
        builder.show();
    }
 
Example 21
@SuppressWarnings("CodeBlock2Expr")
@SuppressLint("InlinedApi")
private void saveToDisk() {
  MediaItem mediaItem = getCurrentMediaItem();

  if (mediaItem != null) {
    SaveAttachmentTask.showWarningDialog(this, (dialogInterface, i) -> {
      Permissions.with(this)
                 .request(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE)
                 .ifNecessary()
                 .withPermanentDenialDialog(getString(R.string.MediaPreviewActivity_signal_needs_the_storage_permission_in_order_to_write_to_external_storage_but_it_has_been_permanently_denied))
                 .onAnyDenied(() -> Toast.makeText(this, R.string.MediaPreviewActivity_unable_to_write_to_external_storage_without_permission, Toast.LENGTH_LONG).show())
                 .onAllGranted(() -> {
                   SaveAttachmentTask saveTask = new SaveAttachmentTask(MediaPreviewActivity.this);
                   long saveDate = (mediaItem.date > 0) ? mediaItem.date : System.currentTimeMillis();
                   saveTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Attachment(mediaItem.uri, mediaItem.type, saveDate, null));
                 })
                 .execute();
    });
  }
}
 
Example 22
Source Project: FimiX8-RE   Source File: ByteUtil.java    License: MIT License 5 votes vote down vote up
@SuppressLint({"DefaultLocale"})
public static byte hexStringToByte(String hexString) {
    if (hexString == null || hexString.equals("")) {
        return (byte) 0;
    }
    if (hexString.length() % 2 != 0) {
        hexString = "0" + hexString;
    }
    char[] hexChars = hexString.toUpperCase().toCharArray();
    return (byte) ((charToByte(hexChars[0]) << 4) | charToByte(hexChars[1]));
}
 
Example 23
Source Project: xmall   Source File: SystemWebViewEngine.java    License: MIT License 5 votes vote down vote up
@SuppressLint("AddJavascriptInterface")
private static void exposeJsInterface(WebView webView, CordovaBridge bridge) {
    if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
        LOG.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
        // Bug being that Java Strings do not get converted to JS strings automatically.
        // This isn't hard to work-around on the JS side, but it's easier to just
        // use the prompt bridge instead.
        return;
    }
    SystemExposedJsApi exposedJsApi = new SystemExposedJsApi(bridge);
    webView.addJavascriptInterface(exposedJsApi, "_cordovaNative");
}
 
Example 24
Source Project: YTPlayer   Source File: MusicService.java    License: GNU General Public License v3.0 5 votes vote down vote up
@SuppressLint("StaticFieldLeak")
@Override
protected void onPostExecute(Void aVoid) {
    if (noInternet) {
        return;
    }
    if (skipSong) {
        if (souncloudFailed)
            Toast.makeText(activity, "Error: Parsing song "+videoTitle, Toast.LENGTH_SHORT).show();
        if (command==1)
            playNext();
        else if (command==2)
            playPrevious();
        return;
    }

    if (bitmapIcon!=null) {
        Palette.generateAsync(bitmapIcon, palette -> {
            Log.e(TAG, "loadVideo: Changing nColor: "+MusicService.nColor +
                    ", ImageUri: "+MusicService.imgUrl);
            nColor = palette.getVibrantColor(activity.getResources().getColor(R.color.light_white));
        });
    }

    setLyricData();

    if (soundCloudPlayBack) {
        ytConfigs.clear();
        ytConfigs.add(new YTConfig("Audio 128 kbit/s",soundCloud.getModel().getStreamUrl(),
                ".mp3",videoTitle,channelTitle,true,soundCloud.getModel().getImageUrl()));
        audioLink = soundCloud.getModel().getStreamUrl();
        continueinMainThread(audioLink);
        return;
    }

    if (!loadedFromData)
        parseVideoNewMethod(YTutils.getYtUrl(videoID),videoTitle);
    else continueinMainThread(audioLink);
    super.onPostExecute(aVoid);
}
 
Example 25
Source Project: xposed-rimet   Source File: RimetPresenter.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressLint("CheckResult")
@Override
public void checkUpdate(boolean auto) {

    // 检测更新
    ioToMain(mRimetSource.checkUpdate())
            .subscribe(model -> {
                // 检测更新成功
                checkUpdate(auto, model);
            }, throwable -> {
                Alog.e("检测异常", throwable);
                if (!auto) mView.onUpdateFailed("检测更新失败,请稍后再试!");
            });
}
 
Example 26
Source Project: Android-utils   Source File: DeviceUtils.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressLint("HardwareIds")
@RequiresPermission(READ_PHONE_STATE)
public static String getIMSI() {
    TelephonyManager tm =
            (TelephonyManager) UtilsApp.getApp().getSystemService(Context.TELEPHONY_SERVICE);
    //noinspection ConstantConditions
    return tm.getSubscriberId();
}
 
Example 27
Source Project: Focus   Source File: PostUtil.java    License: GNU General Public License v3.0 5 votes vote down vote up
@SuppressLint({"SetJavaScriptEnabled", "ClickableViewAccessibility"})
public static void setContent(Context context, FeedItem article, WebView textView, ViewGroup viewGroup) {
    if (article == null || textView == null) {
        return;
    }
    WebViewUtil.LoadHtmlIntoWebView(textView,getContent(article),context,article.getUrl(),viewGroup,article.isBadGuy(),article.isChina());
}
 
Example 28
Source Project: Demos   Source File: StarGroupView.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouchEvent(MotionEvent event) {
    float x = event.getX();
    velocity.addMovement(event);
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            downX = x;
            downAngle = sweepAngle;

            // 取消动画和自动旋转
            velocityAnim.cancel();
            removeCallbacks(autoScrollRunnable);
            return true;
        case MotionEvent.ACTION_MOVE:
            float dx = downX - x;
            sweepAngle = (dx * SCALE_PX_ANGLE + downAngle);
            layoutChildren();
            break;
        case MotionEvent.ACTION_UP:
            velocity.computeCurrentVelocity(16);
            // 速度为负值代表顺时针
            scrollByVelocity(velocity.getXVelocity());
            postDelayed(autoScrollRunnable, 16);
    }
    return super.onTouchEvent(event);
}
 
Example 29
Source Project: BaldPhone   Source File: ViewPagerHolder.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressLint("ClickableViewAccessibility")
public void setViewPagerAdapter(PagerAdapter pagerAdapter) {
    viewPager.setAdapter(pagerAdapter);
    applyPage_of_();
    pageChangeHandler(viewPager.getCurrentItem());

}
 
Example 30
Source Project: Android-utils   Source File: NetworkUtils.java    License: Apache License 2.0 5 votes vote down vote up
@RequiresPermission(CHANGE_WIFI_STATE)
public static void setWifiEnabled(final boolean enabled) {
    @SuppressLint("WifiManagerLeak")
    WifiManager manager = (WifiManager) UtilsApp.getApp().getSystemService(WIFI_SERVICE);
    if (manager == null) return;
    if (enabled == manager.isWifiEnabled()) return;
    manager.setWifiEnabled(enabled);
}