Search in sources :

Example 86 with SuppressLint

use of android.annotation.SuppressLint in project AntennaPod by AntennaPod.

the class AutoFlattrPreferenceDialog method newAutoFlattrPreferenceDialog.

public static void newAutoFlattrPreferenceDialog(final Activity activity, final AutoFlattrPreferenceDialogInterface callback) {
    Validate.notNull(activity);
    Validate.notNull(callback);
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    @SuppressLint("InflateParams") View view = activity.getLayoutInflater().inflate(R.layout.autoflattr_preference_dialog, null);
    final CheckBox chkAutoFlattr = (CheckBox) view.findViewById(R.id.chkAutoFlattr);
    final SeekBar skbPercent = (SeekBar) view.findViewById(R.id.skbPercent);
    final TextView txtvStatus = (TextView) view.findViewById(R.id.txtvStatus);
    chkAutoFlattr.setChecked(UserPreferences.isAutoFlattr());
    skbPercent.setEnabled(chkAutoFlattr.isChecked());
    txtvStatus.setEnabled(chkAutoFlattr.isChecked());
    final int initialValue = (int) (UserPreferences.getAutoFlattrPlayedDurationThreshold() * 100.0f);
    setStatusMsgText(activity, txtvStatus, initialValue);
    skbPercent.setProgress(initialValue);
    chkAutoFlattr.setOnClickListener(v -> {
        skbPercent.setEnabled(chkAutoFlattr.isChecked());
        txtvStatus.setEnabled(chkAutoFlattr.isChecked());
    });
    skbPercent.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        @Override
        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            setStatusMsgText(activity, txtvStatus, progress);
        }

        @Override
        public void onStartTrackingTouch(SeekBar seekBar) {
        }

        @Override
        public void onStopTrackingTouch(SeekBar seekBar) {
        }
    });
    builder.setTitle(R.string.pref_auto_flattr_title).setView(view).setPositiveButton(R.string.confirm_label, (dialog, which) -> {
        float progDouble = ((float) skbPercent.getProgress()) / 100.0f;
        callback.onConfirmed(chkAutoFlattr.isChecked(), progDouble);
        dialog.dismiss();
    }).setNegativeButton(R.string.cancel_label, (dialog, which) -> {
        callback.onCancelled();
        dialog.dismiss();
    }).setCancelable(false).show();
}
Also used : AlertDialog(android.support.v7.app.AlertDialog) UserPreferences(de.danoeh.antennapod.core.preferences.UserPreferences) Context(android.content.Context) SeekBar(android.widget.SeekBar) SuppressLint(android.annotation.SuppressLint) AlertDialog(android.support.v7.app.AlertDialog) TextView(android.widget.TextView) Validate(org.apache.commons.lang3.Validate) CheckBox(android.widget.CheckBox) R(de.danoeh.antennapod.R) View(android.view.View) Activity(android.app.Activity) SeekBar(android.widget.SeekBar) TextView(android.widget.TextView) View(android.view.View) SuppressLint(android.annotation.SuppressLint) CheckBox(android.widget.CheckBox) SuppressLint(android.annotation.SuppressLint) TextView(android.widget.TextView)

Example 87 with SuppressLint

use of android.annotation.SuppressLint in project AntennaPod by AntennaPod.

the class ItemDescriptionFragment method onContextItemSelected.

@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public boolean onContextItemSelected(MenuItem item) {
    boolean handled = selectedURL != null;
    if (selectedURL != null) {
        switch(item.getItemId()) {
            case R.id.open_in_browser_item:
                Uri uri = Uri.parse(selectedURL);
                final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                if (IntentUtils.isCallable(getActivity(), intent)) {
                    getActivity().startActivity(intent);
                }
                break;
            case R.id.share_url_item:
                ShareUtils.shareLink(getActivity(), selectedURL);
                break;
            case R.id.copy_url_item:
                if (android.os.Build.VERSION.SDK_INT >= 11) {
                    ClipData clipData = ClipData.newPlainText(selectedURL, selectedURL);
                    android.content.ClipboardManager cm = (android.content.ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
                    cm.setPrimaryClip(clipData);
                } else {
                    android.text.ClipboardManager cm = (android.text.ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
                    cm.setText(selectedURL);
                }
                Toast t = Toast.makeText(getActivity(), R.string.copied_url_msg, Toast.LENGTH_SHORT);
                t.show();
                break;
            case R.id.go_to_position_item:
                if (Timeline.isTimecodeLink(selectedURL)) {
                    onTimecodeLinkSelected(selectedURL);
                } else {
                    Log.e(TAG, "Selected go_to_position_item, but URL was no timecode link: " + selectedURL);
                }
                break;
            default:
                handled = false;
                break;
        }
        selectedURL = null;
    }
    return handled;
}
Also used : Toast(android.widget.Toast) Intent(android.content.Intent) Context(android.content.Context) Uri(android.net.Uri) ClipData(android.content.ClipData) SuppressLint(android.annotation.SuppressLint)

Example 88 with SuppressLint

use of android.annotation.SuppressLint in project AntennaPod by AntennaPod.

the class PreferenceActivityGingerbread method onCreate.

@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
    setTheme(UserPreferences.getTheme());
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);
    preferenceController = new PreferenceController(preferenceUI);
    preferenceController.onCreate();
}
Also used : PreferenceController(de.danoeh.antennapod.preferences.PreferenceController) SuppressLint(android.annotation.SuppressLint)

Example 89 with SuppressLint

use of android.annotation.SuppressLint in project AntennaPod by AntennaPod.

the class VideoplayerActivity method hideVideoControls.

@SuppressLint("NewApi")
private void hideVideoControls() {
    final Animation animation = AnimationUtils.loadAnimation(this, R.anim.fade_out);
    if (animation != null) {
        videoOverlay.startAnimation(animation);
        controls.startAnimation(animation);
    }
    if (Build.VERSION.SDK_INT >= 14) {
        int videoviewFlag = (Build.VERSION.SDK_INT >= 16) ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0;
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | videoviewFlag);
        videoOverlay.setFitsSystemWindows(true);
    }
    videoOverlay.setVisibility(View.GONE);
    controls.setVisibility(View.GONE);
}
Also used : Animation(android.view.animation.Animation) SuppressLint(android.annotation.SuppressLint) SuppressLint(android.annotation.SuppressLint)

Example 90 with SuppressLint

use of android.annotation.SuppressLint in project mobile-center-sdk-android by Microsoft.

the class MobileCenter method instanceConfigure.

/**
     * Internal SDK configuration.
     *
     * @param application application context.
     * @param appSecret   a unique and secret key used to identify the application.
     * @return true if configuration was successful, false otherwise.
     */
/* UncaughtExceptionHandler is used by PowerMock but lint does not detect it. */
@SuppressLint("VisibleForTests")
private synchronized boolean instanceConfigure(Application application, String appSecret) {
    /* Load some global constants. */
    Constants.loadFromContext(application);
    /* Enable a default log level for debuggable applications. */
    if (!mLogLevelConfigured && Constants.APPLICATION_DEBUGGABLE) {
        MobileCenterLog.setLogLevel(Log.WARN);
    }
    /* Parse and store parameters. */
    if (mApplication != null) {
        MobileCenterLog.warn(LOG_TAG, "Mobile Center may only be configured once");
        return false;
    } else if (application == null) {
        MobileCenterLog.error(LOG_TAG, "application may not be null");
    } else if (appSecret == null || appSecret.isEmpty()) {
        MobileCenterLog.error(LOG_TAG, "appSecret may not be null or empty");
    } else {
        /* Store state. */
        mApplication = application;
        mAppSecret = appSecret;
        /* If parameters are valid, init context related resources. */
        StorageHelper.initialize(application);
        /* Remember state to avoid double call PreferencesStorage. */
        boolean enabled = isInstanceEnabled();
        /* Init uncaught exception handler. */
        mUncaughtExceptionHandler = new UncaughtExceptionHandler();
        if (enabled)
            mUncaughtExceptionHandler.register();
        mServices = new HashSet<>();
        /* Init channel. */
        mLogSerializer = new DefaultLogSerializer();
        mLogSerializer.addLogFactory(StartServiceLog.TYPE, new StartServiceLogFactory());
        mLogSerializer.addLogFactory(CustomPropertiesLog.TYPE, new CustomPropertiesLogFactory());
        mChannel = new DefaultChannel(application, appSecret, mLogSerializer);
        mChannel.setEnabled(enabled);
        mChannel.addGroup(CORE_GROUP, DEFAULT_TRIGGER_COUNT, DEFAULT_TRIGGER_INTERVAL, DEFAULT_TRIGGER_MAX_PARALLEL_REQUESTS, null);
        if (mLogUrl != null)
            mChannel.setLogUrl(mLogUrl);
        MobileCenterLog.logAssert(LOG_TAG, "Mobile Center SDK configured successfully.");
        return true;
    }
    MobileCenterLog.logAssert(LOG_TAG, "Mobile Center SDK configuration failed.");
    return false;
}
Also used : StartServiceLogFactory(com.microsoft.azure.mobile.ingestion.models.json.StartServiceLogFactory) CustomPropertiesLogFactory(com.microsoft.azure.mobile.ingestion.models.json.CustomPropertiesLogFactory) DefaultChannel(com.microsoft.azure.mobile.channel.DefaultChannel) DefaultLogSerializer(com.microsoft.azure.mobile.ingestion.models.json.DefaultLogSerializer) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1773 View (android.view.View)369 TextView (android.widget.TextView)243 Intent (android.content.Intent)232 ImageView (android.widget.ImageView)112 Paint (android.graphics.Paint)109 File (java.io.File)102 IOException (java.io.IOException)96 ArrayList (java.util.ArrayList)93 Context (android.content.Context)91 LayoutInflater (android.view.LayoutInflater)89 Uri (android.net.Uri)84 Bundle (android.os.Bundle)83 SharedPreferences (android.content.SharedPreferences)78 Bitmap (android.graphics.Bitmap)78 WebView (android.webkit.WebView)76 PendingIntent (android.app.PendingIntent)72 Method (java.lang.reflect.Method)72 SimpleDateFormat (java.text.SimpleDateFormat)69 ViewGroup (android.view.ViewGroup)66