Back to project page tasktracker-android.
The source code is released under:
Copyright (c) 2012 Remo Mueller https://github.com/remomueller This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this lice...
If you think the Android project tasktracker-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.github.remomueller.tasktracker.android; //from w w w . j a v a 2 s .c om 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 com.actionbarsherlock.app.SherlockFragmentActivity; import com.viewpagerindicator.PageIndicator; import com.viewpagerindicator.TitlePageIndicator; import com.viewpagerindicator.TitlePageIndicator.IndicatorStyle; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.view.MenuInflater; import com.actionbarsherlock.view.Menu; import com.actionbarsherlock.view.MenuItem; // import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.widget.ListView; import java.util.ArrayList; public class StickiesIndex extends SherlockFragmentActivity { private static final String TAG = "TaskTrackerAndroid"; private static final String[] CONTENT = new String[] { "Completed", "Past Due", "Upcoming" }; StickiesFragmentAdapter mAdapter; ViewPager mPager; PageIndicator mIndicator; public ArrayList<Sticky> stickies = new ArrayList<Sticky>(); User current_user; Project current_project; StickyAdapter stickyAdapter; ListView list; ActionBar actionBar; // public ArrayList<Sticky> getStickies() { // return stickies; // } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getSupportMenuInflater(); inflater.inflate(R.menu.stickies_menu, menu); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection Intent intent; switch (item.getItemId()) { case android.R.id.home: case R.id.projects: intent = new Intent(getApplicationContext(), ProjectsIndex.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); return true; case R.id.stickies: intent = new Intent(getApplicationContext(), StickiesIndex.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); return true; case R.id.new_sticky: intent = new Intent(getApplicationContext(), StickiesNew.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); if(current_project != null){ intent.putExtra(Project.PROJECT_ID, Integer.toString(current_project.id)); intent.putExtra(Project.PROJECT_NAME, current_project.name); } startActivity(intent); // finish(); return true; case R.id.about: intent = new Intent(getApplicationContext(), AboutActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); // finish(); return true; case R.id.logout: current_user.logoutUser(); intent = new Intent(getApplicationContext(), LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); return true; default: return super.onOptionsItemSelected(item); } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); actionBar = getSupportActionBar(); current_user = new User(getApplicationContext()); setContentView(R.layout.simple_tabs); mAdapter = new StickiesFragmentAdapter(getSupportFragmentManager()); mPager = (ViewPager)findViewById(R.id.pager); mPager.setAdapter(mAdapter); TitlePageIndicator indicator = (TitlePageIndicator)findViewById(R.id.indicator); indicator.setViewPager(mPager); indicator.setFooterIndicatorStyle(IndicatorStyle.Triangle); mIndicator = indicator; mIndicator.setCurrentItem(1); Intent intent = getIntent(); current_project = new Project(); if(intent.getStringExtra(Project.PROJECT_ID) != null) { current_project.id = Integer.parseInt( intent.getStringExtra(Project.PROJECT_ID) ); current_project.name = intent.getStringExtra(Project.PROJECT_NAME); // current_project.color = intent.getStringExtra(Project.PROJECT_COLOR); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setTitle(current_project.name); // actionBar.setTextColor(Color.parseColor(current_project.color)); } } class StickiesFragmentAdapter extends FragmentPagerAdapter { private int mCount = CONTENT.length; public StickiesFragmentAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { return StickiesFragment.newInstance(position, current_project); } @Override public int getCount() { return mCount; } @Override public CharSequence getPageTitle(int position) { return CONTENT[position]; } } }