Search in sources :

Example 1 with ActiveBusView

use of cl.smartcities.isci.transportinspector.drawables.ActiveBusView in project androidApp by InspectorIncognito.

the class AccountBusPickerActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_account_user_bus_picker);
    mapView = findViewById(R.id.map);
    mapView.onCreate(savedInstanceState);
    currentAccount = TranSappAccountManager.getCurrentAccount();
    if (currentAccount == null) {
        this.finish();
        return;
    }
    serverBusAvatarId = currentAccount.getBusAvatarId();
    busAvatarId = serverBusAvatarId;
    // new ActiveBusView(this, "506v", serverBusAvatarId, false);
    final ActiveBusView activeBusView = findViewById(R.id.active_bus);
    activeBusView.setAvatarId(serverBusAvatarId);
    RecyclerView recyclerView = findViewById(R.id.bus_picker_recycler_view);
    BusAvatarRowAdapter adapter = new BusAvatarRowAdapter(this, AvatarLists.BUS_AVATARS, new BusAvatarRowAdapter.AvatarClickListener() {

        @Override
        public void onNewAvatarSelected(int serverId) {
            busAvatarId = serverId;
            activeBusView.setAvatarId(serverId);
        }
    }, currentAccount.getLevelPosition(), currentAccount.getBusAvatarId());
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setAdapter(adapter);
    recyclerView.invalidate();
}
Also used : ActiveBusView(cl.smartcities.isci.transportinspector.drawables.ActiveBusView) BusAvatarRowAdapter(cl.smartcities.isci.transportinspector.adapters.BusAvatarRowAdapter) RecyclerView(android.support.v7.widget.RecyclerView) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 2 with ActiveBusView

use of cl.smartcities.isci.transportinspector.drawables.ActiveBusView in project androidApp by InspectorIncognito.

the class BusIconsBuilder method setBusIcons.

void setBusIcons(String id, ServerSentBus bus, LayoutInflater inflater, HashMap<String, Bitmap> imagesMap, HashMap<String, View> viewMap, boolean onBus) {
    ActiveBusView busViewLeft = new ActiveBusView(inflater.getContext(), bus, true);
    ActiveBusView busViewRight = new ActiveBusView(inflater.getContext(), bus, false);
    imagesMap.put(id + "-left", busViewLeft.getBitmapDrawable().getBitmap());
    imagesMap.put(id + "-right", busViewRight.getBitmapDrawable().getBitmap());
    View view = inflater.inflate(R.layout.bus_bubble_with_events, null);
    try {
        setMaxInfoWindow(view, bus, onBus);
    } catch (Exception ignored) {
    }
    imagesMap.put(id + "-max", GenerateViewIconTask.SymbolGenerator.generate(view));
    viewMap.put("bus-max", view);
    if (!bus.getEvents().isEmpty()) {
        View viewMin = inflater.inflate(R.layout.bus_bubble_minimize, null);
        setMinInfoWindow(viewMin, bus);
        imagesMap.put(id + "-min", GenerateViewIconTask.SymbolGenerator.generate(viewMin));
    }
}
Also used : ActiveBusView(cl.smartcities.isci.transportinspector.drawables.ActiveBusView) ImageView(android.widget.ImageView) ActiveBusView(cl.smartcities.isci.transportinspector.drawables.ActiveBusView) TextView(android.widget.TextView) View(android.view.View) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ActiveBusView (cl.smartcities.isci.transportinspector.drawables.ActiveBusView)2 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 TextView (android.widget.TextView)1 BusAvatarRowAdapter (cl.smartcities.isci.transportinspector.adapters.BusAvatarRowAdapter)1 ExecutionException (java.util.concurrent.ExecutionException)1