diff --git a/app/app.iml b/app/app.iml index a16956c..8b0c423 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 1d27485..43582a0 100644 --- a/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java +++ b/app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java @@ -10,6 +10,7 @@ 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.view.menu.MenuView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; @@ -123,6 +124,8 @@ public class CabinetActivity extends AppCompatActivity setContentView(R.layout.cabinet); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); + myToolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(myToolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @@ -133,9 +136,9 @@ public class CabinetActivity extends AppCompatActivity } }); - final DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); + DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( - this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); + this, drawer, toolbar,R.string.navigation_drawer_open, R.string.navigation_drawer_close); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); @@ -151,7 +154,6 @@ 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); positionGroup = (TextView) findViewById(R.id.positionGroup); profileLayout = (RelativeLayout) findViewById(R.id.profileLayout); journalLayout = (RelativeLayout) findViewById(R.id.journalList); @@ -162,8 +164,6 @@ public class CabinetActivity extends AppCompatActivity newsLayout = (RelativeLayout) findViewById(R.id.newsLayout); progressLayout.setVisibility(View.VISIBLE); profileLayout.setVisibility(View.VISIBLE); - myToolbar = (Toolbar) findViewById(R.id.toolbar); - setSupportActionBar(myToolbar); navigationView.getMenu().getItem(1).setChecked(true); myToolbar.setTitle(R.string.title_profile); @@ -172,7 +172,6 @@ public class CabinetActivity extends AppCompatActivity AuthURL = "http://web-iais.admin.tstu.ru:7777/zion/f?p=stud_main"; loadSite(AuthURL); - } @Override @@ -193,15 +192,14 @@ public class CabinetActivity extends AppCompatActivity @Override public boolean onOptionsItemSelected(MenuItem item) { - // Handle action bar item clicks here. The action bar will - // automatically handle clicks on the Home/Up button, so long - // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); - //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } + if (id == R.id.action_reload_newsfeed) { + feedController.drawNewsList(feedController.newsItemList); + } return super.onOptionsItemSelected(item); } @@ -381,10 +379,6 @@ public class CabinetActivity extends AppCompatActivity facultyList.setAdapter(facultyL); } - public void onClickButtonNewsFeed(View view) { - feedController.drawNewsList(feedController.newsItemList); - } - @TargetApi(19) public void getHTML(){ browser.evaluateJavascript("javascript:document.documentElement.outerHTML;", new ValueCallback() { diff --git a/app/src/main/java/ru/defend/defdevteam/tstu/NewsItemList.java b/app/src/main/java/ru/defend/defdevteam/tstu/NewsItemList.java index 8476324..635a67d 100644 --- a/app/src/main/java/ru/defend/defdevteam/tstu/NewsItemList.java +++ b/app/src/main/java/ru/defend/defdevteam/tstu/NewsItemList.java @@ -9,7 +9,7 @@ import java.util.NoSuchElementException; * Created by itsmy on 13.02.2017. */ -public class NewsItemList implements Iterable { +public class NewsItemList { private ArrayList list; @@ -29,36 +29,44 @@ public class NewsItemList implements Iterable { this.list.add(group); } - @Override - public Iterator iterator() { - return new NewsIterator(); + public void set(int index, Group group) { + this.list.set(index, group); } - private class NewsIterator implements Iterator { - private int cursor; - - public NewsIterator() { - this.cursor = 0; - } - - public boolean hasNext() { - return this.cursor < size(); - } - - public Group next() { - if(this.hasNext()) { - Group current = get(cursor); - cursor ++; - return current; - } - throw new NoSuchElementException(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } + public void clear() { + this.list.clear(); } +// @Override +// public Iterator iterator() { +// return new NewsIterator(); +// } + +// private class NewsIterator implements Iterator { +// private int cursor; +// +// public NewsIterator() { +// this.cursor = 0; +// } +// +// public boolean hasNext() { +// return this.cursor < size(); +// } +// +// public Group next() { +// if(this.hasNext()) { +// Group current = get(cursor); +// cursor ++; +// return current; +// } +// throw new NoSuchElementException(); +// } +// +// public void remove() { +// throw new UnsupportedOperationException(); +// } +// } + public class Group { private String title; private String text; @@ -70,12 +78,6 @@ public class NewsItemList implements Iterable { this.link = link; } - public void set(String title, String text, String link) { - this.title = title; - this.text = text; - this.link = link; - } - public String getTitle() { return this.title; } diff --git a/app/src/main/res/layout/cabinet_newsfeed_lastitem.xml b/app/src/main/res/layout/cabinet_newsfeed_lastitem.xml index 6c60202..82d5baa 100644 --- a/app/src/main/res/layout/cabinet_newsfeed_lastitem.xml +++ b/app/src/main/res/layout/cabinet_newsfeed_lastitem.xml @@ -10,7 +10,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/background_light" - android:layout_marginBottom="10dp" android:paddingTop="10dp" android:paddingBottom="10dp"> diff --git a/app/src/main/res/menu/cabinet.xml b/app/src/main/res/menu/cabinet.xml index a2411e3..96ad614 100644 --- a/app/src/main/res/menu/cabinet.xml +++ b/app/src/main/res/menu/cabinet.xml @@ -1,9 +1,17 @@ - + + android:visible="true" />