diff --git a/.gitignore b/.gitignore
index 603b140..3ae4445 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,5 @@
/captures
.externalNativeBuild
.cxx
+/.idea/codeStyles
+.idea/gradle.xml
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
index 88ea3aa..3cc336b 100644
--- a/.idea/codeStyles/Project.xml
+++ b/.idea/codeStyles/Project.xml
@@ -1,6 +1,22 @@
+
+
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..61a9130
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index ac6b0ae..23a89bb 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -15,6 +15,7 @@
+
diff --git a/app/src/main/java/com/anant/codingguide/activity/ControlActivity.kt b/app/src/main/java/com/anant/codingguide/activity/ControlActivity.kt
index e91c2a0..39e2453 100644
--- a/app/src/main/java/com/anant/codingguide/activity/ControlActivity.kt
+++ b/app/src/main/java/com/anant/codingguide/activity/ControlActivity.kt
@@ -1,6 +1,5 @@
package com.anant.codingguide.activity
-//import android.widget.Toolbar
import android.content.DialogInterface
import android.os.Bundle
@@ -17,6 +16,8 @@ import com.anant.codingguide.R
import com.anant.codingguide.fragment.*
import com.google.android.material.navigation.NavigationView
import androidx.appcompat.app.AlertDialog.Builder
+import androidx.fragment.app.Fragment
+import androidx.fragment.app.FragmentTransaction
class ControlActivity : AppCompatActivity() {
@@ -27,7 +28,7 @@ class ControlActivity : AppCompatActivity() {
lateinit var toolbar: Toolbar
lateinit var frameLayout: FrameLayout
lateinit var navigationView: NavigationView
- var previousMenuItem:MenuItem?=null
+ var previousMenuItem: MenuItem? = null
override fun onCreate(savedInstanceState: Bundle?) {
@@ -41,69 +42,65 @@ class ControlActivity : AppCompatActivity() {
navigationView = findViewById(R.id.navigationView)
openHome()
- supportActionBar?.title="Home"
+ supportActionBar?.title = "Home"
setUpToolbar()
- val actionBarDrawerToggle=ActionBarDrawerToggle(this@ControlActivity,drawerLayout,R.string.open_drawer,R.string.close_drawer)
+ val actionBarDrawerToggle = ActionBarDrawerToggle(
+ this@ControlActivity,
+ drawerLayout,
+ R.string.open_drawer,
+ R.string.close_drawer
+ )
drawerLayout.addDrawerListener(actionBarDrawerToggle)
actionBarDrawerToggle.syncState()
navigationView.setNavigationItemSelectedListener {
- if(previousMenuItem != null){
- previousMenuItem?.isChecked=false
+ if (previousMenuItem != null) {
+ previousMenuItem?.isChecked = false
}
- it.isCheckable=true
- it.isChecked=true
- previousMenuItem=it
-
- when(it.itemId)
- {
- R.id.home->{
- openHome()
+ it.isCheckable = true
+ it.isChecked = true
+ previousMenuItem = it
+
+
+ when (it.itemId) {
+ R.id.home -> {
+ openHome()
drawerLayout.closeDrawers()
}
- R.id.language->{
- supportFragmentManager.beginTransaction().replace(R.id.frame,
- LanguagesFragment()
- ).commit()
- supportActionBar?.title="Programming languages"
+ R.id.language -> {
+ setUpFragment(LanguagesFragment())
+ supportActionBar?.title = "Programming languages"
drawerLayout.closeDrawers()
}
- R.id.dev->{
- supportFragmentManager.beginTransaction().replace(R.id.frame,
- DevelopmentFragment()
- ).commit()
- supportActionBar?.title="Software Development"
+ R.id.dev -> {
+ setUpFragment(DevelopmentFragment())
+ supportActionBar?.title = "Software Development"
drawerLayout.closeDrawers()
}
- R.id.quest->{
- supportFragmentManager.beginTransaction().replace(R.id.frame,
- CompetitiveProgrammingFragment()
- ).commit()
- supportActionBar?.title="Competitive programming"
+ R.id.quest -> {
+ setUpFragment(CompetitiveProgrammingFragment())
+ supportActionBar?.title = "Competitive programming"
drawerLayout.closeDrawers()
}
-
- R.id.compiler->{
- supportFragmentManager.beginTransaction().replace(R.id.frame,
- CompilerFragment()
- ).commit()
- supportActionBar?.title="Test your Code"
+ R.id.compiler -> {
+ setUpFragment(CompilerFragment())
+ supportActionBar?.title = "Test your Code"
drawerLayout.closeDrawers()
}
- R.id.exit->{
+ R.id.exit -> {
val builder: android.app.AlertDialog.Builder =
android.app.AlertDialog.Builder(this@ControlActivity)
builder.setTitle(R.string.app_name)
@@ -119,7 +116,6 @@ class ControlActivity : AppCompatActivity() {
}
-
}
@@ -132,36 +128,47 @@ class ControlActivity : AppCompatActivity() {
}
- fun setUpToolbar(){
+ fun setUpToolbar() {
setSupportActionBar(toolbar)
- //supportActionBar?.title="Toolbar Title"
+ //supportActionBar?.title="Toolbar Title"
supportActionBar?.setHomeButtonEnabled(true)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}
+ fun setUpFragment(fragment: Fragment){
+ val manager = supportFragmentManager.beginTransaction()
+ manager.setCustomAnimations(
+ R.anim.slide_in,
+ R.anim.slide_out)
+
+ manager.replace(
+ R.id.frame,
+ fragment
+ )
+ manager.commit()
+ }
+
override fun onOptionsItemSelected(item: MenuItem): Boolean {
- val id=item.itemId
- if(id==android.R.id.home)
- {
+ val id = item.itemId
+ if (id == android.R.id.home) {
drawerLayout.openDrawer(GravityCompat.START)
}
return super.onOptionsItemSelected(item)
}
- fun openHome()
- {
- val fragment=HomeFragment()
- val transaction=supportFragmentManager.beginTransaction()
- transaction.replace(R.id.frame,fragment)
+ fun openHome() {
+ val fragment = HomeFragment()
+ val transaction = supportFragmentManager.beginTransaction()
+ transaction.replace(R.id.frame, fragment)
transaction.commit()
- supportActionBar?.title="Home"
+ supportActionBar?.title = "Home"
navigationView.setCheckedItem(R.id.home)
}
override fun onBackPressed() {
val frag = supportFragmentManager.findFragmentById(R.id.frame)
- when(frag){
+ when (frag) {
!is HomeFragment -> openHome()
else -> super.onBackPressed()
@@ -169,8 +176,6 @@ class ControlActivity : AppCompatActivity() {
}
-
-
}
diff --git a/app/src/main/res/anim/slide_in.xml b/app/src/main/res/anim/slide_in.xml
new file mode 100644
index 0000000..6963dca
--- /dev/null
+++ b/app/src/main/res/anim/slide_in.xml
@@ -0,0 +1,7 @@
+
+
diff --git a/app/src/main/res/anim/slide_out.xml b/app/src/main/res/anim/slide_out.xml
new file mode 100644
index 0000000..8964d89
--- /dev/null
+++ b/app/src/main/res/anim/slide_out.xml
@@ -0,0 +1,7 @@
+
+
diff --git a/app/src/main/res/drawable/mybutton.xml b/app/src/main/res/drawable/mybutton.xml
index 11271cc..d5b300f 100644
--- a/app/src/main/res/drawable/mybutton.xml
+++ b/app/src/main/res/drawable/mybutton.xml
@@ -3,6 +3,6 @@
android:shape="rectangle" >
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_control.xml b/app/src/main/res/layout/activity_control.xml
index d579ff6..6417185 100644
--- a/app/src/main/res/layout/activity_control.xml
+++ b/app/src/main/res/layout/activity_control.xml
@@ -16,7 +16,6 @@
diff --git a/app/src/main/res/layout/activity_splash.xml b/app/src/main/res/layout/activity_splash.xml
index 73f9566..78b7956 100644
--- a/app/src/main/res/layout/activity_splash.xml
+++ b/app/src/main/res/layout/activity_splash.xml
@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="#bbdefb"
+ android:background="@color/blueOcean"
tools:context=".activity.SplashActivity">
diff --git a/app/src/main/res/layout/activity_welcome.xml b/app/src/main/res/layout/activity_welcome.xml
index cefdc08..96b2e35 100644
--- a/app/src/main/res/layout/activity_welcome.xml
+++ b/app/src/main/res/layout/activity_welcome.xml
@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activity.WelcomeActivity"
- android:background="#bbdefb">
+ android:background="@color/blueOcean">
@@ -23,6 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cod"
+ android:elevation="4dp"
android:layout_below="@id/txtWelcome"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"/>
@@ -33,9 +35,10 @@
android:layout_height="wrap_content"
android:layout_below="@id/txtWelcome"
android:layout_centerInParent="true"
+ android:elevation="4dp"
android:layout_marginTop="300dp"
- android:background="@color/colorPrimary"
- android:textColor="#000000"
+ android:background="@drawable/mybutton"
+ android:textColor="@color/white"
android:text="Get Started"/>
diff --git a/app/src/main/res/layout/drawer_header.xml b/app/src/main/res/layout/drawer_header.xml
index e3a1972..154265e 100644
--- a/app/src/main/res/layout/drawer_header.xml
+++ b/app/src/main/res/layout/drawer_header.xml
@@ -20,6 +20,7 @@
android:layout_below="@id/imgLogo"
android:textSize="38sp"
android:layout_centerInParent="true"
- android:textColor="@color/colorPrimaryDark" />
+ android:textStyle="bold"
+ android:textColor="@color/white" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_competitiveprogramming.xml b/app/src/main/res/layout/fragment_competitiveprogramming.xml
index 8a411e5..5cb705b 100644
--- a/app/src/main/res/layout/fragment_competitiveprogramming.xml
+++ b/app/src/main/res/layout/fragment_competitiveprogramming.xml
@@ -1,10 +1,14 @@
-
+
+ android:background="@color/blueOcean">
\ No newline at end of file
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_compiler.xml b/app/src/main/res/layout/fragment_compiler.xml
index fc8b357..c78656b 100644
--- a/app/src/main/res/layout/fragment_compiler.xml
+++ b/app/src/main/res/layout/fragment_compiler.xml
@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.CompilerFragment"
- android:background="#bbdefb">
+ android:background="@color/blueOcean">
+ android:background="@color/blueOcean">
diff --git a/app/src/main/res/layout/fragment_languages.xml b/app/src/main/res/layout/fragment_languages.xml
index e196b95..228cf3a 100644
--- a/app/src/main/res/layout/fragment_languages.xml
+++ b/app/src/main/res/layout/fragment_languages.xml
@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="#bbdefb">
+ android:background="@color/blueOcean">
#4dabf5
#1769aa
#2196f3
+
+ #FFFFFF
+ #bbdefb
\ No newline at end of file