use of android.support.v7.widget.SwitchCompat in project fresco by facebook.
the class ImageFormatKeyframesFragment method initAnimation.
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void initAnimation(View view) {
mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
DraweeController controller = Fresco.newDraweeControllerBuilder().setOldController(mSimpleDraweeView.getController()).setUri(URI_KEYFRAMES_ANIMATION).setAutoPlayAnimations(true).build();
mSimpleDraweeView.setController(controller);
final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked ? new CheckerBoardDrawable(getResources()) : null);
}
});
}
use of android.support.v7.widget.SwitchCompat in project fresco by facebook.
the class ImageFormatProgressiveJpegFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
ProgressBarDrawable progressBarDrawable = new ProgressBarDrawable();
progressBarDrawable.setColor(getResources().getColor(R.color.progress_bar_color));
progressBarDrawable.setBackgroundColor(getResources().getColor(R.color.progress_bar_background));
mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
mSimpleDraweeView.getHierarchy().setProgressBarImage(progressBarDrawable);
mDebugOutput = (TextView) view.findViewById(R.id.debug_output);
mDebugOutputScrollView = (ScrollView) view.findViewById(R.id.debug_output_scroll_view);
final SwitchCompat switchProgressiveRenderingEnabled = (SwitchCompat) view.findViewById(R.id.switch_progressive_enabled);
switchProgressiveRenderingEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mProgressiveRenderingEnabled = isChecked;
}
});
mProgressiveRenderingEnabled = switchProgressiveRenderingEnabled.isChecked();
final Spinner spinner = (Spinner) view.findViewById(R.id.spinner);
spinner.setAdapter(new SimpleUriListAdapter());
spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
final Entry spinnerEntry = SPINNER_ENTRIES[spinner.getSelectedItemPosition()];
setImageUri(spinnerEntry.uri);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
spinner.setSelection(0);
}
use of android.support.v7.widget.SwitchCompat in project MusicDNA by harjot-oberai.
the class SettingsFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
backBtn = (ImageView) view.findViewById(R.id.settings_back_btn);
backBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
getActivity().onBackPressed();
}
});
fragTitle = (TextView) view.findViewById(R.id.settings_fragment_title);
if (SplashActivity.tf4 != null)
fragTitle.setTypeface(SplashActivity.tf4);
bottomMarginLayout = view.findViewById(R.id.bottom_margin_layout);
if (HomeActivity.isReloaded)
bottomMarginLayout.getLayoutParams().height = 0;
else
bottomMarginLayout.getLayoutParams().height = CommonUtils.dpTopx(65, getContext());
resetSettings = (RelativeLayout) view.findViewById(R.id.reset_settings_card);
resetSettings.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final android.app.AlertDialog alertDialog = new android.app.AlertDialog.Builder(view.getContext()).create();
alertDialog.setTitle("Reset settings?");
alertDialog.setMessage("This operation will reset all settings but playlist and other content will remain unchanged.");
alertDialog.setButton(android.app.AlertDialog.BUTTON_POSITIVE, "Reset", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
resetAllSettings();
Toast.makeText(getContext(), "Settings have been reset", Toast.LENGTH_LONG).show();
}
});
alertDialog.setButton(android.app.AlertDialog.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
alertDialog.create();
alertDialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface arg0) {
alertDialog.getButton(android.app.AlertDialog.BUTTON_POSITIVE).setTextColor(HomeActivity.themeColor);
alertDialog.getButton(android.app.AlertDialog.BUTTON_NEGATIVE).setTextColor(HomeActivity.themeColor);
}
});
alertDialog.show();
}
});
densitycard = (RelativeLayout) view.findViewById(R.id.density_card);
densityText = (TextView) view.findViewById(R.id.density_value);
densityText.setText(String.valueOf(100 - (int) (homeActivity.minAudioStrength * 100)));
densitycard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Dialog dialog = new Dialog(getContext());
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.density_dialog);
densitySeekbar = (SeekBar) dialog.findViewById(R.id.density_dialog_seekbar);
densitySeekbar.getProgressDrawable().setColorFilter(new PorterDuffColorFilter(homeActivity.themeColor, PorterDuff.Mode.SRC_IN));
densityTextDialog = (TextView) dialog.findViewById(R.id.density_dialog_value);
densitySeekbar.setMax(100);
densitySeekbar.setProgress(Integer.parseInt(densityText.getText().toString()));
densityTextDialog.setText(String.valueOf(densitySeekbar.getProgress()));
densitySeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
setHomeActivityDNADensity(progress);
densityTextDialog.setText(String.valueOf(progress));
densityText.setText(String.valueOf(progress));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
});
dialog.show();
}
});
themeCard = (RelativeLayout) view.findViewById(R.id.theme_card);
themeColorImg = (ImageView) view.findViewById(R.id.theme_color_img);
themeColorImg.setBackgroundColor(homeActivity.themeColor);
themeCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final AlertDialog dialog = ColorPickerDialogBuilder.with(getContext()).setTitle("Choose color").initialColor(HomeActivity.themeColor).wheelType(ColorPickerView.WHEEL_TYPE.FLOWER).density(9).showColorPreview(true).lightnessSliderOnly().setOnColorSelectedListener(new OnColorSelectedListener() {
@Override
public void onColorSelected(int color) {
}
}).setPositiveButton("ok", new ColorPickerClickListener() {
@Override
public void onClick(DialogInterface dialog, int color, Integer[] allColors) {
setHomeActivityColor(color);
}
}).setNegativeButton("cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).build();
dialog.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setTextColor(HomeActivity.themeColor);
dialog.getButton(AlertDialog.BUTTON_NEGATIVE).setTextColor(HomeActivity.themeColor);
}
});
dialog.show();
}
});
albumArtCard = (RelativeLayout) view.findViewById(R.id.album_art_card);
albumArtToggle = (SwitchCompat) view.findViewById(R.id.album_art_toggle);
albumArtToggle.setChecked(homeActivity.settings.isAlbumArtBackgroundEnabled());
albumArtCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
albumArtToggle.toggle();
}
});
albumArtToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setHomeActivityAlbumBg(isChecked);
}
});
wifiCard = (RelativeLayout) view.findViewById(R.id.wifi_card);
wifiToggle = (SwitchCompat) view.findViewById(R.id.wifi_stream_toggle);
wifiToggle.setChecked(homeActivity.settings.isStreamOnlyOnWifiEnabled());
wifiCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
wifiToggle.toggle();
}
});
wifiToggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setHomeActivityStreamingOnWifi(isChecked);
}
});
aboutCard = (RelativeLayout) view.findViewById(R.id.about_card);
aboutCard.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mCallback.onAboutClicked();
}
});
}
use of android.support.v7.widget.SwitchCompat in project Notes by lguipeng.
the class SwitchPreference method onBindView.
@Override
protected void onBindView(View view) {
super.onBindView(view);
SwitchCompat switchCompat = (SwitchCompat) view.findViewById(R.id.switch_compat);
switchCompat.setChecked(isChecked());
syncSummaryView(view);
}
use of android.support.v7.widget.SwitchCompat in project XposedInstaller by rovo89.
the class StatusInstallerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.status_installer, container, false);
// Available ZIPs
final SwipeRefreshLayout refreshLayout = (SwipeRefreshLayout) v.findViewById(R.id.swiperefreshlayout);
refreshLayout.setColorSchemeColors(getResources().getColor(R.color.colorPrimary));
ONLINE_ZIP_LOADER.setSwipeRefreshLayout(refreshLayout);
ONLINE_ZIP_LOADER.addListener(mOnlineZipListener);
ONLINE_ZIP_LOADER.triggerFirstLoadIfNecessary();
LOCAL_ZIP_LOADER.addListener(mLocalZipListener);
LOCAL_ZIP_LOADER.triggerFirstLoadIfNecessary();
refreshZipViews(v);
// Disable switch
final SwitchCompat disableSwitch = (SwitchCompat) v.findViewById(R.id.disableSwitch);
disableSwitch.setChecked(!DISABLE_FILE.exists());
disableSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (DISABLE_FILE.exists()) {
DISABLE_FILE.delete();
Snackbar.make(disableSwitch, R.string.xposed_on_next_reboot, Snackbar.LENGTH_LONG).show();
} else {
try {
DISABLE_FILE.createNewFile();
Snackbar.make(disableSwitch, R.string.xposed_off_next_reboot, Snackbar.LENGTH_LONG).show();
} catch (IOException e) {
Log.e(XposedApp.TAG, "Could not create " + DISABLE_FILE, e);
}
}
}
});
// Device info
TextView androidSdk = (TextView) v.findViewById(R.id.android_version);
TextView manufacturer = (TextView) v.findViewById(R.id.ic_manufacturer);
TextView cpu = (TextView) v.findViewById(R.id.cpu);
androidSdk.setText(getString(R.string.android_sdk, Build.VERSION.RELEASE, getAndroidVersion(), Build.VERSION.SDK_INT));
manufacturer.setText(getUIFramework());
cpu.setText(FrameworkZips.ARCH);
// Known issues
refreshKnownIssue(v);
// Display warning dialog to new users
if (!XposedApp.getPreferences().getBoolean("hide_install_warning", false)) {
new MaterialDialog.Builder(getActivity()).title(R.string.install_warning_title).content(R.string.install_warning).positiveText(android.R.string.ok).onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
if (dialog.isPromptCheckBoxChecked()) {
XposedApp.getPreferences().edit().putBoolean("hide_install_warning", true).apply();
}
}
}).checkBoxPromptRes(R.string.dont_show_again, false, null).cancelable(false).show();
}
return v;
}
Aggregations