This commit is contained in:
2024-02-14 18:15:11 -06:00
parent a8f146d4fa
commit c2e9789ee9
50 changed files with 846 additions and 23 deletions

View File

@@ -1,6 +1,8 @@
package com.calebfontenot.crimeactivity;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.os.Bundle;
@@ -10,5 +12,15 @@ public class CrimeActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager fm = getSupportFragmentManager();
Fragment fragment = fm.findFragmentById(R.id.fragment_container);
if (fragment == null) {
fragment = new CrimeFragment();
fm.beginTransaction()
.add(R.id.fragment_container,
fragment).commit();
}
}
}

View File

@@ -1,5 +1,7 @@
package com.calebfontenot.crimeactivity;
import static android.widget.CompoundButton.*;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
@@ -31,11 +33,12 @@ public class CrimeFragment extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_crime, container, false);
View v = inflater.inflate(R.layout.activity_main, container, false);
mSolvedCheckBox = (CheckBox) v.findViewById(R.id.crime_solved);
mTitleField = (EditText) v.findViewById(R.id.crime_title);
mDateButton = (Button) v.findViewById(R.id.crime_date);
mSolvedCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
mSolvedCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
mCrime.setmSolved(isChecked);
@@ -58,6 +61,9 @@ public class CrimeFragment extends Fragment {
}
});
return v; //super.onCreateView(inflater, container, savedInstanceState);
mDateButton = (Button) v.findViewById(R.id.crime_date);
mDateButton.setText(mCrime.getmDate().toString());
mDateButton.setEnabled(false);
return super.onCreateView(inflater, container, savedInstanceState);
}
}

View File

@@ -5,9 +5,9 @@
android:layout_height="match_parent"
android:layout_margin="16dp"
android:orientation="vertical">
<!--style="?android:listSeperatorTextViewStyle"-->
<TextView
style="?android:listSeperatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/crime_title_label"/>
@@ -18,8 +18,9 @@
android:layout_height="wrap_content"
android:hint="@string/crime_title_hint" />
<!--style="?android:listSeperatorTextViewStyle"-->
<TextView
style="?android:listSeperatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/crime_details_label"