List of usage examples for android.view View getContext
@ViewDebug.CapturedViewProperty public final Context getContext()
From source file:cn.edu.zucc.list.FabAnimation.MorphFabToDialog.java
@Override public void captureEndValues(TransitionValues transitionValues) { super.captureEndValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return;/*from w w w . j a va 2s.co m*/ } transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), R.color.dialog_background_color)); transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getResources().getDimensionPixelSize(R.dimen.dialog_corners)); }
From source file:bg.phpgcm2.MainActivity.java
private void newButton(String str, int num) { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.height = 30;// w ww . j a v a2 s. c om final LinearLayout lm = (LinearLayout) findViewById(R.id.mainLayout); Button btn = new Button(this); btn.setId(num); get_map_data_btn_id = btn.getId(); btn.setText("get_map_data"); btn.setBackgroundColor(Color.rgb(170, 180, 190)); lm.addView(btn, params); Button btn1 = ((Button) findViewById(get_map_data_btn_id)); btn1.setPadding(0, 0, 0, 0); btn1.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { SharedPreferences settings = getSharedPreferences("Motolife", MODE_PRIVATE); String fb = settings.getString("fb", "0"); Toast.makeText(view.getContext(), "Button clicked index = " + get_map_data_btn_id, Toast.LENGTH_SHORT).show(); } }); }
From source file:br.com.frs.foodrestrictions.AppConfig.java
@Override public void onClick(View view) { boolean checked = ((CheckBox) view).isChecked(); switch (view.getId()) { case R.id.cb_settings_serious_mode: appSettings.setSeriosMode(checked); if (cbMakeItSerious.isChecked()) { Toast.makeText(view.getContext(), getResources().getString(R.string.serious_mode_on_msg), Toast.LENGTH_LONG).show(); } else {// www. ja va2s . co m Toast.makeText(view.getContext(), getResources().getString(R.string.serious_mode_off_msg), Toast.LENGTH_LONG).show(); } break; case R.id.cb_settings_help_dialog: appSettings.setHelpDialog(checked); break; } }
From source file:com.freshdigitable.udonroad.UserInfoView.java
private OnClickListener create(final String actualUrl) { if (TextUtils.isEmpty(actualUrl)) { return null; }//w w w. j av a2 s.c om return new OnClickListener() { @Override public void onClick(View v) { final Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(actualUrl)); v.getContext().startActivity(intent); } }; }
From source file:com.github.andrewlord1990.materialandroidsample.SampleActivity.java
private void setupColorSample() { primaryColorSquare = findViewById(R.id.primary_color_square); if (primaryColorSquare != null) { refreshPrimaryColorSquare();/*from w w w. j a v a2 s. c o m*/ primaryColorSquare.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { showColorChooser(REQUEST_PRIMARY_COLOR, R.string.sample_primary_color, Colors.primaryColors(view.getContext())); } }); } accentColorSquare = findViewById(R.id.accent_color_square); refreshAccentColorSquare(); accentColorSquare.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { showColorChooser(REQUEST_ACCENT_COLOR, R.string.sample_accent_color, Colors.accentColors(view.getContext())); } }); Button colorSample = (Button) findViewById(R.id.color_sample_button); if (colorSample != null) { colorSample.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { onColorSampleSelected(); } }); } }
From source file:com.caij.codehub.ui.transitions.MorphDialogToFab.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override//w w w . ja va2s . co m public void captureStartValues(TransitionValues transitionValues) { super.captureStartValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return; } transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), R.color.background_light)); transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getResources().getDimensionPixelSize(R.dimen.dialog_corners)); }
From source file:com.dante.girl.lib.MorphFabToDialog.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override/* w ww . j a v a2s . c o m*/ public void captureEndValues(TransitionValues transitionValues) { super.captureEndValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return; } transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), android.R.color.white)); transitionValues.values.put(PROPERTY_CORNER_RADIUS, endCornerRadius); }
From source file:com.amitupadhyay.aboutexample.ui.transitions.MorphDialogToFab.java
@Override public void captureStartValues(TransitionValues transitionValues) { super.captureStartValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return;//from w w w . ja v a2 s . c om } transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), R.color.background_light)); transitionValues.values.put(PROPERTY_CORNER_RADIUS, view.getResources().getDimensionPixelSize(R.dimen.dialog_corners)); }
From source file:com.example.usuario.interactivemenu.fragment.ContentFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Bundle args = getArguments();/*w ww . j a v a 2s .c om*/ if (args != null) { if (args.getCharSequence(KEY_TITLE).equals("Principales")) { Toast.makeText(view.getContext(), "Principales", Toast.LENGTH_SHORT).show(); } TextView title = (TextView) view.findViewById(R.id.item_title); title.setText("Title: " + args.getCharSequence(KEY_TITLE)); int indicatorColor = args.getInt(KEY_INDICATOR_COLOR); TextView indicatorColorView = (TextView) view.findViewById(R.id.item_indicator_color); indicatorColorView.setText("Indicator: #" + Integer.toHexString(indicatorColor)); indicatorColorView.setTextColor(indicatorColor); int dividerColor = args.getInt(KEY_DIVIDER_COLOR); TextView dividerColorView = (TextView) view.findViewById(R.id.item_divider_color); dividerColorView.setText("Divider: #" + Integer.toHexString(dividerColor)); dividerColorView.setTextColor(dividerColor); } }
From source file:com.caij.codehub.ui.transitions.MorphFabToDialog.java
@TargetApi(Build.VERSION_CODES.KITKAT) @Override/*from w w w . j a v a 2 s . c o m*/ public void captureEndValues(TransitionValues transitionValues) { super.captureEndValues(transitionValues); final View view = transitionValues.view; if (view.getWidth() <= 0 || view.getHeight() <= 0) { return; } transitionValues.values.put(PROPERTY_COLOR, ContextCompat.getColor(view.getContext(), R.color.background_light)); transitionValues.values.put(PROPERTY_CORNER_RADIUS, endCornerRadius); }