diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 61a9130..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 65f8ad0..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index f4c0eb3..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 7b6dad0..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index 797acea..0000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/java/com/unionmed/unionmedtv/fragment/MyDoctorFragment.java b/app/src/main/java/com/unionmed/unionmedtv/fragment/MyDoctorFragment.java index da13ef6..adafb75 100644 --- a/app/src/main/java/com/unionmed/unionmedtv/fragment/MyDoctorFragment.java +++ b/app/src/main/java/com/unionmed/unionmedtv/fragment/MyDoctorFragment.java @@ -9,6 +9,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; +import androidx.constraintlayout.widget.ConstraintLayout; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -31,6 +32,7 @@ import com.unionmed.unionmedtv.utils.CacheUtil; import com.unionmed.unionmedtv.utils.LinearSpacingItemDecoration; import com.unionmed.unionmedtv.utils.MyGridLayoutManager; import com.unionmed.unionmedtv.utils.OnChildClickListener; +import com.unionmed.unionmedtv.widgets.ImgConstraintLayout; import java.util.ArrayList; import java.util.List; @@ -47,7 +49,7 @@ public class MyDoctorFragment extends Fragment implements View.OnClickListener { private int startNum = 0; private int endNum = 10; private int selectPostion = 0;//当前列表item点击位置 - + private ImgConstraintLayout constraint; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_my_doctor, container, false); @@ -70,37 +72,40 @@ public class MyDoctorFragment extends Fragment implements View.OnClickListener { }); iv_doctor = view.findViewById(R.id.iv_doctor); iv_doctor.setOnClickListener(this); + constraint=view.findViewById(R.id.constraint); + View v=getActivity().findViewById(R.id.tv_my_doctor); + constraint.setNextFocusLeftId(v.getId()); iv_hospital = view.findViewById(R.id.iv_hospital); iv_hospital.setOnClickListener(this); recyclerView.setAdapter(contractedDoctorAdapter); recyclerView.addItemDecoration(new LinearSpacingItemDecoration(getActivity(), 24)); - iv_doctor.setOnFocusChangeListener(new View.OnFocusChangeListener() { - @Override - public void onFocusChange(View v, boolean hasFocus) { - if (hasFocus) { - // 获取最后一个控件的位置 - Rect rect = new Rect(); - iv_doctor.getGlobalVisibleRect(rect); - - // 按下方向键时,如果焦点将离开最后一个控件,则阻止焦点失去 - iv_doctor.setOnKeyListener(new View.OnKeyListener() { - @Override - public boolean onKey(View v, int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN && event.getAction() == KeyEvent.ACTION_DOWN) { - View nextView = iv_doctor.focusSearch(View.FOCUS_DOWN); - if (nextView == null) { - return true; - } - } - return false; - } - }); - } else { - // 移除OnKeyListener,以便在此控件上正常使用 - iv_doctor.setOnKeyListener(null); - } - } - }); +// iv_doctor.setOnFocusChangeListener(new View.OnFocusChangeListener() { +// @Override +// public void onFocusChange(View v, boolean hasFocus) { +// if (hasFocus) { +// // 获取最后一个控件的位置 +// Rect rect = new Rect(); +// iv_doctor.getGlobalVisibleRect(rect); +// +// // 按下方向键时,如果焦点将离开最后一个控件,则阻止焦点失去 +// iv_doctor.setOnKeyListener(new View.OnKeyListener() { +// @Override +// public boolean onKey(View v, int keyCode, KeyEvent event) { +// if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN && event.getAction() == KeyEvent.ACTION_DOWN) { +// View nextView = iv_doctor.focusSearch(View.FOCUS_DOWN); +// if (nextView == null) { +// return true; +// } +// } +// return false; +// } +// }); +// } else { +// // 移除OnKeyListener,以便在此控件上正常使用 +// iv_doctor.setOnKeyListener(null); +// } +// } +// }); } public void loadData() { diff --git a/app/src/main/res/drawable/bg_focus_10.xml b/app/src/main/res/drawable/bg_focus_10.xml new file mode 100644 index 0000000..5f6b1cc --- /dev/null +++ b/app/src/main/res/drawable/bg_focus_10.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/bg_focus_selector_10.xml b/app/src/main/res/drawable/bg_focus_selector_10.xml new file mode 100644 index 0000000..1e9a3d7 --- /dev/null +++ b/app/src/main/res/drawable/bg_focus_selector_10.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_my_doctor.xml b/app/src/main/res/layout/fragment_my_doctor.xml index daa2be8..7623658 100644 --- a/app/src/main/res/layout/fragment_my_doctor.xml +++ b/app/src/main/res/layout/fragment_my_doctor.xml @@ -1,8 +1,10 @@ + android:layout_height="match_parent" + android:descendantFocusability="blocksDescendants"> - + android:layout_height="190dp" + android:layout_marginTop="20dp" + android:layout_marginRight="20dp" + android:nextFocusLeft="@null" + android:layout_weight="1"> + android:src="@mipmap/icon_nearby_doctor" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + android:textSize="24sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> - + + + + android:layout_height="190dp" + android:layout_marginTop="20dp" + android:nextFocusRight="@null" + android:layout_weight="1"> + android:scaleType="fitXY" + android:src="@mipmap/icon_nearby_hospital" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintLeft_toLeftOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + android:textSize="24sp" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintRight_toRightOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + - + + diff --git a/app/src/main/res/mipmap-xhdpi/icon_hang_up.png b/app/src/main/res/mipmap-xhdpi/icon_hang_up.png new file mode 100644 index 0000000..5ce619f Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/icon_hang_up.png differ diff --git a/app/src/main/res/mipmap-xhdpi/icon_mute.png b/app/src/main/res/mipmap-xhdpi/icon_mute.png new file mode 100644 index 0000000..7d821c7 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/icon_mute.png differ diff --git a/app/src/main/res/mipmap-xhdpi/icon_put_through.png b/app/src/main/res/mipmap-xhdpi/icon_put_through.png new file mode 100644 index 0000000..508de7a Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/icon_put_through.png differ diff --git a/app/src/main/res/mipmap-xhdpi/icon_turn_off_camera.png b/app/src/main/res/mipmap-xhdpi/icon_turn_off_camera.png new file mode 100644 index 0000000..1ee5aae Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/icon_turn_off_camera.png differ