presentation
|
@ -10,7 +10,7 @@
|
|||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:name=".ui.activity.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@style/AppTheme.NoActionBar">
|
||||
<intent-filter>
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package at.fhj.swd.dailyhelper;
|
||||
package at.fhj.swd.dailyhelper.ui.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.app.FragmentTransaction;
|
||||
import android.view.View;
|
||||
import android.support.v4.view.GravityCompat;
|
||||
import android.support.v7.app.ActionBarDrawerToggle;
|
||||
|
@ -14,15 +15,41 @@ import android.support.v7.app.AppCompatActivity;
|
|||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Menu;
|
||||
|
||||
import at.fhj.swd.dailyhelper.R;
|
||||
import at.fhj.swd.dailyhelper.ui.fragemnt.HomeFragment;
|
||||
import at.fhj.swd.dailyhelper.ui.fragemnt.LevelFragment;
|
||||
import at.fhj.swd.dailyhelper.ui.fragemnt.MapFragment;
|
||||
import at.fhj.swd.dailyhelper.ui.fragemnt.WeatherFragment;
|
||||
|
||||
public class MainActivity extends AppCompatActivity
|
||||
implements NavigationView.OnNavigationItemSelectedListener {
|
||||
|
||||
|
||||
private static final String HOME = "home";
|
||||
private static final String WEATHER = "weather";
|
||||
private static final String MAP = "map";
|
||||
private static final String LEVEL = "level";
|
||||
|
||||
|
||||
private HomeFragment homeFragment;
|
||||
private LevelFragment levelFragment;
|
||||
private MapFragment mapFragment;
|
||||
private WeatherFragment weatherFragment;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
setContentView(R.layout.activity_main);
|
||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
homeFragment = new HomeFragment();
|
||||
levelFragment = new LevelFragment();
|
||||
mapFragment = new MapFragment();
|
||||
weatherFragment = new WeatherFragment();
|
||||
|
||||
FloatingActionButton fab = findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -37,6 +64,17 @@ public class MainActivity extends AppCompatActivity
|
|||
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
||||
drawer.addDrawerListener(toggle);
|
||||
toggle.syncState();
|
||||
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.add(R.id.flFragmentContainer, homeFragment);
|
||||
transaction.add(R.id.flFragmentContainer, levelFragment);
|
||||
transaction.add(R.id.flFragmentContainer, mapFragment);
|
||||
transaction.add(R.id.flFragmentContainer, weatherFragment);
|
||||
|
||||
transaction.commit();
|
||||
|
||||
setSelectedFragment(HOME);
|
||||
|
||||
navigationView.setNavigationItemSelectedListener(this);
|
||||
}
|
||||
|
||||
|
@ -79,17 +117,42 @@ public class MainActivity extends AppCompatActivity
|
|||
int id = item.getItemId();
|
||||
|
||||
if (id == R.id.nav_home) {
|
||||
// Handle the camera action
|
||||
setSelectedFragment(HOME);
|
||||
} else if (id == R.id.nav_weather) {
|
||||
|
||||
setSelectedFragment(WEATHER);
|
||||
} else if (id == R.id.nav_map) {
|
||||
|
||||
} else if (id == R.id.nav_level) {
|
||||
|
||||
setSelectedFragment(MAP);
|
||||
// } else if (id == R.id.nav_level) {
|
||||
// setSelectedFragment(LEVEL);
|
||||
}
|
||||
|
||||
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||
drawer.closeDrawer(GravityCompat.START);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setSelectedFragment (String fragmentName) {
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
|
||||
transaction.hide(homeFragment);
|
||||
transaction.hide(levelFragment);
|
||||
transaction.hide(mapFragment);
|
||||
transaction.hide(weatherFragment);
|
||||
System.out.println(fragmentName);
|
||||
switch (fragmentName) {
|
||||
case HOME:
|
||||
transaction.show(homeFragment);
|
||||
break;
|
||||
case LEVEL:
|
||||
transaction.show(levelFragment);
|
||||
break;
|
||||
case MAP:
|
||||
transaction.show(mapFragment);
|
||||
break;
|
||||
case WEATHER:
|
||||
transaction.show(weatherFragment);
|
||||
break;
|
||||
}
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package at.fhj.swd.dailyhelper.ui.fragemnt;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import at.fhj.swd.dailyhelper.R;
|
||||
|
||||
public class HomeFragment extends Fragment {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_home, container, false);
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package at.fhj.swd.dailyhelper.ui.fragemnt;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import at.fhj.swd.dailyhelper.R;
|
||||
|
||||
public class LevelFragment extends Fragment {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_level, container, false);
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package at.fhj.swd.dailyhelper.ui.fragemnt;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import at.fhj.swd.dailyhelper.R;
|
||||
|
||||
public class MapFragment extends Fragment {
|
||||
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_map, container, false);
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package at.fhj.swd.dailyhelper.ui.fragemnt;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import at.fhj.swd.dailyhelper.R;
|
||||
|
||||
public class WeatherFragment extends Fragment {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_weather, container, false);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
tools:context=".ui.activity.MainActivity">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -20,7 +20,13 @@
|
|||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<include layout="@layout/content_main" />
|
||||
<!-- <include layout="@layout/content_main" /> -->
|
||||
<FrameLayout
|
||||
android:id="@+id/flFragmentContainer"
|
||||
android:layout_marginTop="200px"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
</FrameLayout>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/fab"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:context=".MainActivity"
|
||||
tools:context=".ui.activity.MainActivity"
|
||||
tools:showIn="@layout/app_bar_main">
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Übersicht, Tempertur, Position, Geschwindigkeit, Wetter"
|
||||
android:textSize="80px"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Wasserwagge"
|
||||
android:textSize="80px"/>
|
||||
<!--
|
||||
<com.google.android.gms.maps.MapView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</com.google.android.gms.maps.MapView>
|
||||
-->
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Karte, Aktuelle Position, GPS Koordinaten"
|
||||
android:textSize="80px"/>
|
||||
<!--
|
||||
<com.google.android.gms.maps.MapView
|
||||
android:id="@+id/map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</com.google.android.gms.maps.MapView>
|
||||
-->
|
||||
|
||||
</LinearLayout>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:text="Wetter Details"
|
||||
android:textSize="80px"/>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_header_height"
|
||||
android:background="@drawable/side_nav_bar"
|
||||
|
@ -14,7 +15,7 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="125dp"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/nav_header_desc"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
android:id="@+id/nav_map"
|
||||
android:icon="@drawable/ic_map"
|
||||
android:title="@string/menu_map" />
|
||||
<item
|
||||
<!-- <item
|
||||
android:id="@+id/nav_level"
|
||||
android:icon="@drawable/ic_level"
|
||||
android:title="@string/menu_level" />
|
||||
android:title="@string/menu_level" /> -->
|
||||
</group>
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 12 KiB |
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorPrimaryDark">#3F3F3F</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
</resources>
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
<string name="app_name">Daily Helper</string>
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
<string name="navigation_drawer_close">Close navigation drawer</string>
|
||||
<string name="nav_header_title">Android Studio</string>
|
||||
<string name="nav_header_subtitle">android.studio@android.com</string>
|
||||
<string name="nav_header_title">Daily Helper</string>
|
||||
<string name="nav_header_subtitle">Alles auf einen Blick!</string>
|
||||
<string name="nav_header_desc">Navigation header</string>
|
||||
<string name="action_settings">Settings</string>
|
||||
|
||||
|
|