mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-22 16:03: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.FragmentManager;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.navigation.NavController;
|
import androidx.navigation.NavController;
|
||||||
|
import androidx.navigation.NavOptions;
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
import androidx.navigation.fragment.NavHostFragment;
|
||||||
import androidx.navigation.ui.NavigationUI;
|
import androidx.navigation.ui.NavigationUI;
|
||||||
|
|
||||||
|
import android.app.ActivityOptions;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
@ -60,6 +62,19 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio
|
||||||
assert navHostFragment != null;
|
assert navHostFragment != null;
|
||||||
NavController navController = navHostFragment.getNavController();
|
NavController navController = navHostFragment.getNavController();
|
||||||
NavigationUI.setupWithNavController(bottomNavigationView, navController);
|
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) {
|
catch (Exception e) {
|
||||||
Log.e("Init", "Failed to init navigation");
|
Log.e("Init", "Failed to init navigation");
|
||||||
|
@ -83,7 +98,8 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio
|
||||||
findViewById(R.id.scanFab).setOnClickListener(v -> {
|
findViewById(R.id.scanFab).setOnClickListener(v -> {
|
||||||
Toast.makeText(this, "Scan", Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Scan", Toast.LENGTH_SHORT).show();
|
||||||
Intent intent = new Intent(this.getApplicationContext(), ScannerManagerActivity.class);
|
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 android.widget.Toast;
|
||||||
|
|
||||||
import androidx.activity.EdgeToEdge;
|
import androidx.activity.EdgeToEdge;
|
||||||
|
import androidx.activity.OnBackPressedCallback;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.core.graphics.Insets;
|
import androidx.core.graphics.Insets;
|
||||||
import androidx.core.view.ViewCompat;
|
import androidx.core.view.ViewCompat;
|
||||||
|
@ -41,6 +42,9 @@ public class ViewerMainActivity extends AppCompatActivity {
|
||||||
return insets;
|
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();
|
Intent intent = getIntent();
|
||||||
try {
|
try {
|
||||||
documentId = intent.getStringExtra("documentId");
|
documentId = intent.getStringExtra("documentId");
|
||||||
|
@ -58,4 +62,5 @@ public class ViewerMainActivity extends AppCompatActivity {
|
||||||
.replace(R.id.nav_host_fragment, ViewerListFragment.newInstance(documentId, documentName))
|
.replace(R.id.nav_host_fragment, ViewerListFragment.newInstance(documentId, documentName))
|
||||||
.commit();
|
.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package one.nem.lacerta.feature.home;
|
package one.nem.lacerta.feature.home;
|
||||||
|
|
||||||
|
import android.app.ActivityOptions;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -89,7 +90,7 @@ public class HomeTopFragment extends Fragment {
|
||||||
Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName);
|
Log.d("HomeTopFragment", "onDocumentSelect: " + documentId + " " + documentName);
|
||||||
intent.putExtra("documentId", documentId);
|
intent.putExtra("documentId", documentId);
|
||||||
intent.putExtra("documentName", documentName);
|
intent.putExtra("documentName", documentName);
|
||||||
startActivity(intent);
|
startActivity(intent, ActivityOptions.makeCustomAnimation(getContext(), 0, 0).toBundle());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
recyclerView.setAdapter(listItemAdapter);
|
recyclerView.setAdapter(listItemAdapter);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user