Skip to content
Snippets Groups Projects
Commit 88008341 authored by JeongPil Lee's avatar JeongPil Lee
Browse files

D-day

parent 72b3ae0d
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,11 @@
android:roundIcon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity android:name=".activities.Dday">
</activity>
<activity
android:name=".activities.SplashActivity"
android:launchMode="singleTask"
......
package com.simplemobiletools.calendar.activities
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import android.content.Intent
import android.view.View
import android.widget.EditText
import android.widget.Toast
import com.simplemobiletools.calendar.R
import com.simplemobiletools.commons.extensions.toast
import kotlinx.android.synthetic.main.activity_dday.*
import java.time.Year
import java.util.*
//class GregorianCalendar()
//{
//
//}
class Dday : SimpleActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_dday)
var CalculDate : String
var tz = TimeZone.getTimeZone("Asia/Seoul")
var gc = Calendar.getInstance(tz)
var t_year = gc.get(Calendar.YEAR).toString()
var t_year2 = gc.get(Calendar.YEAR).toInt()
var t_month = gc.get(Calendar.MONTH).toString()
var t_month2 = gc.get(Calendar.MONTH).toInt()
var t_day = gc.get(Calendar.DATE).toString()
var t_day2 = gc.get(Calendar.DATE).toInt()
var gc2 = Calendar.getInstance(tz)
var t_mil = gc.timeInMillis
var d_mil : Long = 0
// CalculDate = year + "," + month + "," + day
//toast(CalculDate)
//var chooseDate = editText3.selectAll().toString()
button3.setOnClickListener {
var chooseDate = findViewById<View>(R.id.editText3) as EditText
var chooseDate2 = chooseDate.text.toString()
//Toast.makeText(this,chooseDate.text, Toast.LENGTH_SHORT).show()
//toast(chooseDate2)
var tmp = chooseDate2.split("/")
var tmp_year = tmp[0].toInt()
var tmp_month = tmp[1].toInt()
var tmp_day = tmp[2].toInt()
gc2.set(tmp_year, (tmp_month-1), tmp_day)
//toast(tmp_year.toString())
d_mil = gc2.timeInMillis
//toast(t_mil.toString())
var dif_time = (d_mil-t_mil)/(24*60*60*1000)
var asd = dif_time.toInt()
//toast(tmp_month.toString())
toast("D-day: " + asd.toString())
}
//var d_mil = gc2.timeInMillis
var dif_time = (d_mil-t_mil)/(24*60*60*1000)
var asd = dif_time.toInt()
// var tmp = arrayOf(chooseDate.split("/"))
// toast(chooseDate)
// calendarView.setOnDateChangeListener { calendarView, i, j, k -> }
}
}
......@@ -67,7 +67,6 @@ import android.util.Log
import java.io.IOException
class MainActivity : SimpleActivity(), RefreshRecyclerViewListener , com.google.android.gms.location.LocationListener{
//for gps module
private var REQUEST_LOCATION_CODE = 101
private var mGoogleApiClient: GoogleApiClient? = null
......@@ -101,7 +100,12 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener , com.google.
// You can now create a LatLng Object for use with maps
// val latLng = LatLng(location.latitude, location.longitude)
}
// init {
// button_Dday.setOnClickListener {
// val intent_dday = Intent(button_Dday.context, Dday::class.java)
// button_Dday.context.startActivity(intent_dday)
// }
// }
@SuppressLint("MissingPermission")
private fun getLocation() {
mLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient);
......@@ -145,6 +149,14 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener , com.google.
launchNewEventIntent(currentFragments.last().getNewEventDayCode())
}
button_Dday.setOnClickListener {
toast("click!!!!!")
val intent_dday = Intent(this, Dday::class.java)
startActivity(intent_dday)
}
storeStateVariables()
if (resources.getBoolean(R.bool.portrait_only)) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
......@@ -165,6 +177,8 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener , com.google.
if (config.caldavSync) {
refreshCalDAVCalendars(false)
}
}
@Synchronized
private fun buildGoogleApiClient() {
......@@ -347,6 +361,7 @@ class MainActivity : SimpleActivity(), RefreshRecyclerViewListener , com.google.
R.id.export_events -> tryExportEvents()
R.id.settings -> launchSettings()
R.id.about -> launchAbout()
// R.id.button_Dday ->
android.R.id.home -> onBackPressed()
else -> return super.onOptionsItemSelected(item)
}
......
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.Dday">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.kotlin_test.Activity.FunctionActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:weightSum="4">
<EditText
android:id="@+id/editText3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="date"
android:text="입력: 예) 1994/09/16" />
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#aad3e5"
android:text="입력" />
</LinearLayout>
<CalendarView
android:id="@+id/calendarView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
......@@ -8,7 +8,17 @@
<FrameLayout
android:id="@+id/fragments_holder"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent" >
<Button
android:id="@+id/button_Dday"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="455dp"
android:background="#97f500"
android:text="DDAY" />
</FrameLayout>
<com.simplemobiletools.commons.views.MyFloatingActionButton
android:id="@+id/calendar_fab"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment