Skip to content

Commit 0cbf712

Browse files
committed
no message
1 parent d3e0dc9 commit 0cbf712

28 files changed

+355
-70
lines changed

.idea/codeStyles/Project.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

+6
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ android {
2020
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2121
}
2222
}
23+
compileOptions {
24+
sourceCompatibility = '1.8'
25+
targetCompatibility = '1.8'
26+
}
2327
}
2428

2529
dependencies {
@@ -31,4 +35,6 @@ dependencies {
3135
testImplementation 'junit:junit:4.12'
3236
androidTestImplementation 'androidx.test:runner:1.2.0'
3337
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
38+
39+
implementation 'com.google.android.material:material:1.1.0-alpha08'
3440
}

app/src/main/AndroidManifest.xml

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="happy.mjstudio.layoutsample" >
3+
package="happy.mjstudio.layoutsample">
44

55
<application
6-
android:allowBackup="true"
7-
android:icon="@mipmap/ic_launcher"
8-
android:label="@string/app_name"
9-
android:roundIcon="@mipmap/ic_launcher_round"
10-
android:supportsRtl="true"
11-
android:theme="@style/AppTheme" >
12-
<activity android:name=".MainActivity" >
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
1313
<intent-filter>
14-
<action android:name="android.intent.action.MAIN" />
14+
<action android:name="android.intent.action.VIEW"/>
15+
<action android:name="android.intent.action.MAIN"/>
1516

16-
<category android:name="android.intent.category.LAUNCHER" />
17+
<category android:name="android.intent.category.LAUNCHER"/>
1718
</intent-filter>
1819
</activity>
1920
</application>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package happy.mjstudio.layoutsample
2+
3+
import android.os.Bundle
4+
import android.view.LayoutInflater
5+
import android.view.View
6+
import android.view.ViewGroup
7+
import androidx.fragment.app.Fragment
8+
9+
class LinearLayoutFragment : Fragment() {
10+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
11+
val v = inflater.inflate(R.layout.fragment_linearlayout,container,false)
12+
13+
return v
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,78 @@
11
package happy.mjstudio.layoutsample
22

3-
import androidx.appcompat.app.AppCompatActivity
3+
import android.content.DialogInterface
4+
import android.content.Intent
5+
import android.net.Uri
46
import android.os.Bundle
7+
import android.util.Log
8+
import android.view.Menu
9+
import android.view.MenuItem
10+
import androidx.appcompat.app.AlertDialog
11+
import androidx.appcompat.app.AppCompatActivity
12+
import com.google.android.material.bottomsheet.BottomSheetBehavior
13+
import happy.mjstudio.layoutsample.adapter.NavigationAdapter
14+
import kotlinx.android.synthetic.main.activity_main.*
15+
import kotlinx.android.synthetic.main.bottom_sheet.*
516

617
class MainActivity : AppCompatActivity() {
718

819
override fun onCreate(savedInstanceState: Bundle?) {
920
super.onCreate(savedInstanceState)
1021
setContentView(R.layout.activity_main)
22+
23+
initBottomAppBar()
24+
initViews()
25+
}
26+
27+
private fun initBottomAppBar() {
28+
setSupportActionBar(bottomAppBar)
29+
bottomAppBar.replaceMenu(R.menu.main_menu)
30+
}
31+
32+
33+
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
34+
menuInflater.inflate(R.menu.main_menu,menu)
35+
return true
36+
}
37+
38+
override fun onOptionsItemSelected(item: MenuItem?): Boolean {
39+
when(item?.itemId) {
40+
android.R.id.home-> {
41+
Log.e("TAG","home")
42+
val behavior = BottomSheetBehavior.from(bottomSheet)
43+
behavior.state = BottomSheetBehavior.STATE_EXPANDED
44+
}
45+
46+
R.id.menu_info-> {
47+
AlertDialog.Builder(this)
48+
.setTitle("Layout Sample")
49+
.setMessage("Orgarnization : Zizunz Android Master\n\nLicense : Free\n\nGithub : https://github.com/zizunz-android-master/Layout")
50+
.setIcon(R.drawable.ic_launcher_foreground)
51+
.setNegativeButton("Show", object : DialogInterface.OnClickListener {
52+
override fun onClick(dialog: DialogInterface?, which: Int) {
53+
Intent(Intent.ACTION_VIEW).apply {
54+
data = Uri.parse("https://github.com/zizunz-android-master/Layout")
55+
startActivity(this)
56+
}
57+
}
58+
})
59+
.setPositiveButton("Ok",object : DialogInterface.OnClickListener {
60+
override fun onClick(dialog: DialogInterface?, which: Int) {
61+
62+
}
63+
})
64+
.create()
65+
.show()
66+
}
67+
}
68+
69+
return true
1170
}
71+
72+
private fun initViews() {
73+
viewPager.adapter = NavigationAdapter(supportFragmentManager)
74+
75+
}
76+
77+
1278
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package happy.mjstudio.layoutsample.adapter
2+
3+
import androidx.fragment.app.Fragment
4+
import androidx.fragment.app.FragmentManager
5+
import androidx.fragment.app.FragmentStatePagerAdapter
6+
import happy.mjstudio.layoutsample.LinearLayoutFragment
7+
8+
class NavigationAdapter(fm : FragmentManager) : FragmentStatePagerAdapter(fm,FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
9+
override fun getItem(position: Int) = NavigationMenu.getFragmentWithIndex(position)
10+
11+
override fun getCount() = NavigationMenu.getAllNavigationMenu().size
12+
13+
enum class NavigationMenu {
14+
LINEARLAYOUT
15+
16+
;
17+
18+
companion object {
19+
fun getAllNavigationMenu() : List<NavigationMenu> = listOf(LINEARLAYOUT)
20+
21+
fun getFragmentWithIndex(index : Int) : Fragment {
22+
return when(index) {
23+
0 -> LinearLayoutFragment()
24+
25+
else -> throw IllegalArgumentException("Not found Fragment class for given index")
26+
}
27+
}
28+
}
29+
}
30+
}
31+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24"
6+
android:tint="#333333">
7+
<path
8+
android:fillColor="#FF000000"
9+
android:pathData="M11,17h2v-6h-2v6zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM11,9h2L13,7h-2v2z"/>
10+
</vector>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="24dp"
3+
android:height="24dp"
4+
android:viewportWidth="24"
5+
android:viewportHeight="24"
6+
android:tint="#333333">
7+
<path
8+
android:fillColor="#FF000000"
9+
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
10+
</vector>
479 Bytes
Loading
129 Bytes
Loading
316 Bytes
Loading
93 Bytes
Loading
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:aapt="http://schemas.android.com/aapt"
3-
android:width="108dp"
4-
android:height="108dp"
5-
android:viewportHeight="108"
6-
android:viewportWidth="108">
2+
xmlns:aapt="http://schemas.android.com/aapt"
3+
android:width="108dp"
4+
android:height="108dp"
5+
android:viewportHeight="108"
6+
android:viewportWidth="108">
77
<path
8-
android:fillType="evenOdd"
9-
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
10-
android:strokeColor="#00000000"
11-
android:strokeWidth="1">
8+
android:fillType="evenOdd"
9+
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
10+
android:strokeColor="#00000000"
11+
android:strokeWidth="1">
1212
<aapt:attr name="android:fillColor">
1313
<gradient
14-
android:endX="78.5885"
15-
android:endY="90.9159"
16-
android:startX="48.7653"
17-
android:startY="61.0927"
18-
android:type="linear">
14+
android:endX="78.5885"
15+
android:endY="90.9159"
16+
android:startX="48.7653"
17+
android:startY="61.0927"
18+
android:type="linear">
1919
<item
20-
android:color="#44000000"
21-
android:offset="0.0" />
20+
android:color="#44000000"
21+
android:offset="0.0"/>
2222
<item
23-
android:color="#00000000"
24-
android:offset="1.0" />
23+
android:color="#00000000"
24+
android:offset="1.0"/>
2525
</gradient>
2626
</aapt:attr>
2727
</path>
2828
<path
29-
android:fillColor="#FFFFFF"
30-
android:fillType="nonZero"
31-
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
32-
android:strokeColor="#00000000"
33-
android:strokeWidth="1" />
29+
android:fillColor="#FFFFFF"
30+
android:fillType="nonZero"
31+
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
32+
android:strokeColor="#00000000"
33+
android:strokeWidth="1"/>
3434
</vector>
603 Bytes
Loading
115 Bytes
Loading
898 Bytes
Loading
138 Bytes
Loading

app/src/main/res/drawable/ic_launcher_background.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<vector
3-
android:height="108dp"
4-
android:width="108dp"
5-
android:viewportHeight="108"
6-
android:viewportWidth="108"
7-
xmlns:android="http://schemas.android.com/apk/res/android">
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:height="108dp"
5+
android:width="108dp"
6+
android:viewportHeight="108"
7+
android:viewportWidth="108">
88
<path android:fillColor="#008577"
99
android:pathData="M0,0h108v108h-108z"/>
1010
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
+44-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,45 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<androidx.constraintlayout.widget.ConstraintLayout
3-
xmlns:android="http://schemas.android.com/apk/res/android"
4-
xmlns:tools="http://schemas.android.com/tools"
5-
xmlns:app="http://schemas.android.com/apk/res-auto"
6-
android:layout_width="match_parent"
7-
android:layout_height="match_parent"
8-
tools:context=".MainActivity">
9-
10-
<TextView
11-
android:layout_width="wrap_content"
12-
android:layout_height="wrap_content"
13-
android:text="Hello World!"
14-
app:layout_constraintBottom_toBottomOf="parent"
15-
app:layout_constraintLeft_toLeftOf="parent"
16-
app:layout_constraintRight_toRightOf="parent"
17-
app:layout_constraintTop_toTopOf="parent" />
18-
19-
</androidx.constraintlayout.widget.ConstraintLayout>
2+
<androidx.coordinatorlayout.widget.CoordinatorLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
xmlns:app="http://schemas.android.com/apk/res-auto"
6+
android:layout_width="match_parent"
7+
android:layout_height="match_parent"
8+
tools:context=".MainActivity">
9+
10+
11+
<androidx.viewpager.widget.ViewPager
12+
android:id="@+id/viewPager"
13+
android:layout_width="match_parent"
14+
android:layout_height="match_parent"
15+
app:layout_anchor="@id/bottomAppBar"
16+
app:layout_anchorGravity="top"
17+
/>
18+
19+
20+
<com.google.android.material.bottomappbar.BottomAppBar
21+
app:navigationIcon="@drawable/ic_navigation"
22+
app:fabAnimationMode="scale"
23+
app:fabAlignmentMode="center"
24+
android:id="@+id/bottomAppBar"
25+
android:layout_gravity="bottom"
26+
android:layout_width="match_parent"
27+
android:layout_height="wrap_content"/>
28+
29+
<com.google.android.material.floatingactionbutton.FloatingActionButton
30+
app:backgroundTint="#fff"
31+
android:tint="#000"
32+
app:borderWidth="0dp"
33+
app:fabSize="normal"
34+
35+
android:src="@drawable/ic_launcher_foreground"
36+
android:layout_width="wrap_content"
37+
android:layout_height="wrap_content"
38+
app:layout_anchor="@id/bottomAppBar"
39+
40+
/>
41+
42+
<include
43+
layout="@layout/bottom_sheet"/>
44+
45+
</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 commit comments

Comments
 (0)