한윤범

community function

Showing 32 changed files with 333 additions and 77 deletions
......@@ -2,6 +2,7 @@
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintMissingConstraints" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="AndroidLintValidFragment" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
......
......@@ -2,6 +2,7 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/FirebaseAuth.iml" filepath="$PROJECT_DIR$/FirebaseAuth.iml" />
<module fileurl="file://$PROJECT_DIR$/FirebaseAuthDemo.iml" filepath="$PROJECT_DIR$/FirebaseAuthDemo.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
......
......@@ -25,10 +25,14 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.2.6'
compile 'com.google.android.gms:play-services-auth:10.2.6'
compile 'com.google.firebase:firebase-database:10.2.6'
compile 'com.google.firebase:firebase-storage:10.2.6'
compile 'com.firebaseui:firebase-ui-database:0.4.0'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
}
......@@ -36,4 +40,5 @@ dependencies {
apply plugin: 'com.google.gms.google-services'
\ No newline at end of file
......
......@@ -23,7 +23,8 @@
<activity
android:name=".Main2Activity"
android:label="@string/title_activity_main2"
android:theme="@style/AppTheme.NoActionBar"></activity>
android:theme="@style/AppTheme.NoActionBar" />
<activity android:name=".PostActivity"></activity>
</application>
</manifest>
\ No newline at end of file
......
package com.example.user.firebaseauthdemo;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by HYB on 2017. 10. 11..
*/
public class Community extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
setHasOptionsMenu(true);
return inflater.inflate(R.layout.community, container, false);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.community_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if(item.getItemId() == R.id.action_add){
Intent intent = new Intent(getActivity(), PostActivity.class);
startActivity(intent);
}
return super.onOptionsItemSelected(item);
}
}
......@@ -163,22 +163,22 @@ public class LoginActivity extends AppCompatActivity implements View.OnClickList
if(TextUtils.isEmpty(email)){
//email is empty
Toast.makeText(this, "Please enter email", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "이메일을 입력하세요", Toast.LENGTH_SHORT).show();
//stopping the function execution further
return;
}
if(TextUtils.isEmpty(password)) {
//password is empty
Toast.makeText(this, "Please enter password", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "패스워드를 입력하세요", Toast.LENGTH_SHORT).show();
//stopping the function execution further
return;
}
//if validation are ok
//we will first show a progressbar
progressDialog.setTitle("Loading...");
progressDialog.setMessage("Registering User...");
progressDialog.setTitle("로딩중...");
progressDialog.setMessage("로그인 중입니다");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.show();
......
package com.example.user.firebaseauthdemo;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
......@@ -23,14 +23,6 @@ public class Main2Activity extends AppCompatActivity
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
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();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
......@@ -67,31 +59,48 @@ public class Main2Activity extends AppCompatActivity
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
// if (id == R.id.action_settings) {
// return true;
// }
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_map) {
// Handle the camera action
} else if (id == R.id.nav_route) {
} else if (id == R.id.nav_community) {
} else if (id == R.id.nav_manage) {
private void displaySelectedScreen(int id){
Fragment fragment = null;
switch (id){
case R.id.nav_map:
fragment = new Map();
break;
case R.id.nav_route:
fragment = new Route();
break;
case R.id.nav_community:
fragment = new Community();
break;
case R.id.nav_manage:
finish();
startActivity(new Intent(getApplicationContext(), ProfileActivity.class));
}
if(fragment != null){
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.content_main, fragment);
ft.commit();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
displaySelectedScreen(id);
return true;
}
}
......
......@@ -2,14 +2,13 @@ package com.example.user.firebaseauthdemo;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
......@@ -41,7 +40,7 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
if(firebaseAuth.getCurrentUser() != null){
//profile activity here
finish();
startActivity(new Intent(getApplicationContext(), ProfileActivity.class));
startActivity(new Intent(getApplicationContext(), Main2Activity.class));
}
buttonRegister = (Button) findViewById(R.id.buttonRegister);
......@@ -61,22 +60,22 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
if(TextUtils.isEmpty(email)){
//email is empty
Toast.makeText(this, "Please enter email", Toast.LENGTH_SHORT).show();
//stopping the function execution further
Toast.makeText(this, "이메일을 입력하세요요", Toast.LENGTH_SHORT).show();
//stopping the function execution further
return;
}
if(TextUtils.isEmpty(password)) {
//password is empty
Toast.makeText(this, "Please enter password", Toast.LENGTH_SHORT).show();
Toast.makeText(this, "패스워드를 입력하세요", Toast.LENGTH_SHORT).show();
//stopping the function execution further
return;
}
//if validation are ok
//we will first show a progressbar
progressDialog.setTitle("Loading...");
progressDialog.setMessage("Registering User...");
progressDialog.setTitle("로딩중...");
progressDialog.setMessage("등록 중입니다");
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.show();
//creating a new user
......@@ -86,9 +85,9 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful()){
finish();
startActivity(new Intent(getApplicationContext(), ProfileActivity.class));
startActivity(new Intent(getApplicationContext(), Main2Activity.class));
}else{
Toast.makeText(MainActivity.this, "Could not register.. Try again", Toast.LENGTH_SHORT).show();
Toast.makeText(MainActivity.this, "등록할 수 없습니다.", Toast.LENGTH_SHORT).show();
}
progressDialog.dismiss();
}
......
package com.example.user.firebaseauthdemo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by HYB on 2017. 10. 11..
*/
public class Map extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.map, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("Map");
}
}
package com.example.user.firebaseauthdemo;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageButton;
public class PostActivity extends AppCompatActivity {
private ImageButton mSelectImage;
private static final int GALLARY_REQUEST = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_post);
mSelectImage = (ImageButton)findViewById(R.id.imageSelect);
mSelectImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent gallaryIntent = new Intent(Intent.ACTION_GET_CONTENT);
gallaryIntent.setType("image/*");
startActivityForResult(gallaryIntent, GALLARY_REQUEST);
}
});
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == GALLARY_REQUEST && resultCode == RESULT_OK){
Uri imageUri = data.getData();
mSelectImage.setImageURI(imageUri);
}
}
}
......@@ -34,7 +34,9 @@ public class ProfileActivity extends AppCompatActivity implements View.OnClickLi
finish();
startActivity(new Intent(this,LoginActivity.class));
}
databaseReference = FirebaseDatabase.getInstance().getReference();
editTextAddress = (EditText) findViewById(R.id.editTextAddress);
editTextName = (EditText)findViewById(R.id.editTextName);
buttonSave = (Button)findViewById(R.id.buttonSave);
......@@ -57,8 +59,7 @@ public class ProfileActivity extends AppCompatActivity implements View.OnClickLi
FirebaseUser user = firebaseAuth.getCurrentUser();
databaseReference.child(user.getUid()).setValue(userInformation);
Toast.makeText(this, "Information Saved...", Toast.LENGTH_LONG).show();
Toast.makeText(this, "저장되었습니다.", Toast.LENGTH_LONG).show();
}
@Override
......
package com.example.user.firebaseauthdemo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by HYB on 2017. 10. 11..
*/
public class Route extends Fragment {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.route, container, false);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("Route");
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke android:color="@color/colorGray" android:width="1dp "/>
<corners android:radius="5dp"/>
</shape>
\ No newline at end of file
......@@ -21,13 +21,13 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="30dp"
android:text="User Login"
android:text="HELPLIST"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:layout_margin="15dp"
android:inputType="textEmailAddress"
android:hint="Enter your email"
android:hint="이메일을 입력하세요"
android:id="@+id/editTextEmail"
android:layout_width="368dp"
android:layout_height="wrap_content"
......@@ -37,7 +37,7 @@
<EditText
android:layout_margin="15dp"
android:inputType="textPassword"
android:hint="Enter your password"
android:hint="패스워드를 입력하세요"
android:id="@+id/editTextPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -49,7 +49,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:text="Sign in" />
android:text="로그인" />
<com.google.android.gms.common.SignInButton
android:layout_width="match_parent"
......@@ -63,7 +63,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:text="Not have an account? Signup Here" />
android:text="계정이 없나요? 이곳을 클릭하세요" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
......
......@@ -17,7 +17,7 @@
<TextView
android:layout_margin="30dp"
android:text="User Registration"
android:text="환영합니다"
android:id="@+id/textView"
android:layout_width="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
......@@ -47,13 +47,13 @@
<Button
android:layout_margin="15dp"
android:id="@+id/buttonRegister"
android:text="Register User"
android:text="가입"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:textAlignment="center"
android:text="Already Registered? Sign in here"
android:text="이미 가입했나요? 이곳을 클릭하세요"
android:id="@+id/textViewSignIn"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......
<?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"
tools:context="com.example.user.firebaseauthdemo.PostActivity">
<LinearLayout
android:layout_width="368dp"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:layout_editor_absoluteY="8dp"
tools:layout_editor_absoluteX="8dp"
android:weightSum="1">
<ImageButton
android:id="@+id/imageSelect"
android:layout_width="match_parent"
android:layout_height="204dp"
app:srcCompat="@mipmap/add_btn"
android:layout_weight="0.05" />
<EditText
android:id="@+id/titleField"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_gravity="center_horizontal"
android:layout_margin="15dp"
android:background="@drawable/input_outline"
android:ems="10"
android:hint="Post Title.."
android:inputType="textPersonName"
android:singleLine="true"
tools:layout_editor_absoluteX="0dp"
tools:layout_editor_absoluteY="0dp" />
<EditText
android:id="@+id/descField"
android:layout_width="match_parent"
android:layout_height="47dp"
android:layout_margin="15dp"
android:background="@drawable/input_outline"
android:ems="10"
android:hint=" Post Descriptions..."
android:inputType="textMultiLine" />
<Button
android:id="@+id/submitBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="40dp"
android:background="@color/colorPrimary"
android:text="Submit Post"
android:textColor="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
......@@ -24,13 +24,13 @@
<EditText
android:id="@+id/editTextName"
android:hint="Enter your Name"
android:hint="이름을 입력해 주세요"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/editTextAddress"
android:hint="Enter your Address"
android:hint="주소를 입력해 주세요"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......@@ -39,13 +39,13 @@
android:id="@+id/buttonSave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Save information" />
android:text="정보 저장" />
<Button
android:id="@+id/buttonLogout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Logout" />
android:text="로그아웃" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
......
......@@ -22,12 +22,4 @@
<include layout="@layout/content_main2" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
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.support.design.widget.CoordinatorLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
</LinearLayout>
\ No newline at end of file
......@@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/content_main"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.user.firebaseauthdemo.Main2Activity"
tools:showIn="@layout/app_bar_main2">
......
<?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:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Terror inform is displayed in here."
android:textAppearance="@style/TextAppearance.AppCompat.Headline" />
</LinearLayout>
\ No newline at end of file
......@@ -27,12 +27,6 @@
android:textAppearance="@style/TextAppearance.AppCompat.Body2" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hanorang2@gmail.com" />
<TextView
android:id="@+id/gitURL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
......
<?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:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Route Searching."
android:textAppearance="@style/TextAppearance.AppCompat.Headline" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/action_add"
android:icon="@mipmap/ic_add_white_24dp"
android:title="Add Post"
app:showAsAction="always" />
<item android:id="@+id/action_settings"
android:title="Settings"
app:showAsAction="never" />
</menu>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<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"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorPrimary">#0488d1</color>
<color name="colorPrimaryDark">#0477bd</color>
<color name="colorAccent">#FF4081</color>
<color name="colorGray">#c2c2c2</color>
</resources>
......