Compare commits
22
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6402452f6b | ||
|
|
0e14f74a3c | ||
|
|
9dda0adbed | ||
|
|
398186e07c | ||
|
|
4bb63c0fd2 | ||
|
|
b9546b4826 | ||
|
|
1186fd7757 | ||
|
|
737b2c8a4d | ||
|
|
17b3106bdd | ||
|
|
92bc036bc4 | ||
|
|
8c6660d34a | ||
|
|
c946f29fab | ||
|
|
93d9eddf4e | ||
|
|
9a0b132595 | ||
|
|
d1a6d13686 | ||
|
|
709eaf73e9 | ||
|
|
ed5e1173ee | ||
|
|
e645577f40 | ||
|
|
ee6754ffeb | ||
|
|
440eb651e9 | ||
|
|
62a024d1e6 | ||
|
|
5e08eee255 |
No files matched your search
Generated
+4
-1
@@ -1,10 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
|
<option name="testRunner" value="GRADLE" />
|
||||||
|
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
<option name="gradleJvm" value="jbr-17" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
|||||||
Generated
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="jbr-17" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||||
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
package com.example.childguard;
|
package com.example.childguard;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
@@ -61,4 +68,26 @@ public class HomeFragment extends Fragment {
|
|||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
return inflater.inflate(R.layout.fragment_home, container, false);
|
return inflater.inflate(R.layout.fragment_home, container, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
Log.d("HomeFragment", "onResume: called");
|
||||||
|
TextView situationTextView = getView().findViewById(R.id.situation);
|
||||||
|
FrameLayout situation_bg=getView().findViewById(R.id.situation_bg);
|
||||||
|
updateInCarStatus(situationTextView,situation_bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateInCarStatus(TextView situationTextView,FrameLayout situation_bg) {
|
||||||
|
SharedPreferences sharedPreferences = getActivity().getSharedPreferences("default", 0);
|
||||||
|
|
||||||
|
Log.d("HomeFragment", "updateInCarStatus: " + sharedPreferences.getBoolean("inCar", false));
|
||||||
|
if (sharedPreferences.getBoolean("inCar", false)) {
|
||||||
|
situationTextView.setText("\n降車状態");
|
||||||
|
situation_bg.setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.frame_style, null));
|
||||||
|
} else {
|
||||||
|
situationTextView.setText("\n乗車状態");
|
||||||
|
situation_bg.setBackground(ResourcesCompat.getDrawable(getResources(), R.drawable.frame_style_orange, null));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,16 @@
|
|||||||
package com.example.childguard;
|
package com.example.childguard;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.core.app.ActivityCompat;
|
||||||
|
import androidx.core.app.NotificationCompat;
|
||||||
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
|
|
||||||
|
import android.app.NotificationChannel;
|
||||||
|
import android.app.NotificationManager;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Vibrator;
|
||||||
|
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
|
||||||
@@ -12,6 +20,16 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
//通知のやつ↓
|
||||||
|
int importance = NotificationManager.IMPORTANCE_DEFAULT;
|
||||||
|
|
||||||
|
NotificationChannel channel = new NotificationChannel("CHANNEL_ID", "サンプルアプリ", importance);
|
||||||
|
channel.setDescription("説明・説明 ここに通知の説明を書くことができる");
|
||||||
|
|
||||||
|
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
||||||
|
notificationManager.createNotificationChannel(channel);
|
||||||
|
//通知のやつ↑
|
||||||
|
|
||||||
|
|
||||||
BottomNavigationView bottomNavigationView = findViewById(R.id.nav_view);
|
BottomNavigationView bottomNavigationView = findViewById(R.id.nav_view);
|
||||||
|
|
||||||
@@ -34,4 +52,29 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//↓通知のやつ
|
||||||
|
public void notifyTest() {
|
||||||
|
((Vibrator)getSystemService(Context.VIBRATOR_SERVICE)).vibrate(1000);
|
||||||
|
NotificationCompat.Builder builder = new NotificationCompat
|
||||||
|
.Builder(this, "CHANNEL_ID")
|
||||||
|
.setSmallIcon(android.R.drawable.ic_menu_info_details)
|
||||||
|
.setContentTitle("タイトル")
|
||||||
|
.setContentText("メッセージ・メッセージ")
|
||||||
|
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
|
||||||
|
|
||||||
|
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
|
||||||
|
|
||||||
|
if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.POST_NOTIFICATIONS) != PackageManager.PERMISSION_GRANTED) {
|
||||||
|
// TODO: Consider calling
|
||||||
|
// ActivityCompat#requestPermissions
|
||||||
|
// here to request the missing permissions, and then overriding
|
||||||
|
// public void onRequestPermissionsResult(int requestCode, String[] permissions,
|
||||||
|
// int[] grantResults)
|
||||||
|
// to handle the case where the user grants the permission. See the documentation
|
||||||
|
// for ActivityCompat#requestPermissions for more details.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
notificationManager.notify(R.string.app_name, builder.build());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.example.childguard;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
public class QR extends AppCompatActivity {
|
||||||
|
String get_on="乗車状態";
|
||||||
|
String get_off ="降車状態";
|
||||||
|
TextView tv=findViewById(R.id.situation);
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState){
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.fragment_qr);
|
||||||
|
|
||||||
|
findViewById(R.id.camera).setOnClickListener(
|
||||||
|
v -> {
|
||||||
|
if(get_on.equals(tv.getText().toString())){
|
||||||
|
tv.setText(get_off);
|
||||||
|
findViewById(R.id.situation_bg).setBackgroundColor(Color.parseColor("#dcdcdc"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tv.setText(get_on);
|
||||||
|
findViewById(R.id.situation_bg).setBackgroundColor(Color.parseColor("#ff4500"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.example.childguard;
|
package com.example.childguard;
|
||||||
|
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple {@link Fragment} subclass.
|
* A simple {@link Fragment} subclass.
|
||||||
@@ -53,12 +56,33 @@ public class QRFragment extends Fragment {
|
|||||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
// Inflate the layout for this fragment
|
// Inflate the layout for this fragment
|
||||||
return inflater.inflate(R.layout.fragment_qr, container, false);
|
View view = inflater.inflate(R.layout.fragment_qr, container, false);
|
||||||
|
|
||||||
|
Button cameraButton = view.findViewById(R.id.camera);
|
||||||
|
|
||||||
|
// Init shared preferences
|
||||||
|
SharedPreferences sharedPreferences = getActivity().getSharedPreferences("default", 0);
|
||||||
|
SharedPreferences.Editor editor = sharedPreferences.edit();
|
||||||
|
|
||||||
|
cameraButton.setOnClickListener(v -> {
|
||||||
|
Log.d("QRFragment", "onClick: called");
|
||||||
|
if (!sharedPreferences.getBoolean("inCar", false)) {
|
||||||
|
editor.putBoolean("inCar", true);
|
||||||
|
} else {
|
||||||
|
editor.putBoolean("inCar", false);
|
||||||
}
|
}
|
||||||
|
editor.apply();
|
||||||
|
});
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="#ffa500"/>
|
||||||
|
<corners android:radius="25dp"/>
|
||||||
|
|
||||||
|
</shape>
|
||||||
@@ -7,8 +7,8 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".HomeFragment">
|
tools:context=".HomeFragment">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
android:id="@+id/situation_bg"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/frame_style"
|
android:background="@drawable/frame_style"
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textAlignment="center"/>
|
android:textAlignment="center"/>
|
||||||
<TextView
|
<TextView
|
||||||
|
android:id="@+id/situation"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="200dp"
|
android:layout_height="200dp"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
@@ -48,9 +49,9 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="20dp"
|
android:layout_marginTop="5dp"
|
||||||
android:text="切断中"
|
android:text="切断中"
|
||||||
android:textSize="25dp"
|
android:textSize="30dp"
|
||||||
android:textColor="@color/black"
|
android:textColor="@color/black"
|
||||||
android:textAlignment="center"/>
|
android:textAlignment="center"/>
|
||||||
<ImageView
|
<ImageView
|
||||||
@@ -72,21 +73,21 @@
|
|||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="20dp"
|
||||||
android:layout_marginRight="20dp"
|
android:layout_marginRight="20dp"
|
||||||
android:background="@drawable/frame_style_button">
|
android:background="@drawable/frame_style_button">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="20dp"
|
||||||
android:layout_marginTop="75dp"
|
|
||||||
android:layout_marginRight="20dp"
|
android:layout_marginRight="20dp"
|
||||||
|
android:backgroundTint="#778899"
|
||||||
android:text="QRコード印刷"
|
android:text="QRコード印刷"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="40dp"
|
android:textSize="40dp" />
|
||||||
android:backgroundTint="#778899"/>
|
|
||||||
<!--<ImageView
|
<!--<ImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
@@ -6,9 +6,11 @@
|
|||||||
tools:context=".QRFragment">
|
tools:context=".QRFragment">
|
||||||
|
|
||||||
<!-- TODO: Update blank fragment layout -->
|
<!-- TODO: Update blank fragment layout -->
|
||||||
<TextView
|
<Button
|
||||||
android:layout_width="match_parent"
|
android:id="@+id/camera"
|
||||||
android:layout_height="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:text="@string/hello_blank_fragment" />
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
/>
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
@@ -2,4 +2,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
|
<color name="orange">#FF4500</color>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in new issue
Block a user