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();
}
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;
}
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();
}
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);
}
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;
}
Aggregations