FileDocCategorySizeDatePackage
WeekActivity.javaAPI DocAndroid 1.5 API3059Wed May 06 22:42:42 BST 2009com.android.calendar

WeekActivity

public class WeekActivity extends CalendarActivity implements ViewSwitcher.ViewFactory

Fields Summary
private static final int
VIEW_ID
The view id used for all the views we create. It's OK to have all child views have the same ID. This ID is used to pick which view receives focus when a view hierarchy is saved / restore
Constructors Summary
Methods Summary
public android.view.ViewmakeView()

        WeekView wv = new WeekView(this);
        wv.setId(VIEW_ID);
        wv.setLayoutParams(new ViewSwitcher.LayoutParams(
                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        wv.setSelectedDay(mSelectedDay);
        return wv;
    
protected voidonCreate(android.os.Bundle icicle)


    
        
        super.onCreate(icicle);

        setContentView(R.layout.week_activity);

        mSelectedDay = Utils.timeFromIntent(getIntent());
        mViewSwitcher = (ViewSwitcher) findViewById(R.id.switcher);
        mViewSwitcher.setFactory(this);
        mViewSwitcher.getCurrentView().requestFocus();
        mProgressBar = (ProgressBar) findViewById(R.id.progress_circular);
    
protected voidonPause()

        super.onPause();
        CalendarView view = (CalendarView) mViewSwitcher.getCurrentView();
        mSelectedDay = view.getSelectedDay();
    
protected voidonResume()

        super.onResume();

        CalendarView view1 = (CalendarView) mViewSwitcher.getCurrentView();
        CalendarView view2 = (CalendarView) mViewSwitcher.getNextView();
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

        String str = prefs.getString(CalendarPreferenceActivity.KEY_DETAILED_VIEW,
                CalendarPreferenceActivity.DEFAULT_DETAILED_VIEW);
        view1.setDetailedView(str);
        view2.setDetailedView(str);

        // Record Week View as the (new) start view
        String activityString = CalendarApplication.ACTIVITY_NAMES[CalendarApplication.WEEK_VIEW_ID];
        SharedPreferences.Editor editor = prefs.edit();
        editor.putString(CalendarPreferenceActivity.KEY_START_VIEW, activityString);
        editor.commit();