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 454f6c0..0000000
Binary files a/app/src/main/res/drawable/Thumbs.db and /dev/null differ
diff --git a/app/src/main/res/layout/cabinet_newsfeed.xml b/app/src/main/res/layout/cabinet_newsfeed.xml
index d3eb5fa..be25de8 100644
--- a/app/src/main/res/layout/cabinet_newsfeed.xml
+++ b/app/src/main/res/layout/cabinet_newsfeed.xml
@@ -5,9 +5,24 @@
android:layout_height="match_parent"
tools:showIn="@layout/content_cabinet">
-
+
+
+
+
+
+
+
+
+
+
\ 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