Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9d666c7 authored by Vincent Bourgmayer's avatar Vincent Bourgmayer
Browse files

Add "having troubles?" clickable link into preferences and error dialog

parent 918e181f
Loading
Loading
Loading
Loading
+30 −2
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019-2022  MURENA SAS
 * Copyright (C) 2019-2023  MURENA SAS
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
@@ -17,6 +17,10 @@

package foundation.e.apps.ui.parentFragment

import android.content.Intent
import android.graphics.Paint
import android.net.Uri
import android.widget.TextView
import androidx.annotation.LayoutRes
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
@@ -220,6 +224,17 @@ abstract class TimeoutFragment(@LayoutRes layoutId: Int) : Fragment(layoutId) {
        }
    }

     private fun openTroubleshootingPage() {
        val troubleshootUrl = getString(R.string.troubleshootURL)
        val openUrlIntent = Intent(Intent.ACTION_VIEW)
        openUrlIntent.data = Uri.parse(troubleshootUrl)
        startActivity(openUrlIntent)
    }

    private fun setTextviewUnderlined(textView: TextView) {
        textView.paintFlags = textView.paintFlags or Paint.UNDERLINE_TEXT_FLAG
    }

    /**
     * Call to trigger [onTimeout].
     * Can be called from anywhere in the fragment.
@@ -235,6 +250,10 @@ abstract class TimeoutFragment(@LayoutRes layoutId: Int) : Fragment(layoutId) {
                logDisplay.isVisible = true
                moreInfo.isVisible = false
            }
            setTextviewUnderlined(troubleshootingLink)
            troubleshootingLink.setOnClickListener {
                openTroubleshootingPage()
            }

            val logToDisplay = exception.message ?: ""

@@ -281,6 +300,10 @@ abstract class TimeoutFragment(@LayoutRes layoutId: Int) : Fragment(layoutId) {
                logDisplay.isVisible = true
                moreInfo.isVisible = false
            }
            setTextviewUnderlined(troubleshootingLink)
            troubleshootingLink.setOnClickListener {
                openTroubleshootingPage()
            }

            val logToDisplay = exception.message ?: ""
            if (logToDisplay.isNotBlank()) {
@@ -336,6 +359,11 @@ abstract class TimeoutFragment(@LayoutRes layoutId: Int) : Fragment(layoutId) {
                logDisplay.isVisible = true
                moreInfo.isVisible = false
            }
            setTextviewUnderlined(troubleshootingLink)
            troubleshootingLink.setOnClickListener {
                openTroubleshootingPage()
            }

            val logToDisplay = exception.message ?: ""
            if (logToDisplay.isNotBlank()) {
                logDisplay.text = logToDisplay
+1 −1
Original line number Diff line number Diff line
/*
 * Apps  Quickly and easily install Android apps onto your device!
 * Copyright (C) 2022  E FOUNDATION
 * Copyright (C) 2022-2023  E FOUNDATION
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
+1 −2
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
    android:layout_height="match_parent"
    android:orientation="vertical">


    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
@@ -120,7 +121,5 @@
        android:id="@android:id/list_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

    </FrameLayout>

</LinearLayout>
 No newline at end of file
+35 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Apps  Quickly and easily install Android apps onto your device!
  ~ Copyright (C) 2023  MURENA SAS
  ~
  ~ This program is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU General Public License for more details.
  ~
  ~ You should have received a copy of the GNU General Public License
  ~ along with this program.  If not, see <https://www.gnu.org/licenses/>.
  -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
        <TextView
            android:id="@+id/troubleshootingLink"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            android:layout_marginBottom="16dp"
            android:gravity="end"
            android:text="@string/having_troubles"
            android:textColor="@color/colorAccent"
            android:textSize="15sp"
            android:textStyle="bold"/>
</LinearLayout>
 No newline at end of file
+13 −1
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019-2022  MURENA SAS
  ~ Copyright (C) 2019-2023  MURENA SAS
  ~
  ~ This program is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU General Public License as published by
@@ -56,4 +56,16 @@

    </ScrollView>

    <TextView
        android:id="@+id/troubleshootingLink"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/having_troubles"
        android:textColor="@color/colorAccent"
        android:layout_marginTop="10dp"
        android:clickable="true"
        android:focusable="true"
        android:layout_gravity="end"
        />

</LinearLayout>
 No newline at end of file
Loading