-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5 - scroll layout for MainActivity and NewAbsenceActivity.java
- Loading branch information
Showing
25 changed files
with
1,166 additions
and
369 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
app/src/main/java/com/eusecom/attendance/SplashScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package com.eusecom.attendance; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.os.Handler; | ||
import android.support.annotation.NonNull; | ||
import android.util.Log; | ||
import com.eusecom.attendance.models.User; | ||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.auth.FirebaseUser; | ||
|
||
|
||
|
||
public class SplashScreen extends Activity { | ||
|
||
private final static String TAG = SplashScreen.class.getSimpleName(); | ||
private static final String USER_IS_LOGIN = "UserIsLogin"; | ||
private static final String UI_ID_FIREBASE = "UiIdFirebase"; | ||
// Duration of wait | ||
private final int SPLASH_DISPLAY_LENGTH = 2000; | ||
|
||
private FirebaseAuth.AuthStateListener mAuthListener; | ||
private FirebaseAuth mAuth; | ||
|
||
private User mUser; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_splashscreen); | ||
mAuth = FirebaseAuth.getInstance(); | ||
//mUser = User.getInstance(); | ||
|
||
// New Handler to start the Menu-Activity and close this Splash-Screen after some seconds. | ||
new Handler().postDelayed(new Runnable() { | ||
@Override | ||
public void run() { | ||
Log.d("run at handler", "Start splash screen"); | ||
mAuthListener = new FirebaseAuth.AuthStateListener() { | ||
@Override | ||
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) { | ||
FirebaseUser user = firebaseAuth.getCurrentUser(); | ||
if (user != null) { | ||
// User is signed in | ||
//mUser.setLoginState(true); | ||
//mUser.setUiIdFirebase(user.getUid()); | ||
|
||
Log.d(TAG, "User state : signed_in:" + user.getUid()); | ||
//StartMainActivity(); | ||
//SplashScreen.this.finish(); | ||
} else { | ||
// User is signed out | ||
//mUser.setLoginState(false); | ||
|
||
Log.d(TAG, "User state : signed_out"); | ||
//StartSignInActivity(); | ||
//SplashScreen.this.finish(); | ||
} | ||
} | ||
}; | ||
mAuth.addAuthStateListener(mAuthListener); | ||
} | ||
}, SPLASH_DISPLAY_LENGTH); | ||
|
||
//mAuth.addAuthStateListener(mAuthListener); | ||
} | ||
|
||
public void StartMainActivity() { | ||
Log.d(TAG, "User is in , Start MainActivity"); | ||
//Intent i = new Intent(SplashScreen.this,MainActivity.class); | ||
//startActivity(i); | ||
} | ||
|
||
public void StartSignInActivity() { | ||
Log.d(TAG, "User need to sign in , Start SignInActivity"); | ||
//Intent i = new Intent(SplashScreen.this,SignInActivity.class); | ||
//startActivity(i); | ||
} | ||
|
||
@Override | ||
protected void onStart() { | ||
super.onStart(); | ||
//mAuth.addAuthStateListener(mAuthListener); | ||
} | ||
|
||
@Override | ||
protected void onStop() { | ||
super.onStop(); | ||
if (mAuthListener != null) { | ||
mAuth.removeAuthStateListener(mAuthListener); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
app/src/main/java/com/eusecom/attendance/fragment/AdapterContact.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* http://stackoverflow.com/questions/41224253/firebase-database-with-recycler-view-in-fragment | ||
*/ | ||
|
||
package com.eusecom.attendance.fragment; | ||
|
||
import android.content.Context; | ||
import android.support.v7.widget.CardView; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
import com.eusecom.attendance.R; | ||
import com.eusecom.attendance.models.Contact; | ||
|
||
import java.util.ArrayList; | ||
|
||
public class AdapterContact extends RecyclerView.Adapter<AdapterContact.MyViewHolder> { | ||
Context context; | ||
ArrayList<Contact> contacts; | ||
|
||
|
||
|
||
public static class MyViewHolder extends RecyclerView.ViewHolder { | ||
public CardView mCardView1; | ||
public TextView mTextView1,mTextView2,mTextView3,mTextView4; | ||
public MyViewHolder(View v) { | ||
super(v); | ||
//mCardView1 = (CardView) v.findViewById(R.layout.item_contact); | ||
mTextView1 = (TextView) v.findViewById(R.id.contact_profession); | ||
mTextView2 = (TextView) v.findViewById(R.id.contact_name); | ||
//mTextView3 = (TextView) v.findViewById(R.id.contact_address); | ||
//mTextView4 = (TextView) v.findViewById(R.id.contact_number); | ||
} | ||
} | ||
public AdapterContact(Context context,ArrayList<Contact> contacts) { | ||
this.contacts = contacts; | ||
this.context = context; | ||
|
||
} | ||
@Override | ||
public AdapterContact.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
View v = LayoutInflater.from(parent.getContext()) | ||
.inflate(R.layout.item_contact, parent, false); | ||
// set the view's size, margins, paddings and layout parameters | ||
return new MyViewHolder(v); | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(MyViewHolder holder, int position) { | ||
|
||
holder.mTextView1.setText(contacts.get(position).getContactProfession()); | ||
holder.mTextView2.setText(contacts.get(position).getContactName()); | ||
//holder.mTextView3.setText(contacts.get(position).getContactAddress()); | ||
//holder.mTextView4.setText(contacts.get(position).getContactNumber()); | ||
int x = contacts.get(position).getContactStatus(); | ||
|
||
} | ||
@Override | ||
public int getItemCount() { | ||
return this.contacts.size(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.