Example usage for android.os Bundle getSerializable

List of usage examples for android.os Bundle getSerializable

Introduction

In this page you can find the example usage for android.os Bundle getSerializable.

Prototype

@Override
@Nullable
public Serializable getSerializable(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:com.romanenco.gitt.BrowserActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_browse);

    filterBar = findViewById(R.id.filter_bar);

    findViewById(R.id.filter_close).setOnClickListener(new View.OnClickListener() {

        @Override//from w w  w  .  j a  v a2s  .co  m
        public void onClick(View v) {
            showFilterBar(false);
        }
    });

    filterText = (EditText) findViewById(R.id.filter_text);
    filterText.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            adapter.reFilter(s.toString());
        }

    });

    if (savedInstanceState == null) {
        current = (Repo) getIntent().getSerializableExtra(REPO);
        path = browseCache.get(current.getFolder());
        if (path == null) {
            path = ".";
        }
    } else {
        current = (Repo) savedInstanceState.getSerializable(REPO);
        path = savedInstanceState.getString(PATH);
        filterBar.setVisibility(savedInstanceState.getInt(FILTER));
    }

    updateTitleWithPath();
    adapter = new FileListAdapter(this, current, path);
    getListView().setAdapter(adapter);
}

From source file:edu.Groove9.TunesMaster.playlist.PlaylistActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.playlist_act);

    // Set up the toolbar.
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);/*w  ww. j a  v a2  s. c o  m*/
    ActionBar ab = getSupportActionBar();
    ab.setHomeAsUpIndicator(R.drawable.ic_menu);
    ab.setDisplayHomeAsUpEnabled(true);

    // Set up the navigation drawer.
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark);
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    if (navigationView != null) {
        setupDrawerContent(navigationView);
    }

    PlaylistFragment playlistFragment = (PlaylistFragment) getSupportFragmentManager()
            .findFragmentById(R.id.contentFrame);
    if (playlistFragment == null) {
        // Create the fragment
        playlistFragment = PlaylistFragment.newInstance();
        ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), playlistFragment, R.id.contentFrame);
    }

    // Create the presenter
    mPlaylistPresenter = new PlaylistPresenter(Injection.provideUseCaseHandler(), playlistFragment,
            Injection.provideGetTasks(getApplicationContext()));

    // Load previously saved state, if available.
    if (savedInstanceState != null) {
        PlaylistFilterType currentFiltering = (PlaylistFilterType) savedInstanceState
                .getSerializable(CURRENT_FILTERING_KEY);
        mPlaylistPresenter.setFiltering(currentFiltering);
    }

    askForPermission();
}

From source file:org.mifos.androidclient.main.AccountDetailsActivity.java

@Override
public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.account_details);

    tabs = (TabHost) findViewById(R.id.accountDetails_tabHost);
    tabs.setup();/*ww w  .j av  a 2  s . co m*/
    TabHost.TabSpec overviewSpec = tabs.newTabSpec(getString(R.string.accountDetails_tab_overview));
    overviewSpec.setIndicator(getString(R.string.accountDetails_tab_overview));
    overviewSpec.setContent(R.id.account_overview);
    TabHost.TabSpec additionalInfoSpec = tabs.newTabSpec(getString(R.string.accountDetails_tab_additionalInfo));
    additionalInfoSpec.setIndicator(getString(R.string.accountDetails_tab_additionalInfo));
    additionalInfoSpec.setContent(R.id.account_details);
    TabHost.TabSpec transactionSpec = tabs.newTabSpec(getString(R.string.accountDetails_tab_transaction));
    transactionSpec.setIndicator(getString(R.string.accountDetails_tab_transaction));
    transactionSpec.setContent(R.id.account_transaction);
    tabs.addTab(overviewSpec);
    tabs.addTab(transactionSpec);
    tabs.addTab(additionalInfoSpec);
    TabColorUtils.setTabColor(tabs);
    tabs.setOnTabChangedListener(this);

    if (bundle != null) {
        if (bundle.containsKey(AbstractAccountDetails.BUNDLE_KEY)) {
            mDetails = (AbstractAccountDetails) bundle.getSerializable(AbstractAccountDetails.BUNDLE_KEY);
        }
        if (bundle.containsKey(Fee.BUNDLE_KEY)) {
            mApplicableFees = (Map<String, Map<String, String>>) bundle.getSerializable(Fee.BUNDLE_KEY);
        }
        if (bundle.containsKey(SELECTED_TAB_BUNDLE_KEY)) {
            tabs.setCurrentTab(bundle.getInt(SELECTED_TAB_BUNDLE_KEY));
        }

    }

    mAccount = (AccountBasicInformation) getIntent().getSerializableExtra(AccountBasicInformation.BUNDLE_KEY);
    mAccountService = new AccountService(this);
    mSystemSettingsService = new SystemSettingsService(this);
}

From source file:com.sukenda.todoapp.module.task.tasks.TasksActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tasks_act);//  w ww . j  a  v a2s. c o m

    // Set up the toolbar.
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    assert actionBar != null;
    actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
    actionBar.setDisplayHomeAsUpEnabled(true);

    // Set up the navigation drawer.
    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
    assert mDrawerLayout != null;
    mDrawerLayout.setStatusBarBackground(R.color.colorPrimaryDark);
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    if (navigationView != null) {
        setupDrawerContent(navigationView);
    }

    TasksFragment tasksFragment = (TasksFragment) getSupportFragmentManager()
            .findFragmentById(R.id.contentFrame);
    if (tasksFragment == null) {
        // Create the fragment
        tasksFragment = TasksFragment.newInstance();
        ActivityUtils.addFragmentToActivity(getSupportFragmentManager(), tasksFragment, R.id.contentFrame);
    }

    // Create the presenter
    mTasksPresenter = new TasksPresenter(Injection.provideTasksRepository(getApplicationContext()),
            tasksFragment);

    // Load previously saved state, if available.
    if (savedInstanceState != null) {
        TasksFilterType currentFiltering = (TasksFilterType) savedInstanceState
                .getSerializable(CURRENT_FILTERING_KEY);
        mTasksPresenter.setFiltering(currentFiltering);
    }
}

From source file:com.audiokernel.euphonyrmt.MainMenuActivity.java

private SlidingUpPanelLayout initializeSlidingLayout(final Bundle savedInstanceState) {
    final SlidingUpPanelLayout slidingLayout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
    final SlidingUpPanelLayout.PanelSlideListener panelSlideListener = initializeSlidingPanelLayout();

    slidingLayout.setEnableDragViewTouchEvents(true);
    slidingLayout.setPanelHeight((int) getResources().getDimension(R.dimen.nowplaying_small_fragment_height));
    slidingLayout.setPanelSlideListener(panelSlideListener);

    // Ensure that the view state is consistent (otherwise we end up with a view mess)
    // The sliding layout should take care of it itself but does not
    if (savedInstanceState != null) {
        if ((Boolean) savedInstanceState.getSerializable(EXTRA_SLIDING_PANEL_EXPANDED)) {
            slidingLayout.expandPanel();
            panelSlideListener.onPanelSlide(slidingLayout, 1.0f);
            panelSlideListener.onPanelExpanded(slidingLayout);
        } else {/* ww w  .  j  ava2s.  co  m*/
            slidingLayout.collapsePanel();
            panelSlideListener.onPanelSlide(slidingLayout, 0.0f);
            panelSlideListener.onPanelCollapsed(slidingLayout);
        }
    }

    return slidingLayout;
}

From source file:com.google.android.gms.location.sample.activityrecognition.MainActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_activity);

    // Get the UI widgets.
    mRequestActivityUpdatesButton = (Button) findViewById(R.id.request_activity_updates_button);
    mRemoveActivityUpdatesButton = (Button) findViewById(R.id.remove_activity_updates_button);
    mDetectedActivitiesListView = (ListView) findViewById(R.id.detected_activities_listview);

    // Get a receiver for broadcasts from ActivityDetectionIntentService.
    mBroadcastReceiver = new ActivityDetectionBroadcastReceiver();

    // Enable either the Request Updates button or the Remove Updates button depending on
    // whether activity updates have been requested.
    setButtonsEnabledState();//ww w . ja v a  2 s.com

    // Reuse the value of mDetectedActivities from the bundle if possible. This maintains state
    // across device orientation changes. If mDetectedActivities is not stored in the bundle,
    // populate it with DetectedActivity objects whose confidence is set to 0. Doing this
    // ensures that the bar graphs for only only the most recently detected activities are
    // filled in.
    if (savedInstanceState != null && savedInstanceState.containsKey(Constants.DETECTED_ACTIVITIES)) {
        mDetectedActivities = (ArrayList<DetectedActivity>) savedInstanceState
                .getSerializable(Constants.DETECTED_ACTIVITIES);
    } else {
        mDetectedActivities = new ArrayList<DetectedActivity>();

        // Set the confidence level of each monitored activity to zero.
        for (int i = 0; i < Constants.MONITORED_ACTIVITIES.length; i++) {
            mDetectedActivities.add(new DetectedActivity(Constants.MONITORED_ACTIVITIES[i], 0));
        }
    }

    // Bind the adapter to the ListView responsible for display data for detected activities.
    mAdapter = new DetectedActivitiesAdapter(this, mDetectedActivities);
    mDetectedActivitiesListView.setAdapter(mAdapter);

    // Kick off the request to build GoogleApiClient.
    buildGoogleApiClient();
}

From source file:com.gh4a.activities.IssueLabelListActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.generic_list);
    setContentShown(false);/*from  w  ww  .  ja v  a2 s.c  o m*/

    ActionBar actionBar = getSupportActionBar();
    actionBar.setTitle(R.string.issue_labels);
    actionBar.setSubtitle(mRepoOwner + "/" + mRepoName);
    actionBar.setDisplayHomeAsUpEnabled(true);

    mAdapter = new IssueLabelAdapter(this);
    mAdapter.setOnItemClickListener(this);
    mRecyclerView = (RecyclerView) findViewById(R.id.list);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this));
    mRecyclerView.setTag(R.id.FloatingActionButtonScrollEnabled, new Object());
    mRecyclerView.setAdapter(mAdapter);

    CoordinatorLayout rootLayout = getRootLayout();
    mFab = (FloatingActionButton) getLayoutInflater().inflate(R.layout.add_fab, rootLayout, false);
    mFab.setOnClickListener(this);
    rootLayout.addView(mFab);
    updateFabVisibility();

    getSupportLoaderManager().initLoader(0, null, mLabelCallback);

    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(STATE_KEY_ADDED_LABEL)) {
            mAddedLabel = (IssueLabelAdapter.EditableLabel) savedInstanceState
                    .getSerializable(STATE_KEY_EDITING_LABEL);
            mAdapter.add(mAddedLabel);
            startEditing(mAddedLabel);
        } else if (savedInstanceState.containsKey(STATE_KEY_EDITING_LABEL)) {
            IssueLabelAdapter.EditableLabel label = (IssueLabelAdapter.EditableLabel) savedInstanceState
                    .getSerializable(STATE_KEY_EDITING_LABEL);
            int count = mAdapter.getCount();
            for (int i = 0; i < count; i++) {
                IssueLabelAdapter.EditableLabel item = mAdapter.getItem(i);
                if (item.getName().equals(label.getName())) {
                    item.editedName = label.editedName;
                    item.editedColor = label.editedColor;
                    startEditing(item);
                    break;
                }
            }
        }
    }
}

From source file:com.example.caique.educam.Activities.TimelineActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override//from   ww  w  .ja  v  a 2s.  c  o  m
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_timeline);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        setTranslucentStatus(true);
    }

    SystemBarTintManager tintManager = new SystemBarTintManager(this);
    tintManager.setStatusBarTintEnabled(true);
    tintManager.setStatusBarTintResource(R.color.OrangeRed);

    // BEGIN_INCLUDE(initializeRecyclerView)
    mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    mAddButton = (Button) findViewById(R.id.add_button);
    mAddButton.setOnClickListener(this);
    mErrorText = (TextView) findViewById(R.id.error_text);
    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);

    // LinearLayoutManager is used here, this will layout the elements in a similar fashion
    // to the way ListView would layout elements. The RecyclerView.LayoutManager defines how
    // elements are laid out.
    mLayoutManager = new LinearLayoutManager(getApplicationContext());

    mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;

    if (savedInstanceState != null) {
        // Restore saved layout manager type.
        mCurrentLayoutManagerType = (LayoutManagerType) savedInstanceState.getSerializable(KEY_LAYOUT_MANAGER);
    }
    setRecyclerViewLayoutManager(mCurrentLayoutManagerType);

    mErrorText = (TextView) findViewById(R.id.error_text);
    //mDB = new EducamDbHandler(getApplicationContext());

    retrievePosts(String.valueOf(EducamPreferences.getUserId(getApplication())), "ALL");

    //uncomment for local db usage
    /* List<Post> posts = mDB.listPosts();
     Log.e(getLocalClassName(), "num posts: " + posts.size());
     if(posts.size() >= 0){
    initDataset(posts);
    mRecyclerView.setVisibility(View.VISIBLE);
    mErrorText.setVisibility(View.INVISIBLE);
    mAdapter = new CustomAdapter(getApplicationContext(), mDataset);
    // Set CustomAdapter as the adapter for RecyclerView.
    mRecyclerView.setAdapter(mAdapter);
    // END_INCLUDE(initializeRecyclerView)
     }*/
}

From source file:com.customdatepicker.date.DatePickerDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    int listPosition = -1;
    int listPositionOffset = 0;
    int currentView = mDefaultView;
    if (savedInstanceState != null) {
        mWeekStart = savedInstanceState.getInt(KEY_WEEK_START);
        currentView = savedInstanceState.getInt(KEY_CURRENT_VIEW);
        listPosition = savedInstanceState.getInt(KEY_LIST_POSITION);
        listPositionOffset = savedInstanceState.getInt(KEY_LIST_POSITION_OFFSET);
        //noinspection unchecked
        highlightedDays = (HashSet<Calendar>) savedInstanceState.getSerializable(KEY_HIGHLIGHTED_DAYS);
        mThemeDark = savedInstanceState.getBoolean(KEY_THEME_DARK);
        mThemeDarkChanged = savedInstanceState.getBoolean(KEY_THEME_DARK_CHANGED);
        mAccentColor = savedInstanceState.getInt(KEY_ACCENT);
        mVibrate = savedInstanceState.getBoolean(KEY_VIBRATE);
        mDismissOnPause = savedInstanceState.getBoolean(KEY_DISMISS);
        mAutoDismiss = savedInstanceState.getBoolean(KEY_AUTO_DISMISS);
        mTitle = savedInstanceState.getString(KEY_TITLE);
        mOkResid = savedInstanceState.getInt(KEY_OK_RESID);
        mOkString = savedInstanceState.getString(KEY_OK_STRING);
        mOkColor = savedInstanceState.getInt(KEY_OK_COLOR);
        mCancelResid = savedInstanceState.getInt(KEY_CANCEL_RESID);
        mCancelString = savedInstanceState.getString(KEY_CANCEL_STRING);
        mCancelColor = savedInstanceState.getInt(KEY_CANCEL_COLOR);
        mVersion = (Version) savedInstanceState.getSerializable(KEY_VERSION);
        mTimezone = (TimeZone) savedInstanceState.getSerializable(KEY_TIMEZONE);
        mDateRangeLimiter = savedInstanceState.getParcelable(KEY_DATERANGELIMITER);

        /*//from w w w .  j  a  v a2  s  .  c  o  m
        If the user supplied a custom limiter, we need to create a new default one to prevent
        null pointer exceptions on the configuration methods
        If the user did not supply a custom limiter we need to ensure both mDefaultLimiter
        and mDateRangeLimiter are the same reference, so that the config methods actually
        ffect the behaviour of the picker (in the unlikely event the user reconfigures
        the picker when it is shown)
         */
        if (mDateRangeLimiter instanceof DefaultDateRangeLimiter) {
            mDefaultLimiter = (DefaultDateRangeLimiter) mDateRangeLimiter;
        } else {
            mDefaultLimiter = new DefaultDateRangeLimiter();
        }
    }

    mDefaultLimiter.setController(this);

    int viewRes = mVersion == Version.VERSION_1 ? R.layout.mdtp_date_picker_dialog
            : R.layout.mdtp_date_picker_dialog_v2;
    View view = inflater.inflate(viewRes, container, false);
    // All options have been set at this point: round the initial selection if necessary
    mCalendar = mDateRangeLimiter.setToNearestDate(mCalendar);

    mDatePickerHeaderView = (TextView) view.findViewById(R.id.mdtp_date_picker_header);
    mImageViewLeft = (ImageView) view.findViewById(R.id.imageViewLeft);
    mImageViewRight = (ImageView) view.findViewById(R.id.imageViewRight);
    mMonthAndDayView = (LinearLayout) view.findViewById(R.id.mdtp_date_picker_month_and_day);
    mMonthAndDayView.setOnClickListener(this);
    mSelectedMonthTextView = (TextView) view.findViewById(R.id.mdtp_date_picker_month);
    mSelectedDayTextView = (TextView) view.findViewById(R.id.mdtp_date_picker_day);
    mYearView = (TextView) view.findViewById(R.id.mdtp_date_picker_year);
    mYearView.setOnClickListener(this);
    mImageViewLeft.setOnClickListener(this);
    mImageViewRight.setOnClickListener(this);
    final Activity activity = getActivity();
    mDayPickerView = new SimpleDayPickerView(activity, this);
    mYearPickerView = new YearPickerView(activity, this);

    // if theme mode has not been set by java code, check if it is specified in Style.xml
    if (!mThemeDarkChanged) {
        mThemeDark = Utils.isDarkTheme(activity, mThemeDark);
    }

    Resources res = getResources();
    mDayPickerDescription = res.getString(R.string.mdtp_day_picker_description);
    mSelectDay = res.getString(R.string.mdtp_select_day);
    mYearPickerDescription = res.getString(R.string.mdtp_year_picker_description);
    mSelectYear = res.getString(R.string.mdtp_select_year);

    int bgColorResource = mThemeDark ? R.color.mdtp_date_picker_view_animator_dark_theme
            : R.color.mdtp_date_picker_view_animator;
    view.setBackgroundColor(ContextCompat.getColor(activity, bgColorResource));

    mAnimator = (AccessibleDateAnimator) view.findViewById(R.id.mdtp_animator);
    mAnimator.addView(mDayPickerView);
    mAnimator.addView(mYearPickerView);
    mAnimator.setDateMillis(mCalendar.getTimeInMillis());
    // TODO: Replace with animation decided upon by the design team.
    Animation animation = new AlphaAnimation(0.0f, 1.0f);
    animation.setDuration(ANIMATION_DURATION);
    mAnimator.setInAnimation(animation);
    // TODO: Replace with animation decided upon by the design team.
    Animation animation2 = new AlphaAnimation(1.0f, 0.0f);
    animation2.setDuration(ANIMATION_DURATION);
    mAnimator.setOutAnimation(animation2);

    Button okButton = (Button) view.findViewById(R.id.mdtp_ok);
    okButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            tryVibrate();
            notifyOnDateListener();
            dismiss();
        }
    });
    okButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium"));
    if (mOkString != null)
        okButton.setText(mOkString);
    else
        okButton.setText(mOkResid);

    Button cancelButton = (Button) view.findViewById(R.id.mdtp_cancel);
    cancelButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            tryVibrate();
            if (getDialog() != null)
                getDialog().cancel();
        }
    });
    cancelButton.setTypeface(TypefaceHelper.get(activity, "Roboto-Medium"));
    if (mCancelString != null)
        cancelButton.setText(mCancelString);
    else
        cancelButton.setText(mCancelResid);
    cancelButton.setVisibility(isCancelable() ? View.VISIBLE : View.GONE);

    // If an accent color has not been set manually, get it from the context
    if (mAccentColor == -1) {
        mAccentColor = Utils.getAccentColorFromThemeIfAvailable(getActivity());
    }
    if (mDatePickerHeaderView != null)
        mDatePickerHeaderView.setBackgroundColor(Utils.darkenColor(mAccentColor));
    view.findViewById(R.id.mdtp_day_picker_selected_date_layout).setBackgroundColor(mAccentColor);

    // Buttons can have a different color
    if (mOkColor != -1)
        okButton.setTextColor(mOkColor);
    else
        okButton.setTextColor(mAccentColor);
    if (mCancelColor != -1)
        cancelButton.setTextColor(mCancelColor);
    else
        cancelButton.setTextColor(mAccentColor);

    if (getDialog() == null) {
        view.findViewById(R.id.mdtp_done_background).setVisibility(View.GONE);
    }

    updateDisplay(false);
    setCurrentView(currentView);

    if (listPosition != -1) {
        if (currentView == MONTH_AND_DAY_VIEW) {
            mDayPickerView.postSetSelection(listPosition);
        } else if (currentView == YEAR_VIEW) {
            mYearPickerView.postSetSelectionFromTop(listPosition, listPositionOffset);
        }
    }

    mHapticFeedbackController = new HapticFeedbackController(activity);
    return view;
}

From source file:com.juick.android.MessagesFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final ViewConfiguration configuration = ViewConfiguration.get(getActivity());
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    databaseGetter = new Utils.ServiceGetter<DatabaseService>(getActivity(), DatabaseService.class);
    handler = new Handler();
    sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    trackLastRead = sp.getBoolean("lastReadMessages", true);
    alternativeLongClick = sp.getBoolean("alternativeLongClick", false);

    Bundle args = getArguments();

    if (args != null) {
        messagesSource = (MessagesSource) args.getSerializable("messagesSource");
    }/* w w w . j  a v  a 2s . c  o  m*/

    if (messagesSource == null)
        messagesSource = new JuickCompatibleURLMessagesSource(getActivity(), "dummy");
    if (messagesSource.getContext() == null)
        messagesSource.setContext(JuickAdvancedApplication.instance);
    mFlipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mFlipAnimation.setInterpolator(new LinearInterpolator());
    mFlipAnimation.setDuration(250);
    mFlipAnimation.setFillAfter(true);
    mReverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
    mReverseFlipAnimation.setDuration(250);
    mReverseFlipAnimation.setFillAfter(true);

    if (Build.VERSION.SDK_INT >= 8) {
        mScaleDetector = new ScaleGestureDetector(getActivity(), new ScaleListener());
    }

}