Browse Source

Fixed hamburger on action bar.

Earlier has worked only right actionbar menu!
   Fixed cabinet news feed item again :D
master
Defend 8 years ago
parent
commit
e645c55adc
  1. 16
      app/app.iml
  2. 22
      app/src/main/java/ru/defend/defdevteam/tstu/CabinetActivity.java
  3. 68
      app/src/main/java/ru/defend/defdevteam/tstu/NewsItemList.java
  4. 1
      app/src/main/res/layout/cabinet_newsfeed_lastitem.xml
  5. 14
      app/src/main/res/menu/cabinet.xml

16
app/app.iml

@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
@ -82,6 +74,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />

22
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<String>() {

68
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<NewsItemList.Group> {
public class NewsItemList {
private ArrayList<Group> list;
@ -29,36 +29,44 @@ public class NewsItemList implements Iterable<NewsItemList.Group> {
this.list.add(group);
}
@Override
public Iterator<Group> iterator() {
return new NewsIterator();
public void set(int index, Group group) {
this.list.set(index, group);
}
private class NewsIterator implements Iterator<Group> {
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<Group> iterator() {
// return new NewsIterator();
// }
// private class NewsIterator implements Iterator<Group> {
// 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<NewsItemList.Group> {
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;
}

1
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">

14
app/src/main/res/menu/cabinet.xml

@ -1,9 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
<menu xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_settings"
android:id="@+id/action_reload_newsfeed"
android:orderInCategory="100"
android:title="Reload newsfeed"
app:showAsAction="never"
android:visible="true"
tools:ignore="HardcodedText" />
<item
android:id="@+id/action_settings"
android:orderInCategory="101"
android:title="@string/action_settings"
app:showAsAction="never" />
android:visible="true" />
</menu>

Loading…
Cancel
Save