mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +00:00
Transitionテスト
This commit is contained in:
parent
989dc094fa
commit
051a6e582f
|
@ -2,16 +2,17 @@ package one.nem.lacerta;
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
import androidx.navigation.ui.NavigationUI;
|
import androidx.navigation.ui.NavigationUI;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.transition.Transition;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
import com.google.android.material.transition.MaterialSharedAxis;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint;
|
import dagger.hilt.android.AndroidEntryPoint;
|
||||||
|
@ -29,9 +30,12 @@ public class MainActivity extends AppCompatActivity {
|
||||||
FragmentManager supportFragmentManager = getSupportFragmentManager();
|
FragmentManager supportFragmentManager = getSupportFragmentManager();
|
||||||
|
|
||||||
NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment);
|
NavHostFragment navHostFragment = (NavHostFragment) supportFragmentManager.findFragmentById(R.id.nav_host_fragment);
|
||||||
NavController navController = navHostFragment.getNavController();
|
|
||||||
|
// Animation
|
||||||
|
|
||||||
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
|
BottomNavigationView bottomNavigationView = findViewById(R.id.bottom_nav);
|
||||||
|
|
||||||
|
NavController navController = navHostFragment.getNavController();
|
||||||
NavigationUI.setupWithNavController(bottomNavigationView, navController);
|
NavigationUI.setupWithNavController(bottomNavigationView, navController);
|
||||||
|
|
||||||
Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "testMessage", Toast.LENGTH_SHORT).show();
|
||||||
|
|
|
@ -2,8 +2,11 @@ package one.nem.lacerta.feature.home;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import android.transition.TransitionInflater;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
|
import android.transition.TransitionManager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -49,9 +52,14 @@ public class HomeTopFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
// Transition
|
||||||
|
TransitionInflater inflater = TransitionInflater.from(requireContext());
|
||||||
|
setEnterTransition(inflater.inflateTransition(android.R.transition.slide_top));
|
||||||
|
setExitTransition(inflater.inflateTransition(android.R.transition.slide_bottom));
|
||||||
if (getArguments() != null) {
|
if (getArguments() != null) {
|
||||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user