Skip to content
This repository has been archived by the owner on Nov 19, 2022. It is now read-only.

Commit

Permalink
Added login page; not hooked up to firebase
Browse files Browse the repository at this point in the history
  • Loading branch information
gworkman committed Dec 4, 2017
1 parent 959c42d commit 2b97af4
Show file tree
Hide file tree
Showing 15 changed files with 292 additions and 22 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
/build
/captures
.externalNativeBuild
google-services.json
osu_logo.png
login_background.jpg
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,9 @@ dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.google.android.gms:play-services-maps:11.6.2'
implementation 'com.google.android.gms:play-services-location:11.6.2'
implementation 'com.google.firebase:firebase-database:11.6.2'
implementation 'com.google.firebase:firebase-core:11.6.2'
implementation 'com.google.firebase:firebase-auth:11.6.2'
implementation 'com.google.firebase:firebase-crash:11.6.2'
implementation 'com.android.support:design:27.0.1'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package edu.osu.sphs.soundmap.fragments;


import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import edu.osu.sphs.soundmap.R;

/**
* A simple {@link Fragment} subclass.
* Use the {@link LoginFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class LoginFragment extends Fragment {

public LoginFragment() {
// Required empty public constructor
}

/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @return A new instance of fragment LoginFragment.
*/
// TODO: Rename and change types and number of parameters
public static LoginFragment newInstance() {
LoginFragment fragment = new LoginFragment();
return fragment;
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_login, container, false);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ public static MapFragment newInstance() {
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,36 @@
package edu.osu.sphs.soundmap.fragments;

import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.MarkerOptions;

import java.util.Random;

import edu.osu.sphs.soundmap.R;

/**
* A simple {@link Fragment} subclass.
* Use the {@link ProfileFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class ProfileFragment extends Fragment {
public class ProfileFragment extends Fragment implements OnMapReadyCallback {

private static final String TAG = "ProfileFragment";
private MapView mapView;
private GoogleMap googleMap;

public ProfileFragment() {
// Required empty public constructor
Expand Down Expand Up @@ -44,4 +59,29 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_profile, container, false);
}

@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
mapView = view.findViewById(R.id.map_background);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(this);
}

@Override
public void onMapReady(GoogleMap googleMap) {
this.googleMap = googleMap;
Random r = new Random(System.currentTimeMillis());
LatLngBounds.Builder builder = LatLngBounds.builder();
for (int i = 0; i < 10; i++) {
r.setSeed(System.currentTimeMillis() * (System.currentTimeMillis() % 532));
double lat = (r.nextDouble() * .3) + 39.8;
double lon = (r.nextDouble() * .8) - 83.3;
LatLng latLng = new LatLng(lat, lon);
builder.include(latLng);
Log.d(TAG, "onMapReady: latLng " + latLng.toString());
googleMap.addMarker(new MarkerOptions().position(latLng).title("Marker " + i));
}
mapView.onResume();
googleMap.moveCamera(CameraUpdateFactory.newLatLngBounds(builder.build(), 0));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.Log;
import android.util.SparseArray;

import edu.osu.sphs.soundmap.fragments.LoginFragment;
import edu.osu.sphs.soundmap.fragments.MapFragment;
import edu.osu.sphs.soundmap.fragments.MeasureFragment;
import edu.osu.sphs.soundmap.fragments.ProfileFragment;

/**
* Created by Gus on 11/23/2017. ViewPagerAdapter is the adapter for the viewPager object in the
Expand All @@ -31,7 +30,7 @@ public Fragment getItem(int position) {
case 1:
return MeasureFragment.newInstance();
case 2:
return ProfileFragment.newInstance();
return LoginFragment.newInstance();
default:
Log.e("ViewPagerAdapter", "Returned a null fragment, index out of range");
return null;
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/drawable/ic_android.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="@android:color/holo_green_dark"
android:fillColor="#36D236"
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z"/>
</vector>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/login_background_box.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/loginBackgroundGrey" />
<corners android:radius="10dp" />
<stroke
android:width="2dp"
android:color="#E2E2E2" />
</shape>
6 changes: 6 additions & 0 deletions app/src/main/res/drawable/login_button_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="5dp" />
<solid android:color="@color/osuScarlet" />
</shape>
9 changes: 9 additions & 0 deletions app/src/main/res/drawable/login_input_box.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="5dp" />
<stroke
android:width="1dp"
android:color="@color/loginStroke" />
</shape>
102 changes: 102 additions & 0 deletions app/src/main/res/layout/fragment_login.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="edu.osu.sphs.soundmap.fragments.LoginFragment">

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/login_background" />

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:background="@drawable/login_background_box">

<TextView
android:id="@+id/login_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:text="Login or Create Account"
android:textColor="@android:color/black"
android:textSize="24sp" />

<android.support.design.widget.TextInputLayout
android:id="@+id/username_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/login_text"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/login_input_box">

<android.support.design.widget.TextInputEditText
android:id="@+id/username_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:hint="Email" />

</android.support.design.widget.TextInputLayout>

<android.support.design.widget.TextInputLayout
android:id="@+id/password_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/username_layout"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/login_input_box">

<android.support.design.widget.TextInputEditText
android:id="@+id/password_input"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:hint="Password" />

</android.support.design.widget.TextInputLayout>

<Button
android:id="@+id/login_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/password_layout"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:background="@drawable/login_button_background"
android:text="@string/login"
android:textColor="@android:color/white" />

</RelativeLayout>

<ImageView
android:id="@+id/osu_logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:src="@drawable/osu_logo" />

</RelativeLayout>
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_map.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<com.google.android.gms.maps.MapView
android:id="@+id/map_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
android:layout_height="match_parent" />

</RelativeLayout>
66 changes: 60 additions & 6 deletions app/src/main/res/layout/fragment_profile.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,68 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
tools:context="edu.osu.sphs.soundmap.fragments.ProfileFragment">

<!-- TODO: Update blank fragment layout -->
<TextView
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Profile Fragment" />
android:layout_height="wrap_content">

</FrameLayout>
<com.google.android.gms.maps.MapView
android:id="@+id/map_background"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_centerHorizontal="true"
map:liteMode="true" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@color/dark">

<ImageView
android:id="@+id/profile_picture"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:src="@drawable/ic_android" />

<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/profile_picture"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
android:layout_marginTop="12dp"
android:text="Gus Workman"
android:textColor="@android:color/white"
android:textSize="24sp" />

</RelativeLayout>

<!---->
<!--<RelativeLayout-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content">-->
<!---->
<!--<TextView-->
<!--android:id="@+id/my_recordings"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:text="@string/my_recordings"-->
<!--android:textSize="18sp"-->
<!--android:layout_marginTop="24dp"-->
<!--android:layout_centerHorizontal="true"/>-->
<!--&lt;!&ndash;style="@style/TextAppearance.AppCompat.Button"&ndash;&gt;-->


<!--</RelativeLayout>-->


</RelativeLayout>

</ScrollView>
Loading

0 comments on commit 2b97af4

Please sign in to comment.