diff --git a/res/drawable/ic_baseline_departure_board_24.xml b/res/drawable/ic_baseline_departure_board_24.xml
new file mode 100644
index 0000000..0104e53
--- /dev/null
+++ b/res/drawable/ic_baseline_departure_board_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/res/drawable/ic_baseline_map_24.xml b/res/drawable/ic_baseline_map_24.xml
new file mode 100644
index 0000000..ffd9dd9
--- /dev/null
+++ b/res/drawable/ic_baseline_map_24.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/res/drawable/ic_favorite_heart.xml b/res/drawable/ic_favorite_heart.xml
new file mode 100644
index 0000000..2d9d13c
--- /dev/null
+++ b/res/drawable/ic_favorite_heart.xml
@@ -0,0 +1,5 @@
+
+
+
diff --git a/res/drawable/ic_star_filled_white.xml b/res/drawable/ic_star_filled_white.xml
new file mode 100644
index 0000000..75d337d
--- /dev/null
+++ b/res/drawable/ic_star_filled_white.xml
@@ -0,0 +1,9 @@
+
+
+
diff --git a/res/layout/activity_main.xml b/res/layout/activity_main.xml
index d1a3489..63e13a8 100644
--- a/res/layout/activity_main.xml
+++ b/res/layout/activity_main.xml
@@ -1,182 +1,184 @@
+ android:singleLine="true"
+ >
\ No newline at end of file
diff --git a/res/layout/nav_header.xml b/res/layout/nav_header.xml
new file mode 100644
index 0000000..c03c443
--- /dev/null
+++ b/res/layout/nav_header.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/new_main_activity.xml b/res/layout/new_main_activity.xml
index 7c45710..f2704b6 100644
--- a/res/layout/new_main_activity.xml
+++ b/res/layout/new_main_activity.xml
@@ -1,38 +1,43 @@
\ No newline at end of file
diff --git a/res/menu/drawer_main.xml b/res/menu/drawer_main.xml
index fc30055..0b6840e 100644
--- a/res/menu/drawer_main.xml
+++ b/res/menu/drawer_main.xml
@@ -1,16 +1,19 @@
\ No newline at end of file
diff --git a/res/values-v19/styles.xml b/res/values-v19/styles.xml
new file mode 100644
index 0000000..5f8f81e
--- /dev/null
+++ b/res/values-v19/styles.xml
@@ -0,0 +1,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/src/it/reyboz/bustorino/ActivityPrincipal.java b/src/it/reyboz/bustorino/ActivityPrincipal.java
index bba046d..6f40bb7 100644
--- a/src/it/reyboz/bustorino/ActivityPrincipal.java
+++ b/src/it/reyboz/bustorino/ActivityPrincipal.java
@@ -1,113 +1,126 @@
package it.reyboz.bustorino;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
+import android.util.Log;
import android.view.MenuItem;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.NavUtils;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import com.google.android.material.navigation.NavigationView;
import it.reyboz.bustorino.middleware.GeneralActivity;
public class ActivityPrincipal extends GeneralActivity {
private DrawerLayout mDrawer;
private NavigationView mNavView;
private ActionBarDrawerToggle drawerToggle;
+ private final static String DEBUG_TAG="BusTO Act Principal";
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.new_main_activity);
Toolbar mToolbar = findViewById(R.id.default_toolbar);
setSupportActionBar(mToolbar);
-
- //getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ if (getSupportActionBar()!=null)
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ else Log.w(DEBUG_TAG, "NO ACTION BAR");
mDrawer = findViewById(R.id.drawer_layout);
drawerToggle = setupDrawerToggle(mToolbar);
// Setup toggle to display hamburger icon with nice animation
drawerToggle.setDrawerIndicatorEnabled(true);
drawerToggle.syncState();
+ mDrawer.addDrawerListener(drawerToggle);
+
mNavView = findViewById(R.id.nvView);
setupDrawerContent(mNavView);
}
private ActionBarDrawerToggle setupDrawerToggle(Toolbar toolbar) {
// NOTE: Make sure you pass in a valid toolbar reference. ActionBarDrawToggle() does not require it
// and will not render the hamburger icon without it.
return new ActionBarDrawerToggle(this, mDrawer, toolbar, R.string.drawer_open, R.string.drawer_close);
}
private void setupDrawerContent(NavigationView navigationView) {
navigationView.setNavigationItemSelectedListener(
menuItem -> {
//selectDrawerItem(menuItem);
+ Log.d(DEBUG_TAG, "pressed item "+menuItem.toString());
return true;
});
}
// `onPostCreate` called when activity start-up is complete after `onStart()`
// NOTE 1: Make sure to override the method with only a single `Bundle` argument
// Note 2: Make sure you implement the correct `onPostCreate(Bundle savedInstanceState)` method.
// There are 2 signatures and only `onPostCreate(Bundle state)` shows the hamburger icon.
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
drawerToggle.syncState();
}
@Override
public void onConfigurationChanged(@NonNull Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Pass any configuration change to the drawer toggles
drawerToggle.onConfigurationChanged(newConfig);
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
+ int[] cases = {R.id.nav_arrivals, R.id.nav_favorites_item};
+
switch (item.getItemId()){
case android.R.id.home:
mDrawer.openDrawer(GravityCompat.START);
return true;
+ case R.id.nav_arrivals:
+ //do something
+ break;
+ default:
+
}
if (drawerToggle.onOptionsItemSelected(item)) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
if (mDrawer.isDrawerOpen(GravityCompat.START))
mDrawer.closeDrawer(GravityCompat.START);
else
super.onBackPressed();
}
}