Skip to content

Commit

Permalink
app bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ogios committed Oct 20, 2022
1 parent 7ffb5c8 commit 6e3b020
Show file tree
Hide file tree
Showing 64 changed files with 563 additions and 559 deletions.
Empty file modified clockin/.gitignore
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions clockin/.idea/.gitignore
100644 → 100755

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

Empty file modified clockin/.idea/.name
100644 → 100755
Empty file.
10 changes: 5 additions & 5 deletions clockin/.idea/compiler.xml
100644 → 100755

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

10 changes: 5 additions & 5 deletions clockin/.idea/encodings.xml
100644 → 100755

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

36 changes: 18 additions & 18 deletions clockin/.idea/gradle.xml
100644 → 100755

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

56 changes: 28 additions & 28 deletions clockin/.idea/misc.xml
100644 → 100755

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

10 changes: 5 additions & 5 deletions clockin/.idea/render.experimental.xml
100644 → 100755

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

Empty file modified clockin/app/.gitignore
100644 → 100755
Empty file.
Empty file modified clockin/app/build.gradle
100644 → 100755
Empty file.
Empty file modified clockin/app/proguard-rules.pro
100644 → 100755
Empty file.
Empty file.
54 changes: 27 additions & 27 deletions clockin/app/src/main/AndroidManifest.xml
100644 → 100755
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>
Empty file modified clockin/app/src/main/java/com/example/clockin/MainActivity.java
100644 → 100755
Empty file.
114 changes: 57 additions & 57 deletions clockin/app/src/main/java/com/example/clockin/Tools.java
100644 → 100755
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;
}

}


}
8 changes: 6 additions & 2 deletions clockin/app/src/main/java/com/example/clockin/clockin.java
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
unpressed.setDuration(50);

isClockin = view.findViewById(R.id.isClockin);
Log.d(TAG, "onCreateView: START TO EXAM!!!!!!!!!!!");
examClockin();

imageButton = view.findViewById(R.id.send);
Expand Down Expand Up @@ -129,8 +130,11 @@ public void run() {
}

public void examClockin(){
if (!accounts.getString("dayclockTime","").equals("")){
if (Tools.isOverTime(accounts.getString("dayclockTime", ""))){
String date = accounts.getString("dayclockTime","");
Log.d(TAG, "examClockin: "+date);
if (!date.equals("")){
Log.d(TAG, "examClockin: "+Tools.isOverTime(date));
if (Tools.isOverTime(date)){
changeClockin(0);
} else {
changeClockin(1);
Expand Down
Empty file modified clockin/app/src/main/java/com/example/clockin/setting.java
100644 → 100755
Empty file.
Loading

0 comments on commit 6e3b020

Please sign in to comment.