Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.22 KB | None | 0 0
  1. <div id="detay" class="grid_8 info beyazbg">
  2. <div class='detayici'>
  3. <h1 class="haberbaslik">
  4. <span id="ContentPlaceHolder1_Lbaslik">Son 5 yılın YGS konu soru dağılımı </span>
  5. </h1>
  6. <table border="0" cellpadding="0" cellspacing="0" width="490" style="border-collapse:&#xD;&#xA; collapse;width:370pt">
  7. <colgroup><col width="72" style="mso-width-source:userset;mso-width- alt:2633;width:54pt" />
  8. <col width="188" style="mso-width-source:userset;mso-width-alt:6875;width:141pt" />
  9. <col width="46" span="5" style="mso-width-source:userset;mso-width-alt:1682;&#xD;&#xA; width:35pt" />
  10. </colgroup><tbody><tr style="mso-height-source:userset;height:14.1pt">
  11. <td height="18" class="xl70" width="72" style="height:14.1pt;width:54pt">YGS
  12. MATEMATİK</td>
  13. <td class="xl65" width="188" style="border-left:none;width:141pt">KONULAR</td>
  14. <td class="xl64" width="46" style="border-left:none;width:35pt">2011</td>
  15. <td class="xl64" width="46" style="border-left:none;width:35pt">2012</td>
  16. <td class="xl64" width="46" style="border-left:none;width:35pt">2013</td>
  17. <td class="xl64" width="46" style="border-left:none;width:35pt">2014</td>
  18. <td class="xl64" width="46" style="border-left:none;width:35pt">2015</td>
  19. </tr>
  20. <tr style="mso-height-source:userset;height:14.1pt">
  21. <td height="18" class="xl71" width="72" style="height:14.1pt;width:54pt"> <span style="visibility:hidden;mso-ignore:visibility; text-decoration: underline;">&nbsp;</span></td>
  22. <td class="xl66" style="border-top:none;border-left:none">RASYONEL SAYILAR</td>
  23. <td class="xl63" style="border-top:none;border-left:none">4</td>
  24. <td class="xl63" style="border-top:none;border-left:none">1</td>
  25. <td class="xl63" style="border-top:none;border-left:none">&nbsp;</td>
  26. <td class="xl63" style="border-top:none;border-left:none">1</td>
  27. <td class="xl63" style="border-top:none;border-left:none">1</td>
  28. </tr>
  29.  
  30. public class CikmisSorular extends Activity {
  31.  
  32. private Button titleButton, descButton, logoButton, yazarlarButton;
  33. LinearLayout title_layout, desc_layout, logo_layout, yazarlar_layout;
  34. private ProgressDialog progressDialog;
  35. private static String URL = "http://www.utercih.com/rehberlik.aspx";
  36. private static String baseUrl = "http://www.utercih.com/rehberlik.aspx";
  37. private static String authorUrl = "http://www.utercih.com/rehberlik.aspx";
  38. @Override
  39. protected void onCreate(Bundle savedInstanceState) {
  40. super.onCreate(savedInstanceState);
  41. setContentView(R.layout.activity_cikmis_sorular);
  42.  
  43. titleButton = (Button)findViewById(R.id.buttonTitle);
  44. descButton = (Button)findViewById(R.id.buttonDesc);
  45. logoButton = (Button)findViewById(R.id.buttonImage);
  46. yazarlarButton = (Button)findViewById(R.id.buttonYazarlar);
  47.  
  48. titleButton.setOnClickListener(new View.OnClickListener() {
  49. @Override
  50. public void onClick(View v) {
  51.  
  52. new FetchTitle().execute(); // başlık çekmek için
  53. }
  54. });
  55.  
  56. descButton.setOnClickListener(new View.OnClickListener() {
  57. @Override
  58. public void onClick(View v) {
  59.  
  60. new FetchDescription().execute(); // açıklama çekmek için
  61. }
  62. });
  63.  
  64. logoButton.setOnClickListener(new View.OnClickListener() {
  65. @Override
  66. public void onClick(View v) {
  67.  
  68. new FetchImageLogo().execute(); // logo çekmek için
  69. }
  70. });
  71.  
  72. yazarlarButton.setOnClickListener(new View.OnClickListener() {
  73. @Override
  74. public void onClick(View v) {
  75.  
  76. new FetchYazarlar().execute(); // yazarlar kısmını çekmek için
  77. }
  78. });
  79.  
  80. }
  81. private class FetchTitle extends AsyncTask<Void, Void, Void> {
  82.  
  83. String title;
  84. @Override
  85. protected void onPreExecute() {
  86. super.onPreExecute();
  87.  
  88. progressDialog = new ProgressDialog(CikmisSorular.this);
  89. progressDialog.setTitle("BAŞLIK");
  90. progressDialog.setMessage("Başlık Çekiliyor...");
  91. progressDialog.setIndeterminate(false);
  92. progressDialog.show();
  93. }
  94.  
  95. @Override
  96. protected Void doInBackground(Void... params) {
  97.  
  98. try{
  99.  
  100. Document doc = Jsoup.connect(URL).get(); // web siteye bağlantıyı gerçeleştirme
  101.  
  102. title = doc.title(); // ilgili sayfanın başlığını almak için
  103.  
  104. }catch (Exception e){
  105.  
  106. e.printStackTrace();
  107. }
  108.  
  109.  
  110. return null;
  111. }
  112.  
  113. @Override
  114. protected void onPostExecute(Void aVoid) {
  115.  
  116. title_layout = (LinearLayout)findViewById(R.id.title_layout);
  117. TextView txt_title = (TextView)findViewById(R.id.txt_title);
  118. title_layout.setVisibility(View.VISIBLE);
  119. txt_title.setText("Title: " + "" + title);
  120. progressDialog.dismiss();
  121. }
  122. }
  123.  
  124. private class FetchDescription extends AsyncTask<Void, Void, Void> {
  125.  
  126. String desc;
  127. @Override
  128. protected void onPreExecute() {
  129. super.onPreExecute();
  130.  
  131. progressDialog = new ProgressDialog(CikmisSorular.this);
  132. progressDialog.setTitle("AÇIKLAMA");
  133. progressDialog.setMessage("Açıklama Çekiliyor...");
  134. progressDialog.setIndeterminate(false);
  135. progressDialog.show();
  136. }
  137.  
  138. @Override
  139. protected Void doInBackground(Void... params) {
  140.  
  141. try{
  142.  
  143. Document doc = Jsoup.connect(URL).get();
  144. Elements elements = doc.select("div[class=detayici]"); // ilgili sayfanın açıklamasını almak için
  145. desc = elements.attr("content");
  146.  
  147.  
  148. }catch (Exception e){
  149.  
  150. e.printStackTrace();
  151. }
  152.  
  153.  
  154. return null;
  155. }
  156.  
  157. @Override
  158. protected void onPostExecute(Void aVoid) {
  159.  
  160. desc_layout = (LinearLayout)findViewById(R.id.desc_layout);
  161. TextView txt_desc = (TextView)findViewById(R.id.txt_desc);
  162. desc_layout.setVisibility(View.VISIBLE);
  163. txt_desc.setText("Description: " + "" + desc);
  164. progressDialog.dismiss();
  165. }
  166. }
  167.  
  168. private class FetchImageLogo extends AsyncTask<Void, Void, Void> {
  169.  
  170. Bitmap bitmap;
  171.  
  172. @Override
  173. protected void onPreExecute() {
  174. super.onPreExecute();
  175.  
  176. progressDialog = new ProgressDialog(CikmisSorular.this);
  177. progressDialog.setTitle("LOGO");
  178. progressDialog.setMessage("Logo Çekiliyor...");
  179. progressDialog.setIndeterminate(false);
  180. progressDialog.show();
  181. }
  182.  
  183. @Override
  184. protected Void doInBackground(Void... params) {
  185.  
  186. try{
  187.  
  188. Document doc = Jsoup.connect(baseUrl).get();
  189. Elements elements = doc.select("img[src]");
  190. String imgSrc = elements.attr("src");
  191. InputStream input = new java.net.URL(imgSrc).openStream();
  192. bitmap = BitmapFactory.decodeStream(input);
  193.  
  194. }catch (Exception e){
  195.  
  196. e.printStackTrace();
  197. }
  198.  
  199.  
  200. return null;
  201. }
  202.  
  203. @Override
  204. protected void onPostExecute(Void aVoid) {
  205.  
  206. logo_layout = (LinearLayout)findViewById(R.id.logo_layout);
  207. ImageView img_logo = (ImageView)findViewById(R.id.img_logo);
  208. logo_layout.setVisibility(View.VISIBLE);
  209. img_logo.setImageBitmap(bitmap);
  210. progressDialog.dismiss();
  211. }
  212. }
  213.  
  214. private class FetchYazarlar extends AsyncTask<Void, Void, Void> {
  215.  
  216. String authors;
  217. @Override
  218. protected void onPreExecute() {
  219. super.onPreExecute();
  220.  
  221. progressDialog = new ProgressDialog(CikmisSorular.this);
  222. progressDialog.setTitle("YAZARLAR");
  223. progressDialog.setMessage("Yazarlar Çekiliyor...");
  224. progressDialog.setIndeterminate(false);
  225. progressDialog.show();
  226. }
  227.  
  228. @Override
  229. protected Void doInBackground(Void... params) {
  230.  
  231. try{
  232.  
  233. Document doc = Jsoup.connect(authorUrl).get();
  234. Elements elements = doc.select("div[class=post-content]"); // class ismi post-content olan verileri çekmek için
  235. authors = elements.text();
  236.  
  237. }catch (Exception e){
  238.  
  239. e.printStackTrace();
  240. }
  241.  
  242.  
  243. return null;
  244. }
  245.  
  246. @Override
  247. protected void onPostExecute(Void aVoid) {
  248.  
  249. yazarlar_layout = (LinearLayout)findViewById(R.id.yazarlar_layout);
  250. TextView txt_yazarlar = (TextView)findViewById(R.id.txt_yazarlar);
  251. yazarlar_layout.setVisibility(View.VISIBLE);
  252. txt_yazarlar.setText(authors);
  253. progressDialog.dismiss();
  254. }
  255. }
  256. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement