NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

public class ListAdapter extends BaseAdapter {

Context ctx;
private List<ListRowModel> dialogs = new ArrayList<ListRowModel>(); //konusmalarin oldugu listemiz


private LayoutInflater mInflater;

public ListAdapter(Context ctx){
this.ctx = ctx;
mInflater = (LayoutInflater)this.ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}

//msgEkle() diye bir fonksiyon ile içine data eklersin

public void msgEkle(ListRowModel listRowModel){
dialogs.add(listRowModel);
}

@Override
public int getCount() {
return dialogs.size(); //getCount() içinde bu listenin boyutunu yollayalım ki android'e listenin uzunlugunu verelim.
}

@Override
public ListRowModel getItem(int i) {
return dialogs.get(i); //o anki item'i listeden cekelim, android bunu getView metodu icinde cizecek
}

@Override
public long getItemId(int i) {
return 0;
}

@SuppressLint("InflateParams")
@Override
public View getView(int position, View convertView, ViewGroup viewGroup) {

View row = null;
MapViewTutucu mapViewTutucu = null;
TextViewTutucu textViewTutucu = null;
CalendarViewTutucu calendarViewTutucu = null;
DigitalClockTutucu digitalClockTutucu = null;


//o anki ogemiz:

ListRowModel MSG = getItem(position);

boolean isMe = MSG.isMe();
int type = MSG.getType();
//isMe() diye bir metod koymustuk objemizin içine,
// bunu whatsapp veya ATA gibi şekilli yapmak için kullanmak lazım

if(convertView == null){ //eger view yoksa ÇİZ

if(type == Constants.ROW_TYPE_TEXT){ //text ise...
textViewTutucu = new TextViewTutucu();
convertView = mInflater.inflate(R.layout.list_row_text , null);
textViewTutucu.textView = (TextView)convertView.findViewById(R.id.textViewRowId);

if(isMe){ //eger bizimse sol tarafa yasla
textViewTutucu.textView.setGravity(Gravity.LEFT);
} else { //yoksa saga yasla
textViewTutucu.textView.setGravity(Gravity.RIGHT);
}
convertView.setTag(textViewTutucu);
}

if(type == Constants.ROW_TYPE_MAP) {
mapViewTutucu = new MapViewTutucu();
convertView = mInflater.inflate(R.layout.list_rox_map , null);
mapViewTutucu.mapView = (MapView)convertView.findViewById(R.id.mapViewRowId);
//eger tip haritaysa buraya harita koy vs.... (ustteki gibi bir holder kullanmak faydalı)

convertView.setTag(mapViewTutucu);

}

if(type == Constants.ROW_TYPE_CALENDAR) {
calendarViewTutucu = new CalendarViewTutucu();
convertView = mInflater.inflate(R.layout.list_row_calendar , null);
calendarViewTutucu.calendarView = (CalendarView)convertView.findViewById(R.id.calendarViewRowId);
//eger tip haritaysa buraya harita koy vs.... (ustteki gibi bir holder kullanmak faydalı)

convertView.setTag(calendarViewTutucu);
}

if(type == Constants.ROW_TYPE_CLOCK) {
digitalClockTutucu = new DigitalClockTutucu();
convertView = mInflater.inflate(R.layout.list_row_clock , null);
digitalClockTutucu.digitalClock = (DigitalClock)convertView.findViewById(R.id.digitalClockRowId);
//eger tip haritaysa buraya harita koy vs.... (ustteki gibi bir holder kullanmak faydalı)

convertView.setTag(digitalClockTutucu);
}

row = convertView;
}

else { //ustteki gibi tekrar kontrol et, bu kez convertView dolu ama yine de alttaki gibi yapmamız gerek
if(type == Constants.ROW_TYPE_TEXT){

textViewTutucu = (TextViewTutucu) convertView.getTag();

if(isMe){ //eger bizimse sol tarafa yasla
textViewTutucu.textView.setGravity(Gravity.LEFT);
} else { //yoksa saga yasla
textViewTutucu.textView.setGravity(Gravity.RIGHT);
}
}

if(type == Constants.ROW_TYPE_MAP) {
mapViewTutucu = (MapViewTutucu) convertView.getTag();
//eger tip haritaysa buraya harita koy vs.... (ustteki gibi bir holder kullanmak faydalı)

}

if(type == Constants.ROW_TYPE_CALENDAR) {
calendarViewTutucu = (CalendarViewTutucu) convertView.getTag();
//eger tip haritaysa buraya harita koy vs.... (ustteki gibi bir holder kullanmak faydalı)

}

if(type == Constants.ROW_TYPE_CLOCK) {
digitalClockTutucu = (DigitalClockTutucu) convertView.getTag();

//eger tip haritaysa buraya harita koy vs.... (ustteki gibi bir holder kullanmak faydalı)
}

row = convertView;
}


if(type == Constants.ROW_TYPE_TEXT){
textViewTutucu.textView.setText(MSG.getMsg());

}




return row;
}

public static class TextViewTutucu {
//Android bizlere performans acisindan "ViewHolder" kullanın diyor.
//tek esprisi adı üstünde ViewHolder yani öğe tutucu, aynı öğeyi tekrar tekrar çizdirmemek ve telefonu yormamak icin
//bunu simdiden eklemek daha iyi yoksa sonra listView karisinca zorlasir
public TextView textView;

}

public static class MapViewTutucu {
//Android bizlere performans acisindan "ViewHolder" kullanın diyor.
//tek esprisi adı üstünde ViewHolder yani öğe tutucu, aynı öğeyi tekrar tekrar çizdirmemek ve telefonu yormamak icin
//bunu simdiden eklemek daha iyi yoksa sonra listView karisinca zorlasir
public MapView mapView;

}

public static class CalendarViewTutucu {
//Android bizlere performans acisindan "ViewHolder" kullanın diyor.
//tek esprisi adı üstünde ViewHolder yani öğe tutucu, aynı öğeyi tekrar tekrar çizdirmemek ve telefonu yormamak icin
//bunu simdiden eklemek daha iyi yoksa sonra listView karisinca zorlasir
public CalendarView calendarView;

}

public static class DigitalClockTutucu {
//Android bizlere performans acisindan "ViewHolder" kullanın diyor.
//tek esprisi adı üstünde ViewHolder yani öğe tutucu, aynı öğeyi tekrar tekrar çizdirmemek ve telefonu yormamak icin
//bunu simdiden eklemek daha iyi yoksa sonra listView karisinca zorlasir

public DigitalClock digitalClock;

}

}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.