Skip to content

Commit 95bb8ac

Browse files
committed
beta 1.0
1 parent 0508fc3 commit 95bb8ac

File tree

8 files changed

+35
-9
lines changed

8 files changed

+35
-9
lines changed

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ android {
1111
applicationId "k.agera.com.locationwidget"
1212
minSdkVersion 21
1313
targetSdkVersion 19
14-
versionCode 1
14+
versionCode 2
1515
versionName "1.0"
1616

1717
vectorDrawables.useSupportLibrary = true

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
android:label="@string/app_name"
3232
android:supportsRtl="true"
3333
android:theme="@style/AppTheme">
34-
<activity android:name=".base.SplashActivity">
34+
<activity android:name=".base.SplashActivity"
35+
android:launchMode="singleTask">
3536
<intent-filter>
3637
<action android:name="android.intent.action.MAIN" />
3738

@@ -41,10 +42,12 @@
4142

4243
<activity
4344
android:name=".login.SignUpActivity"
44-
android:windowSoftInputMode="adjustPan" />
45+
android:windowSoftInputMode="adjustPan"
46+
android:launchMode="singleTask"/>
4547
<activity
4648
android:name=".login.SignInActivity"
47-
android:windowSoftInputMode="adjustPan" />
49+
android:windowSoftInputMode="adjustPan"
50+
android:launchMode="singleTask"/>
4851

4952
<activity android:name=".base.MainActivity" />
5053

app/src/main/java/k/agera/com/locationwidget/login/SignInActivity.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ class SignInActivity : BaseActivity(), Updatable {
4242
mEt_accound = findViewById(R.id.et_account) as EditText
4343
mEt_password = findViewById(R.id.et_password) as EditText
4444

45+
var account = intent?.getStringExtra("account")
46+
account?.let {
47+
mEt_accound?.setText(account)
48+
}
49+
4550
initEvents()
4651
}
4752

@@ -57,6 +62,11 @@ class SignInActivity : BaseActivity(), Updatable {
5762
startActivity(Intent(SignInActivity@ this, SignUpActivity::class.java))
5863
}
5964

65+
findViewById(R.id.ll_root).setOnClickListener {
66+
var imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
67+
imm.hideSoftInputFromWindow(it.windowToken, 0)
68+
}
69+
6070
mRep = Repositories.repositoryWithInitialValue(Result.absent<String>())
6171
.observe(clickObservable)
6272
.onUpdatesPerLoop()

app/src/main/java/k/agera/com/locationwidget/login/SignUpActivity.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ import com.google.android.agera.Repositories
99
import com.google.android.agera.Repository
1010
import com.google.android.agera.Result
1111
import com.google.android.agera.Updatable
12-
import k.agera.com.locationwidget.base.BaseActivity
13-
import k.agera.com.locationwidget.utils.CommonUtils
1412
import k.agera.com.locationwidget.MyApp
1513
import k.agera.com.locationwidget.R
14+
import k.agera.com.locationwidget.base.BaseActivity
1615
import k.agera.com.locationwidget.core.TaskDriver
1716
import k.agera.com.locationwidget.observable.ClickObservable
17+
import k.agera.com.locationwidget.utils.CommonUtils
1818

1919
/**
2020
* Created by Agera on 2018/8/21.
@@ -49,6 +49,11 @@ class SignUpActivity : BaseActivity(), Updatable {
4949
(MyApp.instance().getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager).hideSoftInputFromWindow(it.windowToken, 0)
5050
clickObservable.onClick(it)
5151
}
52+
findViewById(R.id.ll_root).setOnClickListener {
53+
var imm = getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
54+
imm.hideSoftInputFromWindow(it.windowToken, 0)
55+
}
56+
5257
mRep = Repositories.repositoryWithInitialValue(Result.absent<String>())
5358
.observe(clickObservable)
5459
.onUpdatesPerLoop()
@@ -99,7 +104,9 @@ class SignUpActivity : BaseActivity(), Updatable {
99104
override fun update() {
100105
CommonUtils.instance().showShortMessage(mEt_accound, "注册成功,跳转登录页面...")
101106
TaskDriver.instance().mMainHandler.postDelayed({
102-
startActivity(Intent(SignUpActivity@ this, SignInActivity::class.java))
107+
var intent = Intent(SignUpActivity@ this, SignInActivity::class.java)
108+
intent.putExtra("account", account)
109+
startActivity(intent)
103110
finish()
104111
}, 1_500)
105112
}

app/src/main/java/k/agera/com/locationwidget/utils/CommonUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class CommonUtils private constructor() {
160160
fun startDaemon() {
161161
var build = JobInfo.Builder(0, ComponentName(ctx.baseContext, DaemonService::class.java))
162162
build.setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY)
163-
build.setPeriodic(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) 15 * 60 * 1000 else 10 * 60 * 1000)
163+
build.setPeriodic(if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) 15 * 60 * 1000 else 10 * 60 * 1000)
164164
build.setPersisted(true)
165165
(ctx.getSystemService(Context.JOB_SCHEDULER_SERVICE) as JobScheduler).schedule(build.build())
166166
}

app/src/main/res/layout/sign_in_layout.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/ll_root"
4+
android:clickable="true"
35
android:layout_width="match_parent"
46
android:layout_height="match_parent"
57
android:orientation="vertical">
@@ -41,6 +43,7 @@
4143
android:layout_marginTop="20dp"
4244
android:background="@drawable/circle_rect"
4345
android:hint="密码"
46+
android:inputType="textPassword"
4447
android:padding="5dp" />
4548

4649
<LinearLayout

app/src/main/res/layout/sign_up_layout.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/ll_root"
4+
android:clickable="true"
35
android:layout_width="match_parent"
46
android:layout_height="match_parent"
57
android:orientation="vertical">
@@ -40,6 +42,7 @@
4042
android:layout_height="50dp"
4143
android:layout_marginTop="20dp"
4244
android:background="@drawable/circle_rect"
45+
android:inputType="textPassword"
4346
android:hint="密码"
4447
android:padding="5dp" />
4548

0 commit comments

Comments
 (0)