Advertisement
minafaw3

ViewAnswers

Feb 15th, 2016
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. package com.imaadv.leaynik.Activities;
  2.  
  3. import android.graphics.Typeface;
  4. import android.os.Bundle;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.support.v7.widget.Toolbar;
  7. import android.view.View;
  8. import android.widget.TextView;
  9.  
  10. import com.android.volley.toolbox.NetworkImageView;
  11. import com.imaadv.leaynik.R;
  12. import com.imaadv.leaynik.adapters.ListViewAdapter;
  13. import com.imaadv.leaynik.api.API;
  14. import com.imaadv.leaynik.api.MySingleton;
  15. import com.imaadv.leaynik.fragment.Profile_Fragment;
  16. import com.imaadv.leaynik.model.QuestionItem;
  17.  
  18. public class ViewAnswers extends AppCompatActivity {
  19.  
  20. //private ListView Answers_View;
  21. //private Button Send;
  22. //private ImageView UploadImage;
  23. //private Answers_ListView Adapter;
  24. //private ArrayList<AnswerItem> Answers = new ArrayList<AnswerItem>();
  25. private TextView PostContent, PostUsername;
  26. private NetworkImageView PostUserImage, PostImage;
  27. //private EditText AnswerConent;
  28. private TextView Date, AnswersCount;
  29. //private ProgressBar userimage_prog, postimg_prog;
  30. private QuestionItem item = new QuestionItem();
  31. private com.android.volley.toolbox.ImageLoader imageloader;
  32. private API api;
  33. //private ProgressDialog dialog;
  34. private String postid = "";
  35. //private uploadmultipart uploadParts;
  36. //private String imagepath;
  37. TextView answer_title;
  38. NetworkImageView answer_image;
  39.  
  40. @Override
  41. protected void onCreate(Bundle savedInstanceState) {
  42. super.onCreate(savedInstanceState);
  43. setContentView(R.layout.disp_notify);
  44. api = new API(this);
  45.  
  46. init();
  47. }
  48.  
  49. private void init() {
  50. Typeface tf = Typeface.createFromAsset(getAssets(),
  51. "fonts/GE_SS_Two_Bold.otf");
  52. Typeface tfreg = Typeface.createFromAsset(getAssets(),
  53. "fonts/GE_SS_Two_Light.otf");
  54.  
  55. Toolbar _toolbar = (Toolbar) findViewById(R.id.toolbar);
  56. setSupportActionBar(_toolbar);
  57. getSupportActionBar().setHomeButtonEnabled(true);
  58. getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  59. _toolbar.setNavigationOnClickListener(new View.OnClickListener() {
  60. @Override
  61. public void onClick(View v) {
  62. onBackPressed();
  63. }
  64. });
  65.  
  66. imageloader = MySingleton.getInstance(this).getmImageLoader();
  67. PostContent = (TextView) findViewById(R.id.ques_content);
  68. PostContent.setTypeface(tfreg);
  69.  
  70. answer_title = (TextView) findViewById(R.id.answer_detail);
  71. answer_image = (NetworkImageView) findViewById(R.id.answer_image);
  72.  
  73. PostUsername = (TextView) findViewById(R.id.username_ques);
  74. PostUsername.setTypeface(tf);
  75. Date = (TextView) findViewById(R.id.date);
  76. Date.setTypeface(tfreg);
  77. //AnswersCount = (TextView) findViewById(R.id.answers_con);
  78. //AnswersCount.setTypeface(tfreg);
  79. //Send = (Button) findViewById(R.id.upload_answer);
  80. //Send.setTypeface(tfreg);
  81. PostImage = (NetworkImageView) findViewById(R.id.post_img);
  82. //UploadImage = (ImageView) findViewById(R.id.upload_ans_img);
  83. PostUserImage = (NetworkImageView) findViewById(R.id.ques_user_img);
  84. //Answers_View = (ListView) findViewById(R.id.answers_list);
  85. //AnswerConent = (EditText) findViewById(R.id.answerss_content);
  86. //AnswerConent.setTypeface(tfreg);
  87. //userimage_prog = (ProgressBar) findViewById(R.id.userimgae_prog);
  88. //postimg_prog = (ProgressBar) findViewById(R.id.post_img_pro);
  89. if (getIntent() != null) {
  90. if (getIntent().getExtras() != null)
  91. if (getIntent().getExtras().containsKey("passedobject")) {
  92. item = (QuestionItem) getIntent().getParcelableExtra("passedobject");
  93. }
  94. }
  95. if (item != null) {
  96. //Adapter = new Answers_ListView(this, item.answers);
  97. //Answers_View.setAdapter(Adapter);
  98. PostContent.setText(item.Que_Content);
  99. PostUsername.setText(item.user.username);
  100. Date.setText(item.Que_Date);
  101. postid = item.Que_ID;
  102. //AnswersCount.setText(item.answers.size() + " "+getResources().getString(R.string.answers));
  103.  
  104. if (item.Que_image_url != null) {
  105. if (!item.Que_image_url.contentEquals("")) {
  106. PostImage.setImageUrl(ListViewAdapter.BASE_POST_URl + item.Que_image_url, imageloader);
  107. }
  108. }
  109. if (item.user != null) {
  110. if (item.user.userimageURL != null) {
  111. if (!item.user.userimageURL.contentEquals("")) {
  112. PostUserImage.setImageUrl(Profile_Fragment.BASE_URL + item.user.userimageURL, imageloader);
  113. }
  114. }
  115.  
  116. }
  117.  
  118. if(item.comment != null){
  119. answer_title.setText(item.comment);
  120. }
  121.  
  122. if(item.comment_photo != null){
  123. answer_image.setImageUrl(item.comment_photo , imageloader);
  124. }
  125.  
  126. }
  127.  
  128. }
  129.  
  130.  
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement