Commit 45c79b39 authored by Toni Beier's avatar Toni Beier

Merge branch 'RemoveCanteenFromStart' into 'develop'

Remove canteen from start

See merge request OpenASiST/openasist4android_core!15
parents 816991a9 c3b4f17c
......@@ -28,7 +28,9 @@ public class CanteenModule extends AbstractAsistModule {
public static final String PRICE_GUEST = "G";
public CanteenModule(){
/*Auskommentiert um Mensa auf Startseite und Einstellungen zu deaktivieren
setStartTreeConfig(new CanteenStartViewConfig(this));
*/
setSettingsConfig(new CanteenSettings());
AsistStartModule.registerForPush(getName(), "CanteenModule");
}
......
package de.bps.asist.module.start;
import android.media.Image;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import de.bps.asist.AbstractAsistActivity;
import de.bps.asist.R;
import de.bps.asist.core.manager.ASiSTModuleManager;
import de.bps.asist.gui.AbstractASiSTFragment;
import de.bps.asist.module.AbstractAsistModule;
import de.bps.asist.module.canteen.CanteenModule;
import de.bps.asist.module.start.tree.ASiSTTreeItem;
import de.bps.asist.module.start.tree.ExpandableListAdapter;
public class AsistStartFragment extends AbstractASiSTFragment {
private ExpandableListView listView;
private LinearLayout linearLayout;
private CanteenModule canteenModule;
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
......@@ -29,6 +39,30 @@ public class AsistStartFragment extends AbstractASiSTFragment {
ExpandableListAdapter adapter = new ExpandableListAdapter(getActivity(), treeItems);
listView.setAdapter(adapter);
linearLayout = (LinearLayout) view.findViewById(R.id.linearLayoutStartFragmentCanteenButton);
boolean isModuleRegistered = false;
List<AbstractAsistModule> modules = ASiSTModuleManager.getInstance().getModules();
for(AbstractAsistModule module : modules){
if(module instanceof CanteenModule) {
isModuleRegistered = true;
canteenModule = (CanteenModule) module;
break;
}
}
if(!isModuleRegistered) linearLayout.setVisibility(View.GONE);
linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AsistStartActivity asistStartActivity =(AsistStartActivity)getContext();
if(asistStartActivity instanceof AbstractAsistActivity && asistStartActivity != null) {
asistStartActivity.startModule(canteenModule);
}
}
});
return view;
}
......
......@@ -4,7 +4,9 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
android:gravity="center"
android:background="#cccccc"
>
<!--
<RelativeLayout
android:layout_width="match_parent"
......@@ -79,6 +81,7 @@
android:layout_alignRight="@+id/startViewWeather"
android:layout_alignEnd="@+id/startViewWeather" />
</RelativeLayout> -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -90,11 +93,49 @@
>
</ExpandableListView>
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayoutStartFragmentCanteenButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="1dp"
android:background="@color/backgroundColor">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/imageViewStartFragmentCanteenButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_menu_mensa"
android:scaleType="centerCrop"
android:layout_gravity="center"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="5dp"
android:paddingBottom="5dp">
<android.support.v7.widget.AppCompatTextView
android:id="@+id/textViewStartFragmentCanteenButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/module_canteen_name"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/descColor"
android:textSize="@dimen/descTextSize"
android:text="@string/module_canteen_description"/>
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/background_university"
android:scaleType="centerCrop"
/>
</LinearLayout>
\ No newline at end of file
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