theme rework preparation
This commit is contained in:
		| @ -11,7 +11,10 @@ import android.view.* | ||||
| import androidx.appcompat.app.AppCompatActivity | ||||
| import androidx.core.view.GestureDetectorCompat | ||||
| import androidx.core.view.isVisible | ||||
| import com.google.android.exoplayer2.* | ||||
| import com.google.android.exoplayer2.ExoPlayer | ||||
| import com.google.android.exoplayer2.MediaItem | ||||
| import com.google.android.exoplayer2.Player | ||||
| import com.google.android.exoplayer2.SimpleExoPlayer | ||||
| import com.google.android.exoplayer2.source.hls.HlsMediaSource | ||||
| import com.google.android.exoplayer2.ui.StyledPlayerControlView | ||||
| import com.google.android.exoplayer2.upstream.DataSource | ||||
|  | ||||
| @ -12,18 +12,18 @@ import kotlinx.android.synthetic.main.item_episode.view.* | ||||
| import org.mosad.teapod.R | ||||
| import org.mosad.teapod.util.Episode | ||||
|  | ||||
| class EpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Adapter<EpisodeItemAdapter.MyViewHolder>() { | ||||
| class EpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Adapter<EpisodeItemAdapter.EpisodeViewHolder>() { | ||||
|  | ||||
|     var onItemClick: ((String, Int) -> Unit)? = null | ||||
|     var onImageClick: ((String, Int) -> Unit)? = null | ||||
|  | ||||
|     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder { | ||||
|     override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EpisodeViewHolder { | ||||
|         val view = LayoutInflater.from(parent.context).inflate(R.layout.item_episode, parent, false) | ||||
|  | ||||
|         return MyViewHolder(view) | ||||
|         return EpisodeViewHolder(view) | ||||
|     } | ||||
|  | ||||
|     override fun onBindViewHolder(holder: MyViewHolder, position: Int) { | ||||
|     override fun onBindViewHolder(holder: EpisodeViewHolder, position: Int) { | ||||
|         val context = holder.view.context | ||||
|         val ep = episodes[position] | ||||
|  | ||||
| @ -59,7 +59,7 @@ class EpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Ada | ||||
|         episodes[position].watched = watched | ||||
|     } | ||||
|  | ||||
|     inner class MyViewHolder(val view: View) : RecyclerView.ViewHolder(view) { | ||||
|     inner class EpisodeViewHolder(val view: View) : RecyclerView.ViewHolder(view) { | ||||
|         init { | ||||
|             view.setOnClickListener { | ||||
|                 onItemClick?.invoke(episodes[adapterPosition].title, adapterPosition) | ||||
|  | ||||
| @ -140,7 +140,8 @@ | ||||
|                         android:id="@+id/text_my_list_action" | ||||
|                         android:layout_width="wrap_content" | ||||
|                         android:layout_height="wrap_content" | ||||
|                         android:text="@string/my_list" /> | ||||
|                         android:text="@string/my_list" | ||||
|                         android:textSize="12sp" /> | ||||
|                 </LinearLayout> | ||||
|             </LinearLayout> | ||||
|  | ||||
|  | ||||
| @ -59,6 +59,6 @@ | ||||
|         android:id="@+id/text_episode_desc" | ||||
|         android:layout_width="match_parent" | ||||
|         android:layout_height="wrap_content" | ||||
|         android:maxLines="2" | ||||
|         android:ellipsize="end"/> | ||||
|         android:ellipsize="end" | ||||
|         android:maxLines="2" /> | ||||
| </LinearLayout> | ||||
							
								
								
									
										7
									
								
								app/src/main/res/values/attrs.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								app/src/main/res/values/attrs.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <attr format="color" name="themePrimary"/> | ||||
|     <attr format="color" name="themeSecondary"/> | ||||
|     <attr format="color" name="textPrimary"/> | ||||
|     <attr format="color" name="textSecondary"/> | ||||
| </resources> | ||||
| @ -1,8 +1,21 @@ | ||||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <resources> | ||||
|     <!-- base theme colors --> | ||||
|     <color name="colorPrimary">#6200EE</color> | ||||
|     <color name="colorPrimaryDark">#3700B3</color> | ||||
|     <color name="colorAccent">#03DAC5</color> | ||||
|  | ||||
|     <!-- light theme colors --> | ||||
|     <color name="themePrimaryLight">#f5f5f5</color> | ||||
|     <color name="themeSecondaryLight">#ffffff</color> | ||||
|     <color name="textPrimaryLight">#000000</color> | ||||
|     <color name="textSecondaryLight">#323232</color> | ||||
|  | ||||
|     <!-- dark theme colors --> | ||||
|     <color name="themePrimaryDark">#000000</color> | ||||
|     <color name="themeSecondaryDark">#303030</color> | ||||
|     <color name="textPrimaryDark">#ffffff</color> | ||||
|     <color name="textSecondaryDark">#c0c0c0</color> | ||||
|  | ||||
|     <color name="ic_launcher_background">#FFFFFF</color> | ||||
| </resources> | ||||
| @ -1,12 +1,32 @@ | ||||
| <resources> | ||||
|     <!-- Base application theme. --> | ||||
|     <!-- application themes --> | ||||
|     <style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> | ||||
|         <!-- Customize your theme here. --> | ||||
|         <item name="colorPrimary">@color/colorPrimary</item> | ||||
|         <item name="colorPrimaryDark">@color/colorPrimaryDark</item> | ||||
|         <item name="colorAccent">@color/colorAccent</item> | ||||
|     </style> | ||||
|  | ||||
|     <style name="AppThemeLight" parent="AppTheme"> | ||||
|         <item name="themePrimary">@color/themePrimaryLight</item> | ||||
|         <item name="themeSecondary">@color/themeSecondaryLight</item> | ||||
|         <item name="textPrimary">@color/textPrimaryLight</item> | ||||
|         <item name="textSecondary">@color/textSecondaryLight</item> | ||||
|         <item name="android:textColor">@color/textSecondaryLight</item> | ||||
|         <item name="android:textColorPrimary">@color/textPrimaryLight</item> | ||||
|         <item name="android:textColorHint">@color/textSecondaryLight</item> | ||||
|     </style> | ||||
|  | ||||
|     <style name="AppThemeDark" parent="AppTheme"> | ||||
|         <item name="themePrimary">@color/themePrimaryDark</item> | ||||
|         <item name="themeSecondary">@color/themeSecondaryDark</item> | ||||
|         <item name="textPrimary">@color/textPrimaryDark</item> | ||||
|         <item name="textSecondary">@color/textSecondaryDark</item> | ||||
|         <item name="android:textColor">@color/textPrimaryDark</item> | ||||
|         <item name="android:textColorPrimary">@color/textPrimaryDark</item> | ||||
|         <item name="android:textColorHint">@color/textSecondaryDark</item> | ||||
|     </style> | ||||
|  | ||||
|     <!-- player theme --> | ||||
|     <style name="PlayerTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> | ||||
|         <item name="android:windowNoTitle">true</item> | ||||
|         <item name="android:windowActionBar">false</item> | ||||
| @ -16,6 +36,7 @@ | ||||
|         <item name="android:windowTranslucentNavigation">true</item> | ||||
|     </style> | ||||
|  | ||||
|     <!-- splash theme --> | ||||
|     <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar"> | ||||
|         <item name="android:windowBackground">@drawable/bg_splash</item> | ||||
|     </style> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user