Example usage for android.widget ViewAnimator setOnClickListener

List of usage examples for android.widget ViewAnimator setOnClickListener

Introduction

In this page you can find the example usage for android.widget ViewAnimator setOnClickListener.

Prototype

public void setOnClickListener(@Nullable OnClickListener l) 

Source Link

Document

Register a callback to be invoked when this view is clicked.

Usage

From source file:ansteph.com.beecabfordrivers.view.CabResponder.JobsBoard.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_jobs_board);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);//from  w ww.j  av a2s . com

    sessionManager = new SessionManager(getApplicationContext());
    mGlobalRetainer = (GlobalRetainer) getApplicationContext();

    HashMap<String, String> user = sessionManager.getUserDetails();
    // String id, String name, String companyname, String email, String mobile, String licence, String year, String apikey, int companyid

    mGlobalRetainer.set_grDriver(new Driver(user.get(SessionManager.KEY_ID), user.get(SessionManager.KEY_NAME),
            user.get(SessionManager.KEY_COMNAME), user.get(SessionManager.KEY_EMAIL),
            user.get(SessionManager.KEY_MOBILE), user.get(SessionManager.KEY_LICENSE),
            user.get(SessionManager.KEY_YEAR), user.get(SessionManager.KEY_APIKEY),
            Integer.parseInt(user.get(SessionManager.KEY_COMPANY_ID))));

    //Try to register the firebase messaging token
    FirebaseMessaging.getInstance().subscribeToTopic("BeeCab");
    String token = FirebaseInstanceId.getInstance().getToken();

    /* if(!token.isEmpty())
     {
            
    FirebaseServerRegistration fbRegistration = new FirebaseServerRegistration
            (getApplicationContext(), mGlobalRetainer.get_grDriver(),token);
            
    fbRegistration.registerFBToken();
            
     }*/

    viewPager = (ViewPager) findViewById(R.id.view_pager);
    adapterViewPager = new JobCatAdapter(getSupportFragmentManager());
    viewPager.setAdapter(adapterViewPager);

    tabLayout = (TabLayout) findViewById(R.id.sliding_tabs);
    tabLayout.setupWithViewPager(viewPager);

    final ViewAnimator viewAnimator = (ViewAnimator) findViewById(R.id.viewAnimator);

    final Animation inAmin = AnimationUtils.loadAnimation(getApplication(), android.R.anim.slide_in_left);
    final Animation outAmin = AnimationUtils.loadAnimation(getApplication(), android.R.anim.slide_out_right);

    viewAnimator.setInAnimation(inAmin);
    viewAnimator.setOutAnimation(outAmin);

    viewAnimator.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            viewAnimator.showNext();
        }
    });

    try {

        Glide.with(getApplication()).load(R.drawable.denys).into((ImageView) findViewById(R.id.imgadvplace2));
        Glide.with(getApplication()).load(R.drawable.auto).into((ImageView) findViewById(R.id.imgadvplace3));
    } catch (Exception e) {
        e.printStackTrace();
    }

    Button btnCaller = (Button) findViewById(R.id.btnCaller);
    btnCaller.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(getApplication(), JoRPickupBoard.class);
            startActivity(i);
        }
    });

    mRegistrationBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {

            //Checking for the type of intent filter
            if (intent.getAction().equals(Config.REGISTRATION_COMPLETE)) {
                //gcm successful reg
                //now subscribe to the topic beecab topic to receive app wide notifications
                FirebaseMessaging.getInstance().subscribeToTopic(Config.TOPIC_GLOBAL);
            } else if (intent.getAction().equals(Config.PUSH_NOTIFICATION)) {
                String message = intent.getStringExtra("message");

                Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
            }

        }
    };
    updateRegIDonServer();
}