-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ff1edd
commit cc3bc40
Showing
42 changed files
with
784 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package com.example.myuw | ||
|
||
import android.os.Bundle | ||
import com.google.android.material.floatingactionbutton.FloatingActionButton | ||
import com.google.android.material.snackbar.Snackbar | ||
import androidx.navigation.findNavController | ||
import androidx.navigation.ui.AppBarConfiguration | ||
import androidx.navigation.ui.navigateUp | ||
import androidx.navigation.ui.setupActionBarWithNavController | ||
import androidx.navigation.ui.setupWithNavController | ||
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 | ||
|
||
class NavDrawerMain : AppCompatActivity() { | ||
|
||
private lateinit var appBarConfiguration: AppBarConfiguration | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_nav_drawer_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 navController = findNavController(R.id.nav_host_fragment) | ||
// Passing each menu ID as a set of Ids because each | ||
// menu should be considered as top level destinations. | ||
appBarConfiguration = AppBarConfiguration( | ||
setOf( | ||
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow, | ||
R.id.nav_tools, R.id.nav_share, R.id.nav_send | ||
), drawerLayout | ||
) | ||
setupActionBarWithNavController(navController, appBarConfiguration) | ||
navView.setupWithNavController(navController) | ||
} | ||
|
||
override fun onCreateOptionsMenu(menu: Menu): Boolean { | ||
// Inflate the menu; this adds items to the action bar if it is present. | ||
menuInflater.inflate(R.menu.nav_drawer_main, menu) | ||
return true | ||
} | ||
|
||
override fun onSupportNavigateUp(): Boolean { | ||
val navController = findNavController(R.id.nav_host_fragment) | ||
return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp() | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/example/myuw/ui/gallery/GalleryFragment.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,31 @@ | ||
package com.example.myuw.ui.gallery | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.TextView | ||
import androidx.fragment.app.Fragment | ||
import androidx.lifecycle.Observer | ||
import androidx.lifecycle.ViewModelProviders | ||
import com.example.myuw.R | ||
|
||
class GalleryFragment : Fragment() { | ||
|
||
private lateinit var galleryViewModel: GalleryViewModel | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
galleryViewModel = | ||
ViewModelProviders.of(this).get(GalleryViewModel::class.java) | ||
val root = inflater.inflate(R.layout.fragment_gallery, container, false) | ||
val textView: TextView = root.findViewById(R.id.text_gallery) | ||
galleryViewModel.text.observe(this, Observer { | ||
textView.text = it | ||
}) | ||
return root | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/example/myuw/ui/gallery/GalleryViewModel.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,13 @@ | ||
package com.example.myuw.ui.gallery | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class GalleryViewModel : ViewModel() { | ||
|
||
private val _text = MutableLiveData<String>().apply { | ||
value = "This is gallery Fragment" | ||
} | ||
val text: LiveData<String> = _text | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/example/myuw/ui/home/HomeFragment.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,31 @@ | ||
package com.example.myuw.ui.home | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.TextView | ||
import androidx.fragment.app.Fragment | ||
import androidx.lifecycle.Observer | ||
import androidx.lifecycle.ViewModelProviders | ||
import com.example.myuw.R | ||
|
||
class HomeFragment : Fragment() { | ||
|
||
private lateinit var homeViewModel: HomeViewModel | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
homeViewModel = | ||
ViewModelProviders.of(this).get(HomeViewModel::class.java) | ||
val root = inflater.inflate(R.layout.fragment_home, container, false) | ||
val textView: TextView = root.findViewById(R.id.text_home) | ||
homeViewModel.text.observe(this, Observer { | ||
textView.text = it | ||
}) | ||
return root | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/example/myuw/ui/home/HomeViewModel.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,13 @@ | ||
package com.example.myuw.ui.home | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class HomeViewModel : ViewModel() { | ||
|
||
private val _text = MutableLiveData<String>().apply { | ||
value = "This is home Fragment" | ||
} | ||
val text: LiveData<String> = _text | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/example/myuw/ui/send/SendFragment.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,31 @@ | ||
package com.example.myuw.ui.send | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.TextView | ||
import androidx.fragment.app.Fragment | ||
import androidx.lifecycle.Observer | ||
import androidx.lifecycle.ViewModelProviders | ||
import com.example.myuw.R | ||
|
||
class SendFragment : Fragment() { | ||
|
||
private lateinit var sendViewModel: SendViewModel | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
sendViewModel = | ||
ViewModelProviders.of(this).get(SendViewModel::class.java) | ||
val root = inflater.inflate(R.layout.fragment_send, container, false) | ||
val textView: TextView = root.findViewById(R.id.text_send) | ||
sendViewModel.text.observe(this, Observer { | ||
textView.text = it | ||
}) | ||
return root | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/example/myuw/ui/send/SendViewModel.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,13 @@ | ||
package com.example.myuw.ui.send | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class SendViewModel : ViewModel() { | ||
|
||
private val _text = MutableLiveData<String>().apply { | ||
value = "This is send Fragment" | ||
} | ||
val text: LiveData<String> = _text | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/example/myuw/ui/share/ShareFragment.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,31 @@ | ||
package com.example.myuw.ui.share | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.TextView | ||
import androidx.fragment.app.Fragment | ||
import androidx.lifecycle.Observer | ||
import androidx.lifecycle.ViewModelProviders | ||
import com.example.myuw.R | ||
|
||
class ShareFragment : Fragment() { | ||
|
||
private lateinit var shareViewModel: ShareViewModel | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
shareViewModel = | ||
ViewModelProviders.of(this).get(ShareViewModel::class.java) | ||
val root = inflater.inflate(R.layout.fragment_share, container, false) | ||
val textView: TextView = root.findViewById(R.id.text_share) | ||
shareViewModel.text.observe(this, Observer { | ||
textView.text = it | ||
}) | ||
return root | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/example/myuw/ui/share/ShareViewModel.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,13 @@ | ||
package com.example.myuw.ui.share | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class ShareViewModel : ViewModel() { | ||
|
||
private val _text = MutableLiveData<String>().apply { | ||
value = "This is share Fragment" | ||
} | ||
val text: LiveData<String> = _text | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/example/myuw/ui/slideshow/SlideshowFragment.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,31 @@ | ||
package com.example.myuw.ui.slideshow | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.TextView | ||
import androidx.fragment.app.Fragment | ||
import androidx.lifecycle.Observer | ||
import androidx.lifecycle.ViewModelProviders | ||
import com.example.myuw.R | ||
|
||
class SlideshowFragment : Fragment() { | ||
|
||
private lateinit var slideshowViewModel: SlideshowViewModel | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
slideshowViewModel = | ||
ViewModelProviders.of(this).get(SlideshowViewModel::class.java) | ||
val root = inflater.inflate(R.layout.fragment_slideshow, container, false) | ||
val textView: TextView = root.findViewById(R.id.text_slideshow) | ||
slideshowViewModel.text.observe(this, Observer { | ||
textView.text = it | ||
}) | ||
return root | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/example/myuw/ui/slideshow/SlideshowViewModel.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,13 @@ | ||
package com.example.myuw.ui.slideshow | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class SlideshowViewModel : ViewModel() { | ||
|
||
private val _text = MutableLiveData<String>().apply { | ||
value = "This is slideshow Fragment" | ||
} | ||
val text: LiveData<String> = _text | ||
} |
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/example/myuw/ui/tools/ToolsFragment.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,31 @@ | ||
package com.example.myuw.ui.tools | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.TextView | ||
import androidx.fragment.app.Fragment | ||
import androidx.lifecycle.Observer | ||
import androidx.lifecycle.ViewModelProviders | ||
import com.example.myuw.R | ||
|
||
class ToolsFragment : Fragment() { | ||
|
||
private lateinit var toolsViewModel: ToolsViewModel | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View? { | ||
toolsViewModel = | ||
ViewModelProviders.of(this).get(ToolsViewModel::class.java) | ||
val root = inflater.inflate(R.layout.fragment_tools, container, false) | ||
val textView: TextView = root.findViewById(R.id.text_tools) | ||
toolsViewModel.text.observe(this, Observer { | ||
textView.text = it | ||
}) | ||
return root | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/com/example/myuw/ui/tools/ToolsViewModel.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,13 @@ | ||
package com.example.myuw.ui.tools | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.MutableLiveData | ||
import androidx.lifecycle.ViewModel | ||
|
||
class ToolsViewModel : ViewModel() { | ||
|
||
private val _text = MutableLiveData<String>().apply { | ||
value = "This is tools Fragment" | ||
} | ||
val text: LiveData<String> = _text | ||
} |
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,12 @@ | ||
<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="M12,12m-3.2,0a3.2,3.2 0,1 1,6.4 0a3.2,3.2 0,1 1,-6.4 0" /> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M9,2L7.17,4H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V6c0,-1.1 -0.9,-2 -2,-2h-3.17L15,2H9zm3,15c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5z" /> | ||
</vector> |
Oops, something went wrong.