Search in sources :

Example 11 with OnClickListener

use of android.view.View.OnClickListener in project Android-PanesLibrary by cricklet.

the class ExampleFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    setRetainInstance(true);
    parentView = inflater.inflate(R.layout.example_fragment, container, false);
    if (color != -1) {
        parentView.setBackgroundColor(color);
    } else {
        randomizeColor();
    }
    parentView.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            randomizeColor();
        }
    });
    addButton = (Button) parentView.findViewById(R.id.add);
    addButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            addExampleFragment();
        }
    });
    if (text1Val == -1)
        text1Val = sExampleNum++;
    text1 = (TextView) parentView.findViewById(R.id.text1);
    text1.setText("" + text1Val);
    text2 = (TextView) parentView.findViewById(R.id.text2);
    text2.setText("...");
    return parentView;
}
Also used : OnClickListener(android.view.View.OnClickListener) TextView(android.widget.TextView) View(android.view.View)

Example 12 with OnClickListener

use of android.view.View.OnClickListener in project OneClickAndroid by cyngn.

the class UsbActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    OneClickStats.sendEvent(this, OneClickStats.Categories.PAGE_SHOWN, OneClickStats.Actions.PAGE_ADB);
    if (adbIsEnabled()) {
        startActivity(new Intent(getBaseContext(), PtpActivity.class));
        finish();
        return;
    }
    setContentView(R.layout.usb);
    ImageView instructionView = (ImageView) findViewById(R.id.usb_instructions);
    DecelerateInterpolator interpolator = new DecelerateInterpolator(2.0f);
    AnimationSet instructionAnimations = new AnimationSet(true);
    instructionAnimations.setInterpolator(interpolator);
    TranslateAnimation instructionMoveAnimation = new TranslateAnimation(0, 0, 250, 0);
    instructionMoveAnimation.setDuration(1000);
    instructionMoveAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    instructionAnimations.addAnimation(instructionMoveAnimation);
    // we want them to read the instructions first! so we give them a few seconds
    AlphaAnimation instructionFadeAnimation = new AlphaAnimation(0.0f, 1.0f);
    instructionFadeAnimation.setDuration(1000);
    instructionFadeAnimation.setStartOffset(500);
    instructionFadeAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    instructionAnimations.addAnimation(instructionFadeAnimation);
    instructionView.setAnimation(instructionAnimations);
    // continue button should take even longer
    AlphaAnimation buttonAnimation = new AlphaAnimation(0.0f, 1.0f);
    buttonAnimation.setDuration(750);
    buttonAnimation.setStartTime(Animation.START_ON_FIRST_FRAME);
    buttonAnimation.setStartOffset(1000);
    findViewById(R.id.next).setAnimation(buttonAnimation);
    OnClickListener openUsbListener = new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            Intent intent = new Intent();
            intent.setClassName("com.android.settings", "com.android.settings.DevelopmentSettings");
            try {
                OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.BUTTON_CLICK, OneClickStats.Actions.BTN_ADB);
                startActivity(intent);
                startService(new Intent(getBaseContext(), UsbDebuggingMonitorService.class));
            } catch (ActivityNotFoundException e) {
                // we want to know if this happens, right?
                OneClickStats.sendEvent(view.getContext(), OneClickStats.Categories.SWITCH_ERROR, OneClickStats.Actions.ERR_ADB);
            }
        }
    };
    findViewById(R.id.next).setOnClickListener(openUsbListener);
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) ActivityNotFoundException(android.content.ActivityNotFoundException) TranslateAnimation(android.view.animation.TranslateAnimation) OnClickListener(android.view.View.OnClickListener) Intent(android.content.Intent) ImageView(android.widget.ImageView) AnimationSet(android.view.animation.AnimationSet) ImageView(android.widget.ImageView) View(android.view.View) AlphaAnimation(android.view.animation.AlphaAnimation)

Example 13 with OnClickListener

use of android.view.View.OnClickListener in project subsampling-scale-image-view by davemorrissey.

the class ExtensionFreehandFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(layout.extension_freehand_fragment, container, false);
    rootView.findViewById(id.previous).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            ((ExtensionActivity) getActivity()).previous();
        }
    });
    final FreehandView imageView = (FreehandView) rootView.findViewById(id.imageView);
    imageView.setImage(ImageSource.asset("squirrel.jpg"));
    rootView.findViewById(id.reset).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            imageView.reset();
        }
    });
    return rootView;
}
Also used : OnClickListener(android.view.View.OnClickListener) FreehandView(com.davemorrissey.labs.subscaleview.sample.extension.views.FreehandView) View(android.view.View) FreehandView(com.davemorrissey.labs.subscaleview.sample.extension.views.FreehandView)

Example 14 with OnClickListener

use of android.view.View.OnClickListener in project subsampling-scale-image-view by davemorrissey.

the class ImageDisplayLargeFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(layout.imagedisplay_large_fragment, container, false);
    rootView.findViewById(id.next).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            ((ImageDisplayActivity) getActivity()).next();
        }
    });
    SubsamplingScaleImageView imageView = (SubsamplingScaleImageView) rootView.findViewById(id.imageView);
    imageView.setImage(ImageSource.asset("card.png"));
    return rootView;
}
Also used : OnClickListener(android.view.View.OnClickListener) SubsamplingScaleImageView(com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView) SubsamplingScaleImageView(com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView) View(android.view.View)

Example 15 with OnClickListener

use of android.view.View.OnClickListener in project subsampling-scale-image-view by davemorrissey.

the class ImageDisplayRegionFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(layout.imagedisplay_region_fragment, container, false);
    final SubsamplingScaleImageView imageView = (SubsamplingScaleImageView) rootView.findViewById(id.imageView);
    imageView.setOrientation(SubsamplingScaleImageView.ORIENTATION_90);
    imageView.setImage(ImageSource.asset("card.png").region(new Rect(0, 0, 3778, 2834)));
    rootView.findViewById(id.previous).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            ((ImageDisplayActivity) getActivity()).previous();
        }
    });
    rootView.findViewById(id.rotate).setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View view) {
            imageView.setOrientation((imageView.getOrientation() + 90) % 360);
        }
    });
    return rootView;
}
Also used : Rect(android.graphics.Rect) OnClickListener(android.view.View.OnClickListener) SubsamplingScaleImageView(com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView) SubsamplingScaleImageView(com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView) View(android.view.View)

Aggregations

OnClickListener (android.view.View.OnClickListener)772 View (android.view.View)770 TextView (android.widget.TextView)478 Button (android.widget.Button)262 ImageView (android.widget.ImageView)251 Intent (android.content.Intent)179 ListView (android.widget.ListView)110 AdapterView (android.widget.AdapterView)88 LinearLayout (android.widget.LinearLayout)49 ScrollView (android.widget.ScrollView)49 Bundle (android.os.Bundle)42 LayoutInflater (android.view.LayoutInflater)35 ViewGroup (android.view.ViewGroup)30 ArrayList (java.util.ArrayList)29 EditText (android.widget.EditText)27 BindView (butterknife.BindView)27 KeyEvent (android.view.KeyEvent)25 DialogInterface (android.content.DialogInterface)24 FragmentManager (android.support.v4.app.FragmentManager)23 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)23