Skip to content

Commit

Permalink
Add third party page
Browse files Browse the repository at this point in the history
  • Loading branch information
Linfye committed Aug 29, 2024
1 parent f440202 commit b2bf1ac
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 7 deletions.
6 changes: 5 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@
<activity
android:name=".activities.PrivacyPolicyActivity"
android:label="@string/app.about.privacyPolicy"
android:parentActivityName=".activities.MainActivity" />/>
android:parentActivityName=".activities.MainActivity" />
<activity
android:name=".activities.ThirdPartyActivity"
android:label="@string/app.about.thirdParty"
android:parentActivityName=".activities.MainActivity" />
<activity
android:name=".activities.LanguageSettings"
android:label="Language Settings"
Expand Down
10 changes: 4 additions & 6 deletions app/src/main/java/be/scri/activities/AboutActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,10 @@ class AboutActivity : BaseSimpleActivity(), GestureDetector.OnGestureListener{
ItemsViewModel(image = R.drawable.light_bulb_icon, textResId = R.string.app_about_appHints, image2 = R.drawable.counter_clockwise_icon, url = null, activity = null, action = null)
)

private fun getThirdRecyclerViewData(): List<ItemsViewModel> {
return listOf(
ItemsViewModel(image = R.drawable.shield_lock, R.string.app_about_privacyPolicy, image2 = R.drawable.right_arrow, url = null, activity = PrivacyPolicyActivity::class.java, action = null),
ItemsViewModel(image = R.drawable.license_icon, R.string.app_about_thirdParty, image2 = R.drawable.right_arrow, url = null, activity = null, action = null)
)
}
private fun getThirdRecyclerViewData(): List<Any> = listOf(
ItemsViewModel(image = R.drawable.shield_lock, textResId = R.string.app_about_privacyPolicy, image2 = R.drawable.right_arrow, url = null, activity = PrivacyPolicyActivity::class.java, action = null),
ItemsViewModel(image = R.drawable.license_icon, textResId = R.string.app_about_thirdParty, image2 = R.drawable.right_arrow, url = null, activity = ThirdPartyActivity::class.java, action = null)
)


override fun onTouchEvent(event: MotionEvent): Boolean {
Expand Down
47 changes: 47 additions & 0 deletions app/src/main/java/be/scri/activities/ThirdPartyActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package be.scri.activities


import android.content.Intent
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import be.scri.R
import be.scri.helpers.APP_ICON_IDS
import be.scri.helpers.APP_LAUNCHER_NAME
import com.google.android.material.bottomnavigation.BottomNavigationView


class ThirdPartyActivity : BaseSimpleActivity(){
override fun getAppIconIDs() = intent.getIntegerArrayListExtra(APP_ICON_IDS) ?: ArrayList()

override fun getAppLauncherName() = intent.getStringExtra(APP_LAUNCHER_NAME) ?: ""

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_third_party)
enableEdgeToEdge()
val bottomNavigationView = findViewById<BottomNavigationView>(R.id.bottom_navigation)

bottomNavigationView.selectedItemId = R.id.info

bottomNavigationView.setOnNavigationItemSelectedListener(BottomNavigationView.OnNavigationItemSelectedListener { item ->
when (item.itemId) {
R.id.settings -> {
startActivity(Intent(applicationContext, SettingsActivity::class.java))
overridePendingTransition(0, 0)
return@OnNavigationItemSelectedListener true
}

R.id.info -> {
return@OnNavigationItemSelectedListener true }
R.id.installation -> {
startActivity(Intent(applicationContext, MainActivity::class.java))
overridePendingTransition(0, 0)
return@OnNavigationItemSelectedListener true
}
}
false
})
bottomNavigationView.selectedItemId = R.id.info
}

}
37 changes: 37 additions & 0 deletions app/src/main/res/drawable/doc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="32dp"
android:height="32dp"
android:viewportWidth="100"
android:viewportHeight="100">

<path
android:fillColor="#000000"
android:fillAlpha="0.9"
android:pathData="M34.375 43.75C33.5462 43.75 32.7513 44.0792 32.1653 44.6653C31.5792 45.2513
31.25 46.0462 31.25 46.875C31.25 47.7038 31.5792 48.4987 32.1653 49.0847C32.7513
49.6708 33.5462 50 34.375 50H65.625C66.4538 50 67.2487 49.6708 67.8347
49.0847C68.4208 48.4987 68.75 47.7038 68.75 46.875C68.75 46.0462 68.4208 45.2513
67.8347 44.6653C67.2487 44.0792 66.4538 43.75 65.625 43.75H34.375ZM31.25
59.375C31.25 58.5462 31.5792 57.7513 32.1653 57.1653C32.7513 56.5792 33.5462
56.25 34.375 56.25H65.625C66.4538 56.25 67.2487 56.5792 67.8347 57.1653C68.4208
57.7513 68.75 58.5462 68.75 59.375C68.75 60.2038 68.4208 60.9987 67.8347
61.5847C67.2487 62.1708 66.4538 62.5 65.625 62.5H34.375C33.5462 62.5 32.7513
62.1708 32.1653 61.5847C31.5792 60.9987 31.25 60.2038 31.25 59.375ZM31.25
71.875C31.25 71.0462 31.5792 70.2513 32.1653 69.6653C32.7513 69.0792 33.5462
68.75 34.375 68.75H46.875C47.7038 68.75 48.4987 69.0792 49.0847 69.6653C49.6708
70.2513 50 71.0462 50 71.875C50 72.7038 49.6708 73.4987 49.0847 74.0847C48.4987
74.6708 47.7038 75 46.875 75H34.375C33.5462 75 32.7513 74.6708 32.1653
74.0847C31.5792 73.4987 31.25 72.7038 31.25 71.875Z" />
<path
android:fillColor="#000000"
android:fillAlpha="0.9"
android:pathData="M59.375 0H25C21.6848 0 18.5054 1.31696 16.1612 3.66117C13.817 6.00537 12.5
9.18479 12.5 12.5V87.5C12.5 90.8152 13.817 93.9946 16.1612 96.3388C18.5054
98.683 21.6848 100 25 100H75C78.3152 100 81.4946 98.683 83.8388 96.3388C86.183
93.9946 87.5 90.8152 87.5 87.5V28.125L59.375 0ZM59.375 6.25V18.75C59.375 21.2364
60.3627 23.621 62.1209 25.3791C63.879 27.1373 66.2636 28.125 68.75
28.125H81.25V87.5C81.25 89.1576 80.5915 90.7473 79.4194 91.9194C78.2473 93.0915
76.6576 93.75 75 93.75H25C23.3424 93.75 21.7527 93.0915 20.5806 91.9194C19.4085
90.7473 18.75 89.1576 18.75 87.5V12.5C18.75 10.8424 19.4085 9.25268 20.5806
8.08058C21.7527 6.90848 23.3424 6.25 25 6.25H59.375Z" />
</vector>
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
android:id="@+id/recycleView3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:paddingBottom="50dp"
android:layout_marginTop="10dp"/>
</LinearLayout>
Expand Down
107 changes: 107 additions & 0 deletions app/src/main/res/layout/activity_third_party.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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:id="@+id/clBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_color">

<ScrollView
android:id="@+id/scrollView2"
android:layout_width="0dp"
android:layout_height="0dp"
android:fillViewport="true"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@+id/bottom_navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">



<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp">
<View
android:layout_width="match_parent"
android:layout_height="40dp" />

<TextView
android:id="@+id/textView"
android:layout_width="303dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="56dp"
android:text="@string/app.about.thirdParty.caption"
android:layout_marginEnd="16dp"
android:textColor="@color/app_text_color"
android:textSize="20sp"
android:textStyle="bold" />

<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<androidx.cardview.widget.CardView
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:background="@color/card_view_color"
app:cardBackgroundColor="@color/card_view_color"
app:cardCornerRadius="20dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="16dp">

<TextView
android:layout_width="304dp"
android:layout_height="wrap_content"
android:layout_gravity=""
android:text="@string/app.about.thirdParty.body"
android:textSize="16sp" />

</LinearLayout>

<ImageView
android:layout_width="75dp"
android:layout_height="76dp"
android:layout_gravity="top|end"
android:alpha="0.9"
android:contentDescription="@string/app.about.thirdParty"
android:src="@drawable/corner_polygon" />

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_margin="8dp"

android:contentDescription="@string/app.about.thirdParty"
android:src="@drawable/doc" />
</androidx.cardview.widget.CardView>
</FrameLayout>
</LinearLayout>
</ScrollView>

<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/nav_bar_color"
app:itemIconTint="@drawable/nav_bar_selector"
app:itemTextColor="@drawable/nav_bar_selector"
app:menu="@menu/menu_navigation_bottom"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit b2bf1ac

Please sign in to comment.