团队冲刺第二阶段01

徐姣美:今天计划完善密码设置的内容,完成了密码设置的布局。较第一阶段的内容添加了密保问题。

代码:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:pixlui="http://schemas.android.com/apk/com.neopixl.pixlui"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ScrollView
        android:id="@+id/password_root"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="@dimen/activity_horizontal_margin"
        android:scrollbarSize="4dp"
        android:scrollbarStyle="outsideOverlay"
        android:scrollbarThumbVertical="@drawable/scroll_bar">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <com.neopixl.pixlui.components.textview.TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/settings_password_instructions"
                android:textColor="@color/text_gray"
                android:textSize="15sp"
                pixlui:typeface="Roboto-Regular.ttf" />

            <EditText
                android:id="@+id/password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:gravity="center_horizontal"
                android:hint="@string/insert_new_password"
                android:inputType="textPassword"
                style="@style/Text.Normal" />

            <EditText
                android:id="@+id/password_check"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:gravity="center_horizontal"
                android:hint="@string/confirm_new_password"
                android:inputType="textPassword"
                style="@style/Text.Normal" />

            <com.neopixl.pixlui.components.textview.TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="20dp"
                android:text="@string/settings_password_question_instructions"
                android:textColor="@color/text_gray"
                android:textSize="15sp"
                pixlui:typeface="Roboto-Regular.ttf" />

            <EditText
                android:id="@+id/question"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="16dp"
                android:gravity="center_horizontal"
                android:singleLine="true"
                android:hint="@string/settings_password_question"
                style="@style/Text.Normal" />

            <EditText
                android:id="@+id/answer"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:gravity="center_horizontal"
                android:hint="@string/settings_password_answer"
                android:inputType="textPassword"
                style="@style/Text.Normal" />

            <EditText
                android:id="@+id/answer_check"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:gravity="center_horizontal"
                android:hint="@string/settings_password_answer_check"
                android:inputType="textPassword"
                style="@style/Text.Normal" />

            <include layout="@layout/password_buttons" />

        </LinearLayout>

    </ScrollView>

    <include
        android:id="@+id/crouton_handle"
        layout="@layout/crouton_handle" />

</RelativeLayout>

深澳宇:今天做了关于分类的添加修改移除在数据库中的操作。

代码:

  public ArrayList<Category> getCategories () {
    ArrayList<Category> categoriesList = new ArrayList<>();
    String sql = "SELECT "
        + KEY_CATEGORY_ID + ","
        + KEY_CATEGORY_NAME + ","
        + KEY_CATEGORY_DESCRIPTION + ","
        + KEY_CATEGORY_COLOR + ","
        + " COUNT(" + KEY_ID + ") count"
        + " FROM " + TABLE_CATEGORY
        + " LEFT JOIN ("
        + " SELECT " + KEY_ID + ", " + KEY_CATEGORY
        + " FROM " + TABLE_NOTES
        + " WHERE " + KEY_TRASHED + " IS NOT 1"
        + ") USING( " + KEY_CATEGORY + ") "
        + " GROUP BY "
        + KEY_CATEGORY_ID + ","
        + KEY_CATEGORY_NAME + ","
        + KEY_CATEGORY_DESCRIPTION + ","
        + KEY_CATEGORY_COLOR
        + " ORDER BY IFNULL(NULLIF(" + KEY_CATEGORY_NAME + ", ''),'zzzzzzzz') ";

    Cursor cursor = null;
    try {
      cursor = getDatabase().rawQuery(sql, null);
      // Looping through all rows and adding to list
      if (cursor.moveToFirst()) {
        do {
          categoriesList.add(new Category(cursor.getLong(0),
              cursor.getString(1), cursor.getString(2), cursor
              .getString(3), cursor.getInt(4)));
        } while (cursor.moveToNext());
      }

    } finally {
      if (cursor != null) {
        cursor.close();
      }
    }
    return categoriesList;
  }


  /**
   * Updates or insert a new a category
   *
   * @param category Category to be updated or inserted
   * @return Rows affected or new inserted category ID
   */
  public Category updateCategory (Category category) {
    ContentValues values = new ContentValues();
    values.put(KEY_CATEGORY_ID, category.getId() != null ? category.getId() : Calendar.getInstance()
                                                                                      .getTimeInMillis());
    values.put(KEY_CATEGORY_NAME, category.getName());
    values.put(KEY_CATEGORY_DESCRIPTION, category.getDescription());
    values.put(KEY_CATEGORY_COLOR, category.getColor());
    getDatabase(true).insertWithOnConflict(TABLE_CATEGORY, KEY_CATEGORY_ID, values, SQLiteDatabase
        .CONFLICT_REPLACE);
    return category;
  }


  /**
   * Deletion of  a category
   *
   * @param category Category to be deleted
   * @return Number 1 if category's record has been deleted, 0 otherwise
   */
  public long deleteCategory (Category category) {
    long deleted;

    SQLiteDatabase db = getDatabase(true);
    // Un-categorize notes associated with this category
    ContentValues values = new ContentValues();
    values.put(KEY_CATEGORY, "");

    // Updating row
    db.update(TABLE_NOTES, values, KEY_CATEGORY + " = ?",
        new String[]{String.valueOf(category.getId())});

    // Delete category
    deleted = db.delete(TABLE_CATEGORY, KEY_CATEGORY_ID + " = ?",
        new String[]{String.valueOf(category.getId())});
    return deleted;
  }


  /**
   * Get note Category
   */
  public Category getCategory (Long id) {
    Category category = null;
    String sql = "SELECT "
        + KEY_CATEGORY_ID + ","
        + KEY_CATEGORY_NAME + ","
        + KEY_CATEGORY_DESCRIPTION + ","
        + KEY_CATEGORY_COLOR
        + " FROM " + TABLE_CATEGORY
        + " WHERE " + KEY_CATEGORY_ID + " = " + id;

    try (Cursor cursor = getDatabase().rawQuery(sql, null)) {

      if (cursor.moveToFirst()) {
        category = new Category(cursor.getLong(0), cursor.getString(1),
            cursor.getString(2), cursor.getString(3));
      }

    }
    return category;
  }

 

 

 

刘贺鑫:今天重新做了新建笔记的fab按钮,点击+号会弹出三个按钮,照片、待办事项、文本。

代码:

<?xml version="1.0" encoding="utf-8"?>

<com.getbase.floatingactionbutton.FloatingActionsMenu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:fab="http://schemas.android.com/apk/res-auto"
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    fab:fab_addButtonColorNormal="@color/colorAccent"
    fab:fab_addButtonColorPressed="@color/colorAccentPressed"
    fab:fab_addButtonPlusIconColor="@color/white"
    android:layout_marginBottom="8dp"
    android:layout_marginRight="@dimen/fab_right_margin"
    android:layout_marginEnd="@dimen/fab_right_margin"
    android:visibility="invisible"
    fab:fab_labelsPosition="left"
    fab:fab_labelStyle="@style/fab_labels_style">

    <com.getbase.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab_camera"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        fab:fab_icon="@drawable/ic_camera_alt_white_48dp"
        fab:fab_colorNormal="@color/action_color"
        fab:fab_colorPressed="@color/action_color_pressed"
        fab:fab_size="mini"
        fab:fab_title="@string/photo"/>

    <com.getbase.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab_checklist"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        fab:fab_icon="@drawable/ic_format_list_bulleted_white_48dp"
        fab:fab_colorNormal="@color/colorPrimary"
        fab:fab_colorPressed="@color/colorPrimaryDark"
        fab:fab_size="mini"
        fab:fab_title="@string/checklist"/>

    <com.getbase.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab_note"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        fab:fab_icon="@drawable/ic_file_document_box_white_48dp"
        fab:fab_colorNormal="@color/colorAccent"
        fab:fab_colorPressed="@color/colorAccentPressed"
        android:visibility="gone"
        fab:fab_size="mini"
        fab:fab_title="@string/text_note"/>

</com.getbase.floatingactionbutton.FloatingActionsMenu>

 

posted @ 2020-05-21 23:46  吃饭要排队  阅读(181)  评论(0编辑  收藏  举报