-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add resources module with themes/styles #27
Changes from all commits
229fcf7
3a2bf9d
adbbf6f
e1a6d6d
81556d6
59d8036
f64a3bb
0657d95
c017fec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
package com.muvi | ||
|
||
import android.os.Bundle | ||
import android.view.Menu | ||
import android.view.MenuItem | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.muvi.navigation.themePlaygroundIntent | ||
|
||
class MainActivity : AppCompatActivity() { | ||
class MainActivity : AppCompatActivity(R.layout.activity_main) { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
override fun onCreateOptionsMenu(menu: Menu?): Boolean { | ||
menuInflater.inflate(R.menu.menu_main, menu) | ||
return true | ||
} | ||
|
||
override fun onOptionsItemSelected(item: MenuItem?): Boolean { | ||
return when (item?.itemId) { | ||
R.id.action_theme_playground -> { | ||
startActivity(themePlaygroundIntent()) | ||
true | ||
} | ||
else -> super.onOptionsItemSelected(item) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<menu | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<item | ||
android:id="@+id/action_theme_playground" | ||
android:title="@string/action_theme_playground" | ||
android:icon="@drawable/ic_android_24dp" | ||
app:showAsAction="ifRoom" /> | ||
|
||
</menu> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<string name="app_name">MuVi</string> | ||
|
||
<string name="action_theme_playground">Show theme playground</string> | ||
|
||
</resources> |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'kotlin-android' | ||
|
||
dependencies { | ||
implementation libraries.androidxAppCompat | ||
implementation libraries.androidxConstraintLayout | ||
implementation libraries.kotlinStdLib | ||
implementation libraries.materialComponents | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<manifest | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.muvi.resources"> | ||
|
||
<application> | ||
|
||
<activity android:name=".ThemePlaygroundActivity" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a real life app, I guess this Manifest would exist in both the main and debug sourcesets so we only had ThemePlaygroundActivity in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea I think we could get away with it in debug, theoretically, unless I'm missing something! |
||
|
||
<meta-data | ||
android:name="preloaded_fonts" | ||
android:resource="@array/preloaded_fonts" /> | ||
|
||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.muvi.resources | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
|
||
class ThemePlaygroundActivity : AppCompatActivity(R.layout.activity_theme_playground) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0" | ||
android:tint="?attr/colorOnPrimarySurface"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z"/> | ||
</vector> |
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="Poppins:500,600,700" | ||
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs"> | ||
</font-family> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,241 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ScrollView | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
tools:context=".ThemePlaygroundActivity"> | ||
|
||
<androidx.constraintlayout.widget.ConstraintLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:paddingBottom="16dp" | ||
android:clipToPadding="false"> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/raisedButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
android:text="Raised Button" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/unelevatedButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/raisedButton" | ||
android:text="Unelevated Button" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/outlinedButtonButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
style="@style/Widget.MaterialComponents.Button.OutlinedButton" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/unelevatedButton" | ||
android:text="Outlined Button" /> | ||
|
||
<com.google.android.material.button.MaterialButton | ||
android:id="@+id/textButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
style="@style/Widget.MaterialComponents.Button.TextButton" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toEndOf="@id/outlinedButtonButton" | ||
android:text="Text Button" /> | ||
|
||
<com.google.android.material.chip.Chip | ||
android:id="@+id/inputChip" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
style="?attr/chipStandaloneStyle" | ||
app:layout_constraintTop_toBottomOf="@id/raisedButton" | ||
app:layout_constraintStart_toStartOf="parent" | ||
android:text="Input Chip" /> | ||
|
||
<com.google.android.material.chip.Chip | ||
android:id="@+id/choiceChip" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
style="@style/Widget.MaterialComponents.Chip.Choice" | ||
app:layout_constraintTop_toBottomOf="@id/raisedButton" | ||
app:layout_constraintStart_toEndOf="@id/inputChip" | ||
android:text="Choice Chip" /> | ||
|
||
<com.google.android.material.chip.Chip | ||
android:id="@+id/filterChip" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
style="@style/Widget.MaterialComponents.Chip.Filter" | ||
app:layout_constraintTop_toBottomOf="@id/raisedButton" | ||
app:layout_constraintStart_toEndOf="@id/choiceChip" | ||
android:text="Filter Chip" /> | ||
|
||
<com.google.android.material.chip.Chip | ||
android:id="@+id/actionChip" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
app:chipIcon="@drawable/ic_android_24dp" | ||
style="?attr/chipStyle" | ||
app:layout_constraintTop_toBottomOf="@id/raisedButton" | ||
app:layout_constraintStart_toEndOf="@id/filterChip" | ||
android:text="Action Chip" /> | ||
|
||
<com.google.android.material.checkbox.MaterialCheckBox | ||
android:id="@+id/checkBox" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
app:layout_constraintTop_toBottomOf="@id/inputChip" | ||
app:layout_constraintStart_toStartOf="parent" | ||
android:text="Checkbox" /> | ||
|
||
<com.google.android.material.radiobutton.MaterialRadioButton | ||
android:id="@+id/radioButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
app:layout_constraintTop_toBottomOf="@id/inputChip" | ||
app:layout_constraintStart_toEndOf="@id/checkBox" | ||
android:text="Radio Button" /> | ||
|
||
<com.google.android.material.switchmaterial.SwitchMaterial | ||
android:id="@+id/switchMaterial" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
app:layout_constraintTop_toBottomOf="@id/inputChip" | ||
app:layout_constraintStart_toEndOf="@id/radioButton" | ||
android:text="Switch" /> | ||
|
||
<com.google.android.material.textfield.TextInputLayout | ||
android:id="@+id/filledBoxTextField" | ||
android:layout_width="240dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
app:layout_constraintTop_toBottomOf="@id/checkBox" | ||
app:layout_constraintStart_toStartOf="parent" | ||
android:hint="Filled Box Text Field"> | ||
|
||
<com.google.android.material.textfield.TextInputEditText | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:text="Text" /> | ||
|
||
</com.google.android.material.textfield.TextInputLayout> | ||
|
||
<com.google.android.material.textfield.TextInputLayout | ||
android:id="@+id/outlinedBoxTextField" | ||
android:layout_width="240dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" | ||
app:layout_constraintTop_toBottomOf="@id/checkBox" | ||
app:layout_constraintStart_toEndOf="@id/filledBoxTextField" | ||
android:hint="Outlined Box Text Field"> | ||
|
||
<com.google.android.material.textfield.TextInputEditText | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:text="Text" /> | ||
|
||
</com.google.android.material.textfield.TextInputLayout> | ||
|
||
<com.google.android.material.floatingactionbutton.FloatingActionButton | ||
android:id="@+id/floatingActionButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
app:srcCompat="@drawable/ic_android_24dp" | ||
app:layout_constraintTop_toBottomOf="@id/checkBox" | ||
app:layout_constraintStart_toEndOf="@id/outlinedBoxTextField" /> | ||
|
||
<com.google.android.material.tabs.TabLayout | ||
android:id="@+id/tabs" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
android:layout_marginEnd="16dp" | ||
app:layout_constraintTop_toBottomOf="@id/filledBoxTextField" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toStartOf="@id/card"> | ||
|
||
<com.google.android.material.tabs.TabItem | ||
android:id="@+id/tab1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Tab 1" /> | ||
|
||
<com.google.android.material.tabs.TabItem | ||
android:id="@+id/tab2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Tab 2" /> | ||
|
||
<com.google.android.material.tabs.TabItem | ||
android:id="@+id/tab3" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:text="Tab 3" /> | ||
|
||
</com.google.android.material.tabs.TabLayout> | ||
|
||
<com.google.android.material.bottomnavigation.BottomNavigationView | ||
android:id="@+id/bottomNavigation" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginStart="16dp" | ||
android:layout_marginEnd="16dp" | ||
app:menu="@menu/menu_bottom_navigation" | ||
app:layout_constraintTop_toBottomOf="@id/tabs" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintEnd_toStartOf="@id/card" /> | ||
|
||
<com.google.android.material.card.MaterialCardView | ||
android:id="@+id/card" | ||
android:layout_width="360dp" | ||
android:layout_height="160dp" | ||
android:layout_marginTop="16dp" | ||
android:layout_marginEnd="16dp" | ||
app:layout_constraintTop_toBottomOf="@id/filledBoxTextField" | ||
app:layout_constraintEnd_toEndOf="parent"> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
android:text="Card" /> | ||
|
||
</com.google.android.material.card.MaterialCardView> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> | ||
|
||
</ScrollView> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.