Made some fragments :)
This commit is contained in:
@@ -4,7 +4,7 @@ android {
|
|||||||
compileSdkVersion 25
|
compileSdkVersion 25
|
||||||
buildToolsVersion "25.0.3"
|
buildToolsVersion "25.0.3"
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "nl.myhyvesbookplus.stagram"
|
applicationId "nl.myhyvesbookplus.tagram"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 1
|
versionCode 1
|
||||||
@@ -37,4 +37,9 @@ dependencies {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
apply plugin: 'com.google.gms.google-services'
|
apply plugin: 'com.google.gms.google-services'
|
||||||
@@ -10,18 +10,17 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity
|
<activity
|
||||||
android:name="nl.myhyvesbookplus.tagram.MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name">
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity android:name="nl.myhyvesbookplus.tagram.LoginActivity">
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity android:name=".LoginActivity">
|
||||||
|
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple {@link Fragment} subclass.
|
||||||
|
* Activities that contain this fragment must implement the
|
||||||
|
* {@link CameraFragment.OnFragmentInteractionListener} interface
|
||||||
|
* to handle interaction events.
|
||||||
|
* Use the {@link CameraFragment#newInstance} factory method to
|
||||||
|
* create an instance of this fragment.
|
||||||
|
*/
|
||||||
|
public class CameraFragment extends Fragment {
|
||||||
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
|
private static final String ARG_PARAM1 = "param1";
|
||||||
|
private static final String ARG_PARAM2 = "param2";
|
||||||
|
|
||||||
|
// TODO: Rename and change types of parameters
|
||||||
|
private String mParam1;
|
||||||
|
private String mParam2;
|
||||||
|
|
||||||
|
private OnFragmentInteractionListener mListener;
|
||||||
|
|
||||||
|
public CameraFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this factory method to create a new instance of
|
||||||
|
* this fragment using the provided parameters.
|
||||||
|
*
|
||||||
|
* @param param1 Parameter 1.
|
||||||
|
* @param param2 Parameter 2.
|
||||||
|
* @return A new instance of fragment CameraFragment.
|
||||||
|
*/
|
||||||
|
// TODO: Rename and change types and number of parameters
|
||||||
|
public static CameraFragment newInstance(String param1, String param2) {
|
||||||
|
CameraFragment fragment = new CameraFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(ARG_PARAM1, param1);
|
||||||
|
args.putString(ARG_PARAM2, param2);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if (getArguments() != null) {
|
||||||
|
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||||
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
return inflater.inflate(R.layout.fragment_camera, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Rename method, update argument and hook method into UI event
|
||||||
|
public void onButtonPressed(Uri uri) {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onFragmentInteraction(uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
if (context instanceof OnFragmentInteractionListener) {
|
||||||
|
mListener = (OnFragmentInteractionListener) context;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(context.toString()
|
||||||
|
+ " must implement OnFragmentInteractionListener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
mListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface must be implemented by activities that contain this
|
||||||
|
* fragment to allow an interaction in this fragment to be communicated
|
||||||
|
* to the activity and potentially other fragments contained in that
|
||||||
|
* activity.
|
||||||
|
* <p>
|
||||||
|
* See the Android Training lesson <a href=
|
||||||
|
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
||||||
|
* >Communicating with Other Fragments</a> for more information.
|
||||||
|
*/
|
||||||
|
public interface OnFragmentInteractionListener {
|
||||||
|
// TODO: Update argument type and name
|
||||||
|
void onFragmentInteraction(Uri uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,6 +40,14 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
findViews();
|
findViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStart() {
|
||||||
|
super.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assigns all views.
|
||||||
|
*/
|
||||||
protected void findViews() {
|
protected void findViews() {
|
||||||
passwordConfirmLabel = (TextView) findViewById(R.id.confirm_password_label);
|
passwordConfirmLabel = (TextView) findViewById(R.id.confirm_password_label);
|
||||||
usernameLabel = (TextView) findViewById(R.id.username_label);
|
usernameLabel = (TextView) findViewById(R.id.username_label);
|
||||||
@@ -57,14 +65,22 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
/// OnClick ///
|
/// OnClick ///
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the logon action.
|
||||||
|
*
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
public void logInOnClick(View view) {
|
public void logInOnClick(View view) {
|
||||||
mAuth.signOut(); // TODO: Remove this after login check is implemented.
|
|
||||||
String emailSting = emailField.getText().toString();
|
String emailSting = emailField.getText().toString();
|
||||||
String passwordSting = passwordField.getText().toString();
|
String passwordSting = passwordField.getText().toString();
|
||||||
|
|
||||||
logIn(emailSting, passwordSting);
|
logIn(emailSting, passwordSting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the register action.
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
public void registerOnClick(View view) {
|
public void registerOnClick(View view) {
|
||||||
Log.d(TAG, "registerOnClick: ");
|
Log.d(TAG, "registerOnClick: ");
|
||||||
|
|
||||||
@@ -80,6 +96,10 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
/// UI-changes ///
|
/// UI-changes ///
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the Activity for registering.
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
public void goToRegisterOnClick(View view) {
|
public void goToRegisterOnClick(View view) {
|
||||||
passwordConfirmField.setVisibility(View.VISIBLE);
|
passwordConfirmField.setVisibility(View.VISIBLE);
|
||||||
passwordConfirmLabel.setVisibility(View.VISIBLE);
|
passwordConfirmLabel.setVisibility(View.VISIBLE);
|
||||||
@@ -92,6 +112,10 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
logInButton.setVisibility(View.GONE);
|
logInButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Changes the Activity for logging in.
|
||||||
|
* @param view
|
||||||
|
*/
|
||||||
public void backToLoginOnClick(View view) {
|
public void backToLoginOnClick(View view) {
|
||||||
passwordConfirmField.setVisibility(View.GONE);
|
passwordConfirmField.setVisibility(View.GONE);
|
||||||
passwordConfirmLabel.setVisibility(View.GONE);
|
passwordConfirmLabel.setVisibility(View.GONE);
|
||||||
@@ -104,13 +128,22 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
logInButton.setVisibility(View.VISIBLE);
|
logInButton.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs intend to Main screen.
|
||||||
|
*/
|
||||||
protected void goToMainScreen() {
|
protected void goToMainScreen() {
|
||||||
Intent intent = new Intent(this, MainActivity.class);
|
Intent intent = new Intent(this, MainActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
this.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// FireBase ///
|
/// FireBase ///
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the actual login action.
|
||||||
|
* @param emailSting email address
|
||||||
|
* @param passwordSting the entered password
|
||||||
|
*/
|
||||||
protected void logIn(String emailSting, String passwordSting) {
|
protected void logIn(String emailSting, String passwordSting) {
|
||||||
mAuth.signInWithEmailAndPassword(emailSting, passwordSting)
|
mAuth.signInWithEmailAndPassword(emailSting, passwordSting)
|
||||||
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
|
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
|
||||||
@@ -133,6 +166,11 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs the actual register action
|
||||||
|
* @param email Users email address
|
||||||
|
* @param password the entered password
|
||||||
|
*/
|
||||||
protected void registerUser(String email, String password) {
|
protected void registerUser(String email, String password) {
|
||||||
mAuth.createUserWithEmailAndPassword(email, password)
|
mAuth.createUserWithEmailAndPassword(email, password)
|
||||||
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
|
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
|
||||||
@@ -156,6 +194,10 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Saves the Username to Firebase
|
||||||
|
* @param user The User object that needs to be updated
|
||||||
|
*/
|
||||||
protected void updateUserInfo(final FirebaseUser user) {
|
protected void updateUserInfo(final FirebaseUser user) {
|
||||||
UserProfileChangeRequest request = new UserProfileChangeRequest.Builder()
|
UserProfileChangeRequest request = new UserProfileChangeRequest.Builder()
|
||||||
.setDisplayName(usernameField.getText().toString())
|
.setDisplayName(usernameField.getText().toString())
|
||||||
@@ -173,6 +215,10 @@ public class LoginActivity extends AppCompatActivity {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a confirm email
|
||||||
|
* @param user The User object which the mail needs to be send to
|
||||||
|
*/
|
||||||
protected void sendConfirmEmail(FirebaseUser user) {
|
protected void sendConfirmEmail(FirebaseUser user) {
|
||||||
user.sendEmailVerification()
|
user.sendEmailVerification()
|
||||||
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
.addOnCompleteListener(new OnCompleteListener<Void>() {
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
package nl.myhyvesbookplus.tagram;
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.app.FragmentManager;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.design.widget.BottomNavigationView;
|
import android.support.design.widget.BottomNavigationView;
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.TextView;
|
import android.view.View;
|
||||||
|
|
||||||
import com.google.firebase.database.DatabaseReference;
|
import com.google.firebase.auth.FirebaseAuth;
|
||||||
import com.google.firebase.database.FirebaseDatabase;
|
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity implements CameraFragment.OnFragmentInteractionListener {
|
||||||
|
final static private String TAG = "MainScreen";
|
||||||
|
|
||||||
|
FirebaseAuth mAuth;
|
||||||
|
CameraFragment cameraFragment;
|
||||||
|
|
||||||
private TextView mTextMessage;
|
|
||||||
|
|
||||||
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
|
||||||
= new BottomNavigationView.OnNavigationItemSelectedListener() {
|
= new BottomNavigationView.OnNavigationItemSelectedListener() {
|
||||||
@@ -20,14 +25,11 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case nl.myhyvesbookplus.tagram.R.id.navigation_home:
|
case nl.myhyvesbookplus.tagram.R.id.navigation_timeline:
|
||||||
mTextMessage.setText(nl.myhyvesbookplus.tagram.R.string.title_home);
|
|
||||||
return true;
|
return true;
|
||||||
case nl.myhyvesbookplus.tagram.R.id.navigation_dashboard:
|
case nl.myhyvesbookplus.tagram.R.id.navigation_camera:
|
||||||
mTextMessage.setText(nl.myhyvesbookplus.tagram.R.string.title_dashboard);
|
|
||||||
return true;
|
return true;
|
||||||
case nl.myhyvesbookplus.tagram.R.id.navigation_notifications:
|
case nl.myhyvesbookplus.tagram.R.id.navigation_profile:
|
||||||
mTextMessage.setText(nl.myhyvesbookplus.tagram.R.string.title_notifications);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -40,13 +42,38 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(nl.myhyvesbookplus.tagram.R.layout.activity_main);
|
setContentView(nl.myhyvesbookplus.tagram.R.layout.activity_main);
|
||||||
|
|
||||||
mTextMessage = (TextView) findViewById(nl.myhyvesbookplus.tagram.R.id.message);
|
|
||||||
BottomNavigationView navigation = (BottomNavigationView) findViewById(nl.myhyvesbookplus.tagram.R.id.navigation);
|
BottomNavigationView navigation = (BottomNavigationView) findViewById(nl.myhyvesbookplus.tagram.R.id.navigation);
|
||||||
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
|
||||||
FirebaseDatabase database = FirebaseDatabase.getInstance();
|
|
||||||
DatabaseReference ref = database.getReference();
|
FragmentManager fragmentManager = getFragmentManager();
|
||||||
// ref.setValue("Hello, Wold!");
|
// FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||||
ref.child("Messages").child("child?").setValue("Hallo!");
|
|
||||||
|
mAuth = FirebaseAuth.getInstance();
|
||||||
|
if (mAuth.getCurrentUser() == null) {
|
||||||
|
goToLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
// super.onBackPressed();
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFragmentInteraction(Uri uri) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void logOutOnClick(View view) {
|
||||||
|
FirebaseAuth.getInstance().signOut();
|
||||||
|
goToLogin();
|
||||||
|
this.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void goToLogin() {
|
||||||
|
Intent goToLogIn = new Intent(this, LoginActivity.class);
|
||||||
|
startActivity(goToLogIn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple {@link Fragment} subclass.
|
||||||
|
* Activities that contain this fragment must implement the
|
||||||
|
* {@link ProfileFragment.OnFragmentInteractionListener} interface
|
||||||
|
* to handle interaction events.
|
||||||
|
* Use the {@link ProfileFragment#newInstance} factory method to
|
||||||
|
* create an instance of this fragment.
|
||||||
|
*/
|
||||||
|
public class ProfileFragment extends Fragment {
|
||||||
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
|
private static final String ARG_PARAM1 = "param1";
|
||||||
|
private static final String ARG_PARAM2 = "param2";
|
||||||
|
|
||||||
|
// TODO: Rename and change types of parameters
|
||||||
|
private String mParam1;
|
||||||
|
private String mParam2;
|
||||||
|
|
||||||
|
private OnFragmentInteractionListener mListener;
|
||||||
|
|
||||||
|
public ProfileFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this factory method to create a new instance of
|
||||||
|
* this fragment using the provided parameters.
|
||||||
|
*
|
||||||
|
* @param param1 Parameter 1.
|
||||||
|
* @param param2 Parameter 2.
|
||||||
|
* @return A new instance of fragment ProfileFragment.
|
||||||
|
*/
|
||||||
|
// TODO: Rename and change types and number of parameters
|
||||||
|
public static ProfileFragment newInstance(String param1, String param2) {
|
||||||
|
ProfileFragment fragment = new ProfileFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(ARG_PARAM1, param1);
|
||||||
|
args.putString(ARG_PARAM2, param2);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if (getArguments() != null) {
|
||||||
|
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||||
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
return inflater.inflate(R.layout.fragment_profile, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Rename method, update argument and hook method into UI event
|
||||||
|
public void onButtonPressed(Uri uri) {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onFragmentInteraction(uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
if (context instanceof OnFragmentInteractionListener) {
|
||||||
|
mListener = (OnFragmentInteractionListener) context;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(context.toString()
|
||||||
|
+ " must implement OnFragmentInteractionListener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
mListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface must be implemented by activities that contain this
|
||||||
|
* fragment to allow an interaction in this fragment to be communicated
|
||||||
|
* to the activity and potentially other fragments contained in that
|
||||||
|
* activity.
|
||||||
|
* <p>
|
||||||
|
* See the Android Training lesson <a href=
|
||||||
|
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
||||||
|
* >Communicating with Other Fragments</a> for more information.
|
||||||
|
*/
|
||||||
|
public interface OnFragmentInteractionListener {
|
||||||
|
// TODO: Update argument type and name
|
||||||
|
void onFragmentInteraction(Uri uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
package nl.myhyvesbookplus.tagram;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A simple {@link Fragment} subclass.
|
||||||
|
* Activities that contain this fragment must implement the
|
||||||
|
* {@link TimelineFragment.OnFragmentInteractionListener} interface
|
||||||
|
* to handle interaction events.
|
||||||
|
* Use the {@link TimelineFragment#newInstance} factory method to
|
||||||
|
* create an instance of this fragment.
|
||||||
|
*/
|
||||||
|
public class TimelineFragment extends Fragment {
|
||||||
|
// TODO: Rename parameter arguments, choose names that match
|
||||||
|
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||||
|
private static final String ARG_PARAM1 = "param1";
|
||||||
|
private static final String ARG_PARAM2 = "param2";
|
||||||
|
|
||||||
|
// TODO: Rename and change types of parameters
|
||||||
|
private String mParam1;
|
||||||
|
private String mParam2;
|
||||||
|
|
||||||
|
private OnFragmentInteractionListener mListener;
|
||||||
|
|
||||||
|
public TimelineFragment() {
|
||||||
|
// Required empty public constructor
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Use this factory method to create a new instance of
|
||||||
|
* this fragment using the provided parameters.
|
||||||
|
*
|
||||||
|
* @param param1 Parameter 1.
|
||||||
|
* @param param2 Parameter 2.
|
||||||
|
* @return A new instance of fragment TimelineFragment.
|
||||||
|
*/
|
||||||
|
// TODO: Rename and change types and number of parameters
|
||||||
|
public static TimelineFragment newInstance(String param1, String param2) {
|
||||||
|
TimelineFragment fragment = new TimelineFragment();
|
||||||
|
Bundle args = new Bundle();
|
||||||
|
args.putString(ARG_PARAM1, param1);
|
||||||
|
args.putString(ARG_PARAM2, param2);
|
||||||
|
fragment.setArguments(args);
|
||||||
|
return fragment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if (getArguments() != null) {
|
||||||
|
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||||
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
// Inflate the layout for this fragment
|
||||||
|
return inflater.inflate(R.layout.fragment_timeline, container, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Rename method, update argument and hook method into UI event
|
||||||
|
public void onButtonPressed(Uri uri) {
|
||||||
|
if (mListener != null) {
|
||||||
|
mListener.onFragmentInteraction(uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAttach(Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
if (context instanceof OnFragmentInteractionListener) {
|
||||||
|
mListener = (OnFragmentInteractionListener) context;
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException(context.toString()
|
||||||
|
+ " must implement OnFragmentInteractionListener");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
mListener = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface must be implemented by activities that contain this
|
||||||
|
* fragment to allow an interaction in this fragment to be communicated
|
||||||
|
* to the activity and potentially other fragments contained in that
|
||||||
|
* activity.
|
||||||
|
* <p>
|
||||||
|
* See the Android Training lesson <a href=
|
||||||
|
* "http://developer.android.com/training/basics/fragments/communicating.html"
|
||||||
|
* >Communicating with Other Fragments</a> for more information.
|
||||||
|
*/
|
||||||
|
public interface OnFragmentInteractionListener {
|
||||||
|
// TODO: Update argument type and name
|
||||||
|
void onFragmentInteraction(Uri uri);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<?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="nl.myhyvesbookplus.stagram.LoginActivity">-->
|
<?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="nl.myhyvesbookplus.tagram.LoginActivity">-->
|
||||||
|
|
||||||
<!--</android.support.constraint.ConstraintLayout>-->
|
<!--</android.support.constraint.ConstraintLayout>-->
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Email" />
|
android:labelFor="@+id/email"
|
||||||
|
android:text="@string/email" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/email"
|
android:id="@+id/email"
|
||||||
@@ -27,7 +28,8 @@
|
|||||||
android:id="@+id/username_label"
|
android:id="@+id/username_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Username"
|
android:labelFor="@+id/username"
|
||||||
|
android:text="@string/username"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
@@ -40,7 +42,8 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Password" />
|
android:labelFor="@+id/password"
|
||||||
|
android:text="@string/password" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/password"
|
android:id="@+id/password"
|
||||||
@@ -52,14 +55,13 @@
|
|||||||
android:id="@+id/confirm_password_label"
|
android:id="@+id/confirm_password_label"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Confirm Password"
|
android:text="@string/confirm_password"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/confirm_password_field"
|
android:id="@+id/confirm_password_field"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="confirm password"
|
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
@@ -70,7 +72,7 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:onClick="logInOnClick"
|
android:onClick="logInOnClick"
|
||||||
android:text="Login" />
|
android:text="@string/login_button" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/go_to_register_button"
|
android:id="@+id/go_to_register_button"
|
||||||
@@ -79,7 +81,7 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:onClick="goToRegisterOnClick"
|
android:onClick="goToRegisterOnClick"
|
||||||
android:text="Register" />
|
android:text="@string/register" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/register_button"
|
android:id="@+id/register_button"
|
||||||
@@ -88,7 +90,7 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:onClick="registerOnClick"
|
android:onClick="registerOnClick"
|
||||||
android:text="Register"
|
android:text="@string/register"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
@@ -98,8 +100,7 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginStart="16dp"
|
android:layout_marginStart="16dp"
|
||||||
android:onClick="backToLoginOnClick"
|
android:onClick="backToLoginOnClick"
|
||||||
android:text="back to Login"
|
android:text="@string/back_to_login"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -14,16 +14,12 @@
|
|||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<TextView
|
<fragment
|
||||||
android:id="@+id/message"
|
android:id="@+id/fragment_container"
|
||||||
|
android:name="nl.myhyvesbookplus.tagram.CameraFragment"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginBottom="@dimen/activity_vertical_margin"
|
tools:layout="@layout/fragment_camera" />
|
||||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
|
||||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
|
||||||
android:layout_marginTop="@dimen/activity_vertical_margin"
|
|
||||||
android:text="@string/title_home" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<android.support.design.widget.BottomNavigationView
|
<android.support.design.widget.BottomNavigationView
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<FrameLayout 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="layout.CameraFragment">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/hello_blank_fragment" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:onClick="logOutOnClick"
|
||||||
|
android:text="LogOut" />
|
||||||
|
</LinearLayout>
|
||||||
|
<!-- TODO: Update blank fragment layout -->
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<FrameLayout 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="nl.myhyvesbookplus.tagram.ProfileFragment">
|
||||||
|
|
||||||
|
<!-- TODO: Update blank fragment layout -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/hello_blank_fragment" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<FrameLayout 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="nl.myhyvesbookplus.tagram.TimelineFragment">
|
||||||
|
|
||||||
|
<!-- TODO: Update blank fragment layout -->
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:text="@string/hello_blank_fragment" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
@@ -2,17 +2,17 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/navigation_home"
|
android:id="@+id/navigation_timeline"
|
||||||
android:icon="@drawable/ic_home_black_24dp"
|
android:icon="@drawable/ic_home_black_24dp"
|
||||||
android:title="@string/title_home" />
|
android:title="@string/title_home" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/navigation_dashboard"
|
android:id="@+id/navigation_camera"
|
||||||
android:icon="@drawable/ic_dashboard_black_24dp"
|
android:icon="@drawable/ic_dashboard_black_24dp"
|
||||||
android:title="@string/title_dashboard" />
|
android:title="@string/title_dashboard" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/navigation_notifications"
|
android:id="@+id/navigation_profile"
|
||||||
android:icon="@drawable/ic_notifications_black_24dp"
|
android:icon="@drawable/ic_notifications_black_24dp"
|
||||||
android:title="@string/title_notifications" />
|
android:title="@string/title_notifications" />
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">MyHyvesBookPlusTagram</string>
|
||||||
|
<string name="back_to_login">terug naar Login</string>
|
||||||
|
<string name="confirm_password">Bevestig wachtwoord</string>
|
||||||
|
<string name="email">Email</string>
|
||||||
|
<string name="login_button">Login</string>
|
||||||
|
<string name="password">Wachtwoord</string>
|
||||||
|
<string name="register">Registreer</string>
|
||||||
|
<string name="title_dashboard">Camera</string>
|
||||||
|
<string name="title_home">Tijdlijn</string>
|
||||||
|
<string name="title_notifications">Profiel</string>
|
||||||
|
<string name="username">Gebruikersnaam</string>
|
||||||
|
<string name="confirm_password_hint">bevestig wachtwoord</string>
|
||||||
|
</resources>
|
||||||
@@ -4,6 +4,16 @@
|
|||||||
<string name="title_dashboard">Camera</string>
|
<string name="title_dashboard">Camera</string>
|
||||||
<string name="title_notifications">Profile</string>
|
<string name="title_notifications">Profile</string>
|
||||||
|
|
||||||
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
|
<string name="username">Username</string>
|
||||||
|
<string name="password">Password</string>
|
||||||
|
<string name="confirm_password">Confirm Password</string>
|
||||||
|
<string name="confirm_password_hint">confirm password</string>
|
||||||
|
<string name="login_button">Login</string>
|
||||||
|
<string name="register">Register</string>
|
||||||
|
<string name="back_to_login">back to Login</string>
|
||||||
|
<string name="email">Email</string>
|
||||||
|
|
||||||
<!-- TODO: Remove or change this placeholder text -->
|
<!-- TODO: Remove or change this placeholder text -->
|
||||||
<string name="hello_blank_fragment">Hello blank fragment</string>
|
<string name="hello_blank_fragment">Hello blank fragment</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user