-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.example.clockin"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<application | ||
android:allowBackup="true" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.ClockIn" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
package="com.example.clockin"> | ||
|
||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<application | ||
android:allowBackup="true" | ||
android:dataExtractionRules="@xml/data_extraction_rules" | ||
android:fullBackupContent="@xml/backup_rules" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.ClockIn" | ||
tools:targetApi="31"> | ||
<activity | ||
android:name=".MainActivity" | ||
android:exported="true"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,57 @@ | ||
package com.example.clockin; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
import java.util.HashMap; | ||
import java.util.Iterator; | ||
import java.util.Map; | ||
|
||
public class Tools { | ||
|
||
public static Map<String,String> jsonTomap(String json) throws JSONException { | ||
Map<String, String> map = new HashMap<String, String>(); | ||
|
||
JSONObject jsonObject = new JSONObject(json); | ||
Iterator<String> keys = jsonObject.keys(); | ||
while (keys.hasNext()){ | ||
String key = keys.next(); | ||
String val = jsonObject.getString(key); | ||
// System.out.println(key+val); | ||
map.put(key, val); | ||
} | ||
return map; | ||
} | ||
|
||
public static boolean isOverTime(String old){ | ||
Long timestamp = System.currentTimeMillis(); | ||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); | ||
String date = simpleDateFormat.format(new Date(timestamp)); | ||
|
||
String[] oldDate = old.split("-"); | ||
String[] nowDate = date.split("-"); | ||
|
||
int isover = 0; | ||
for (int i=0; i< oldDate.length; i++){ | ||
if (i==2){ | ||
if (Integer.parseInt(oldDate[i]) > Integer.parseInt(nowDate[i])){ | ||
isover++; | ||
} | ||
} else { | ||
if (Integer.parseInt(oldDate[i]) >= Integer.parseInt(nowDate[i])){ | ||
isover++; | ||
} | ||
} | ||
} | ||
if (isover == 3){ | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
|
||
} | ||
|
||
|
||
} | ||
package com.example.clockin; | ||
|
||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
import java.util.HashMap; | ||
import java.util.Iterator; | ||
import java.util.Map; | ||
|
||
public class Tools { | ||
|
||
public static Map<String,String> jsonTomap(String json) throws JSONException { | ||
Map<String, String> map = new HashMap<String, String>(); | ||
|
||
JSONObject jsonObject = new JSONObject(json); | ||
Iterator<String> keys = jsonObject.keys(); | ||
while (keys.hasNext()){ | ||
String key = keys.next(); | ||
String val = jsonObject.getString(key); | ||
// System.out.println(key+val); | ||
map.put(key, val); | ||
} | ||
return map; | ||
} | ||
|
||
public static boolean isOverTime(String old){ | ||
Long timestamp = System.currentTimeMillis(); | ||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); | ||
String date = simpleDateFormat.format(new Date(timestamp)); | ||
|
||
String[] oldDate = old.split("-"); | ||
String[] nowDate = date.split("-"); | ||
|
||
int isover = 0; | ||
for (int i = 0; i < oldDate.length; i++) { | ||
if (i == 2) { | ||
if (Integer.parseInt(nowDate[i]) > Integer.parseInt(oldDate[i])) { | ||
isover++; | ||
} | ||
} else { | ||
if (Integer.parseInt(nowDate[i]) >= Integer.parseInt(oldDate[i])) { | ||
isover++; | ||
} | ||
} | ||
} | ||
if (isover == 3){ | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
|
||
} | ||
|
||
|
||
} |