WIP
This commit is contained in:
parent
ee6754ffeb
commit
ed5e1173ee
|
@ -1,10 +1,12 @@
|
||||||
<?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="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
<option name="gradleJvm" value="Embedded JDK" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
<?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">
|
||||||
|
|
33
app/src/main/java/com/example/childguard/QR.java
Normal file
33
app/src/main/java/com/example/childguard/QR.java
Normal file
|
@ -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,5 +1,6 @@
|
||||||
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;
|
||||||
|
@ -7,6 +8,7 @@ import androidx.fragment.app.Fragment;
|
||||||
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 +55,20 @@ 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);
|
||||||
|
|
||||||
|
|
||||||
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -9,6 +9,7 @@
|
||||||
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 +27,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"
|
||||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue
Block a user