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

Reworked the Menu, added Animations to VPlan Entries

parent 325b62a0
......@@ -82,10 +82,6 @@ public class MainActivity extends AppCompatActivity {
navi.clear();
navi.navigate(new SettingsFragment(), R.id.fragment_container);
return true;
case R.id.mainmenu_links:
navi.clear();
navi.navigate(new LinksFragment(), R.id.fragment_container);
return true;
case R.id.mainmenu_about:
navi.clear();
navi.navigate(new AboutFragment(), R.id.fragment_container);
......@@ -96,14 +92,18 @@ public class MainActivity extends AppCompatActivity {
return true;
// SUBMENU "PARTNERS"
case R.id.mainmenu_partners:
case R.id.mainmenu_more:
navigationView.getMenu().clear();
navigationView.inflateMenu(R.menu.submenu_partners);
navigationView.inflateMenu(R.menu.submenu_more);
return true;
case R.id.submenu_partners_back:
navigationView.getMenu().clear();
navigationView.inflateMenu(R.menu.navigation_menu);
return true;
case R.id.mainmenu_links:
navi.clear();
navi.navigate(new LinksFragment(), R.id.fragment_container);
return true;
case R.id.submenu_partners_secretary:
navi.clear();
navi.navigate(new OfficeFragment(), R.id.fragment_container);
......
......@@ -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.getSummary()));
summary.setText(Html.fromHtml(entry.getText()));
final String link = entry.getLink();
Settings settings = new Settings(context);
if (!link.isEmpty() && settings.getBool("news_browser")) {
......
......@@ -79,4 +79,9 @@ public class PlanEntryHolder extends RecyclerView.ViewHolder {
public CardView getCardView() {
return cardView;
}
public void clearAnimation()
{
cardView.clearAnimation();
}
}
......@@ -9,6 +9,8 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;
......@@ -24,6 +26,8 @@ public class RecylcerPlanAdapter extends RecyclerView.Adapter<PlanEntryHolder> {
private ArrayList<VplanEntry> elements = new ArrayList<>();
private PlanEntryAdapterEvents events;
private int lastPosition = -1; // None
private String unique;
private int endOffset;
......@@ -57,6 +61,7 @@ public class RecylcerPlanAdapter extends RecyclerView.Adapter<PlanEntryHolder> {
@Override
public void onBindViewHolder(final PlanEntryHolder holder, final int position) {
holder.update(elements.get(position));
setAnimation(holder.getCardView(), position);
}
@Override
......@@ -71,4 +76,21 @@ public class RecylcerPlanAdapter extends RecyclerView.Adapter<PlanEntryHolder> {
public void clear() {
elements.clear();
}
private void setAnimation(View viewToAnimate, int position)
{
// If the bound view wasn't previously displayed on screen, it's animated
if (position > lastPosition)
{
Animation animation = AnimationUtils.loadAnimation(context, android.R.anim.slide_in_left);
viewToAnimate.startAnimation(animation);
lastPosition = position;
}
}
@Override
public void onViewDetachedFromWindow(PlanEntryHolder holder) {
holder.clearAnimation();
super.onViewDetachedFromWindow(holder);
}
}
......@@ -43,7 +43,7 @@ public class FeedbackFragment extends AuthenticationFragment {
setHasOptionsMenu(true);
context.getToolbarManager()
.clear()
.setImage(R.mipmap.feedback_header)
.setImage(R.drawable.feedback_header)
.showBottomScrim()
.setTitle(getString(R.string.menutitle_feedback))
.setExpandable(true, true);
......
......@@ -31,7 +31,7 @@ public class OfficeFragment extends AuthenticationFragment {
setHasOptionsMenu(true);
context.getToolbarManager()
.clear()
.setImage(R.mipmap.office_header)
.setImage(R.drawable.office_header)
.showBottomScrim()
.setTitle(getString(R.string.menutitle_secretary))
.setExpandable(true, true);
......
package de.mytfg.apps.vplan.fragments;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.CardView;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;
import java.net.URLEncoder;
import de.mytfg.apps.vplan.R;
import de.mytfg.apps.vplan.activities.MainActivity;
public class ParentsFragment extends AuthenticationFragment {
private final String addressString = "Kalkumer Schlossallee 28 40489 Düsseldorf";
public ParentsFragment() {
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_office, container, false);
MainActivity context = (MainActivity)this.getActivity();
setHasOptionsMenu(true);
context.getToolbarManager()
.clear()
.setImage(R.drawable.office_header)
.showBottomScrim()
.setTitle(getString(R.string.menutitle_secretary))
.setExpandable(true, true);
CardView address = (CardView) view.findViewById(R.id.office_address);
address.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_VIEW,
Uri.parse(String.format("geo:0,0?q=%s",
URLEncoder.encode(addressString))));
startActivity(i);
}
});
final String num = getString(R.string.office_phone_val).replace("/", "");
CardView phone = (CardView) view.findViewById(R.id.office_phone);
phone.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_DIAL,
Uri.parse("tel:" + num));
startActivity(i);
}
});
CardView mail = (CardView) view.findViewById(R.id.office_mail);
mail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(Intent.ACTION_SENDTO);
i.setData(Uri.parse("mailto:" + getString(R.string.office_mail_val)));
startActivity(i);
}
});
return view;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
super.onCreateOptionsMenu(menu, inflater);
}
}
......@@ -8,6 +8,7 @@ import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v4.widget.NestedScrollView;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.CardView;
import android.support.v7.widget.SearchView;
......@@ -69,7 +70,7 @@ public class PlanFragment extends AuthenticationFragment {
setHasOptionsMenu(true);
FloatingActionButton fab = (FloatingActionButton) context.findViewById(R.id.fab);
final FloatingActionButton fab = (FloatingActionButton) context.findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
......
......@@ -60,7 +60,7 @@ public class SettingsFragment extends AuthenticationFragment {
setHasOptionsMenu(true);
context.getToolbarManager()
.clear()
.setImage(R.mipmap.settings_header)
.setImage(R.drawable.settings_header)
.showBottomScrim()
.setTitle(getString(R.string.menutitle_settings))
.setExpandable(true, true);
......
......@@ -58,7 +58,7 @@ public class VrrFragment extends AuthenticationFragment {
setHasOptionsMenu(true);
context.getToolbarManager()
.clear()
.setImage(R.mipmap.vrr_header_s)
.setImage(R.drawable.vrr_header_s)
.setTitle(getString(R.string.menutitle_vrr))
.setExpandable(true, true);
......
......@@ -55,4 +55,8 @@ public class TfgNewsEntry extends MytfgObject {
public String getLink() {
return link;
}
public String getText() {
return text;
}
}
......@@ -11,15 +11,10 @@
android:icon="@drawable/ic_menu_vrr"
android:title="@string/menutitle_vrr" >
</item>
<item android:id="@+id/mainmenu_partners"
android:icon="@drawable/ic_menu_partners"
android:title="@string/menutitle_partners" >
<item android:id="@+id/mainmenu_more"
android:icon="@drawable/ic_menu_more"
android:title="@string/menutitle_more" >
</item>
<item android:id="@+id/mainmenu_links"
android:icon="@drawable/ic_menu_links"
android:title="@string/menutitle_links" >
</item>
</group>
<group android:id="@+id/menu_group_2">
<item android:id="@+id/mainmenu_account"
......
......@@ -6,6 +6,10 @@
android:title="@string/menutitle_back" />
</group>
<group android:id="@+id/menu_group_1">
<item android:id="@+id/mainmenu_links"
android:icon="@drawable/ic_menu_links"
android:title="@string/menutitle_links" >
</item>
<item android:id="@+id/submenu_partners_boosters"
android:icon="@drawable/ic_menu_boosters"
android:title="@string/menutitle_boosters" />
......
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