Skip to content

Commit

Permalink
PreRelease 0.9
Browse files Browse the repository at this point in the history
add launcher icon
change app name
fix WallpaperChange issue
  • Loading branch information
zzndb committed Apr 20, 2019
1 parent edea3fa commit 9a312fb
Show file tree
Hide file tree
Showing 17 changed files with 25 additions and 45 deletions.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build
/src/androidTest
/src/test
/release/output.json
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "0.6"
versionName "0.9"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Binary file added app/release/app-release.apk
Binary file not shown.
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/launcher"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
android:usesCleartextTraffic="true"
Expand All @@ -23,7 +23,7 @@
android:exported="true">
</service>
<service
android:name=".view.WallpaperChange"
android:name=".presenter.WallpaperChange"
android:enabled="true"
android:exported="true">
</service>
Expand Down
14 changes: 0 additions & 14 deletions app/src/main/java/cn/com/zzndb/wallpaper/domain/DownloadImage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ class DownloadImage(private val listener: DownloadListener,
val TYPE_SUCCESS: Int = 0
val TYPE_FAILED: Int = 1

private var lastProgress = 0

override fun doInBackground(vararg params: String?): Int {
var savedFile: RandomAccessFile? = null
var ins: InputStream? = null
Expand Down Expand Up @@ -59,10 +57,6 @@ class DownloadImage(private val listener: DownloadListener,
while (({len = ins.read(b); len}()) != -1) {
total += len
savedFile.write(b, 0, len)
// caculate the process of downloading
val progress: Int = ((total + downloadLength) * 100 /
contentLength).toInt()
publishProgress(progress)
}
response.body()?.close()
return TYPE_SUCCESS
Expand All @@ -80,14 +74,6 @@ class DownloadImage(private val listener: DownloadListener,
return TYPE_FAILED
}

override fun onProgressUpdate(vararg values: Int?) {
val progress: Int = values[0]!!
if (progress > lastProgress) {
listener.onProgress(progress)
lastProgress = progress
}
}

override fun onPostExecute(result: Int?) {
when (result) {
TYPE_SUCCESS -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package cn.com.zzndb.wallpaper.domain.db

import android.provider.ContactsContract
import cn.com.zzndb.wallpaper.domain.model.ImageCard
import org.jetbrains.anko.db.*
import java.lang.Exception
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cn.com.zzndb.wallpaper.view
package cn.com.zzndb.wallpaper.presenter

import android.app.AlarmManager
import android.app.PendingIntent
Expand All @@ -8,7 +8,6 @@ import android.content.Intent
import android.os.Binder
import android.os.IBinder
import android.util.Log
import cn.com.zzndb.wallpaper.presenter.PresenterImpl
import org.jetbrains.anko.doAsync
import java.util.*

Expand All @@ -17,8 +16,7 @@ class WallpaperChange: Service() {
var presenter: PresenterImpl? = null
var hour: Int = 6
var min: Int = 0
private var alarmMgr: AlarmManager? = null
private lateinit var pendingIntent: PendingIntent
lateinit var calender: Calendar

var count = 0

Expand All @@ -27,8 +25,6 @@ class WallpaperChange: Service() {
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
// check whether from this
// if (intent!!.getBooleanExtra("status", false)) {
// check whether set time
if ((intent!!.getIntExtra("hour", 25)) == 25) {
// do not change initial from MainActivity
Expand All @@ -50,30 +46,26 @@ class WallpaperChange: Service() {
// skip first main activity set alarm
if (!intent.getBooleanExtra("fromMain", false)) {
// alarm test
val calender: Calendar = Calendar.getInstance().apply {
calender = Calendar.getInstance().apply {
timeInMillis = System.currentTimeMillis()
set(Calendar.HOUR_OF_DAY, hour)
set(Calendar.MINUTE, min)
set(Calendar.HOUR_OF_DAY, hour)
}
if (intent.getBooleanExtra("status", false)) {
calender.add(Calendar.DATE, 1)
}
val wcintent = Intent(this, WallpaperChange::class.java)
// wcintent.putExtra("status", true)
pendingIntent = PendingIntent.getService(this, 1, wcintent, PendingIntent.FLAG_CANCEL_CURRENT)
alarmMgr = getSystemService(Context.ALARM_SERVICE) as AlarmManager
alarmMgr?.setInexactRepeating(
AlarmManager.RTC,
wcintent.putExtra("status", true)
val pendingIntent = PendingIntent.getService(this, 0, wcintent, 0)
val alarmMgr = getSystemService(Context.ALARM_SERVICE) as AlarmManager
alarmMgr.setInexactRepeating(
AlarmManager.RTC_WAKEUP,
calender.timeInMillis,
AlarmManager.INTERVAL_DAY,
pendingIntent
)
}
// }
// else Log.d("test service", "not status true")
return super.onStartCommand(intent, flags, startId)
// alarm = getSystemService(Context.ALARM_SERVICE) as AlarmManager
// val triggerTime = SystemClock.elapsedRealtime() + 5000
// val i = Intent(this, WallpaperChange::class.java)
// val pendingIntent = PendingIntent.getService(this, 1, i, 0)
// alarm!!.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP, triggerTime, pendingIntent)
}

private var mBinder = WallBinder()
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/cn/com/zzndb/wallpaper/view/IView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.fragment.app.Fragment
import cn.com.zzndb.wallpaper.domain.model.ImageCard
import cn.com.zzndb.wallpaper.presenter.DownloadService
import cn.com.zzndb.wallpaper.presenter.PresenterImpl
import cn.com.zzndb.wallpaper.presenter.WallpaperChange

/**
* all view interface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package cn.com.zzndb.wallpaper.view

import android.annotation.SuppressLint
import android.content.*
import android.content.pm.PackageManager
import android.net.ConnectivityManager
Expand All @@ -27,6 +26,7 @@ import cn.com.zzndb.wallpaper.domain.db.PicDb
import cn.com.zzndb.wallpaper.domain.db.PicDbHelper
import cn.com.zzndb.wallpaper.presenter.DownloadService
import cn.com.zzndb.wallpaper.presenter.PresenterImpl
import cn.com.zzndb.wallpaper.presenter.WallpaperChange
import kotlinx.android.synthetic.main.titlebar.*
import org.jetbrains.anko.doAsync
import org.jetbrains.anko.find
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/cn/com/zzndb/wallpaper/view/Setting.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import android.widget.TimePicker
import androidx.fragment.app.DialogFragment
import androidx.preference.Preference
import cn.com.zzndb.wallpaper.R
import cn.com.zzndb.wallpaper.presenter.WallpaperChange
import kotlinx.android.synthetic.main.nav_in_titlebar.*
import org.jetbrains.anko.find
import java.util.*
Expand Down Expand Up @@ -54,7 +55,6 @@ class TimePickerFragment : DialogFragment(), TimePickerDialog.OnTimeSetListener
val upTimeIntent = Intent(activity, WallpaperChange::class.java)
upTimeIntent.putExtra("hour", hourOfDay)
upTimeIntent.putExtra("min", minute)
upTimeIntent.putExtra("status", true)
activity!!.startService(upTimeIntent)
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/nav_header.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
android:layout_height="180dp"
android:padding="10dp"
android:fitsSystemWindows="true"
android:background="@color/colorPrimary">
android:background="@color/p">

<ImageView
android:id="@+id/icon_image"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@mipmap/ic_launcher"
android:src="@mipmap/launcher"
android:layout_centerInParent="true"
android:layout_alignParentStart="true"
android:contentDescription="@string/app_icon"/>
Expand Down
Binary file added app/src/main/res/mipmap-hdpi/launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-mdpi/launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xhdpi/launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/mipmap-xxxhdpi/launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
<color name="text_black">#000</color>
<color name="text_grey">#F1F1F1</color>
<color name="semi_transparent">#88000000</color>
<color name="p">#AA00FF</color>
</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">wallpaper</string>
<string name="app_name_version">wallpaper 0.6</string>
<string name="app_name">易壁纸</string>
<string name="app_name_version">易壁纸 0.9</string>
<string name="titlebar_more">more</string>
<string name="titlebar_text">A WallPic</string>
<string name="titlebar_search">Search</string>
Expand Down

0 comments on commit 9a312fb

Please sign in to comment.