RouteViewHolder(View itemView, List<RouteModel> routesCV, Context context) { super(itemView); Typeface gidole = Typeface.createFromAsset(itemView.getContext().getAssets(), "fonts/Gidole_Regular.ttf"); mContext = context; this.routesCV = routesCV; cv = (CardView) itemView.findViewById(R.id.cv); destination = (TextView) itemView.findViewById(R.id.destinationCV); startingPoint = (TextView) itemView.findViewById(R.id.startingPointCV); startingDateAndTime = (TextView) itemView.findViewById(R.id.textDateAndTimeCV); destination.setTypeface(gidole); startingPoint.setTypeface(gidole); startingDateAndTime.setTypeface(gidole); map = (MapView) itemView.findViewById(R.id.map_view); linearlayout = (LinearLayout) itemView.findViewById(R.id.linearlayout); itemView.setOnClickListener(this); map.onCreate(null); map.onResume(); map.getMapAsync(this); }
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mMapView = (MapView) view.findViewById(R.id.map); mMapView.onCreate(savedInstanceState != null ? savedInstanceState.getBundle(STATE_MAP) : null); mMapView.getMapAsync(this); mToolbar = (Toolbar) view.findViewById(R.id.toolbar); ((AppCompatActivity) getActivity()).setSupportActionBar(mToolbar); mWeatherModeBtn = (ImageButton) view.findViewById(R.id.feature_mode_weather_btn); mWeatherModeBtn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { setFeatureMode(FeatureMode.WEATHER); } }); mTemperatureModeBtn = (ImageButton) view.findViewById(R.id.feature_mode_temperature_btn); mTemperatureModeBtn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { setFeatureMode(FeatureMode.TEMPERATURE); } }); mLogoView = view.findViewById(R.id.logo); mPostButton = view.findViewById(R.id.post_button); mPostButton.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { showPostFragment(null); } }); if (getHomeFragment() != null) { showHomeFragment(); } else if (getPostFragment() != null) { showPostFragment(null); } if (savedInstanceState == null) { Bundle args = getArguments(); if (args != null) { if (args.getBoolean(ARG_SHOW_HOME)) showHomeFragment(); else if (args.getBoolean(ARG_SHOW_POST)) showPostFragment(args); else if (args.containsKey(ARG_LOCATION)) { mMapLocation = args.getParcelable(ARG_LOCATION); } } mWeatherModeBtn.setSelected(true); } }
/** Starts the map in the dialog. */ private void startMap() { mapView.getMapAsync(this); }