Kaynağa Gözat

Add buttomBar for navigation and the header

Yiupang 9 yıl önce
ebeveyn
işleme
c28d9ffc78

BIN
.gradle/3.3/taskArtifacts/fileHashes.bin


BIN
.gradle/3.3/taskArtifacts/fileSnapshots.bin


BIN
.gradle/3.3/taskArtifacts/taskArtifacts.bin


BIN
.gradle/3.3/taskArtifacts/taskArtifacts.lock


+ 27 - 0
.idea/misc.xml

@@ -1,5 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project version="4">
+  <component name="EntryPointsManager">
+    <entry_points version="2.0" />
+  </component>
+  <component name="NullableNotNullManager">
+    <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
+    <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
+    <option name="myNullables">
+      <value>
+        <list size="4">
+          <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
+          <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
+          <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
+          <item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
+        </list>
+      </value>
+    </option>
+    <option name="myNotNulls">
+      <value>
+        <list size="4">
+          <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
+          <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
+          <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
+          <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
+        </list>
+      </value>
+    </option>
+  </component>
   <component name="ProjectLevelVcsManager" settingsEditedManually="false">
     <OptionsSetting value="true" id="Add" />
     <OptionsSetting value="true" id="Remove" />

Dosya farkı çok büyük olduğundan ihmal edildi
+ 23 - 1241
.idea/workspace.xml


+ 9 - 0
app/app.iml

@@ -76,13 +76,21 @@
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
       <sourceFolder url="file://$MODULE_DIR$/src/androidTest/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/classes" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
+      <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/res" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
       <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
+      <excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
       <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
+      <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
     </content>
     <orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
     <orderEntry type="sourceFolder" forTests="false" />
@@ -94,6 +102,7 @@
     <orderEntry type="library" exported="" scope="TEST" name="hamcrest-integration-1.3" level="project" />
     <orderEntry type="library" exported="" name="design-25.3.1" level="project" />
     <orderEntry type="library" exported="" name="support-core-ui-25.3.1" level="project" />
+    <orderEntry type="library" exported="" name="bottom-bar-1.3.3" level="project" />
     <orderEntry type="library" exported="" scope="TEST" name="jsr305-2.0.1" level="project" />
     <orderEntry type="library" exported="" name="support-core-utils-25.3.1" level="project" />
     <orderEntry type="library" exported="" name="support-fragment-25.3.1" level="project" />

+ 1 - 0
app/build.gradle

@@ -27,5 +27,6 @@ dependencies {
     compile 'com.android.support:appcompat-v7:25.3.1'
     compile 'com.android.support.constraint:constraint-layout:1.0.2'
     compile 'com.android.support:design:25.3.1'
+    compile 'com.roughike:bottom-bar:1.3.3'
     testCompile 'junit:junit:4.12'
 }

+ 20 - 0
app/src/main/java/com/example/yiupang/freefoodfinder/AboutUsScreen.java

@@ -0,0 +1,20 @@
+package com.example.yiupang.freefoodfinder;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Created by yiupang on 5/6/2017.
+ */
+
+public class AboutUsScreen extends android.support.v4.app.Fragment
+{
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
+    {
+        return inflater.inflate(R.layout.aboutus_screen, container, false);
+    }
+}

+ 22 - 0
app/src/main/java/com/example/yiupang/freefoodfinder/EventsScreen.java

@@ -0,0 +1,22 @@
+package com.example.yiupang.freefoodfinder;
+
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Created by yiupang on 5/6/2017.
+ *
+ */
+
+public class EventsScreen extends android.support.v4.app.Fragment
+{
+    @Nullable
+    @Override
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
+    {
+        return inflater.inflate(R.layout.events_screen, container, false);
+    }
+}

+ 53 - 9
app/src/main/java/com/example/yiupang/freefoodfinder/MainActivity.java

@@ -1,31 +1,73 @@
 package com.example.yiupang.freefoodfinder;
 
 import android.os.Bundle;
+import android.support.annotation.IdRes;
 import android.support.design.widget.FloatingActionButton;
 import android.support.design.widget.Snackbar;
+import android.support.v7.app.ActionBarActivity;
 import android.support.v7.app.AppCompatActivity;
 import android.support.v7.widget.Toolbar;
 import android.view.View;
+import com.roughike.bottombar.BottomBar;
 import android.view.Menu;
 import android.view.MenuItem;
 
-public class MainActivity extends AppCompatActivity {
+import com.roughike.bottombar.BottomBar;
+import com.roughike.bottombar.BottomBarBadge;
+import com.roughike.bottombar.OnMenuTabClickListener;
 
+public class MainActivity extends ActionBarActivity
+{
+    BottomBar bottomBar;
     @Override
-    protected void onCreate(Bundle savedInstanceState) {
+    protected void onCreate(Bundle savedInstanceState)
+    {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
-        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
-        setSupportActionBar(toolbar);
+        bottomBar = BottomBar.attach(this, savedInstanceState);
+        bottomBar.setItemsFromMenu(R.menu.menu_main, new OnMenuTabClickListener()
+        {
+            @Override
+            public void onMenuTabSelected(@IdRes int menuItemId)
+            {
+                if(menuItemId == R.id.BottomBarEvents)
+                {
+                    EventsScreen es = new EventsScreen();
+                    getSupportFragmentManager().beginTransaction().replace(R.id.frame, es).commit();
+                }
+                else if(menuItemId == R.id.BottomBarItemMap)
+                {
+                    MapScreen es = new MapScreen();
+                    getSupportFragmentManager().beginTransaction().replace(R.id.frame, es).commit();
+                }
+                else if(menuItemId == R.id.BottomBarItemMyEvent)
+                {
+                    MyEventScreen es = new MyEventScreen();
+                    getSupportFragmentManager().beginTransaction().replace(R.id.frame, es).commit();
+                }
+                else if(menuItemId == R.id.BottomBarItemAboutUs)
+                {
+                    AboutUsScreen es = new AboutUsScreen();
+                    getSupportFragmentManager().beginTransaction().replace(R.id.frame, es).commit();
+                }
+            }
 
-        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
-        fab.setOnClickListener(new View.OnClickListener() {
             @Override
-            public void onClick(View view) {
-                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
-                        .setAction("Action", null).show();
+            public void onMenuTabReSelected(@IdRes int menuItemId)
+            {
+
             }
         });
+
+        bottomBar.mapColorForTab(0, "#ff0000");
+        bottomBar.mapColorForTab(1, "#ff0000");
+        bottomBar.mapColorForTab(2, "#ff0000");
+        bottomBar.mapColorForTab(3, "#ff0000");
+
+        BottomBarBadge unread;
+        unread = bottomBar.makeBadgeForTabAt(3, "#FF0000", 13);
+        unread.show();
+
     }
 
     @Override
@@ -42,10 +84,12 @@ public class MainActivity extends AppCompatActivity {
         // as you specify a parent activity in AndroidManifest.xml.
         int id = item.getItemId();
 
+/*
         //noinspection SimplifiableIfStatement
         if (id == R.id.action_settings) {
             return true;
         }
+*/
 
         return super.onOptionsItemSelected(item);
     }

+ 20 - 0
app/src/main/java/com/example/yiupang/freefoodfinder/MapScreen.java

@@ -0,0 +1,20 @@
+package com.example.yiupang.freefoodfinder;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Created by yiupang on 5/6/2017.
+ */
+
+public class MapScreen extends android.support.v4.app.Fragment
+{
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
+    {
+        return inflater.inflate(R.layout.map_screen, container, false);
+    }
+}

+ 21 - 0
app/src/main/java/com/example/yiupang/freefoodfinder/MyEventScreen.java

@@ -0,0 +1,21 @@
+package com.example.yiupang.freefoodfinder;
+
+import android.app.Fragment;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+/**
+ * Created by yiupang on 5/6/2017.
+ *
+ */
+
+public class MyEventScreen extends android.support.v4.app.Fragment
+{
+    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
+    {
+        return inflater.inflate(R.layout.myevent_screen, container, false);
+    }
+}

+ 14 - 0
app/src/main/res/layout/aboutus_screen.xml

@@ -0,0 +1,14 @@
+<?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="About Us"
+        android:typeface="serif"
+        android:textStyle="bold"
+        android:textSize="30dp">
+
+    </TextView>
+</LinearLayout>

+ 8 - 28
app/src/main/res/layout/activity_main.xml

@@ -1,33 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
-<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    tools:context="com.example.yiupang.freefoodfinder.MainActivity">
+    android:layout_height="match_parent">
 
-    <android.support.design.widget.AppBarLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:theme="@style/AppTheme.AppBarOverlay">
-
-        <android.support.v7.widget.Toolbar
-            android:id="@+id/toolbar"
-            android:layout_width="match_parent"
-            android:layout_height="?attr/actionBarSize"
-            android:background="?attr/colorPrimary"
-            app:popupTheme="@style/AppTheme.PopupOverlay" />
-
-    </android.support.design.widget.AppBarLayout>
-
-    <include layout="@layout/content_main" />
-
-    <android.support.design.widget.FloatingActionButton
-        android:id="@+id/fab"
+    <include
+        android:id="@+id/toolBar"
+        layout="@layout/tool_bar" />
+    <FrameLayout android:id="@+id/frame"
         android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_gravity="bottom|end"
-        android:layout_margin="@dimen/fab_margin"
-        app:srcCompat="@android:drawable/ic_dialog_email" />
+        android:layout_height="wrap_content" />
 
-</android.support.design.widget.CoordinatorLayout>
+</RelativeLayout>

+ 0 - 20
app/src/main/res/layout/content_main.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    app:layout_behavior="@string/appbar_scrolling_view_behavior"
-    tools:context="com.example.yiupang.freefoodfinder.MainActivity"
-    tools:showIn="@layout/activity_main">
-
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="Hello World!"
-        app:layout_constraintBottom_toBottomOf="parent"
-        app:layout_constraintLeft_toLeftOf="parent"
-        app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintTop_toTopOf="parent" />
-
-</android.support.constraint.ConstraintLayout>

+ 15 - 0
app/src/main/res/layout/events_screen.xml

@@ -0,0 +1,15 @@
+<?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="Events"
+        android:typeface="serif"
+        android:textStyle="bold"
+        android:textSize="30dp">
+
+        </TextView>
+
+</LinearLayout>

+ 14 - 0
app/src/main/res/layout/map_screen.xml

@@ -0,0 +1,14 @@
+<?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="Map"
+        android:typeface="serif"
+        android:textStyle="bold"
+        android:textSize="30dp">
+
+    </TextView>
+</LinearLayout>

+ 6 - 0
app/src/main/res/layout/myevent_screen.xml

@@ -0,0 +1,6 @@
+<?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">
+
+</LinearLayout>

+ 9 - 0
app/src/main/res/layout/tool_bar.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="#ff0000"
+    android:elevation="4dp"
+    >
+
+</android.support.v7.widget.Toolbar>

+ 27 - 10
app/src/main/res/menu/menu_main.xml

@@ -1,10 +1,27 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    tools:context="com.example.yiupang.freefoodfinder.MainActivity">
-    <item
-        android:id="@+id/action_settings"
-        android:orderInCategory="100"
-        android:title="@string/action_settings"
-        app:showAsAction="never" />
-</menu>
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@+id/BottomBarEvents"
+        android:icon="@mipmap/ic_launcher"
+        android:title="Events">
+
+    </item>
+
+    <item android:id="@+id/BottomBarItemMap"
+        android:icon="@mipmap/ic_launcher"
+        android:title="Map">
+
+    </item>
+
+    <item android:id="@+id/BottomBarItemMyEvent"
+        android:icon="@mipmap/ic_launcher"
+        android:title="My Event">
+
+    </item>
+
+    <item android:id="@+id/BottomBarItemAboutUs"
+        android:icon="@mipmap/ic_launcher"
+        android:title="Setting">
+
+    </item>
+
+</menu>

+ 1 - 1
app/src/main/res/values/styles.xml

@@ -1,7 +1,7 @@
 <resources>
 
     <!-- Base application theme. -->
-    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
+    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
         <!-- Customize your theme here. -->
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>

BIN
build/generated/mockable-android-25.jar


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor