Android Open Source - trip-chain-android Start Fragment






From Project

Back to project page trip-chain-android.

License

The source code is released under:

MIT License

If you think the Android project trip-chain-android 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 fi.aalto.tripchain;
//from  w  ww .jav  a2  s  .  co m
import android.os.Bundle;
import android.os.RemoteException;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

/**
 * Provides UI for starting and stopping trip recording.
 *
 */
public class StartFragment extends Fragment {
  
  private Button startButton;
  private MainActivity main;

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(
                R.layout.start_fragment, container, false);
        
        this.main = (MainActivity) getActivity();
        
        this.startButton = ((Button) rootView.findViewById(R.id.button));
    this.startButton.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View arg0) {
        if (!main.recording()) {
          try {
            main.start();
          } catch (RemoteException e) {
          }
        } else {
          try {
            main.stop();
          } catch (RemoteException e) {
          }
        }
        
        startButton.setText(!main.recording() ? "Start recording"
            : "Stop recording");
      }
    });

    this.startButton.setText(!main.recording() ? "Start recording"
        : "Stop recording");
  
        return rootView;
  }
}




Java Source Code List

fi.aalto.tripchain.BackgroundService.java
fi.aalto.tripchain.Configuration.java
fi.aalto.tripchain.LoginActivity.java
fi.aalto.tripchain.MainActivity.java
fi.aalto.tripchain.StartFragment.java
fi.aalto.tripchain.TripFragment.java
fi.aalto.tripchain.receivers.ActivityReceiver.java
fi.aalto.tripchain.receivers.EventDispatcher.java
fi.aalto.tripchain.receivers.EventListener.java
fi.aalto.tripchain.receivers.LocationReceiver.java
fi.aalto.tripchain.receivers.Receiver.java
fi.aalto.tripchain.route.ActivityListener.java
fi.aalto.tripchain.route.Activity.java
fi.aalto.tripchain.route.LocationListener.java
fi.aalto.tripchain.route.RoadSegment.java
fi.aalto.tripchain.route.Roads.java
fi.aalto.tripchain.route.RouteSegment.java
fi.aalto.tripchain.route.Route.java
fi.aalto.tripchain.route.TripRecorder.java
fi.aalto.tripchain.route.Trip.java