From 4ef20e1f7d2d32ad16afa5775c9a1c372a7758be Mon Sep 17 00:00:00 2001 From: Defend Date: Mon, 13 Feb 2017 02:42:41 +0300 Subject: [PATCH] Crafting NewsFeed Layout[25%] --- app/app.iml | 16 ++--- .../defdevteam/tstu/CabinetActivity.java | 57 +++++++++++++++++- .../defdevteam/tstu/FeedController.java | 2 +- app/src/main/res/drawable/Thumbs.db | Bin 13312 -> 0 bytes app/src/main/res/layout/cabinet_newsfeed.xml | 25 ++++++-- .../main/res/layout/cabinet_newsfeed_item.xml | 44 ++++++++++++++ 6 files changed, 129 insertions(+), 15 deletions(-) delete mode 100644 app/src/main/res/drawable/Thumbs.db create mode 100644 app/src/main/res/layout/cabinet_newsfeed_item.xml diff --git a/app/app.iml b/app/app.iml index 8b0c423..a16956c 100644 --- a/app/app.iml +++ b/app/app.iml @@ -66,14 +66,6 @@ - - - - - - - - @@ -82,6 +74,14 @@ + + + + + + + + diff --git a/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java b/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java index e1ebf59..86854ee 100644 --- a/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java +++ b/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java @@ -3,10 +3,15 @@ package ru.defend.defdevteam.tstu; import android.annotation.TargetApi; import android.content.Context; import android.content.Intent; +import android.graphics.Bitmap; +import android.graphics.BitmapFactory; +import android.media.Image; +import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; +import android.support.v7.widget.LinearLayoutCompat; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -25,10 +30,14 @@ import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ArrayAdapter; import android.widget.Chronometer; +import android.widget.ImageView; +import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; +import java.io.InputStream; +import java.net.URL; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; @@ -149,7 +158,7 @@ public class CabinetActivity extends AppCompatActivity studentRate = (TextView) findViewById(R.id.studentRate); studentGroup = (TextView) findViewById(R.id.studentGroup); positionFaculty = (TextView) findViewById(R.id.positionFaculty); - newsTextView = (TextView) findViewById(R.id.newsTextView); + //newsTextView = (TextView) findViewById(R.id.newsTextView); positionGroup = (TextView) findViewById(R.id.positionGroup); profileLayout = (RelativeLayout) findViewById(R.id.profileLayout); journalLayout = (RelativeLayout) findViewById(R.id.journalList); @@ -171,6 +180,9 @@ public class CabinetActivity extends AppCompatActivity AuthURL = "http://web-iais.admin.tstu.ru:7777/zion/f?p=stud_main"; loadSite(AuthURL); + addNewsItem(null); + addNewsItem(null); + } @Override @@ -270,7 +282,50 @@ public class CabinetActivity extends AppCompatActivity return true; } + private class DownloadImageTask extends AsyncTask { + ImageView bmImage; + + public DownloadImageTask(ImageView bmImage) { + this.bmImage = bmImage; + } + + protected Bitmap doInBackground(String... urls) { + String urldisplay = urls[0]; + Bitmap mIcon11 = null; + try { + InputStream in = new java.net.URL(urldisplay).openStream(); + mIcon11 = BitmapFactory.decodeStream(in); + } catch (Exception e) { + Log.e("Error", e.getMessage()); + e.printStackTrace(); + } + return mIcon11; + } + protected void onPostExecute(Bitmap result) { + bmImage.setImageBitmap(result); + } + } + + public void addNewsItem (View v) { + //Это всего лишь тестовая функция + LinearLayout mainLayer = (LinearLayout) findViewById(R.id.newsfeed_scroll); + LayoutInflater inflater = getLayoutInflater(); + mainLayer.addView(inflater.inflate(R.layout.cabinet_newsfeed_item, null)); + View layout = inflater.inflate(R.layout.cabinet_newsfeed_item, null); + mainLayer.addView(layout); + + TextView text = (TextView) layout.findViewById(R.id.newsfeed_item_title); + text.setText("В ТГТУ прошел региональный этап Всероссийской олимпиады школьников по информатике и ИКТ"); + + + TextView text2 = (TextView) layout.findViewById(R.id.newsfeed_item_text); + + new DownloadImageTask((ImageView) layout.findViewById(R.id.newsfeed_item_image)) + .execute("http://press.tstu.ru/photo/News/2017/0000494857574.jpg"); + + mainLayer.addView(inflater.inflate(R.layout.cabinet_newsfeed_item, null)); + } public void loadSite (String url) { browser.loadUrl(url); diff --git a/app/src/main/java/ru/defend/defdevteam/tstu/FeedController.java b/app/src/main/java/ru/defend/defdevteam/tstu/FeedController.java index f78efe9..991eeee 100644 --- a/app/src/main/java/ru/defend/defdevteam/tstu/FeedController.java +++ b/app/src/main/java/ru/defend/defdevteam/tstu/FeedController.java @@ -50,7 +50,7 @@ public class FeedController { activity.runOnUiThread(new Runnable() { @Override public void run() { - activity.newsTextView.setText(result); + //activity.newsTextView.setText(result); } }); } diff --git a/app/src/main/res/drawable/Thumbs.db b/app/src/main/res/drawable/Thumbs.db deleted file mode 100644 index 454f6c0cd109d6ee7c50c5af3dfe84f42a4e30ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13312 zcmeHtcUTn5wr|6blYnFtM8Y6Rf@B22O&E|Y3>gVZ&N(9rC=O{zTcQ#rOJ>M92gyp# z2r^_D;>;b-zURFCoqNyy&U^Qt_wGAuzF${$bysz-P;0HOnlGbN%O5M4R)D`FSpWo} zF~k7DpW1P-^_&(_q6}m z`@i%2KllAt{r^7+{PNKtERf(o>`G*!VXkT!sd2*}3)Ksa{+Tq+z86%M8gV8y1R_}I7o+Y4jQ zaY1^@t{aW;%lMB( z>J|iAl*RzrRn-&dJToFZfhgR9RJBQ(IS$Xz1wd z>h9_7>mL}On4FrP`TA{kWp!*^RDlA{P zc)#@Wi!U5ppI?kq;o-9h5m3u(6I!_4yes^Yh(;m)V?{eLyNJ#Kt)=@I2_46S70$z7 zto?b&1WooFWw&Ti^t%2hAXRMz7A$n4UDYTOw78q+>t9fz~Up7Xh4EZ)$Q{9(;KEy@Xv zN3rEk`fC^`6FagAxYY>Stju*I`gkYN;62?bo+yoy{er#k3c|$?)6S@C>tq`0&y-hC z$Q-xI*XF1Kt`E%uOYz;?EDTekwdR!_i^d^?`pjBnNU+=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2%P{TL9g}c$5=>c=bqbwl9h08zZX74QY2-kLx!!SWGYdN z!HJ*Y^z*@+r9Cbsz|(r4^72nroi%36NnG?k@HuiG9IK7r#D47Qn2W{e7t~ZDT0#V- z!AWf+lRCXD^^6kh9;WKG#Vcvz;Sa8*j1fmr6mpPm<&olIjD`xxa*agEIDX1#bTvbP z75t>?)sxz}BfnQ9>(d79hhL4QwFe=Rq@ffy27;gY z$Jg_u2d%_sh7ESMu+-|hkn|TX!gEj@CHBVBYAU(POqrmnzDu`85)esgk-$3}wlw|L z1pSoc816YDaZtt(V^~HwH>*!-6FIBpRr{i^7e zU|+CGxg}NGvI~;hL$x2$ORra#gJN^M&F>W}^Fy6~tQTz7+Od$O=Pzhl6Vj4pGw>nH zqb6W!H_dTJx4ob%YKRXRb{@`Z3skIswz|Vb^retXUVJcd)#b|Pf$ekypXK;`g(U{? zhk_+vycp#Zg9qE-`^Lra#>18055cKNx{@v3Au@2tI^2(A!eOAtjo-fo$vduw1pAkI zsyZa;M5(E0g>x4-Gu1SFfBre53blAzlY;?5e+*4HkEbPk-sbR2?`PxNg}eZBB=mD+ zLcnl!u_)fvw3d?7jwtTjzhs<$%{>2;k{}|!bjjA^?e02nAK!avR>qZ?&`!LU^EN#4 z?PWbP1_!99RB0!LzU~lS!Q(qP@-INbbOUfTT6iwT;@qfs`lwSNNFD3>Z!k2YQvGw0|E5Sx%YBoWeYcN-v*^$ ztTXgHtVPSlg>>X&fP$r~R~X>im|}3h09_koVPdJeNHGwes=)+ zb=H)*zrfN45I(~GIqHg~#pX?U?k4i80>xH_jaZR - + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/cabinet_newsfeed_item.xml b/app/src/main/res/layout/cabinet_newsfeed_item.xml new file mode 100644 index 0000000..0bf4cf0 --- /dev/null +++ b/app/src/main/res/layout/cabinet_newsfeed_item.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + \ No newline at end of file