mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 07:53:15 +00:00
iroiro
This commit is contained in:
parent
6679f8389c
commit
5096e8de23
|
@ -8,9 +8,11 @@ import androidx.fragment.app.Fragment;
|
|||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.NavOptions;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Color;
|
||||
|
@ -60,6 +62,19 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio
|
|||
assert navHostFragment != null;
|
||||
NavController navController = navHostFragment.getNavController();
|
||||
NavigationUI.setupWithNavController(bottomNavigationView, navController);
|
||||
|
||||
bottomNavigationView.setOnItemSelectedListener(item -> {
|
||||
NavOptions navOptions = new NavOptions.Builder()
|
||||
.setLaunchSingleTop(true)
|
||||
.setEnterAnim(androidx.navigation.ui.R.anim.nav_default_enter_anim)
|
||||
.setExitAnim(androidx.navigation.ui.R.anim.nav_default_exit_anim)
|
||||
.setPopEnterAnim(androidx.navigation.ui.R.anim.nav_default_pop_enter_anim)
|
||||
.setPopExitAnim(androidx.navigation.ui.R.anim.nav_default_pop_exit_anim)
|
||||
.build();
|
||||
|
||||
navController.navigate(item.getItemId(), null, navOptions);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.e("Init", "Failed to init navigation");
|
||||
|
@ -83,7 +98,8 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio
|
|||
findViewById(R.id.scanFab).setOnClickListener(v -> {
|
||||
Toast.makeText(this, "Scan", Toast.LENGTH_SHORT).show();
|
||||
Intent intent = new Intent(this.getApplicationContext(), ScannerManagerActivity.class);
|
||||
startActivity(intent);
|
||||
// startActivity(intent);
|
||||
startActivity(intent, ActivityOptions.makeCustomAnimation(this, 0, 0).toBundle());
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.os.Bundle;
|
|||
import android.widget.Toast;
|
||||
|
||||
import androidx.activity.EdgeToEdge;
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.core.graphics.Insets;
|
||||
import androidx.core.view.ViewCompat;
|
||||
|
@ -41,6 +42,9 @@ public class ViewerMainActivity extends AppCompatActivity {
|
|||
return insets;
|
||||
});
|
||||
|
||||
// // Transition
|
||||
// overridePendingTransition(one.nem.lacerta.shared.ui.R.anim.nav_up_enter_anim, one.nem.lacerta.shared.ui.R.anim.nav_up_exit_anim);
|
||||
|
||||
Intent intent = getIntent();
|
||||
try {
|
||||
documentId = intent.getStringExtra("documentId");
|
||||
|
@ -58,4 +62,5 @@ public class ViewerMainActivity extends AppCompatActivity {
|
|||
.replace(R.id.nav_host_fragment, ViewerListFragment.newInstance(documentId, documentName))
|
||||
.commit();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package one.nem.lacerta.feature.home;
|
||||
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
@ -89,7 +90,7 @@ public class HomeTopFragment extends Fragment {
|
|||
Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName);
|
||||
intent.putExtra("documentId", documentId);
|
||||
intent.putExtra("documentName", documentName);
|
||||
startActivity(intent);
|
||||
startActivity(intent, ActivityOptions.makeCustomAnimation(getContext(), 0, 0).toBundle());
|
||||
}
|
||||
});
|
||||
recyclerView.setAdapter(listItemAdapter);
|
||||
|
|
Loading…
Reference in New Issue
Block a user