mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 09:43:15 +00:00
fab追加
This commit is contained in:
parent
a61de24931
commit
b9d81ab997
|
@ -10,6 +10,7 @@ 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.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -17,12 +18,14 @@ import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import one.nem.lacerta.component.scanner.ScannerManagerActivity;
|
||||||
import one.nem.lacerta.model.FragmentNavigation;
|
import one.nem.lacerta.model.FragmentNavigation;
|
||||||
import one.nem.lacerta.model.pref.FeatureSwitchOverride;
|
import one.nem.lacerta.model.pref.FeatureSwitchOverride;
|
||||||
import one.nem.lacerta.utils.FeatureSwitch;
|
import one.nem.lacerta.utils.FeatureSwitch;
|
||||||
|
|
||||||
import com.google.android.material.appbar.AppBarLayout;
|
import com.google.android.material.appbar.AppBarLayout;
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
|
||||||
|
|
||||||
import java.io.NotActiveException;
|
import java.io.NotActiveException;
|
||||||
|
@ -74,6 +77,13 @@ public class MainActivity extends AppCompatActivity implements FragmentNavigatio
|
||||||
// Set status bar color
|
// Set status bar color
|
||||||
getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface));
|
getWindow().setStatusBarColor(ContextCompat.getColor(this, one.nem.lacerta.shared.ui.R.color.colorSurface));
|
||||||
|
|
||||||
|
// Fab
|
||||||
|
findViewById(R.id.scanFab).setOnClickListener(v -> {
|
||||||
|
Toast.makeText(this, "Scan", Toast.LENGTH_SHORT).show();
|
||||||
|
Intent intent = new Intent(this.getApplicationContext(), ScannerManagerActivity.class);
|
||||||
|
startActivity(intent);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
private void initializeApp() {
|
private void initializeApp() {
|
||||||
Log.d("Init", "Initializing app");
|
Log.d("Init", "Initializing app");
|
||||||
|
|
|
@ -34,4 +34,17 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:menu="@menu/bottom_nav_menu" />
|
app:menu="@menu/bottom_nav_menu" />
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/scanFab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="24dp"
|
||||||
|
android:layout_marginBottom="24dp"
|
||||||
|
android:clickable="true"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/bottom_nav"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:srcCompat="@drawable/ic_baseline_add_24" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user