Skip to content

Commit

Permalink
release v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
liying2008 committed Apr 14, 2018
1 parent a4c21a0 commit 2f60eb4
Show file tree
Hide file tree
Showing 18 changed files with 204 additions and 73 deletions.
Binary file added .idea/caches/build_file_checksums.ser
Binary file not shown.
29 changes: 29 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android:
components:
- platform-tools
- tools
- android-26
- android-27
- extra-android-m2repository

before_install:
Expand All @@ -25,4 +25,4 @@ cache:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/

script: ./gradlew build
script: ./gradlew assembleDebug
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

# v1.0.0
- 【新增】导入密码界面可长按删除文件。

# v1.0.0_beta
- 初始版本。
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,26 @@
[![license](https://img.shields.io/github/license/liying2008/QPassword.svg)](https://github.com/liying2008/QPassword/blob/master/LICENSE)


> ### [Download Latest APK](https://github.com/liying2008/QPassword/releases/download/v1.0.0_beta/qpassword_v1.0.0_beta.apk)
> ### [Download Latest APK](https://github.com/liying2008/QPassword/releases/download/v1.0.0/qpassword_v1.0.0.apk)
Compiling Environment
---------------------
- compileSdkVersion 26
- Gradle Version 4.1
- Kotlin Version 1.2.0
- compileSdkVersion 27
- targetSdkVersion 27
- Gradle Version 4.4
- Kotlin Version 1.2.31

### Linux
```shell
./gradlew build
./gradlew assembleDebug
```

### Windows
```shell
gradlew.bat build
gradlew assembleDebug
```

> ### 项目可直接导入 <code>Android Studio 3.0.1</code> 中运行。
> ### 项目可直接导入 <code>Android Studio 3.1.1</code> 中运行。
Primary Function
----------------
Expand All @@ -47,7 +48,11 @@ ScreenShot

Update
------
2017-12-03
2018-04-14

UpdateLog
------
[点击查看更新日志](CHANGELOG.md)

Contact Me
---------
Expand All @@ -64,7 +69,7 @@ License
----

```
Copyright 2017 独毒火
Copyright 2017-2018 独毒火
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 26
compileSdkVersion 27
defaultConfig {
applicationId "cc.duduhuo.qpassword"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0.0_beta"
targetSdkVersion 27
versionCode 2
versionName "1.0.0"
// vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand All @@ -31,10 +31,10 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'cc.duduhuo.applicationtoast:applicationtoast:0.3'
implementation 'com.alibaba:fastjson:1.1.61.android'
implementation 'com.andrognito.patternlockview:patternlockview:1.0.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import kotlinx.android.synthetic.main.item_drawer_title.view.*
*/
class DrawerItemAdapter(private val mContext: Context) : RecyclerView.Adapter<DrawerItemAdapter.DrawerViewHolder>() {
companion object {
private val TYPE_DIVIDER = 0
private val TYPE_GROUP = 1
private val TYPE_OPERATION = 2
private val TYPE_HEADER = 3
private val TYPE_TITLE = 4
private const val TYPE_DIVIDER = 0
private const val TYPE_GROUP = 1
private const val TYPE_OPERATION = 2
private const val TYPE_HEADER = 3
private const val TYPE_TITLE = 4
}

private var mLastIndex = -1
Expand Down Expand Up @@ -151,7 +151,7 @@ class DrawerItemAdapter(private val mContext: Context) : RecyclerView.Adapter<Dr
return super.getItemViewType(position)
}

override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): DrawerViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DrawerViewHolder {
var viewHolder: DrawerViewHolder? = null
val inflater = LayoutInflater.from(mContext)
when (viewType) {
Expand Down
38 changes: 30 additions & 8 deletions app/src/main/java/cc/duduhuo/qpassword/adapter/FileListAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,34 @@ import kotlinx.android.synthetic.main.item_import_file.view.*
* =======================================================
*/
class FileListAdapter(private val mContext: Context,
private val mFileList: List<ImportFile>) : RecyclerView.Adapter<FileListAdapter.ViewHolder>() {
private var mFileList: MutableList<ImportFile>) : RecyclerView.Adapter<FileListAdapter.ViewHolder>() {
private var mFileClickListener: OnFileClickListener? = null
fun setOnFileClickListener(listener: OnFileClickListener) {
this.mFileClickListener = listener
}

override fun onBindViewHolder(holder: ViewHolder?, position: Int) {
fun removeItem(position: Int) {
mFileList.removeAt(position)
this.notifyItemRemoved(position)
}

fun refresh(fileList: MutableList<ImportFile>) {
this.mFileList = fileList
notifyDataSetChanged()
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val file = mFileList[position]
if (holder != null) {
holder.itemView.tv_file.text = file.fileName
holder.itemView.tv_file_size.text = getFormatSize(file.fileSize)
holder.itemView.setOnClickListener {
mFileClickListener?.onFileClick(file.absolutePath)
holder.itemView.tv_file.text = file.fileName
holder.itemView.tv_file_size.text = getFormatSize(file.fileSize)
holder.itemView.setOnClickListener {
mFileClickListener?.onFileClick(file.absolutePath)
}
holder.itemView.setOnLongClickListener {
if (mFileClickListener == null) {
return@setOnLongClickListener true
} else {
return@setOnLongClickListener mFileClickListener!!.onFileLongClick(holder.adapterPosition, file.absolutePath)
}
}
}
Expand All @@ -43,7 +58,7 @@ class FileListAdapter(private val mContext: Context,
return mFileList.size
}

override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(mContext).inflate(R.layout.item_import_file, parent, false)
return ViewHolder(view)
}
Expand All @@ -59,5 +74,12 @@ class FileListAdapter(private val mContext: Context,
* @param absolutePath 绝对路径
*/
fun onFileClick(absolutePath: String)

/**
* 文件名被长按
* @param position Item 位置
* @param absolutePath 绝对路径
*/
fun onFileLongClick(position: Int, absolutePath: String): Boolean
}
}
31 changes: 15 additions & 16 deletions app/src/main/java/cc/duduhuo/qpassword/adapter/NumberGridAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,30 @@ class NumberGridAdapter(private val mContext: Context) : RecyclerView.Adapter<Nu
this.mListener = listener
}

override fun onBindViewHolder(holder: ViewHolder?, position: Int) {
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val number = mNumbers[position]
if (holder != null) {
holder.itemView.tv_number_btn.text = number
if (number == mContext.getString(R.string.delete)) {
holder.itemView.setOnClickListener {
mListener?.onClickDel(holder.itemView as TextView)
}
} else if (number == mContext.getString(R.string.ok)) {
holder.itemView.setOnClickListener {
mListener?.onClickOk(holder.itemView as TextView)
}
} else {
holder.itemView.setOnClickListener {
mListener?.onClickNum(number, holder.itemView as TextView)
}
holder.itemView.tv_number_btn.text = number
if (number == mContext.getString(R.string.delete)) {
holder.itemView.setOnClickListener {
mListener?.onClickDel(holder.itemView as TextView)
}
} else if (number == mContext.getString(R.string.ok)) {
holder.itemView.setOnClickListener {
mListener?.onClickOk(holder.itemView as TextView)
}
} else {
holder.itemView.setOnClickListener {
mListener?.onClickNum(number, holder.itemView as TextView)
}
}

}

override fun getItemCount(): Int {
return mNumbers.size
}

override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(LayoutInflater.from(mContext).inflate(R.layout.item_number_grid, parent, false))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class PasswordListAdapter(private val mContext: Context) : RecyclerView.Adapter<
return true
}

override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
val view = LayoutInflater.from(mContext).inflate(R.layout.item_password, parent, false)
return ViewHolder(view)
}
Expand Down
18 changes: 18 additions & 0 deletions app/src/main/java/cc/duduhuo/qpassword/app/App.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cc.duduhuo.qpassword.app

import android.app.Application
import android.content.Context
import android.content.pm.ApplicationInfo
import cc.duduhuo.applicationtoast.AppToast

/**
Expand All @@ -17,4 +19,20 @@ class App : Application() {
super.onCreate()
AppToast.init(this)
}

companion object {
/**
* 判断是否是 DEBUG 版本
* @param context
*/
fun isDebugVersion(context: Context): Boolean {
try {
val info = context.applicationInfo
return info.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0
} catch (e: Exception) {
e.printStackTrace()
}
return false
}
}
}
16 changes: 8 additions & 8 deletions app/src/main/java/cc/duduhuo/qpassword/db/DBInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ import cc.duduhuo.qpassword.bean.Password
object DBInfo {

/** 数据库名称 */
val DB_NAME = "password.db"
const val DB_NAME = "password.db"
/** 数据库版本 */
val DB_VERSION = 1
const val DB_VERSION = 1

/**
* 数据库表
*/
object Table {
val TB_KEY = "password_key"
val TB_PASSWORD = "password"
val TB_GROUP = "password_group"
const val TB_KEY = "password_key"
const val TB_PASSWORD = "password"
const val TB_GROUP = "password_group"

val TB_KEY_CREATE = "CREATE TABLE IF NOT EXISTS " + TB_KEY + " (" +
const val TB_KEY_CREATE = "CREATE TABLE IF NOT EXISTS " + TB_KEY + " (" +
Key.KEY + " TEXT PRIMARY KEY," +
Key.MODE + " INTEGER NOT NULL" +
");"
val TB_PASSWORD_CREATE = "CREATE TABLE IF NOT EXISTS " + TB_PASSWORD + " (" +
const val TB_PASSWORD_CREATE = "CREATE TABLE IF NOT EXISTS " + TB_PASSWORD + " (" +
Password.ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
Password.CREATE_DATE + " INTEGER NOT NULL," +
Password.TITLE + " TEXT NOT NULL, " +
Expand All @@ -43,7 +43,7 @@ object DBInfo {
Password.NOTE + " TEXT NOT NULL," +
Password.GROUP_NAME + " TEXT NOT NULL" +
");"
val TB_GROUP_CREATE = "CREATE TABLE IF NOT EXISTS " + TB_GROUP + " (" +
const val TB_GROUP_CREATE = "CREATE TABLE IF NOT EXISTS " + TB_GROUP + " (" +
Group.NAME + " TEXT PRIMARY KEY" +
");"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import android.support.v7.app.AlertDialog
import android.view.MenuItem
import android.view.View
import cc.duduhuo.qpassword.R
import cc.duduhuo.qpassword.app.App
import cc.duduhuo.qpassword.util.*
import kotlinx.android.synthetic.main.activity_about.*

Expand All @@ -28,6 +29,11 @@ class AboutActivity : BaseActivity() {
setTitle(R.string.title_about)

tv_version.text = getString(R.string.version, getVersionName())
if (App.isDebugVersion(this)) {
tv_name.setText(R.string.app_name_debug)
} else {
tv_name.setText(R.string.app_name)
}
}

/**
Expand Down
Loading

0 comments on commit 2f60eb4

Please sign in to comment.