Android Open Source - on-the-hook Fish Adapter






From Project

Back to project page on-the-hook.

License

The source code is released under:

MIT License

If you think the Android project on-the-hook 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.yoandinkov.onthehook.adapters;
/*from   ww  w  .  ja va 2 s.com*/
import java.util.List;


import com.yoandinkov.onthehook.R;
import com.yoandinkov.onthehook.db.models.FishDbModel;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class FishAdapter extends ArrayAdapter<FishDbModel>{
  private Context context;
  private int layoutId;
  private List<FishDbModel> data;
  
  
  public FishAdapter(Context context, int textViewResourseId, List<FishDbModel> objects) {
    super(context, textViewResourseId, objects);
    this.setContext(context);
    this.setData(objects);
    this.setLayoutId(textViewResourseId);
  }


  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = ((Activity)context).getLayoutInflater();
    
    View row = inflater.inflate(this.getLayoutId(), parent, false);
    
    TextView TextViewFishSpeciesName = (TextView)row.findViewById(R.id.draughtLayoutTextViewFishSpeciesName);
    TextView TextViewFishWeight = (TextView)row.findViewById(R.id.draughtLayoutTextViewFishWeight);
    
    double fishWeight = data.get(position).getWeight();
    
    TextViewFishSpeciesName.setText(data.get(position).getName());
    TextViewFishWeight.setText(String.format("Weight: %.2f kilos.", fishWeight));
    
    return row;
  }
  
  public Context getContext() {
    return context;
  }


  public void setContext(Context context) {
    this.context = context;
  }


  public int getLayoutId() {
    return layoutId;
  }


  public void setLayoutId(int layoutId) {
    this.layoutId = layoutId;
  }


  public List<FishDbModel> getData() {
    return data;
  }


  public void setData(List<FishDbModel> data) {
    this.data = data;
  }
  
  
}




Java Source Code List

com.yoandinkov.onthehook.DraughtActivity.java
com.yoandinkov.onthehook.FishActivity.java
com.yoandinkov.onthehook.FishingActivity.java
com.yoandinkov.onthehook.LoginActivity.java
com.yoandinkov.onthehook.MainMenuActivity.java
com.yoandinkov.onthehook.RegisterActivity.java
com.yoandinkov.onthehook.RequestActivity.java
com.yoandinkov.onthehook.adapters.FishAdapter.java
com.yoandinkov.onthehook.crypt.JsonConverter.java
com.yoandinkov.onthehook.crypt.SHA1Converter.java
com.yoandinkov.onthehook.db.DatabaseHelper.java
com.yoandinkov.onthehook.db.DatabaseManager.java
com.yoandinkov.onthehook.db.models.FishDbModel.java
com.yoandinkov.onthehook.models.Coordinates.java
com.yoandinkov.onthehook.models.Credentials.java
com.yoandinkov.onthehook.models.FishButton.java
com.yoandinkov.onthehook.models.FishSpecies.java
com.yoandinkov.onthehook.models.Fish.java
com.yoandinkov.onthehook.models.Fishing.java
com.yoandinkov.onthehook.models.HttpResponseWrapper.java
com.yoandinkov.onthehook.models.HttpType.java
com.yoandinkov.onthehook.models.Login.java
com.yoandinkov.onthehook.models.NewFishing.java
com.yoandinkov.onthehook.models.Registration.java
com.yoandinkov.onthehook.models.RequestPurpose.java
com.yoandinkov.onthehook.models.Response.java
com.yoandinkov.onthehook.models.WaterLocation.java