Commit fb06d581 authored by Lennart Bader's avatar Lennart Bader
Browse files

Minor fixes

parent 5451ff1f
......@@ -16,7 +16,6 @@ import de.mytfg.apps.vplan.fragments.AboutFragment;
import de.mytfg.apps.vplan.fragments.AuthenticationFragment;
import de.mytfg.apps.vplan.fragments.FeedbackFragment;
import de.mytfg.apps.vplan.fragments.LinksFragment;
import de.mytfg.apps.vplan.fragments.NewsFragment;
import de.mytfg.apps.vplan.fragments.OfficeFragment;
import de.mytfg.apps.vplan.fragments.SettingsFragment;
import de.mytfg.apps.vplan.fragments.LoginFragment;
......
......@@ -39,7 +39,7 @@ public class NewsEntryHolder extends RecyclerView.ViewHolder {
//titleView.setText(baseObject.getName());
title.setText(entry.getTitle());
date.setText(entry.getDateString());
summary.setText(Html.fromHtml(entry.getText()));
summary.setText(entry.getSummary());
final String link = entry.getLink();
Settings settings = new Settings(context);
if (!link.isEmpty() && settings.getBool("news_browser")) {
......
package de.mytfg.apps.vplan.fragments;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import de.mytfg.apps.vplan.R;
import de.mytfg.apps.vplan.activities.MainActivity;
import de.mytfg.apps.vplan.adapters.RecylcerNewsAdapter;
import de.mytfg.apps.vplan.adapters.RecylcerVrrAdapter;
import de.mytfg.apps.vplan.api.SuccessCallback;
import de.mytfg.apps.vplan.objects.TfgNews;
import de.mytfg.apps.vplan.objects.TfgNewsEntry;
import de.mytfg.apps.vplan.objects.Vrr;
import de.mytfg.apps.vplan.objects.VrrEntry;
import de.mytfg.apps.vplan.tools.ItemOffsetDecoration;
public class NewsFragment extends AuthenticationFragment {
private View view;
private RecylcerNewsAdapter adapter;
private RecyclerView recyclerView;
private SwipeRefreshLayout swipeRefreshLayout;
public NewsFragment() {
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
view = inflater.inflate(R.layout.fragment_news, container, false);
swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.base_refreshLayout);
MainActivity context = (MainActivity)this.getActivity();
recyclerView = (RecyclerView) view.findViewById(R.id.news_recylcerview);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 1);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(gridLayoutManager);
recyclerView.addItemDecoration(new ItemOffsetDecoration(getContext(), R.dimen.cardview_spacing));
setHasOptionsMenu(true);
context.getToolbarManager()
.clear()
.showBottomScrim()
.setImage(R.drawable.news_header_s)
.setTitle(getString(R.string.menutitle_news))
.setExpandable(true, true);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
displayNews();
}
});
this.displayNews();
return view;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public void onResume() {
super.onResume();
}
public void displayNews() {
recyclerView = (RecyclerView) view.findViewById(R.id.news_recylcerview);
swipeRefreshLayout.setRefreshing(true);
final TfgNews news = new TfgNews(getContext());
news.load(new SuccessCallback() {
@Override
public void callback(boolean success) {
swipeRefreshLayout.setRefreshing(false);
if (success) {
adapter = new RecylcerNewsAdapter(getContext());
recyclerView.setAdapter(adapter);
for (TfgNewsEntry entry : news.getEntries()) {
adapter.addItem(entry);
}
adapter.notifyDataSetChanged();
} else {
((MainActivity)getActivity()).getNavi().snackbar(getString(R.string.api_news_error));
}
}
});
}
}
......@@ -22,7 +22,7 @@
android:layout_marginRight="@dimen/cardview_spacing"
android:layout_marginEnd="@dimen/cardview_spacing"
android:layout_gravity="center_horizontal"
android:textSize="@dimen/textDefault"
android:textSize="@dimen/textTitle"
android:id="@+id/plan_entry_lesson" />
<TextView
......
......@@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
......
#Mon Dec 28 10:00:20 PST 2015
#Sun Mar 05 15:27:18 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment