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

Commit acc89ab4 authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

Merge branch '1348-upstream' into 'main'

Cherry pick our changes from master branch

See merge request !9
parents 30859277 28dc7b23
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -86,4 +86,6 @@ dependencies {


    //Theme Engine
    //Theme Engine
    implementation 'com.jaredrummler:cyanea:1.0.2'
    implementation 'com.jaredrummler:cyanea:1.0.2'

    implementation 'foundation.e:elib:0.0.1-alpha11'
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@
        android:supportsRtl="true"
        android:supportsRtl="true"
        android:requestLegacyExternalStorage="true"
        android:requestLegacyExternalStorage="true"
        android:usesCleartextTraffic="true"
        android:usesCleartextTraffic="true"
        android:theme="@style/Theme.Cyanea.Light.DarkActionBar">
        android:theme="@style/AppTheme">


        <activity
        <activity
            android:name=".MainActivity"
            android:name=".MainActivity"
+5 −5
Original line number Original line Diff line number Diff line
@@ -34,15 +34,15 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.DialogFragment;


import com.franmontiel.attributionpresenter.AttributionPresenter;
import com.franmontiel.attributionpresenter.AttributionPresenter;
import com.franmontiel.attributionpresenter.entities.Attribution;
import com.franmontiel.attributionpresenter.entities.Attribution;
import com.franmontiel.attributionpresenter.entities.License;
import com.franmontiel.attributionpresenter.entities.License;
import com.gsnathan.pdfviewer.databinding.ActivityAboutBinding;
import com.gsnathan.pdfviewer.databinding.ActivityAboutBinding;
import com.jaredrummler.cyanea.app.CyaneaAppCompatActivity;


public class AboutActivity extends CyaneaAppCompatActivity {
public class AboutActivity extends AppCompatActivity {


    private ActivityAboutBinding viewBinding;
    private ActivityAboutBinding viewBinding;
    private final String APP_VERSION_RELEASE = "Version " + Utils.getAppVersion();   //contains Version + the version number
    private final String APP_VERSION_RELEASE = "Version " + Utils.getAppVersion();   //contains Version + the version number
@@ -80,7 +80,7 @@ public class AboutActivity extends CyaneaAppCompatActivity {
    }
    }


    public void showLicense(View v) {
    public void showLicense(View v) {
        startActivity(Utils.linkIntent("https://github.com/JavaCafe01/PdfViewer/blob/master/LICENSE"));
        startActivity(Utils.linkIntent(getString(R.string.e_pdfviewer_license)));
    }
    }


    public void showLibraries(View v) {
    public void showLibraries(View v) {
@@ -157,11 +157,11 @@ public class AboutActivity extends CyaneaAppCompatActivity {
    }
    }


    public void navToGit(View v) {
    public void navToGit(View v) {
        startActivity(Utils.linkIntent("https://github.com/JavaCafe01"));
        startActivity(Utils.linkIntent(getString(R.string.e_gitlab)));
    }
    }


    public void navToSourceCode(View v) {
    public void navToSourceCode(View v) {
        startActivity(Utils.linkIntent("https://github.com/JavaCafe01/PdfViewer"));
        startActivity(Utils.linkIntent(getString(R.string.e_pdfviewer)));
    }
    }


    @Override
    @Override
+122 −0
Original line number Original line Diff line number Diff line
/*
   Copyright Murena SAS 2022
   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/>.
*/
package com.gsnathan.pdfviewer;

import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.MenuInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.LayoutRes;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.widget.Toolbar;

public abstract class AppCompatPreferenceActivity extends PreferenceActivity {

    private AppCompatDelegate mDelegate;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        getDelegate().installViewFactory();
        getDelegate().onCreate(savedInstanceState);
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void onPostCreate(Bundle savedInstanceState) {
        super.onPostCreate(savedInstanceState);
        getDelegate().onPostCreate(savedInstanceState);
    }

    public ActionBar getSupportActionBar() {
        return getDelegate().getSupportActionBar();
    }

    public void setSupportActionBar(@Nullable Toolbar toolbar) {
        getDelegate().setSupportActionBar(toolbar);
    }

    @Override
    public MenuInflater getMenuInflater() {
        return getDelegate().getMenuInflater();
    }

    @Override
    public void setContentView(@LayoutRes int layoutResID) {
        getDelegate().setContentView(layoutResID);
    }

    @Override
    public void setContentView(View view) {
        getDelegate().setContentView(view);
    }

    @Override
    public void setContentView(View view, ViewGroup.LayoutParams params) {
        getDelegate().setContentView(view, params);
    }

    @Override
    public void addContentView(View view, ViewGroup.LayoutParams params) {
        getDelegate().addContentView(view, params);
    }

    @Override
    protected void onPostResume() {
        super.onPostResume();
        getDelegate().onPostResume();
    }

    @Override
    protected void onTitleChanged(CharSequence title, int color) {
        super.onTitleChanged(title, color);
        getDelegate().setTitle(title);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        getDelegate().onConfigurationChanged(newConfig);
    }

    @Override
    protected void onStop() {
        super.onStop();
        getDelegate().onStop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        getDelegate().onDestroy();
    }

    AppCompatDelegate getDelegate() {
        if (mDelegate == null) {
            mDelegate = AppCompatDelegate.create(this, null);
        }
        return mDelegate;
    }

    public void invalidateOptionsMenu() {
        getDelegate().invalidateOptionsMenu();
    }

}
+2 −23
Original line number Original line Diff line number Diff line
@@ -55,6 +55,7 @@ import androidx.activity.result.contract.ActivityResultContracts.StartActivityFo
import androidx.annotation.NonNull;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.DialogFragment;


@@ -78,7 +79,7 @@ import java.io.IOException;


import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;


public class MainActivity extends CyaneaAppCompatActivity {
public class MainActivity extends AppCompatActivity {


    private static final String TAG = "MainActivity";
    private static final String TAG = "MainActivity";


@@ -133,8 +134,6 @@ public class MainActivity extends CyaneaAppCompatActivity {
        prefManager = PreferenceManager.getDefaultSharedPreferences(this);
        prefManager = PreferenceManager.getDefaultSharedPreferences(this);


        mgr = (PrintManager) getSystemService(PRINT_SERVICE);
        mgr = (PrintManager) getSystemService(PRINT_SERVICE);
        onFirstInstall();
        onFirstUpdate();


        if (savedInstanceState != null) {
        if (savedInstanceState != null) {
            restoreInstanceState(savedInstanceState);
            restoreInstanceState(savedInstanceState);
@@ -157,26 +156,6 @@ public class MainActivity extends CyaneaAppCompatActivity {
        viewBinding.bottomNavigation.setBackgroundColor(Cyanea.getInstance().getPrimary());
        viewBinding.bottomNavigation.setBackgroundColor(Cyanea.getInstance().getPrimary());
    }
    }


    private void onFirstInstall() {
        boolean isFirstRun = prefManager.getBoolean("FIRSTINSTALL", true);
        if (isFirstRun) {
            startActivity(new Intent(this, MainIntroActivity.class));
            SharedPreferences.Editor editor = prefManager.edit();
            editor.putBoolean("FIRSTINSTALL", false);
            editor.apply();
        }
    }

    private void onFirstUpdate() {
        boolean isFirstRun = prefManager.getBoolean(Utils.getAppVersion(), true);
        if (isFirstRun) {
            Utils.showLog(this);
            SharedPreferences.Editor editor = prefManager.edit();
            editor.putBoolean(Utils.getAppVersion(), false);
            editor.apply();
        }
    }

    @Override
    @Override
    protected void onSaveInstanceState(@NonNull Bundle outState) {
    protected void onSaveInstanceState(@NonNull Bundle outState) {
        outState.putParcelable("uri", uri);
        outState.putParcelable("uri", uri);
Loading