-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add contact list
- Loading branch information
CullyCross
committed
Nov 4, 2015
1 parent
ceea1d4
commit 1282c3e
Showing
25 changed files
with
975 additions
and
206 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
152 changes: 0 additions & 152 deletions
152
app/src/main/java/me/cullycross/test4tabs/FourTabsActivity.java
This file was deleted.
Oops, something went wrong.
124 changes: 124 additions & 0 deletions
124
app/src/main/java/me/cullycross/test4tabs/activities/FourTabsActivity.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,124 @@ | ||
package me.cullycross.test4tabs.activities; | ||
|
||
import android.os.Bundle; | ||
import android.support.design.widget.FloatingActionButton; | ||
import android.support.design.widget.Snackbar; | ||
import android.support.design.widget.TabLayout; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
import android.support.v4.view.ViewPager; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.LayoutInflater; | ||
import android.view.Menu; | ||
import android.view.MenuItem; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
import butterknife.Bind; | ||
import butterknife.ButterKnife; | ||
import me.cullycross.test4tabs.R; | ||
import me.cullycross.test4tabs.fragments.ContactsFragment; | ||
import me.cullycross.test4tabs.fragments.DatabaseFragment; | ||
import me.cullycross.test4tabs.fragments.PicturesFragment; | ||
import me.cullycross.test4tabs.fragments.SinglePictureFragment; | ||
|
||
public class FourTabsActivity extends AppCompatActivity { | ||
|
||
private SectionsPagerAdapter mSectionsPagerAdapter; | ||
|
||
|
||
@Bind(R.id.toolbar) Toolbar mToolbar; | ||
@Bind(R.id.container) ViewPager mViewPager; | ||
@Bind(R.id.tabs) TabLayout mTabLayout; | ||
|
||
@Override protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_four_tabs); | ||
ButterKnife.bind(this); | ||
|
||
setSupportActionBar(mToolbar); | ||
|
||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); | ||
|
||
mViewPager.setAdapter(mSectionsPagerAdapter); | ||
mTabLayout.setupWithViewPager(mViewPager); | ||
|
||
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(); | ||
} | ||
}); | ||
} | ||
|
||
@Override public boolean onCreateOptionsMenu(Menu menu) { | ||
// Inflate the menu; this adds items to the action bar if it is present. | ||
getMenuInflater().inflate(R.menu.menu_four_tabs, menu); | ||
return true; | ||
} | ||
|
||
@Override public boolean onOptionsItemSelected(MenuItem item) { | ||
// Handle action bar item clicks here. The action bar will | ||
// automatically handle clicks on the Home/Up button, so long | ||
// as you specify a parent activity in AndroidManifest.xml. | ||
int id = item.getItemId(); | ||
|
||
//noinspection SimplifiableIfStatement | ||
if (id == R.id.action_settings) { | ||
return true; | ||
} | ||
|
||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
public class SectionsPagerAdapter extends FragmentPagerAdapter { | ||
|
||
public static final String CONTACTS = "Contacts"; | ||
public static final String DATABASE = "Database"; | ||
public static final String PICTURES = "Pictures"; | ||
public static final String SINGLE_PICTURE = "Single picture"; | ||
|
||
public SectionsPagerAdapter(FragmentManager fm) { | ||
super(fm); | ||
} | ||
|
||
@Override public Fragment getItem(int position) { | ||
|
||
switch (position) { | ||
case 0: | ||
return ContactsFragment.newInstance(); | ||
case 1: | ||
return DatabaseFragment.newInstance(); | ||
case 2: | ||
return PicturesFragment.newInstance(); | ||
case 3: | ||
return SinglePictureFragment.newInstance(); | ||
default: | ||
return null; | ||
} | ||
} | ||
|
||
@Override public int getCount() { | ||
return 4; | ||
} | ||
|
||
@Override public CharSequence getPageTitle(int position) { | ||
switch (position) { | ||
case 0: | ||
return CONTACTS; | ||
case 1: | ||
return DATABASE; | ||
case 2: | ||
return PICTURES; | ||
case 3: | ||
return SINGLE_PICTURE; | ||
default: | ||
return null; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.