Search in sources :

Example 1 with BusToggleButton

use of cl.smartcities.isci.transportinspector.map.buttons.BusToggleButton in project androidApp by InspectorIncognito.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.d(TAG, "onCreate");
    busButton = new BusToggleButton((ImageView) findViewById(R.id.floating_button_bus), null, false);
    userMapLevel = findViewById(R.id.user_map_level);
    userMapLevel.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            openActivity(AccountActivity.class);
        }
    });
    findViewById(R.id.floating_button_bus).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            busButtonClick();
        }
    });
    // Sliding Panel Initialization
    initializeSlidingPanel();
    tittleView = getLayoutInflater().inflate(R.layout.activity_main_title_bar, null);
    tittleText = tittleView.findViewById(R.id.activity_main_title_text);
    tittleImage = tittleView.findViewById(R.id.activity_main_title_image);
    // Connection Message
    MessageLayout = findViewById(R.id.textOfflineBar);
    ConnectionChange = ConnectionChangeReceiver.getBroadcastReceiverInstance();
    // Create supportMapFragment
    if (savedInstanceState == null) {
        // Create fragment
        final FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        Location location = PositionProvider.getInstance().getLastKnownLocation();
        // Build mapboxMap
        MapboxMapOptions options = new MapboxMapOptions();
        options.styleUrl(Style.MAPBOX_STREETS);
        options.camera(new CameraPosition.Builder().target(new LatLng(location.getLatitude(), location.getLongitude())).zoom(16).build());
        // Create map fragment
        mapFragment = VectorMapFragment.newInstance(options);
        // Add map fragment to parent container
        transaction.add(R.id.container, mapFragment, "com.mapbox.map");
        transaction.commit();
    } else {
        mapFragment = (VectorMapFragment) getSupportFragmentManager().findFragmentByTag("com.mapbox.map");
    }
    Bundle extras = getIntent().getExtras();
    if (extras != null) {
        if (extras.containsKey(BUS_SERVICE_KEY) && extras.containsKey(BUS_TOKEN_KEY)) {
            showEvaluationDialog(extras.getString(BUS_SERVICE_KEY), extras.getString(BUS_TOKEN_KEY));
        }
    }
    onFoot();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) AccountActivity(cl.smartcities.isci.transportinspector.gamification.ui.AccountActivity) Bundle(android.os.Bundle) MapboxMapOptions(com.mapbox.mapboxsdk.maps.MapboxMapOptions) BusToggleButton(cl.smartcities.isci.transportinspector.map.buttons.BusToggleButton) ImageView(android.widget.ImageView) LatLng(com.mapbox.mapboxsdk.geometry.LatLng) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) Location(android.location.Location)

Aggregations

Location (android.location.Location)1 Bundle (android.os.Bundle)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 AccountActivity (cl.smartcities.isci.transportinspector.gamification.ui.AccountActivity)1 BusToggleButton (cl.smartcities.isci.transportinspector.map.buttons.BusToggleButton)1 LatLng (com.mapbox.mapboxsdk.geometry.LatLng)1 MapboxMapOptions (com.mapbox.mapboxsdk.maps.MapboxMapOptions)1