65  {
   66    setTitle(R.string.title_home);
   67    super.onCreate(savedInstanceState);
   68    setContentView(R.layout.home);
   69 
   70    mDecor = getWindow().getDecorView();
   71    mDecor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION |
   72                                 View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
   73 
   74    long heapSize = Runtime.getRuntime().maxMemory();
   75    Log.i(TAG, "Max HeapSize: " + heapSize);
   76    Log.i(TAG, "App data folder: " + getFilesDir().toString());
   77 
   78    
   79    sectionLabelBookmarks = getResources().getString(R.string.section_bookmarks);
   80 
   81    
   82    addBookmarkPlaceholder = new PlaceholderBookmark();
   83    addBookmarkPlaceholder.setName(ADD_BOOKMARK_PLACEHOLDER);
   84    addBookmarkPlaceholder.setLabel(
   85        getResources().getString(R.string.list_placeholder_add_bookmark));
   86 
   87    
   88    Intent caller = getIntent();
   89    Uri callParameter = caller.getData();
   90 
   91    if (Intent.ACTION_VIEW.equals(caller.getAction()) && callParameter != null)
   92    {
   93      String refStr = ConnectionReference.getFileReference(callParameter.getPath());
   94      Bundle bundle = new Bundle();
   95      bundle.putString(BookmarkActivity.PARAM_CONNECTION_REFERENCE, refStr);
   96 
   97      Intent bookmarkIntent =
   98          new Intent(this.getApplicationContext(), BookmarkActivity.class);
   99      bookmarkIntent.putExtras(bundle);
  100      startActivity(bookmarkIntent);
  101    }
  102 
  103    
  104    clearTextButton = findViewById(R.id.clear_search_btn);
  105    superBarEditText = findViewById(R.id.superBarEditText);
  106 
  107    listViewBookmarks = findViewById(R.id.listViewBookmarks);
  108 
  109    
  110    listViewBookmarks.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  111      public void onItemClick(AdapterView<?> parent, View view, int position, long id)
  112      {
  113        String curSection = separatedListAdapter.getSectionForPosition(position);
  114        Log.v(TAG, "Clicked on item id " + separatedListAdapter.getItemId(position) +
  115                       " in section " + curSection);
  116        if (curSection.equals(sectionLabelBookmarks))
  117        {
  118          String refStr = view.getTag().toString();
  119          if (ConnectionReference.isManualBookmarkReference(refStr) ||
  120              ConnectionReference.isHostnameReference(refStr))
  121          {
  122            Bundle bundle = new Bundle();
  123            bundle.putString(SessionActivity.PARAM_CONNECTION_REFERENCE, refStr);
  124 
  125            Intent sessionIntent = new Intent(view.getContext(), SessionActivity.class);
  126            sessionIntent.putExtras(bundle);
  127            startActivity(sessionIntent);
  128 
  129            
  130            superBarEditText.setText("");
  131            superBarEditText.clearFocus();
  132          }
  133          else if (ConnectionReference.isPlaceholderReference(refStr))
  134          {
  135            
  136            if (ConnectionReference.getPlaceholder(refStr).equals(
  137                    ADD_BOOKMARK_PLACEHOLDER))
  138            {
  139              Intent bookmarkIntent =
  140                  new Intent(view.getContext(), BookmarkActivity.class);
  141              startActivity(bookmarkIntent);
  142            }
  143          }
  144        }
  145      }
  146    });
  147 
  148    listViewBookmarks.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
  149      @Override
  150      public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
  151      {
  152        
  153        
  154        View itemView = ((AdapterContextMenuInfo)menuInfo).targetView;
  155        String refStr = itemView.getTag() != null ? itemView.getTag().toString() : null;
  156        if (refStr != null && !ConnectionReference.isHostnameReference(refStr) &&
  157            !ConnectionReference.isPlaceholderReference(refStr))
  158        {
  159          getMenuInflater().inflate(R.menu.bookmark_context_menu, menu);
  160          menu.setHeaderTitle(getResources().getString(R.string.menu_title_bookmark));
  161        }
  162      }
  163    });
  164 
  165    superBarEditText.addTextChangedListener(new SuperBarTextWatcher());
  166 
  167    clearTextButton.setOnClickListener(new OnClickListener() {
  168      @Override public void onClick(View v)
  169      {
  170        superBarEditText.setText("");
  171      }
  172    });
  173  }