-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23a2406
commit 719229f
Showing
24 changed files
with
997 additions
and
69 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
app/src/main/java/app/com/ieeedtu/CouncilMemberActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
package app.com.ieeedtu; | ||
|
||
import android.support.v7.app.AppCompatActivity; | ||
import android.os.Bundle; | ||
import android.support.v7.widget.LinearLayoutManager; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import app.com.ieeedtu.POJO.CouncilMember; | ||
import retrofit2.Call; | ||
import retrofit2.Callback; | ||
import retrofit2.Response; | ||
|
||
public class CouncilMemberActivity extends AppCompatActivity { | ||
|
||
RecyclerView rvCouncil; | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_council_member); | ||
|
||
rvCouncil = (RecyclerView) findViewById(R.id.rv_council); | ||
|
||
Call<List<CouncilMember>> callCouncil = RetroClass.client.getCouncil(); | ||
callCouncil.enqueue(new Callback<List<CouncilMember>>() { | ||
@Override | ||
public void onResponse(Call<List<CouncilMember>> call, Response<List<CouncilMember>> response) { | ||
CouncilAdapter adapter = new CouncilAdapter(response.body()); | ||
rvCouncil.setAdapter(adapter); | ||
rvCouncil.setLayoutManager(new LinearLayoutManager(CouncilMemberActivity.this)); | ||
rvCouncil.setHasFixedSize(true); | ||
} | ||
|
||
@Override | ||
public void onFailure(Call<List<CouncilMember>> call, Throwable t) { | ||
|
||
} | ||
}); | ||
|
||
} | ||
|
||
class CouncilAdapter extends RecyclerView.Adapter<CouncilAdapter.CouncilHolder>{ | ||
|
||
List<CouncilMember> list = new ArrayList<>(); | ||
|
||
public CouncilAdapter(List<CouncilMember> list) { | ||
this.list = list; | ||
} | ||
|
||
@Override | ||
public CouncilHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
return new CouncilHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_council_recycler,parent,false)); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(CouncilHolder holder, int position) { | ||
|
||
String name = list.get(position).getMember().getUser().getFirstName()+" "+list.get(position).getMember().getUser().getLastName(); | ||
holder.tvName.setText(name); | ||
holder.tvDes.setText(list.get(position).getDesignation()); | ||
|
||
|
||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return list.size(); | ||
} | ||
|
||
public class CouncilHolder extends RecyclerView.ViewHolder { | ||
|
||
TextView tvName, tvDes; | ||
ImageView ivImage; | ||
|
||
public CouncilHolder(View itemView) { | ||
super(itemView); | ||
tvName = (TextView) itemView.findViewById(R.id.tv_council_member_name); | ||
tvDes = (TextView) itemView.findViewById(R.id.tv_council_member_designation); | ||
ivImage = (ImageView) itemView.findViewById(R.id.iv_council_image); | ||
|
||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package app.com.ieeedtu; | ||
|
||
import java.util.List; | ||
|
||
import app.com.ieeedtu.POJO.CouncilMember; | ||
import app.com.ieeedtu.POJO.NewsInfo; | ||
import app.com.ieeedtu.POJO.SigInfo; | ||
import retrofit2.Call; | ||
import retrofit2.http.GET; | ||
|
||
/** | ||
* Created by samarthgupta on 08/08/17. | ||
*/ | ||
|
||
public interface DataInterface { | ||
|
||
@GET("/news/") | ||
Call<List<NewsInfo>> getNews(); | ||
|
||
@GET("/sigs/") | ||
Call<List<SigInfo>> getSigs(); | ||
|
||
@GET("/council/") | ||
Call<List<CouncilMember>> getCouncil(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package app.com.ieeedtu.POJO; | ||
|
||
import com.google.gson.annotations.Expose; | ||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* Created by samarthgupta on 08/08/17. | ||
*/ | ||
|
||
public class CouncilMember { | ||
|
||
@SerializedName("id") | ||
@Expose | ||
private Integer id; | ||
@SerializedName("member") | ||
@Expose | ||
private Person member; | ||
@SerializedName("designation") | ||
@Expose | ||
private String designation; | ||
@SerializedName("fbProfileLink") | ||
@Expose | ||
private String fbProfileLink; | ||
|
||
public Integer getId() { | ||
return id; | ||
} | ||
|
||
public void setId(Integer id) { | ||
this.id = id; | ||
} | ||
|
||
public Person getMember() { | ||
return member; | ||
} | ||
|
||
public void setMember(Person member) { | ||
this.member = member; | ||
} | ||
|
||
public String getDesignation() { | ||
return designation; | ||
} | ||
|
||
public void setDesignation(String designation) { | ||
this.designation = designation; | ||
} | ||
|
||
public String getFbProfileLink() { | ||
return fbProfileLink; | ||
} | ||
|
||
public void setFbProfileLink(String fbProfileLink) { | ||
this.fbProfileLink = fbProfileLink; | ||
} | ||
} |
Oops, something went wrong.