Implemented View for settings and added about info for the app #42 and #53

This commit is contained in:
amazing-username
2019-04-20 18:55:40 -04:00
parent ab1ed63fb0
commit 45d2d7d420
7 changed files with 209 additions and 10 deletions
+1
View File
@@ -41,4 +41,5 @@ dependencies {
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:28.0.0' implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828' implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.XuDeveloper:XPopupWindow:1.0.1'
} }
@@ -1,8 +1,13 @@
package com.example.mear.activities package com.example.mear.activities
import android.content.Context
import android.os.Bundle import android.os.Bundle
import android.os.Environment import android.os.Environment
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.CardView
import android.view.View
import android.widget.LinearLayout
import android.widget.Toast
import java.lang.Exception import java.lang.Exception
import kotlinx.android.synthetic.main.activity_settings.* import kotlinx.android.synthetic.main.activity_settings.*
@@ -12,7 +17,9 @@ import com.example.mear.adapters.SettingsAdapter
import com.example.mear.R import com.example.mear.R
import com.example.mear.management.MusicFiles import com.example.mear.management.MusicFiles
import com.example.mear.management.TrackManager import com.example.mear.management.TrackManager
import com.example.mear.ui.popups.AboutPopup
import com.example.mear.repositories.TrackRepository import com.example.mear.repositories.TrackRepository
import kotlinx.android.synthetic.main.popup_layout.*
class SettingsActivity : AppCompatActivity() { class SettingsActivity : AppCompatActivity() {
@@ -22,6 +29,16 @@ class SettingsActivity : AppCompatActivity() {
setContentView(R.layout.activity_settings) setContentView(R.layout.activity_settings)
setSupportActionBar(toolbar) setSupportActionBar(toolbar)
var aListener = AboutListener(aboutApp, this)
About.setOnClickListener(aListener)
/**
About.setOnClickListener {
val i =0
var j = i.plus(500)
}
*/
initialize() initialize()
supportActionBar?.setDisplayHomeAsUpEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true)
} }
@@ -55,4 +72,20 @@ class SettingsActivity : AppCompatActivity() {
private fun updateLibrary() { private fun updateLibrary() {
loadTracks(loadSongPaths()) loadTracks(loadSongPaths())
} }
class AboutListener(var layout: LinearLayout?, val ctx: Context): View.OnClickListener {
override fun onClick(v: View?) {
val ss = 10
var ob = ss.plus(500)
try {
val popup = AboutPopup(ctx)
popup?.showPopupFromScreenCenter(R.layout.activity_settings)
}
catch (ex: Exception) {
val exMsg = ex.message
}
Toast.makeText(ctx, "About Setting pressed", Toast.LENGTH_LONG).show()
}
}
} }
@@ -0,0 +1,38 @@
package com.example.mear.ui.popups
import android.animation.Animator
import android.content.Context
import android.view.View
import com.example.mear.R
import com.xu.xpopupwindow.XPopupWindow
class AboutPopup(ctx: Context): XPopupWindow(ctx) {
override fun exitAnim(view: View): Animator? {
return null
}
override fun getLayoutId(): Int {
return R.layout.popup_layout
}
override fun getLayoutParentNodeId(): Int {
return R.id.parent
}
override fun initData() {
}
override fun initViews() {
}
override fun startAnim(view: View): Animator? {
return null
}
override fun animStyle(): Int {
return -1
}
}
+57 -6
View File
@@ -14,9 +14,11 @@
android:layout_width="12dp" android:layout_width="12dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_marginStart="120dp" android:layout_marginStart="120dp"
android:layout_marginTop="8dp"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<!--
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/settingList" android:id="@+id/settingList"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -28,10 +30,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/space3" app:layout_constraintTop_toBottomOf="@+id/space3"
/> />
<!-- -->
<FrameLayout <FrameLayout
android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="464dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/space3">
<LinearLayout <LinearLayout
android:id="@+id/dm" android:id="@+id/dm"
@@ -39,19 +47,62 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/RefreshLibrary" android:id="@+id/RefreshLibrary"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:lineSpacingExtra="12sp" android:lineSpacingExtra="12sp"
android:text="@string/update_library" android:text="@string/update_library"
android:textColor="@color/track_details" android:textColor="@color/setting_text"
android:textSize="18sp" android:textSize="18sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/setting_text"
android:text="@string/update_library_description"
android:textSize="15sp"
android:textStyle="normal" />
</LinearLayout>
<LinearLayout
android:id="@+id/About"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:lineSpacingExtra="12sp"
android:text="@string/about_header"
android:textColor="@color/setting_text"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:lineSpacingExtra="12sp"
android:text="@string/about_description"
android:textColor="@color/setting_text"
android:textSize="15sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
-->
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
+62
View File
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="@+id/aboutApp"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:background="@color/popup_about_background"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:textAlignment="center">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="200dp"
app:srcCompat="@mipmap/vertical" />
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_version"
android:textAlignment="center"
android:textColor="@color/popup_text" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/popup_about_contributors"
android:textAlignment="center"
android:textColor="@color/popup_text" />
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_author"
android:textAlignment="center"
android:textColor="@color/popup_text" />
<TextView
android:id="@+id/textView5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_logo_designer"
android:textAlignment="center"
android:textColor="@color/popup_text" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
+7
View File
@@ -17,4 +17,11 @@
<color name="song_searchView">@color/color_background</color> <color name="song_searchView">@color/color_background</color>
<color name="song_searchView_hint_text">#FFFFFF</color> <color name="song_searchView_hint_text">#FFFFFF</color>
<color name="song_searchView_text">#FFFFFF</color> <color name="song_searchView_text">#FFFFFF</color>
<!-- Settings -->
<color name="setting_text">#FFFFFF</color>
<!-- Popups -->
<color name="popup_about_background">#323232</color>
<color name="popup_about">#FFFFFF</color>
</resources> </resources>
+11 -4
View File
@@ -1,5 +1,9 @@
<resources> <resources>
<string name="app_name">Mear</string> <string name="app_name">Mear</string>
<string name="app_version">Pre-development release</string>
<string name="app_author">amazing-username - Kun Deng</string>
<string name="app_logo_designer">Zularizal</string>
<string name="navigation_drawer_open">Open navigation drawer</string> <string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string> <string name="navigation_drawer_close">Close navigation drawer</string>
<string name="nav_header_title">Android Studio</string> <string name="nav_header_title">Android Studio</string>
@@ -24,15 +28,18 @@
<!-- Strings related to SettingsActivity --> <!-- Strings related to SettingsActivity -->
<string name="update_library">Update Music Library</string> <string name="update_library">Update Music Library</string>
<string name="update_library_description">Clear your music databas <string name="update_library_description">Clear your music databas e and search for music </string>
e and search for musiczf <string name="about_header">About</string>
dhdfhfdhdfh <string name="about_description">Information about the software</string>
</string>
<!-- Music Player popup strings --> <!-- Music Player popup strings -->
<string name="settings">Settings</string> <string name="settings">Settings</string>
<string name="song_view">Songs</string> <string name="song_view">Songs</string>
<!-- Popups -->
<string name="popup_about_header">About</string>
<string name="popup_about_contributors">Contributors</string>
<!-- Song Search --> <!-- Song Search -->
<string name="song_search_hint">Search for songs or artists</string> <string name="song_search_hint">Search for songs or artists</string>