Commit 04dd6c15 authored by DESKTOP-NFGF3PG\zxa01's avatar DESKTOP-NFGF3PG\zxa01

Update home fragment layout

parent 2cf221ae
...@@ -7,6 +7,7 @@ import android.support.design.widget.BottomNavigationView; ...@@ -7,6 +7,7 @@ import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem; import android.view.MenuItem;
import com.example.zxa01.iotclient.R; import com.example.zxa01.iotclient.R;
import com.example.zxa01.iotclient.device.DeviceFragment; import com.example.zxa01.iotclient.device.DeviceFragment;
import com.example.zxa01.iotclient.privacy.PrivacyFragment; import com.example.zxa01.iotclient.privacy.PrivacyFragment;
...@@ -16,7 +17,7 @@ import butterknife.BindView; ...@@ -16,7 +17,7 @@ import butterknife.BindView;
import butterknife.ButterKnife; import butterknife.ButterKnife;
public class HomeActivity extends AppCompatActivity public class HomeActivity extends AppCompatActivity
implements HomeFragment.OnFragmentInteractionListener, DeviceFragment.OnFragmentInteractionListener implements DeviceFragment.OnFragmentInteractionListener
, PrivacyFragment.OnFragmentInteractionListener, SettingFragment.OnFragmentInteractionListener { , PrivacyFragment.OnFragmentInteractionListener, SettingFragment.OnFragmentInteractionListener {
DeviceFragment mDeviceFragment = new DeviceFragment(); DeviceFragment mDeviceFragment = new DeviceFragment();
...@@ -57,11 +58,6 @@ public class HomeActivity extends AppCompatActivity ...@@ -57,11 +58,6 @@ public class HomeActivity extends AppCompatActivity
showFragment(mDeviceFragment); showFragment(mDeviceFragment);
} }
@Override
public void onFragmentInteraction(Uri uri) {
// do nothing
}
@Override @Override
public void onDeviceFragment(Uri uri) { public void onDeviceFragment(Uri uri) {
// do nothing // do nothing
...@@ -79,7 +75,7 @@ public class HomeActivity extends AppCompatActivity ...@@ -79,7 +75,7 @@ public class HomeActivity extends AppCompatActivity
private void showFragment(Fragment fragment) { private void showFragment(Fragment fragment) {
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.replace(R.id.fragment_home, fragment) .replace(R.id.home_fragment_layout, fragment)
.commit(); .commit();
} }
} }
package com.example.zxa01.iotclient.home;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.zxa01.iotclient.R;
public class HomeFragment extends Fragment {
private OnFragmentInteractionListener mListener;
public HomeFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_home, container, false);
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
public interface OnFragmentInteractionListener {
void onFragmentInteraction(Uri uri);
}
}
...@@ -19,17 +19,15 @@ ...@@ -19,17 +19,15 @@
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:menu="@menu/navigation" /> app:menu="@menu/navigation" />
<fragment <FrameLayout
android:id="@+id/fragment_home" android:id="@+id/home_fragment_layout"
android:name="com.example.zxa01.iotclient.home.HomeFragment" android:layout_width="match_parent"
android:layout_width="0dp" android:layout_height="456dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/navigation" app:layout_constraintBottom_toTopOf="@+id/navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.444"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent">
app:layout_constraintVertical_bias="0.0" />
</FrameLayout>
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".home.HomeFragment">
</FrameLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment