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 { ...@@ -28,7 +28,9 @@ public class CanteenModule extends AbstractAsistModule {
public static final String PRICE_GUEST = "G"; public static final String PRICE_GUEST = "G";
public CanteenModule(){ public CanteenModule(){
/*Auskommentiert um Mensa auf Startseite und Einstellungen zu deaktivieren
setStartTreeConfig(new CanteenStartViewConfig(this)); setStartTreeConfig(new CanteenStartViewConfig(this));
*/
setSettingsConfig(new CanteenSettings()); setSettingsConfig(new CanteenSettings());
AsistStartModule.registerForPush(getName(), "CanteenModule"); AsistStartModule.registerForPush(getName(), "CanteenModule");
} }
......
package de.bps.asist.module.start; package de.bps.asist.module.start;
import android.media.Image;
import android.os.Bundle; import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ExpandableListView; import android.widget.ExpandableListView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import de.bps.asist.AbstractAsistActivity;
import de.bps.asist.R; import de.bps.asist.R;
import de.bps.asist.core.manager.ASiSTModuleManager;
import de.bps.asist.gui.AbstractASiSTFragment; 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.ASiSTTreeItem;
import de.bps.asist.module.start.tree.ExpandableListAdapter; import de.bps.asist.module.start.tree.ExpandableListAdapter;
public class AsistStartFragment extends AbstractASiSTFragment { public class AsistStartFragment extends AbstractASiSTFragment {
private ExpandableListView listView; private ExpandableListView listView;
private LinearLayout linearLayout;
private CanteenModule canteenModule;
@Override @Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
...@@ -29,6 +39,30 @@ public class AsistStartFragment extends AbstractASiSTFragment { ...@@ -29,6 +39,30 @@ public class AsistStartFragment extends AbstractASiSTFragment {
ExpandableListAdapter adapter = new ExpandableListAdapter(getActivity(), treeItems); ExpandableListAdapter adapter = new ExpandableListAdapter(getActivity(), treeItems);
listView.setAdapter(adapter); 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; return view;
} }
......
...@@ -4,7 +4,9 @@ ...@@ -4,7 +4,9 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center"> android:gravity="center"
android:background="#cccccc"
>
<!-- <!--
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -79,6 +81,7 @@ ...@@ -79,6 +81,7 @@
android:layout_alignRight="@+id/startViewWeather" android:layout_alignRight="@+id/startViewWeather"
android:layout_alignEnd="@+id/startViewWeather" /> android:layout_alignEnd="@+id/startViewWeather" />
</RelativeLayout> --> </RelativeLayout> -->
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -90,11 +93,49 @@ ...@@ -90,11 +93,49 @@
> >
</ExpandableListView> </ExpandableListView>
</LinearLayout> </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 <ImageView
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:src="@drawable/background_university" android:src="@drawable/background_university"
android:scaleType="centerCrop" android:scaleType="centerCrop"
/> />
</LinearLayout> </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