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

Commit 75e31e32 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Merge branch '1919-s-parental' into 'v1-s'

Parental control changes

See merge request !59
parents 517eea3b a2d72ec6
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -295,6 +295,19 @@
            </intent-filter>
        </activity>

        <activity android:name=".ParentalControlActivity"
                  android:label="@string/activity_label_empty"
                  android:excludeFromRecents="true"
                  android:configChanges="mcc|mnc"
                  android:immersive="true"
                  android:exported="false"
                  android:windowSoftInputMode="stateAlwaysHidden">
            <intent-filter>
                <action android:name="org.lineageos.setupwizard.E_PARENTAL_CONTROL_SETTINGS" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <activity android:name=".backup.RestoreIntroActivity"
                  android:label="@string/activity_label_empty"
                  android:excludeFromRecents="true"
+74 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2018-2021 E FOUNDATION

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<com.google.android.setupdesign.GlifLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/setup_wizard_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        style="@style/SudContentFrame">

        <FrameLayout android:id="@+id/page"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <ScrollView android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fillViewport="true">

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

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:textSize="16sp"
                        android:textColor="?android:attr/textColorPrimary"
                        android:text="@string/parental_control_setup_summary" />

                    <Button
                        android:id="@+id/activate_parental_control"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:text="@string/activate_parental_control"
                        android:textSize="14sp"
                        android:textAllCaps="true"
                        android:layout_marginEnd="16dp"
                        android:layout_marginStart="16dp"
                        android:layout_marginTop="80dp"
                        style="@style/SudGlifButton.Primary" />
                        
                </LinearLayout>
            </ScrollView>
        </FrameLayout>

        <org.lineageos.setupwizard.NavigationLayout
            android:id="@+id/navigation_bar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            app:showSkipButton="false" />

    </LinearLayout>
</com.google.android.setupdesign.GlifLayout>
+4 −0
Original line number Diff line number Diff line
@@ -29,6 +29,10 @@
        <result wizard:action="locale" />
    </WizardAction>
    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.LINEAGE_LOCALE;end" id="locale">
        <result wizard:action="e_parental_control_settings" />
    </WizardAction>

    <WizardAction wizard:uri="intent:#Intent;action=org.lineageos.setupwizard.E_PARENTAL_CONTROL_SETTINGS;end" id="e_parental_control_settings">
        <result wizard:action="datetime" />
    </WizardAction>

+4 −0
Original line number Diff line number Diff line
@@ -27,4 +27,8 @@
    <string name="update_recovery_title_e">Update Recovery</string>
    <string name="update_recovery_description_e">Updates Recovery on first boot subsequent to every update.</string>
    <string name="update_recovery_setting_e">Update Recovery alongside the OS</string>

    <string name="activate_parental_control">Activate parental control</string>
    <string name="parental_control_setup_title">Setup parental control</string>
    <string name="parental_control_setup_summary">This app offers protection against inappropriate content for your children and teenagers. You can activate this feature when lending your phone to your kid or if this is their device.</string>
</resources>
 No newline at end of file
+73 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 MURENA SAS
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.lineageos.setupwizard;

import static org.lineageos.setupwizard.SetupWizardApp.PARENTAL_COMPONENTNAME;
import static org.lineageos.setupwizard.SetupWizardApp.REQUEST_CODE_PARENTAL_CONTROL;

import android.content.Intent;
import android.view.View;
import android.os.Bundle;

public class ParentalControlActivity extends SubBaseActivity {

     @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setNextText(R.string.skip);
    }

    @Override
    protected void onStartSubactivity() {
        setNextAllowed(true);
        findViewById(R.id.activate_parental_control).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                launchParentalControl();
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(resultCode == RESULT_OK) {
            onNavigateNext();
        }
    }

    @Override
    protected int getLayoutResId() {
        return R.layout.setup_parental_control;
    }

    @Override
    protected int getTitleResId() {
        return R.string.parental_control_setup_title;
    }

    @Override
    protected int getIconResId() {
        return R.drawable.ic_account_manager_screen;
    }

    private void launchParentalControl() {
        Intent intent = new Intent();
        intent.setComponent(PARENTAL_COMPONENTNAME);
        startActivityForResult(intent, REQUEST_CODE_PARENTAL_CONTROL);
    }
}
Loading