-
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 - layouts, model, activity, fragment, for Absence
- Loading branch information
Showing
17 changed files
with
1,273 additions
and
23 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
128 changes: 128 additions & 0 deletions
128
app/src/main/java/com/eusecom/attendance/AbsenceActivity.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,128 @@ | ||
/* | ||
* Copyright 2015 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.eusecom.attendance; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.design.widget.TabLayout; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
import android.support.v4.view.ViewPager; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
|
||
import com.eusecom.attendance.fragment.EmptyFragment; | ||
import com.eusecom.attendance.fragment.MyAbsenceFragment; | ||
import com.google.firebase.auth.FirebaseAuth; | ||
import com.google.firebase.database.DataSnapshot; | ||
import com.google.firebase.database.DatabaseReference; | ||
import com.google.firebase.database.FirebaseDatabase; | ||
import com.google.firebase.database.ValueEventListener; | ||
|
||
|
||
public class AbsenceActivity extends BaseDatabaseActivity { | ||
|
||
private FragmentPagerAdapter mPagerAdapter; | ||
private ViewPager mViewPager; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_ints); | ||
//showProgressDialog(); | ||
|
||
// Create the adapter that will return a fragment for each section | ||
mPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) { | ||
private final Fragment[] mFragments = new Fragment[] { | ||
new MyAbsenceFragment(), | ||
new EmptyFragment(), | ||
new EmptyFragment(), | ||
}; | ||
private final String[] mFragmentNames = new String[] { | ||
"Absences", | ||
"Next", | ||
"Next" | ||
}; | ||
@Override | ||
public Fragment getItem(int position) { | ||
return mFragments[position]; | ||
} | ||
@Override | ||
public int getCount() { | ||
return mFragments.length; | ||
} | ||
@Override | ||
public CharSequence getPageTitle(int position) { | ||
return mFragmentNames[position]; | ||
} | ||
}; | ||
// Set up the ViewPager with the sections adapter. | ||
mViewPager = (ViewPager) findViewById(R.id.container); | ||
mViewPager.setAdapter(mPagerAdapter); | ||
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); | ||
tabLayout.setupWithViewPager(mViewPager); | ||
|
||
// Button launches NewPostActivity | ||
findViewById(R.id.fab_new_post).setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
|
||
Intent i = new Intent(AbsenceActivity.this, NewPostActivity.class); | ||
Bundle extras = new Bundle(); | ||
extras.putString("editx", "0"); | ||
extras.putString("keyx", "0"); | ||
|
||
i.putExtras(extras); | ||
startActivity(i); | ||
|
||
} | ||
}); | ||
//hideProgressDialog(); | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
getMenuInflater().inflate(R.menu.menu_database, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch(item.getItemId()) { | ||
case R.id.action_logout: | ||
FirebaseAuth.getInstance().signOut(); | ||
startActivity(new Intent(this, EmailPasswordActivity.class)); | ||
finish(); | ||
return true; | ||
|
||
case R.id.action_settings: | ||
FirebaseAuth.getInstance().signOut(); | ||
startActivity(new Intent(this, SettingsActivity.class)); | ||
finish(); | ||
return true; | ||
|
||
default: | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} |
125 changes: 125 additions & 0 deletions
125
app/src/main/java/com/eusecom/attendance/IntsActivity.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,125 @@ | ||
/* | ||
* Copyright 2015 Google Inc. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.eusecom.attendance; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.design.widget.TabLayout; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
import android.support.v4.view.ViewPager; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
|
||
import com.eusecom.attendance.fragment.MyIntsFragment; | ||
import com.google.firebase.auth.FirebaseAuth; | ||
|
||
|
||
public class IntsActivity extends BaseDatabaseActivity { | ||
|
||
private static final String TAG = "MainActivity"; | ||
|
||
private FragmentPagerAdapter mPagerAdapter; | ||
private ViewPager mViewPager; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_ints); | ||
//showProgressDialog(); | ||
|
||
// Create the adapter that will return a fragment for each section | ||
mPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) { | ||
private final Fragment[] mFragments = new Fragment[] { | ||
new MyIntsFragment(), | ||
new MyIntsFragment(), | ||
new MyIntsFragment(), | ||
}; | ||
private final String[] mFragmentNames = new String[] { | ||
"Interruptions", | ||
"Next", | ||
"Next" | ||
}; | ||
@Override | ||
public Fragment getItem(int position) { | ||
return mFragments[position]; | ||
} | ||
@Override | ||
public int getCount() { | ||
return mFragments.length; | ||
} | ||
@Override | ||
public CharSequence getPageTitle(int position) { | ||
return mFragmentNames[position]; | ||
} | ||
}; | ||
// Set up the ViewPager with the sections adapter. | ||
mViewPager = (ViewPager) findViewById(R.id.container); | ||
mViewPager.setAdapter(mPagerAdapter); | ||
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); | ||
tabLayout.setupWithViewPager(mViewPager); | ||
|
||
// Button launches NewPostActivity | ||
findViewById(R.id.fab_new_post).setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
|
||
Intent i = new Intent(IntsActivity.this, NewPostActivity.class); | ||
Bundle extras = new Bundle(); | ||
extras.putString("editx", "0"); | ||
extras.putString("keyx", "0"); | ||
|
||
i.putExtras(extras); | ||
startActivity(i); | ||
|
||
} | ||
}); | ||
//hideProgressDialog(); | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
getMenuInflater().inflate(R.menu.menu_database, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
switch(item.getItemId()) { | ||
case R.id.action_logout: | ||
FirebaseAuth.getInstance().signOut(); | ||
startActivity(new Intent(this, EmailPasswordActivity.class)); | ||
finish(); | ||
return true; | ||
|
||
case R.id.action_settings: | ||
FirebaseAuth.getInstance().signOut(); | ||
startActivity(new Intent(this, SettingsActivity.class)); | ||
finish(); | ||
return true; | ||
|
||
default: | ||
return super.onOptionsItemSelected(item); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
|
||
} |
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
Oops, something went wrong.