|
|
|
@ -1,17 +1,17 @@ |
|
|
|
|
package io.legado.app.ui.main |
|
|
|
|
|
|
|
|
|
import android.os.Bundle |
|
|
|
|
import com.google.android.material.floatingactionbutton.FloatingActionButton |
|
|
|
|
import com.google.android.material.snackbar.Snackbar |
|
|
|
|
import androidx.core.view.GravityCompat |
|
|
|
|
import androidx.appcompat.app.ActionBarDrawerToggle |
|
|
|
|
import android.view.Menu |
|
|
|
|
import android.view.MenuItem |
|
|
|
|
import androidx.appcompat.app.ActionBarDrawerToggle |
|
|
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
|
|
import androidx.core.view.GravityCompat |
|
|
|
|
import androidx.drawerlayout.widget.DrawerLayout |
|
|
|
|
import com.google.android.material.navigation.NavigationView |
|
|
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
|
|
import androidx.appcompat.widget.Toolbar |
|
|
|
|
import android.view.Menu |
|
|
|
|
import com.google.android.material.snackbar.Snackbar |
|
|
|
|
import io.legado.app.R |
|
|
|
|
import kotlinx.android.synthetic.main.activity_main.* |
|
|
|
|
import kotlinx.android.synthetic.main.app_bar_main.* |
|
|
|
|
|
|
|
|
|
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener { |
|
|
|
|
|
|
|
|
@ -19,25 +19,23 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte |
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) { |
|
|
|
|
super.onCreate(savedInstanceState) |
|
|
|
|
setContentView(R.layout.activity_main) |
|
|
|
|
val toolbar: Toolbar = findViewById(R.id.toolbar) |
|
|
|
|
|
|
|
|
|
setSupportActionBar(toolbar) |
|
|
|
|
|
|
|
|
|
val fab: FloatingActionButton = findViewById(R.id.fab) |
|
|
|
|
fab.setOnClickListener { view -> |
|
|
|
|
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) |
|
|
|
|
.setAction("Action", null).show() |
|
|
|
|
} |
|
|
|
|
val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout) |
|
|
|
|
val navView: NavigationView = findViewById(R.id.nav_view) |
|
|
|
|
|
|
|
|
|
val toggle = ActionBarDrawerToggle( |
|
|
|
|
this, drawerLayout, toolbar, |
|
|
|
|
this, drawer_layout, toolbar, |
|
|
|
|
R.string.navigation_drawer_open, |
|
|
|
|
R.string.navigation_drawer_close |
|
|
|
|
) |
|
|
|
|
drawerLayout.addDrawerListener(toggle) |
|
|
|
|
drawer_layout.addDrawerListener(toggle) |
|
|
|
|
toggle.syncState() |
|
|
|
|
|
|
|
|
|
navView.setNavigationItemSelectedListener(this) |
|
|
|
|
nav_view.setNavigationItemSelectedListener(this) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onBackPressed() { |
|
|
|
|