Example usage for android.support.v4.widget CursorAdapter FLAG_REGISTER_CONTENT_OBSERVER

List of usage examples for android.support.v4.widget CursorAdapter FLAG_REGISTER_CONTENT_OBSERVER

Introduction

In this page you can find the example usage for android.support.v4.widget CursorAdapter FLAG_REGISTER_CONTENT_OBSERVER.

Prototype

int FLAG_REGISTER_CONTENT_OBSERVER

To view the source code for android.support.v4.widget CursorAdapter FLAG_REGISTER_CONTENT_OBSERVER.

Click Source Link

Document

If set the adapter will register a content observer on the cursor and will call #onContentChanged() when a notification comes in.

Usage

From source file:com.pixplicity.wizardpager.wizard.ui.SingleChoiceCursorFragment.java

@Override
public ListAdapter getAdapter() {
    final SingleFixedChoiceCursorPage fixedChoicePage = (SingleFixedChoiceCursorPage) mPage;
    Cursor cursor = fixedChoicePage.getCursor();
    FragmentActivity activity = getActivity();
    if (cursor == null || activity == null) {
        mSingleChoiceCursorAdapter = null;
    } else if (mSingleChoiceCursorAdapter == null) {
        mSingleChoiceCursorAdapter = new SingleChoiceCursorAdapter(activity, cursor,
                fixedChoicePage.getColumnNameId(), fixedChoicePage.getColumnNameValue(),
                fixedChoicePage.getValue(), CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
    } else {/*from w  w  w . ja  va2s  .c o  m*/
        mSingleChoiceCursorAdapter.swapCursor(cursor);
    }
    return mSingleChoiceCursorAdapter;
}

From source file:cm.aptoide.pt.ScheduledDownloads.java

private void continueLoading() {
    lv = (ListView) findViewById(android.R.id.list);
    db = Database.getInstance();//from   w  w  w  .  j ava2s.  c o m

    adapter = new CursorAdapter(this, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER) {

        @Override
        public View newView(Context context, Cursor arg1, ViewGroup arg2) {
            return LayoutInflater.from(context).inflate(R.layout.row_sch_download, null);
        }

        @Override
        public void bindView(View convertView, Context arg1, Cursor c) {
            // Planet to display
            ScheduledDownload scheduledDownload = scheduledDownloadsHashMap.get(c.getString(0));

            // The child views in each row.
            CheckBox checkBoxScheduled;
            TextView textViewName;
            TextView textViewVersion;
            ImageView imageViewIcon;

            // Create a new row view
            if (convertView.getTag() == null) {

                // Find the child views.
                textViewName = (TextView) convertView.findViewById(R.id.name);
                textViewVersion = (TextView) convertView.findViewById(R.id.appversion);
                checkBoxScheduled = (CheckBox) convertView.findViewById(R.id.schDwnChkBox);
                imageViewIcon = (ImageView) convertView.findViewById(R.id.appicon);
                // Optimization: Tag the row with it's child views, so we don't have to
                // call findViewById() later when we reuse the row.
                convertView.setTag(new Holder(textViewName, textViewVersion, checkBoxScheduled, imageViewIcon));

                // If CheckBox is toggled, update the planet it is tagged with.
                checkBoxScheduled.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        CheckBox cb = (CheckBox) v;
                        ScheduledDownload schDownload = (ScheduledDownload) cb.getTag();
                        schDownload.setChecked(cb.isChecked());
                    }
                });
            }
            // Reuse existing row view
            else {
                // Because we use a ViewHolder, we avoid having to call findViewById().
                Holder viewHolder = (Holder) convertView.getTag();
                checkBoxScheduled = viewHolder.checkBoxScheduled;
                textViewVersion = viewHolder.textViewVersion;
                textViewName = viewHolder.textViewName;
                imageViewIcon = viewHolder.imageViewIcon;
            }

            // Tag the CheckBox with the Planet it is displaying, so that we can
            // access the planet in onClick() when the CheckBox is toggled.
            checkBoxScheduled.setTag(scheduledDownload);

            // Display planet data
            checkBoxScheduled.setChecked(scheduledDownload.isChecked());
            textViewName.setText(scheduledDownload.getName());
            textViewVersion.setText(scheduledDownload.getVername());

            // Tag the CheckBox with the Planet it is displaying, so that we can
            // access the planet in onClick() when the CheckBox is toggled.
            checkBoxScheduled.setTag(scheduledDownload);

            // Display planet data
            checkBoxScheduled.setChecked(scheduledDownload.isChecked());
            textViewName.setText(scheduledDownload.getName());
            textViewVersion.setText("" + scheduledDownload.getVername());

            ImageLoader.getInstance().displayImage(scheduledDownload.getIconPath(), imageViewIcon);

        }
    };
    lv.setAdapter(adapter);
    getSupportLoaderManager().initLoader(0, null, this);
    lv.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View item, int arg2, long arg3) {
            ScheduledDownload scheduledDownload = (ScheduledDownload) ((Holder) item.getTag()).checkBoxScheduled
                    .getTag();
            scheduledDownload.toggleChecked();
            Holder viewHolder = (Holder) item.getTag();
            viewHolder.checkBoxScheduled.setChecked(scheduledDownload.isChecked());
        }
    });
    IntentFilter filter = new IntentFilter("pt.caixamagica.aptoide.REDRAW");
    registerReceiver(receiver, filter);
    Button installButton = (Button) findViewById(R.id.sch_down);
    //      installButton.setText(getText(R.string.schDown_installselected));
    installButton.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {
            if (isAllChecked()) {
                for (String scheduledDownload : scheduledDownloadsHashMap.keySet()) {
                    if (scheduledDownloadsHashMap.get(scheduledDownload).checked) {
                        ScheduledDownload schDown = scheduledDownloadsHashMap.get(scheduledDownload);
                        ViewApk apk = new ViewApk();
                        apk.setApkid(schDown.getApkid());
                        apk.setName(schDown.getName());
                        apk.setVercode(schDown.getVercode());
                        apk.setIconPath(schDown.getIconPath());
                        apk.setVername(schDown.getVername());
                        apk.setRepoName(schDown.getRepoName());

                        serviceDownloadManager
                                .startDownloadWithWebservice(serviceDownloadManager.getDownload(apk), apk);
                        Toast toast = Toast.makeText(ScheduledDownloads.this, R.string.starting_download,
                                Toast.LENGTH_SHORT);
                        toast.show();
                    }
                }

            } else {
                Toast toast = Toast.makeText(ScheduledDownloads.this, R.string.schDown_nodownloadselect,
                        Toast.LENGTH_SHORT);
                toast.show();
            }
        }
    });
    if (getIntent().hasExtra("downloadAll")) {

        Builder dialogBuilder = new AlertDialog.Builder(this);
        final AlertDialog scheduleDownloadDialog = dialogBuilder.create();
        scheduleDownloadDialog.setTitle(getText(R.string.schDwnBtn));
        scheduleDownloadDialog.setIcon(android.R.drawable.ic_dialog_alert);
        scheduleDownloadDialog.setCancelable(false);

        scheduleDownloadDialog.setMessage(getText(R.string.schDown_install));
        scheduleDownloadDialog.setButton(Dialog.BUTTON_POSITIVE, getString(android.R.string.yes),
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        for (String scheduledDownload : scheduledDownloadsHashMap.keySet()) {
                            ScheduledDownload schDown = scheduledDownloadsHashMap.get(scheduledDownload);
                            ViewApk apk = new ViewApk();
                            apk.setApkid(schDown.getApkid());
                            apk.setName(schDown.getName());
                            apk.setVercode(schDown.getVercode());
                            apk.setIconPath(schDown.getIconPath());
                            apk.setVername(schDown.getVername());
                            apk.setRepoName(schDown.getRepoName());
                            serviceDownloadManager
                                    .startDownloadWithWebservice(serviceDownloadManager.getDownload(apk), apk);
                            Toast toast = Toast.makeText(ScheduledDownloads.this, R.string.starting_download,
                                    Toast.LENGTH_SHORT);
                            toast.show();
                        }
                        finish();

                    }
                });
        scheduleDownloadDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(android.R.string.no),
                new Dialog.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface arg0, int arg1) {
                        finish();

                    }
                });
        scheduleDownloadDialog.show();
    }
}

From source file:com.dabay6.android.apps.carlog.ui.fuel.fragments.FuelHistoryListFragment.java

/**
 * {@inheritDoc}//w  w  w .j a v a  2s.  c o m
 */
@Override
protected BaseCheckableCursorAdapter createListAdapter(final Bundle savedInstanceState) {
    if (AndroidUtils.isAtLeastHoneycomb()) {
        return new FuelHistoryCursorAdapter(applicationContext, savedInstanceState, null,
                CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
    } else {
        return new FuelHistoryCursorAdapter(applicationContext, savedInstanceState, null);
    }
}

From source file:eu.chainfire.geolog.ui.LogsFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(preferenceReceiver,
            new IntentFilter(SettingsFragment.NOTIFY_BROADCAST));

    getListView().setSelector(android.R.color.transparent);

    setEmptyText(getResources().getString(R.string.logs_empty));
    setListShown(false);//w  w w.  j a v  a2s.c  om

    getLoaderManager().initLoader(LIST_LOADER, null, this);
    adapter = new CursorAdapter(getActivity(), null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER) {
        private LayoutInflater inflater = null;
        private Database.Location location = null;

        private String formatTime = null;
        private String formatActivity = null;
        private String formatLocation = null;
        private String formatBattery = null;
        private boolean lastMetric = true;

        private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ",
                Locale.ENGLISH);

        @Override
        public View newView(Context context, Cursor cursor, ViewGroup root) {
            if (inflater == null)
                inflater = LayoutInflater.from(context);
            return inflater.inflate(R.layout.row_logs, null);
        }

        @SuppressWarnings("deprecation")
        @Override
        public void bindView(View view, Context context, Cursor cursor) {
            ViewHolder holder = (ViewHolder) view.getTag();
            if (holder == null) {
                holder = new ViewHolder();
                holder.container = view.findViewById(R.id.container);
                holder.time = (TextView) view.findViewById(R.id.time);
                holder.activity = (TextView) view.findViewById(R.id.activity);
                holder.location = (TextView) view.findViewById(R.id.location);
                view.setTag(holder);
            }

            if (location == null)
                location = new Database.Location();
            location.loadFromCursor(cursor);

            if (formatTime == null)
                formatTime = context.getString(R.string.row_logs_time);
            if (formatActivity == null)
                formatActivity = context.getString(R.string.row_logs_activity);
            if (formatBattery == null)
                formatBattery = context.getString(R.string.row_logs_battery);
            if ((formatLocation == null) || (metric != lastMetric)) {
                if (metric) {
                    formatLocation = context.getString(R.string.row_logs_location_metric);
                } else {
                    formatLocation = context.getString(R.string.row_logs_location_imperial);
                }
                lastMetric = metric;
            }

            float accuracy = location.getAccuracyDistance();
            if (!metric)
                accuracy *= SettingsFragment.METER_FEET_RATIO;

            if (location.isSegmentStart()) {
                holder.container.setBackgroundColor(0xFFa8dff4);
            } else {
                holder.container.setBackgroundDrawable(null);
            }

            holder.time.setText(Html.fromHtml(String.format(Locale.ENGLISH, formatTime,
                    simpleDateFormat.format(new Date(location.getTime())))));
            holder.activity.setText(Html.fromHtml(String.format(Locale.ENGLISH, formatActivity,
                    Database.activityToString(location.getActivity()), location.getConfidence())
                    + " "
                    + String.format(Locale.ENGLISH, formatBattery,
                            (location.getBattery() > 100) ? location.getBattery() - 100 : location.getBattery(),
                            (location.getBattery() > 100) ? "+" : "")));
            holder.location.setText(Html.fromHtml(String.format(Locale.ENGLISH, formatLocation,
                    location.getLatitude(), location.getLongitude(), accuracy)));
        }
    };
    setListAdapter(adapter);
}

From source file:com.aptoide.amethyst.ui.ScheduledDownloadsActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    //Aptoide.getThemePicker().setAptoideTheme(this);
    super.onCreate(savedInstanceState);

    setContentView(getContentView());/* w w w .  ja v a  2 s.co  m*/
    bindViews();

    mToolbar.setCollapsible(false);
    setSupportActionBar(mToolbar);

    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(true);
    getSupportActionBar().setTitle(getString(R.string.setting_schdwntitle));

    lv = (ListView) findViewById(android.R.id.list);
    lv.setDivider(null);
    db = new AptoideDatabase(Aptoide.getDb());
    bindService(new Intent(this, DownloadService.class), conn, Context.BIND_AUTO_CREATE);

    adapter = new CursorAdapter(this, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER) {

        @Override
        public View newView(Context context, Cursor arg1, ViewGroup arg2) {
            return LayoutInflater.from(context).inflate(R.layout.row_sch_download, null);
        }

        @Override
        public void bindView(View convertView, Context arg1, Cursor c) {
            ScheduledDownload scheduledDownload = scheduledDownloadsMap.get(c.getLong(c.getColumnIndex("_id")));

            // The child views in each row.
            CheckBox checkBoxScheduled;
            TextView textViewName;
            TextView textViewVersion;
            ImageView imageViewIcon;

            if (convertView.getTag() == null) {
                textViewName = (TextView) convertView.findViewById(R.id.name);
                textViewVersion = (TextView) convertView.findViewById(R.id.appversion);
                checkBoxScheduled = (CheckBox) convertView.findViewById(R.id.schDwnChkBox);
                imageViewIcon = (ImageView) convertView.findViewById(R.id.appicon);
                convertView.setTag(new Holder(textViewName, textViewVersion, checkBoxScheduled, imageViewIcon));

                checkBoxScheduled.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        CheckBox cb = (CheckBox) v;
                        ScheduledDownload schDownload = (ScheduledDownload) cb.getTag();
                        schDownload.setChecked(cb.isChecked());
                    }
                });
            }
            // Reuse existing row view
            else {
                // Because we use a ViewHolder, we avoid having to call findViewById().
                Holder viewHolder = (Holder) convertView.getTag();
                checkBoxScheduled = viewHolder.checkBoxScheduled;
                textViewVersion = viewHolder.textViewVersion;
                textViewName = viewHolder.textViewName;
                imageViewIcon = viewHolder.imageViewIcon;
            }

            // Tag the CheckBox with the Planet it is displaying, so that we can
            // access the planet in onClick() when the CheckBox is toggled.
            checkBoxScheduled.setTag(scheduledDownload);

            // Display planet data
            checkBoxScheduled.setChecked(scheduledDownload.isChecked());
            textViewName.setText(scheduledDownload.getName());
            textViewVersion.setText(scheduledDownload.getVersion_name());

            Glide.with(ScheduledDownloadsActivity.this).load(scheduledDownload.getIcon()).into(imageViewIcon);
        }
    };

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

    lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View item, int arg2, long arg3) {
            ScheduledDownload scheduledDownload = (ScheduledDownload) ((Holder) item.getTag()).checkBoxScheduled
                    .getTag();
            scheduledDownload.toggleChecked();
            Holder viewHolder = (Holder) item.getTag();
            viewHolder.checkBoxScheduled.setChecked(scheduledDownload.isChecked());
        }

    });

    if (getIntent().hasExtra(ARG_DOWNLOAD_ALL)) {
        ScheduledDownloadsDialog pd = new ScheduledDownloadsDialog();
        pd.show(getSupportFragmentManager(), "installAllScheduled");
    }

    lv.setAdapter(adapter);
}

From source file:com.dabay6.android.apps.carlog.ui.base.BaseNavigationVehicleSelectorActivity.java

/**
 * {@inheritDoc}//from   w  ww  .  j  av  a 2  s  .  c om
 */
@Override
protected void onConfigureActionBar() {
    final ActionBar actionBar = getSupportActionBar();
    final Context context = actionBar.getThemedContext();

    super.onConfigureActionBar();

    if (AndroidUtils.isAtLeastHoneycomb()) {
        adapter = new DualLineCursorAdapter(context, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
    } else {
        adapter = new DualLineCursorAdapter(context, null);
    }

    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    adapter.setTitle(string.fuel_history);

    actionBar.setListNavigationCallbacks(adapter, this);
}

From source file:com.yanzhenjie.searchview.sample.SearchActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_main, menu);
    mSearchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_action_user_search));
    Utils.setSearchViewCursorColor(mSearchView, R.drawable.text_cursor_white);
    mSearchView.setSubmitButtonEnabled(true);
    mSearchView.setQueryHint(getText(R.string.title_search_user_hint));
    mSearchView.setOnQueryTextListener(mOnQueryTextListener);

    // Can not exit to icon.
    // mSearchView.setOnCloseListener(() -> TextUtils.isEmpty(mSearchView.getQuery()));

    // Automatic expansion.
    //        mSearchView.setIconified(false);
    //        mSearchView.setIconifiedByDefault(true);

    mSearchView.setOnSuggestionListener(mSuggestionListener);
    SearchableInfo searchableInfo = ((SearchManager) getSystemService(Context.SEARCH_SERVICE))
            .getSearchableInfo(getComponentName());
    mSearchView.setSearchableInfo(searchableInfo);

    mCursorAdapter = new SimpleCursorAdapter(this, R.layout.item_text_list_popup, null,
            new String[] { UserSearchProvider.ProviderInfo.USER_NAME,
                    UserSearchProvider.ProviderInfo.USER_DES },
            new int[] { R.id.tv_item_list, R.id.tv_item_list_des },
            CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
    mSearchView.setSuggestionsAdapter(mCursorAdapter);

    getSupportLoaderManager().initLoader(CURSOR_LOADER_ID, null, mLoaderCallbacks);
    return true;/*from w  w  w . j  ava2s. c  om*/
}

From source file:com.iaraby.template.view.fragment.ListFrag.java

private void populateList() {

    String[] from = null;//from  www .j  a v a  2 s  .c  om
    if (isFav) {
        from = new String[] { Beans.Favorite.COL_TITLE };
    } else {
        from = new String[] { Beans.Category.COL_NAME };
    } //check if fav or list
    int[] to = { R.id.list_item_text };
    int layoutId = R.layout.list_item;
    if (Preferences.getInstance(getActivity()).isRTL())
        layoutId = R.layout.list_item_right;

    getLoaderManager().initLoader(1, null, this);
    adapter = new SimpleCursorAdapter(getActivity(), layoutId, null, from, to,
            CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
    adapter.setViewBinder(new Binder());
    setListAdapter(adapter);
    adapter.notifyDataSetChanged();
}

From source file:com.luboganev.dejalist.ui.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Views.inject(this);

    mTitle = mDrawerTitle = getTitle();/*w ww .jav a  2 s  .c om*/

    // set a custom shadow that overlays the main content when the drawer opens
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

    mAdapter = new NavigationCursorAdapter(getApplicationContext(),
            CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER, onAddCategoryListener);
    mDrawerList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
    mDrawerList.setAdapter(mAdapter);

    if (savedInstanceState == null) {
        selectItem(NavigationCursorAdapter.POSITION_CHECKLIST);
    } else {
        mStateSelectedNavigationPosition = savedInstanceState.getInt(STATE_SELECTED_NAVIGATION, -1);
    }

    if (getSupportLoaderManager().getLoader(LOADER_NAVIGATION_ID) != null) {
        getSupportLoaderManager().restartLoader(LOADER_NAVIGATION_ID, null, this);
    } else {
        getSupportLoaderManager().initLoader(LOADER_NAVIGATION_ID, null, this);
    }

    // set up the drawer's list view with items and click listener
    //        mDrawerList.setAdapter(new ArrayAdapter<String>(this,
    //                R.layout.drawer_list_item, mPlanetTitles));

    mDrawerList.setOnItemClickListener(new DrawerItemClickListener());

    // enable ActionBar app icon to behave as action to toggle nav drawer
    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);

    // ActionBarDrawerToggle ties together the the proper interactions
    // between the sliding drawer and the action bar app icon
    mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */
            mDrawerLayout, /* DrawerLayout object */
            R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */
            R.string.drawer_open, /* "open drawer" description for accessibility */
            R.string.drawer_close /* "close drawer" description for accessibility */
    ) {
        public void onDrawerClosed(View view) {
            getActionBar().setTitle(mTitle);
            if (mProductsGalleryActionTaker != null)
                mProductsGalleryActionTaker.setOptionMenuItemsVisible(true);
            if (mChecklistActionTaker != null)
                mChecklistActionTaker.setOptionMenuItemsVisible(true);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }

        public void onDrawerOpened(View drawerView) {
            getActionBar().setTitle(mDrawerTitle);
            if (mProductsGalleryActionTaker != null)
                mProductsGalleryActionTaker.setOptionMenuItemsVisible(false);
            if (mChecklistActionTaker != null)
                mChecklistActionTaker.setOptionMenuItemsVisible(false);
            invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu()
        }
    };
    mDrawerLayout.setDrawerListener(mDrawerToggle);
    mUndoBarController = new UndoBarController(findViewById(R.id.undobar), this);
}

From source file:com.nextgis.ngm_clink_monitoring.fragments.ObjectListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    MainActivity activity = (MainActivity) getActivity();
    View view = inflater.inflate(R.layout.fragment_object_list, null);

    mLineName = (TextView) view.findViewById(R.id.line_name_ls);
    mObjectListCaption = (TextView) view.findViewById(R.id.object_list_caption_ls);
    mObjectList = (ListView) view.findViewById(R.id.object_list_ls);

    String toolbarTitle = "";

    switch (mFoclStructLayerType) {
    case FoclConstants.LAYERTYPE_FOCL_OPTICAL_CABLE:
        toolbarTitle = activity.getString(R.string.cable_laying);
        mObjectListCaption.setText(R.string.select_optical_cables_colon);
        break;/*  w  w w  .j  a  v a2 s  . c  o m*/

    case FoclConstants.LAYERTYPE_FOCL_FOSC:
        toolbarTitle = activity.getString(R.string.fosc_mounting);
        mObjectListCaption.setText(R.string.select_fosc_colon);
        break;

    case FoclConstants.LAYERTYPE_FOCL_OPTICAL_CROSS:
        toolbarTitle = activity.getString(R.string.cross_mounting);
        mObjectListCaption.setText(R.string.select_cross_colon);
        break;

    case FoclConstants.LAYERTYPE_FOCL_ACCESS_POINT:
        toolbarTitle = activity.getString(R.string.access_point_mounting);
        mObjectListCaption.setText(R.string.select_access_points_colon);
        break;

    case FoclConstants.LAYERTYPE_FOCL_UNKNOWN:
        // TODO: for FoclConstants.LAYERTYPE_FOCL_UNKNOWN
        break;
    }

    activity.setBarsView(toolbarTitle);

    GISApplication app = (GISApplication) getActivity().getApplication();
    final FoclProject foclProject = app.getFoclProject();

    if (null == foclProject) {
        setBlockedView();
        return view;
    }

    FoclStruct foclStruct;
    try {
        foclStruct = (FoclStruct) foclProject.getLayer(mLineId);
    } catch (Exception e) {
        foclStruct = null;
    }

    if (null == foclStruct) {
        setBlockedView();
        return view;
    }

    FoclVectorLayer layer = (FoclVectorLayer) foclStruct.getLayerByFoclType(mFoclStructLayerType);

    if (null == layer) {
        setBlockedView();
        return view;
    }

    mLineName.setText(Html.fromHtml(foclStruct.getHtmlFormattedNameTwoStringsSmall()));
    mObjectLayerName = layer.getPath().getName();

    Uri uri = Uri.parse("content://" + FoclSettingsConstantsUI.AUTHORITY + "/" + mObjectLayerName);

    String proj[] = { FIELD_ID, FoclConstants.FIELD_NAME, FoclConstants.FIELD_STATUS_BUILT };

    try {
        mAdapterCursor = getActivity().getContentResolver().query(uri, proj, null, null, null);

    } catch (Exception e) {
        Log.d(TAG, e.getLocalizedMessage());
        mAdapterCursor = null;
    }

    if (null != mAdapterCursor && mAdapterCursor.getCount() > 0) {
        mObjectList.setEnabled(true);
    } else {
        setBlockedView();
        return view;
    }

    ObjectCursorAdapter cursorAdapter = new ObjectCursorAdapter(getActivity(), mAdapterCursor,
            CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);

    mObjectList.setAdapter(cursorAdapter);
    mObjectList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Cursor cursor = (Cursor) mObjectList.getAdapter().getItem(position);
            mObjectId = cursor.getLong(cursor.getColumnIndex(FIELD_ID));
            cursor.close();
            onObjectClick();
        }
    });

    return view;
}