-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create the main screen with new UX/UI using DrawerNavigation
fixes #182
- Loading branch information
Showing
36 changed files
with
569 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
app/src/main/java/br/org/cesar/discordtime/stickysessions/ui/main/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package br.org.cesar.discordtime.stickysessions.ui.main | ||
|
||
import android.os.Build | ||
import android.os.Bundle | ||
import android.view.Menu | ||
import android.view.MenuItem | ||
import android.widget.TextView | ||
import androidx.appcompat.app.ActionBarDrawerToggle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.appcompat.widget.Toolbar | ||
import androidx.core.content.ContextCompat | ||
import androidx.core.graphics.drawable.DrawableCompat | ||
import androidx.core.view.GravityCompat | ||
import br.org.cesar.discordtime.stickysessions.R | ||
import br.org.cesar.discordtime.stickysessions.ui.meeting.MeetingFragment | ||
import com.google.android.material.navigation.NavigationView | ||
import com.google.android.material.snackbar.Snackbar | ||
|
||
import kotlinx.android.synthetic.main.activity_main.* | ||
import kotlinx.android.synthetic.main.activity_main_app_bar.* | ||
|
||
class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener { | ||
|
||
private lateinit var mToolbarTitle: TextView | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
configureToolbar() | ||
|
||
fab.setOnClickListener { view -> | ||
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) | ||
.setAction("Action", null).show() | ||
} | ||
|
||
supportFragmentManager.beginTransaction() | ||
.replace(R.id.main_container, MeetingFragment()).commit() | ||
} | ||
|
||
private fun configureToolbar() { | ||
val toolbar = findViewById<Toolbar>(R.id.toolbar) | ||
setSupportActionBar(toolbar) | ||
|
||
supportActionBar?.apply { | ||
setDisplayShowHomeEnabled(true) | ||
setDisplayHomeAsUpEnabled(true) | ||
} | ||
|
||
mToolbarTitle = findViewById(R.id.toolbar_title) | ||
mToolbarTitle.apply { | ||
text = getString(R.string.nav_header_desc) | ||
} | ||
|
||
val toggle = ActionBarDrawerToggle( | ||
this, drawer_layout, toolbar, R.string.navigation_drawer_open, | ||
R.string.navigation_drawer_close | ||
) | ||
|
||
drawer_layout.addDrawerListener(toggle) | ||
toggle.syncState() | ||
|
||
nav_view.setNavigationItemSelectedListener(this) | ||
} | ||
|
||
override fun onBackPressed() { | ||
if (drawer_layout.isDrawerOpen(GravityCompat.START)) { | ||
drawer_layout.closeDrawer(GravityCompat.START) | ||
} else { | ||
super.onBackPressed() | ||
} | ||
} | ||
|
||
override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
menuInflater.inflate(R.menu.drawer_menu, menu) | ||
|
||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { | ||
val icon = menu.findItem(R.id.notification_menu).icon | ||
val drawable = DrawableCompat.wrap(icon) | ||
DrawableCompat.setTint(drawable, ContextCompat.getColor(this, R.color.coral)) | ||
menu.findItem(R.id.notification_menu).apply { | ||
setIcon(drawable) | ||
} | ||
} | ||
|
||
return true | ||
} | ||
|
||
override fun onNavigationItemSelected(item: MenuItem): Boolean { | ||
when (item.itemId) { | ||
R.id.nav_meetings -> { showMeetingFragment() } | ||
R.id.nav_about -> { } | ||
R.id.nav_settings -> { } | ||
} | ||
|
||
drawer_layout.closeDrawer(GravityCompat.START) | ||
return true | ||
} | ||
|
||
private fun showMeetingFragment() { | ||
supportFragmentManager.beginTransaction() | ||
.replace(R.id.main_container, MeetingFragment()).commit() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item android:color="@color/coral" android:state_checked="true" /> | ||
<item android:color="@color/warm_grey" /> | ||
</selector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M12,2a10,10 0,1 0,10 10A10,10 0,0 0,12 2zM13,17h-2v-6h2zM13,9h-2L11,7h2z" | ||
android:fillColor="#8b8b8b"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M2,21h18v-2H2M20,8h-2V5h2m0,-2H4v10a4,4 0,0 0,4 4h6a4,4 0,0 0,4 -4v-3h2a2,2 0,0 0,2 -2V5a2,2 0,0 0,-2 -2z" | ||
android:fillColor="#ff534b"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M10.09,15.59L11.5,17l5,-5 -5,-5 -1.41,1.41L12.67,11H3v2h9.67l-2.58,2.59zM19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M2.01,21L23,12 2.01,3 2,10l15,2 -15,2z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M18,16.08c-0.76,0 -1.44,0.3 -1.96,0.77L8.91,12.7c0.05,-0.23 0.09,-0.46 0.09,-0.7s-0.04,-0.47 -0.09,-0.7l7.05,-4.11c0.54,0.5 1.25,0.81 2.04,0.81 1.66,0 3,-1.34 3,-3s-1.34,-3 -3,-3 -3,1.34 -3,3c0,0.24 0.04,0.47 0.09,0.7L8.04,9.81C7.5,9.31 6.79,9 6,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3c0.79,0 1.5,-0.31 2.04,-0.81l7.12,4.16c-0.05,0.21 -0.08,0.43 -0.08,0.65 0,1.61 1.31,2.92 2.92,2.92 1.61,0 2.92,-1.31 2.92,-2.92s-1.31,-2.92 -2.92,-2.92z"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M18.714,16.952v0.762L5,17.714v-0.762l1.524,-1.524L6.524,10.857a5.326,5.326 0,0 1,3.81 -5.112v-0.221a1.524,1.524 0,0 1,3.048 0v0.221a5.326,5.326 0,0 1,3.81 5.112v4.571l1.524,1.524m-5.333,1.524a1.524,1.524 0,0 1,-3.048 0" | ||
android:fillColor="#8b8b8b"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:pathData="M19.144,12.936a7.832,7.832 0,0 0,0.06 -0.936,5.918 5.918,0 0,0 -0.072,-0.936l2.024,-1.584a0.5,0.5 0,0 0,0.12 -0.612l-1.92,-3.324a0.488,0.488 0,0 0,-0.588 -0.216l-2.388,0.96a7.03,7.03 0,0 0,-1.62 -0.936l-0.36,-2.544a0.479,0.479 0,0 0,-0.48 -0.408h-3.84a0.467,0.467 0,0 0,-0.468 0.408l-0.36,2.544a7.219,7.219 0,0 0,-1.62 0.936L5.244,5.328a0.475,0.475 0,0 0,-0.588 0.216l-1.92,3.324a0.465,0.465 0,0 0,0.12 0.612l2.028,1.584a5.655,5.655 0,0 0,-0.012 1.872L2.844,14.52a0.5,0.5 0,0 0,-0.12 0.612l1.92,3.324a0.488,0.488 0,0 0,0.588 0.216l2.388,-0.96a7.03,7.03 0,0 0,1.62 0.936l0.36,2.544a0.488,0.488 0,0 0,0.48 0.408h3.84a0.459,0.459 0,0 0,0.468 -0.408l0.36,-2.544a7.219,7.219 0,0 0,1.62 -0.936l2.388,0.96a0.475,0.475 0,0 0,0.588 -0.216l1.92,-3.324a0.465,0.465 0,0 0,-0.12 -0.612l-2,-1.584zM12,15.6a3.6,3.6 0,1 1,3.6 -3.6,3.611 3.611,0 0,1 -3.6,3.6z" | ||
android:fillColor="#8b8b8b"/> | ||
</vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<font-family xmlns:app="http://schemas.android.com/apk/res-auto" | ||
app:fontProviderAuthority="com.google.android.gms.fonts" | ||
app:fontProviderPackage="com.google.android.gms" | ||
app:fontProviderQuery="Roboto" | ||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs"> | ||
</font-family> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<font-family xmlns:app="http://schemas.android.com/apk/res-auto" | ||
app:fontProviderAuthority="com.google.android.gms.fonts" | ||
app:fontProviderPackage="com.google.android.gms" | ||
app:fontProviderQuery="name=Roboto&weight=700" | ||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs"> | ||
</font-family> |
Oops, something went wrong.