Search in sources :

Example 1 with LineStop

use of flying.grub.tamtime.data.persistence.LineStop in project TamTime by flyingrub.

the class HomeAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holderParam, int position) {
    if (holderParam instanceof ViewHolderCustom) {
        return;
    }
    ViewHolder holder = (ViewHolder) holderParam;
    LineStop lineStop = favoriteStopLine.get(position - 1);
    StopZone s = lineStop.getStopZone();
    Line l = lineStop.getLine();
    holder.title.setText(s.getName() + " - Ligne " + l.getLineNum());
    holder.recyclerView.setHasFixedSize(true);
    RecyclerView.LayoutManager layoutManager = new org.solovyev.android.views.llm.LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false);
    holder.recyclerView.setLayoutManager(layoutManager);
    holder.recyclerView.setItemAnimator(new DefaultItemAnimator());
    AllDirectionStopLine adapter = new AllDirectionStopLine(s.getStops(l), context);
    final StopZone finalS = s;
    adapter.SetOnItemClickListener(new AllDirectionStopLine.OnItemClickListener() {

        @Override
        public void onItemClick(View view, int position) {
            Intent intent = new Intent(context, OneStopActivity.class);
            Bundle bundle = new Bundle();
            bundle.putInt("stop_zone_id", finalS.getID());
            intent.putExtras(bundle);
            context.startActivity(intent);
            context.overridePendingTransition(R.anim.slide_from_right, R.anim.fade_scale_out);
        }
    });
    holder.recyclerView.setAdapter(adapter);
}
Also used : LineStop(flying.grub.tamtime.data.persistence.LineStop) Bundle(android.os.Bundle) Intent(android.content.Intent) OneStopActivity(flying.grub.tamtime.activity.OneStopActivity) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View) SearchView(flying.grub.tamtime.layout.SearchView) FavHomeView(flying.grub.tamtime.layout.FavHomeView) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) Line(flying.grub.tamtime.data.map.Line) RecyclerView(android.support.v7.widget.RecyclerView) StopZone(flying.grub.tamtime.data.map.StopZone)

Aggregations

Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)1 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 OneStopActivity (flying.grub.tamtime.activity.OneStopActivity)1 Line (flying.grub.tamtime.data.map.Line)1 StopZone (flying.grub.tamtime.data.map.StopZone)1 LineStop (flying.grub.tamtime.data.persistence.LineStop)1 FavHomeView (flying.grub.tamtime.layout.FavHomeView)1 SearchView (flying.grub.tamtime.layout.SearchView)1