/** * Activity ** */
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GlobalManager.setCustomContentView(this, R.layout.review_manager);
    findViewById(R.id.title_bar_text).setVisibility(View.GONE);

    // DB work
    try {
      databaseManager = GlobalFactory.getDatabaseManagerByLanguage(this);
      databaseManager.openDatabase();
    } catch (IOException e) {
      e.printStackTrace();
    }

    // Project verse list view and Butotn Setting

    reveiwManagerListView = (ListView) findViewById(R.id.review_manager_list_view);

    Button backButton = (Button) findViewById(R.id.review_manager_back_button);
    backButton.setOnClickListener(this);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GlobalManager.setCustomContentView(this, R.layout.verse_chooser);

    // DB work

    try {
      databaseManager = GlobalFactory.getDatabaseManagerByLanguage(this);
      databaseManager.openDatabase();
    } catch (IOException e1) {
      e1.printStackTrace();
    }

    // Get Intent from previous Activity as a bundle form.
    // Intent includes the activity information.

    Bundle extras = getIntent().getExtras();
    projectId = extras.getInt(GlobalVariable.PROJECT_ID);
    boolean memorize = extras.getBoolean(GlobalVariable.MEMORIZE);
    boolean project = extras.getBoolean(GlobalVariable.PROJECT);

    // Find Wheel view resources

    bookWheel = (WheelView) findViewById(R.id.verse_chooser_wheel_book);
    chapterWheel = (WheelView) findViewById(R.id.verse_chooser_wheel_chapter);
    verseWheel = (WheelView) findViewById(R.id.verse_chooser_wheel_verse);

    // Buttons Setting
    // This Activity decides which buttons will be shown
    // by Activity information got from previous Activity intent.

    Button backbutton = (Button) findViewById(R.id.verse_chooser_back_button);
    backbutton.setOnClickListener(
        new Button.OnClickListener() {
          public void onClick(View v) {
            finish();
          }
        });

    // if the previous Activity is MainAct, hide add project button.
    // Hide Title Text

    if (memorize) {
      Button button = (Button) findViewById(R.id.verse_chooser_add_verse_to_project_button);
      button.setVisibility(View.GONE);

      Button memorizeButton = (Button) findViewById(R.id.verse_chooser_memorize_button);
      memorizeButton.setOnClickListener(
          new Button.OnClickListener() {
            public void onClick(View v) {
              startActivityChooser();
            }
          });
    }

    // if the previous Activity is Project, hide memorize button.
    // Set title text with project name

    else if (project) {
      Button button = (Button) findViewById(R.id.verse_chooser_memorize_button);
      button.setVisibility(View.GONE);

      Button addVerseToProjectBtn =
          (Button) findViewById(R.id.verse_chooser_add_verse_to_project_button);
      addVerseToProjectBtn.setOnClickListener(
          new Button.OnClickListener() {
            public void onClick(View v) {
              addVerseThisVerse();
            }
          });

      backbutton.setText(getResources().getString(R.string.done_label));
    }

    // Get Book List
    // Book Widget List Setting
    // Wheel Event Setting

    books = databaseManager.getBookList();
    bookWheel.setViewAdapter(new BookAdapter(this, books));

    chapterWheel.addScrollingListener(
        new OnWheelScrollListener() {
          public void onScrollingStarted(WheelView wheel) {}

          public void onScrollingFinished(WheelView wheel) {
            if (!VerseChooserAct.this.isFinishing())
              updateVerseWheel(
                  verseWheel, Integer.valueOf(bookWheel.getCurrentItem()), wheel.getCurrentItem());
          }
        });

    bookWheel.addScrollingListener(
        new OnWheelScrollListener() {
          public void onScrollingStarted(WheelView wheel) {}

          public void onScrollingFinished(WheelView wheel) {
            if (!VerseChooserAct.this.isFinishing()) {
              updateChapterWheel(chapterWheel, books.get(wheel.getCurrentItem()).getChapterCount());
              updateVerseWheel(
                  verseWheel,
                  wheel.getCurrentItem(),
                  Integer.valueOf(chapterWheel.getCurrentItem()));
            }
          }
        });
  }