@Override
 public void gDriveConnected(final boolean connected, final boolean canceled) {
   mPullToRefreshLayout.setRefreshing(false);
   if (connected) {
     statusText.setText(R.string.gDriveConnected);
     gDrive.getListOfBackups(GDriveBackupsAdapter);
   } else if (gDrive.isError()) {
     GDriveBackupsAdapter.clear();
     statusText.setText(gDrive.getErrorMessage());
   } else {
     GDriveBackupsAdapter.clear();
     statusText.setText(R.string.gDriveDisconnected);
   }
   getActivity().invalidateOptionsMenu();
 }
 @Override
 public void onPause() {
   GDriveBackupsAdapter.clear();
   gDrive.onStop();
   gDrive.setObserver(null);
   super.onPause();
 }
  @Override
  public boolean onMenuItemClick(MenuItem menuItem) {
    final Metadata item = GDriveBackupsAdapter.getItem(clickedPosition);

    switch (menuItem.getItemId()) {
      case R.id.menu_gDrive_remove:
        {
          gDrive.deleteBackup(
              item,
              new GDriveRemoveTask.DoneSuccess() {
                @Override
                public void done() {
                  gDrive.getListOfBackups(GDriveBackupsAdapter);
                }
              });
          return true;
        }
      case R.id.menu_gDrive_restore:
        {
          gDrive.restoreBackup(item.getDriveId());
          return true;
        }
    }
    return false;
  }
 private void enableGDrive(boolean enable) {
   if (enable) {
     gDrive.setObserver(this);
     gDrive.onStart(MainActivity.instance);
   } else {
     GDriveBackupsAdapter.clear();
     gDrive.onStop();
     gDrive.resetAccount();
   }
 }