-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
171 additions
and
20 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
app/src/main/java/com/example/lc/broadcast/another_view/Crime_Flagment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package com.example.lc.broadcast.another_view; | ||
|
||
|
||
import android.os.Bundle; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.text.Editable; | ||
import android.text.TextWatcher; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.Button; | ||
import android.widget.CheckBox; | ||
import android.widget.CompoundButton; | ||
import android.widget.EditText; | ||
|
||
import com.example.lc.broadcast.R; | ||
|
||
/** | ||
* 这个是Crime_Flagment的Fragment的程序 | ||
*/ | ||
public class Crime_Flagment extends Fragment { | ||
private Crime mCrime; | ||
private EditText CrimeText; | ||
private Button btn_Date; | ||
private CheckBox mCheckBox; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { | ||
View v = inflater.inflate(R.layout.crime_fragment,container,false); | ||
mCrime =new Crime(); | ||
CrimeText = v.findViewById(R.id.CrimeInformation); | ||
btn_Date = v.findViewById(R.id.Date); | ||
mCheckBox = v.findViewById(R.id.Crime_CheckBox); | ||
CrimeText.addTextChangedListener(new TextWatcher() { | ||
@Override | ||
public void beforeTextChanged(CharSequence s, int start, int count, int after) { | ||
} | ||
|
||
@Override | ||
public void onTextChanged(CharSequence s, int start, int before, int count) { | ||
|
||
} | ||
|
||
@Override | ||
public void afterTextChanged(Editable s) { | ||
mCrime.setTitle(s.toString()); | ||
} | ||
}); | ||
btn_Date.setText(mCrime.getDate()); | ||
btn_Date.setEnabled(false); | ||
mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { | ||
@Override | ||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { | ||
mCrime.setSolved(isChecked); | ||
} | ||
}); | ||
return v; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
app/src/main/java/com/example/lc/broadcast/another_view/SingleFragment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.example.lc.broadcast.another_view; | ||
|
||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
import com.example.lc.broadcast.R; | ||
|
||
public abstract class SingleFragment extends AppCompatActivity { | ||
protected abstract Fragment createFragment(); | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_crime); | ||
|
||
FragmentManager fm = getSupportFragmentManager(); | ||
Fragment fragment = fm.findFragmentById(R.id.Fragment_contain); | ||
if(fragment==null) | ||
{ | ||
fragment = createFragment(); | ||
fm.beginTransaction() | ||
.add(R.id.Fragment_contain,fragment) | ||
.commit(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:id="@+id/Fragment_contain" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
|
||
|
||
|
||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
<TextView | ||
style="?android:listSeparatorTextViewStyle" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/title"/> | ||
<EditText | ||
android:id="@+id/CrimeInformation" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:hint="输入犯错的信息"/> | ||
<TextView | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:hint="DETAILS"/> | ||
<Button | ||
android:id="@+id/Date" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" /> | ||
<CheckBox | ||
android:id="@+id/Crime_CheckBox" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="8dp" | ||
style="?android:listSeparatorTextViewStyle" | ||
android:text="解决了么"/> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters