Android Open Source - BikeStation Time Activity






From Project

Back to project page BikeStation.

License

The source code is released under:

GNU General Public License

If you think the Android project BikeStation listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.bikestation.app.activity;
/* w  ww  .  j  av  a  2 s .com*/
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.View;
import android.widget.Button;

import com.bikestation.app.BluetoothConnector;
import com.bikestation.app.ExtApp;
import com.bikestation.app.Lock;
import com.kdravolin.smartlock.app.R;

import butterknife.ButterKnife;
import butterknife.InjectView;

public class TimeActivity extends ActionBarActivity {

    @InjectView(R.id.btn_open)
    Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_time);
        ButterKnife.inject(this);

        BluetoothConnector connector = ExtApp.bluetoothConnector;
        if (connector.isConnected()) {
            setButtonConnectedState(true);
        }

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Lock.ReturnBikeTask task = new Lock.ReturnBikeTask(TimeActivity.this);
                task.execute();
            }
        });
    }

    public void setButtonConnectedState(boolean connected){
        if (connected){
            button.setText("??????? ?? ?????????");
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    Lock.ReturnBikeTask task = new Lock.ReturnBikeTask(TimeActivity.this);
                    task.execute();
                }
            });
        }else{
            button.setText("?????? ?????????????");
            button.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    TimeActivity.this.finish();
                }
            });
        }
    }
}




Java Source Code List

com.bikestation.app.BluetoothConnector.java
com.bikestation.app.BluetoothWorker.java
com.bikestation.app.ExtApp.java
com.bikestation.app.History.java
com.bikestation.app.Lock.java
com.bikestation.app.User.java
com.bikestation.app.account.AccountAuthenticator.java
com.bikestation.app.account.AuthenticationService.java
com.bikestation.app.activity.AccountActivity.java
com.bikestation.app.activity.BikesActivity.java
com.bikestation.app.activity.DeviceActivity.java
com.bikestation.app.activity.TimeActivity.java
com.bikestation.app.adapter.BikesAdapter.java
com.bikestation.app.adapter.DeviceAdapter.java