Skip to content

Commit

Permalink
menu fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
prajitdas committed Jun 14, 2016
1 parent e7eb634 commit 1619b53
Show file tree
Hide file tree
Showing 9 changed files with 256 additions and 209 deletions.
406 changes: 210 additions & 196 deletions .idea/workspace.xml

Large diffs are not rendered by default.

17 changes: 8 additions & 9 deletions app/app.iml
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
Expand All @@ -80,6 +72,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
Expand Down Expand Up @@ -112,7 +112,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class UMBCIoTApplication extends Application {
private static final String BEACON_TAG = "beaconid";
private static final String RESPONSE_TAG = "response";
private static final String EDDYSTONE_UUID = "0000feaa-0000-1000-8000-00805f9b34fb";
private static final String url = "https://c02d67b7.ngrok.io/bot";
private static final String url = "https://94d435b2.ngrok.io/bot";
public static final int REQUEST_RESOLVE_ERROR = 1;
public static final int REQUEST_PERMISSION = 2;
public static final int VOICE_QUERY_RESPONSE = 3;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.support.design.widget.NavigationView;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.res.ResourcesCompat;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
Expand All @@ -30,6 +31,7 @@
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;

import com.google.android.gms.common.ConnectionResult;
Expand All @@ -42,6 +44,8 @@
import com.google.android.gms.nearby.messages.Strategy;
import com.google.android.gms.nearby.messages.SubscribeOptions;

import java.util.Calendar;

import edu.umbc.cs.iot.clients.android.R;
import edu.umbc.cs.iot.clients.android.UMBCIoTApplication;
import edu.umbc.cs.iot.clients.android.ui.fragments.PrefsFragment;
Expand All @@ -64,6 +68,7 @@ public class MainActivity extends AppCompatActivity implements
private GoogleApiClient mGoogleApiClient;
private String beaconData;
private MessageListener mMessageListener;
private View headerView;

/**
* Delay the process of stopping beacon discovery for 100 seconds so that we don't keep on hanging around forever for beacons
Expand Down Expand Up @@ -95,6 +100,34 @@ protected void onCreate(Bundle savedInstanceState) {
navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);

/**
* http://stackoverflow.com/questions/33560219/in-android-how-to-set-navigation-drawer-header-image-and-name-programmatically-i
* As mentioned in the bug 190226, Since version 23.1.0 getting header layout view with: navigationView.findViewById(R.id.navigation_header_text) no longer works.
* A workaround is to inflate the headerview programatically and find view by ID from the inflated header view.
* mNavHeaderMain = (LinearLayout) findViewById(R.id.drawer_view);
*/
headerView = navigationView.inflateHeaderView(R.layout.nav_header_main);
headerView.findViewById(R.id.drawer_view);

Calendar cal = Calendar.getInstance();
int hourofday = cal.get(Calendar.HOUR_OF_DAY);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (hourofday <= 12)
headerView.setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.csee_morning, getTheme()));
else if (hourofday <= 18 && hourofday > 12)
headerView.setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.csee_afternoon, getTheme()));
else
headerView.setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.csee_evening, getTheme()));
} else {
if (hourofday <= 12)
headerView.setBackground(ContextCompat.getDrawable(getApplicationContext(), R.drawable.csee_morning));
else if (hourofday <= 18 && hourofday > 12)
headerView.setBackground(ContextCompat.getDrawable(getApplicationContext(), R.drawable.csee_afternoon));
else
headerView.setBackground(ContextCompat.getDrawable(getApplicationContext(), R.drawable.csee_evening));
}

// Get a GoogleApiClient object for the using the NearbyMessagesApi
setGoogleApiClient();
setListeners();
Expand Down
File renamed without changes
Binary file added app/src/main/res/drawable/csee_evening.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/csee_morning.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:menu="@menu/activity_main_drawer" />
<!--app:headerLayout="@layout/nav_header_main"-->

</android.support.v4.widget.DrawerLayout>
3 changes: 2 additions & 1 deletion app/src/main/res/layout/nav_header_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/nav_header_height"
android:background="@mipmap/csee"
android:background="@drawable/csee_morning"
android:gravity="bottom"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:id="@+id/drawer_view"
android:theme="@style/ThemeOverlay.AppCompat.Dark">

<ImageView
Expand Down

0 comments on commit 1619b53

Please sign in to comment.