Android Open Source - ManipalNow-Android Level Adapter






From Project

Back to project page ManipalNow-Android.

License

The source code is released under:

Apache License

If you think the Android project ManipalNow-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 com.example.nav;
//from  w ww  .j  a  v a  2  s  .c o m
import android.R.color;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class LevelAdapter extends ArrayAdapter<Level> {
  
   static Context context;
      static int layoutResourceId;   
       Level data[] = null;
     
   public LevelAdapter(Context context, int layoutResourceId, Level[] data) {
          super(context, layoutResourceId, data);
          this.layoutResourceId = layoutResourceId;
          this.context = context;
          this.data = data;
      }
      
     
    public long getItemId(int position) {
            return position;
      }

      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View row = convertView;
          WeatherHolder holder = null;
         
          if(row == null)
          {
              LayoutInflater inflater = ((Activity)context).getLayoutInflater();
              row = inflater.inflate(layoutResourceId, parent, false);
             //row.setMinimumHeight(200);
              holder = new WeatherHolder();
             holder.imgIcon = (ImageView)row.findViewById(R.id.imgIcon);
          Typeface robotoLight = Typeface.createFromAsset(getContext().getAssets(), "Roboto-Light.ttf");
          Typeface robotoThin = Typeface.createFromAsset(getContext().getAssets(), "Roboto-Thin.ttf");
          //holder.txtTitle2=(TextView)row.findViewById(R.id.txtTitle2);
          holder.txtTitle = (TextView)row.findViewById(R.id.txtTitle);
             // holder.txtTitle2 = (TextView)row.findViewById(R.id.txtTitle2);
            //  holder.txtTitle3 = (TextView)row.findViewById(R.id.txtTitle3);
              holder.txtTitle.setTypeface(robotoLight);
              //if (mCurrentSelectedPosition == position) {
                //  holder.txtTitle.setBackgroundResource(R.attr.listPopupWindowStyle);
              //} else {
                //  holder.txtTitle.setBackgroundResource(R.attr.listChoiceBackgroundIndicator);
              //}
             // holder.txtTitle2.setTypeface(robotoLight);
            // holder.txtTitle2.setTypeface(robotoLight);
             // holder.txtTitle3.setTypeface(robotoLight);
              //holder.txtTitle2.setTextColor(Color.parseColor("#ff0099cc"));
              //holder.txtTitle3.setTextColor(Color.parseColor("#FF4444"));
              
              
              row.setTag(holder);
          }
          else
          {
              holder = (WeatherHolder)row.getTag();
          }
         
          Level weather = data[position];
          holder.txtTitle.setText(weather.title);
          holder.imgIcon.setImageResource(weather.icon);
         // holder.txtTitle2.setText(weather.title2);
         // holder.txtTitle2.setText(weather.title2);
         // holder.txtTitle3.setText(weather.title3);
          return row;
      }
     
      static class WeatherHolder
      {
         ImageView imgIcon;
          TextView txtTitle;
          TextView txtTitle2;
         // TextView txtTitle3;
      //    ImageView imgIcon2;
      }

}




Java Source Code List

com.example.nav.BarFragment.java
com.example.nav.BarInfo.java
com.example.nav.Bars.java
com.example.nav.CafeFragment.java
com.example.nav.CafeInfo.java
com.example.nav.Cafes.java
com.example.nav.Coffee.java
com.example.nav.Food.java
com.example.nav.HelpAct.java
com.example.nav.HelpFragment1.java
com.example.nav.HelpFragment2.java
com.example.nav.HelpFragment3.java
com.example.nav.HelpFragment4.java
com.example.nav.HelpFragment5.java
com.example.nav.HelpFragment6.java
com.example.nav.HelpFragment7.java
com.example.nav.HelpFragment8.java
com.example.nav.HospitalFragment.java
com.example.nav.HospitalInfo.java
com.example.nav.Hospitals.java
com.example.nav.ImageAdapter.java
com.example.nav.LevelAdapter.java
com.example.nav.Level.java
com.example.nav.MainActivity.java
com.example.nav.RestaurantFragment.java
com.example.nav.RestaurantInfo.java
com.example.nav.Restaurants.java
com.example.nav.Settings3.java
com.example.nav.ShowCity3.java
com.example.nav.ShowCity5.java
com.example.nav.ShowCity6.java
com.example.nav.ShowCity7.java
com.example.nav.util.SystemUiHiderBase.java
com.example.nav.util.SystemUiHiderHoneycomb.java
com.example.nav.util.SystemUiHider.java