Remove code connected to the old EngagementActivity

MAILAND-2695
This commit is contained in:
stefanija 2022-03-02 18:49:28 +01:00
parent 370c20ac62
commit 7ee00e30a0
8 changed files with 0 additions and 515 deletions

View File

@ -278,10 +278,6 @@
android:exported="false"
android:screenOrientation="portrait"
android:label="@string/account_settings"/>
<activity
android:name=".activities.EngagementActivity"
android:exported="false"
android:theme="@style/Theme.AppCompat.Dialog" />
<activity
android:name=".activities.EditSettingsItemActivity"
android:exported="false"

View File

@ -1,167 +0,0 @@
/*
* Copyright (c) 2020 Proton Technologies AG
*
* This file is part of ProtonMail.
*
* ProtonMail 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.
*
* ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
*/
package ch.protonmail.android.activities;
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.viewpagerindicator.CirclePageIndicator;
import butterknife.BindView;
import butterknife.OnClick;
import ch.protonmail.android.R;
import ch.protonmail.android.activities.fragments.EngagementImageFragment;
public class EngagementActivity extends BaseActivity {
@BindView(R.id.engagement_pager)
ViewPager mViewPager;
@BindView(R.id.pager_indicator)
CirclePageIndicator mCirclePageIndicator;
private int[] images;
private int[] titles;
private int[] subtitles;
private EngagementAdapter adapter;
@Override
protected int getLayoutId() {
return R.layout.activity_engagement;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.PopupTheme);
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
initData();
adapter = new EngagementAdapter(getSupportFragmentManager());
mViewPager.setOffscreenPageLimit(5);
mViewPager.setAdapter(adapter);
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (position == (images.length - 1)) {
mCirclePageIndicator.setVisibility(View.GONE);
} else {
mCirclePageIndicator.setVisibility(View.VISIBLE);
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
mCirclePageIndicator.setViewPager(mViewPager);
float density = getResources().getDisplayMetrics().density;
mCirclePageIndicator.setFillColor(getResources().getColor(R.color.icon_purple));
mCirclePageIndicator.setPageColor(getResources().getColor(R.color.white));
mCirclePageIndicator.setStrokeColor(getResources().getColor(R.color.blue));
mCirclePageIndicator.setRadius(5 * density);
}
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
getWindow().setLayout((int) (width * 0.99f), (int) (height * 0.95f));
}
@Override
public void onBackPressed() {
exitTour();
super.onBackPressed();
}
@OnClick(R.id.button_close)
public void onCloseClicked() {
exitTour();
}
private void initData() {
images = new int[]{
R.drawable.welcome,
R.drawable.swipe,
R.drawable.labels,
R.drawable.encryption,
R.drawable.expire,
R.drawable.help
};
titles = new int[]{
R.string.engagement_title_welcome,
R.string.engagement_title_swipe,
R.string.engagement_title_labels,
R.string.engagement_title_encryption,
R.string.engagement_title_expire,
R.string.engagement_title_help
};
subtitles = new int[]{
R.string.engagement_subtitle_welcome,
R.string.engagement_subtitle_swipe,
R.string.engagement_subtitle_labels,
R.string.engagement_subtitle_encryption,
R.string.engagement_subtitle_expire,
R.string.engagement_subtitle_help
};
}
private void exitTour() {
mUserManager.engagementDone();
finish();
}
public class EngagementAdapter extends FragmentStatePagerAdapter {
EngagementAdapter(FragmentManager fm) {
super(fm);
}
@Override
public int getCount() {
return images.length;
}
@Override
public Fragment getItem(int position) {
return EngagementImageFragment.newInstance(images[position], titles[position], subtitles[position], false);
}
}
}

View File

@ -1,108 +0,0 @@
/*
* Copyright (c) 2020 Proton Technologies AG
*
* This file is part of ProtonMail.
*
* ProtonMail 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.
*
* ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
*/
package ch.protonmail.android.activities.fragments;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Optional;
import ch.protonmail.android.R;
import ch.protonmail.android.utils.extensions.TextExtensions;
/**
* Created by dkadrikj on 12/11/15.
*/
public class EngagementImageFragment extends Fragment {
private static final String ARGUMENT_IMAGE_RESOURCE_ID = "image_resource_id";
private static final String ARGUMENT_TITLE_RESOURCE_ID = "title_resource_id";
private static final String ARGUMENT_SUBTITLE_RESOURCE_ID = "subtitle_resource_id";
private static final String ARGUMENT_IS_SUPPORT = "is_support";
@BindView(R.id.engagement_image)
ImageView mImageView;
@BindView(R.id.engagement_title)
TextView mTitleView;
@BindView(R.id.engagement_subtitle)
TextView mSubtitleView;
private int imageResourceId;
private int titleResourceId;
private int subtitleResourceId;
private boolean isSupport;
public static EngagementImageFragment newInstance(int imageResourceId, int titleResourceId,
int subtitleResourceId, boolean isSupport){
EngagementImageFragment engagementImageFragment = new EngagementImageFragment();
Bundle bundle = new Bundle();
bundle.putInt(ARGUMENT_IMAGE_RESOURCE_ID, imageResourceId);
bundle.putInt(ARGUMENT_TITLE_RESOURCE_ID, titleResourceId);
bundle.putInt(ARGUMENT_SUBTITLE_RESOURCE_ID, subtitleResourceId);
bundle.putBoolean(ARGUMENT_IS_SUPPORT, isSupport);
engagementImageFragment.setArguments(bundle);
return engagementImageFragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(getArguments() != null){
imageResourceId = getArguments().getInt(ARGUMENT_IMAGE_RESOURCE_ID);
titleResourceId = getArguments().getInt(ARGUMENT_TITLE_RESOURCE_ID);
subtitleResourceId = getArguments().getInt(ARGUMENT_SUBTITLE_RESOURCE_ID);
isSupport = getArguments().getBoolean(ARGUMENT_IS_SUPPORT);
}
}
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
int resource = R.layout.fragment_engagement_page;
if (isSupport) {
resource = R.layout.fragment_engagement_page_support;
}
View rootView = inflater.inflate(resource, container, false);
ButterKnife.bind(this, rootView);
mImageView.setImageResource(imageResourceId);
mTitleView.setText(getString(titleResourceId));
mSubtitleView.setText(getString(subtitleResourceId));
return rootView;
}
@Optional
@OnClick(R.id.support)
public void onSupportClicked() {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.support_protonmail)));
if (intent.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(intent);
} else {
TextExtensions.showToast(getContext(), R.string.no_browser_found, Toast.LENGTH_SHORT);
}
}
}

View File

@ -67,7 +67,6 @@ private const val PREF_PIN_INCORRECT_ATTEMPTS = "mailbox_pin_incorrect_attempts"
private const val PREF_IS_FIRST_MAILBOX_LOAD_AFTER_LOGIN = "is_first_mailbox_load_after_login"
const val PREF_SHOW_STORAGE_LIMIT_WARNING = "show_storage_limit_warning"
const val PREF_SHOW_STORAGE_LIMIT_REACHED = "show_storage_limit_reached"
private const val PREF_ENGAGEMENT_SHOWN = "engagement_shown"
// endregion
/**
@ -205,10 +204,6 @@ class UserManager @Inject constructor(
val isFirstMailboxLoad: Boolean
get() = prefs.getBoolean(PREF_IS_FIRST_MAILBOX_LOAD_AFTER_LOGIN, true)
val isEngagementShown: Boolean
// Disable Engagement screen.
get() = true // backupPrefs.getBoolean(PREF_ENGAGEMENT_SHOWN, false)
private val currentUserPreferences
get() = currentUserId?.let(::preferencesFor)
@ -255,10 +250,6 @@ class UserManager @Inject constructor(
prefs.edit().putBoolean(PREF_IS_FIRST_MAILBOX_LOAD_AFTER_LOGIN, false).apply()
}
fun engagementDone() {
backupPrefs.edit().putBoolean(PREF_ENGAGEMENT_SHOWN, true).apply()
}
fun increaseIncorrectPinAttempt() {
val secureSharedPreferences = app.secureSharedPreferences
var attempts = secureSharedPreferences.getInt(PREF_PIN_INCORRECT_ATTEMPTS, 0)

View File

@ -1,56 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2020 Proton Technologies AG
This file is part of ProtonMail.
ProtonMail 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.
ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.viewpager.widget.ViewPager
android:id="@+id/engagement_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/spacing_large" />
<Button
android:id="@+id/button_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:gravity="center"
android:layout_marginEnd="@dimen/fields_default_space"
android:layout_marginRight="@dimen/fields_default_space"
android:layout_marginTop="@dimen/fields_default_space"
android:background="@android:color/transparent"
android:drawableEnd="@drawable/ic_clear_black"
android:drawableRight="@drawable/ic_clear_black"
android:drawablePadding="@dimen/fields_default_space_small"
android:text="@string/close_engagement" />
<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/pager_indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="@dimen/fields_default_space_large"
android:padding="10dp" />
</RelativeLayout>

View File

@ -1,67 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2020 Proton Technologies AG
This file is part of ProtonMail.
ProtonMail 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.
ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ch.protonmail.android.views.CustomFontTextView
android:id="@+id/engagement_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/fields_default_space_medium"
android:layout_marginLeft="@dimen/fields_default_space"
android:layout_marginRight="@dimen/fields_default_space"
android:gravity="center_horizontal"
android:textColor="@color/new_purple"
android:textSize="@dimen/h0"
android:text="@string/engagement_title_welcome"
android:textStyle="bold"
app:fontName="Roboto-Light.ttf" />
<ch.protonmail.android.views.CustomFontTextView
android:id="@+id/engagement_subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/fields_default_space"
android:layout_marginRight="@dimen/fields_default_space"
android:layout_marginTop="@dimen/fields_default_space_medium"
android:gravity="center_horizontal"
android:text="@string/engagement_subtitle_welcome"
android:textSize="@dimen/h3"
app:fontName="Roboto-Light.ttf" />
</LinearLayout>
<ImageView
android:id="@+id/engagement_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/welcome"
android:scaleType="fitCenter" />
</LinearLayout>

View File

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2020 Proton Technologies AG
This file is part of ProtonMail.
ProtonMail 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.
ProtonMail 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 ProtonMail. If not, see https://www.gnu.org/licenses/.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="7">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="vertical">
<ch.protonmail.android.views.CustomFontTextView
android:id="@+id/engagement_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/fields_default_space_medium"
android:layout_marginLeft="@dimen/fields_default_space"
android:layout_marginRight="@dimen/fields_default_space"
android:gravity="center_horizontal"
android:textColor="@color/new_purple"
android:textSize="@dimen/h0"
android:textStyle="bold"
app:fontName="Roboto-Light.ttf" />
<ch.protonmail.android.views.CustomFontTextView
android:id="@+id/engagement_subtitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/fields_default_space"
android:layout_marginRight="@dimen/fields_default_space"
android:gravity="center_horizontal"
android:textSize="@dimen/h3"
app:fontName="Roboto-Light.ttf" />
</LinearLayout>
<ImageView
android:id="@+id/engagement_image"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2.5"
android:scaleType="fitCenter" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_gravity="top">
<ch.protonmail.android.views.CustomFontButton
android:id="@+id/support"
android:layout_width="wrap_content"
android:layout_height="42dp"
android:layout_gravity="top|center_horizontal"
android:layout_marginTop="@dimen/fields_default_space_large"
android:background="@drawable/button_selector_inverted"
android:paddingEnd="@dimen/fields_default_space"
android:paddingLeft="@dimen/fields_default_space"
android:paddingRight="@dimen/fields_default_space"
android:paddingStart="@dimen/fields_default_space"
android:text="@string/engagement_title_support_protonmail"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="@dimen/h3"
app:fontName="Roboto-Light.ttf" />
</FrameLayout>
</LinearLayout>

View File

@ -330,22 +330,7 @@
<string name="display_images">Show remote content</string>
<string name="retry">Retry</string>
<string name="saving_failed_no_conn">Saving failed, no connection</string>
<string name="close_engagement">close tour</string>
<string name="engagement_title_welcome">Welcome to ProtonMail!</string>
<string name="engagement_title_swipe">Quick Swipe actions</string>
<string name="engagement_title_labels">Label management</string>
<string name="engagement_title_encryption">End-to-End Encryption</string>
<string name="engagement_title_expire">Expiring messages</string>
<string name="engagement_title_help">Help &amp; Support</string>
<string name="engagement_title_support_protonmail">Support ProtonMail</string>
<string name="engagement_subtitle_welcome">Your new encrypted email account has been set up and is ready to send and receive encrypted messages.</string>
<string name="engagement_subtitle_swipe">You can customize swipe gestures in the ProtonMail App Settings.</string>
<string name="engagement_subtitle_labels">Create and add Labels to organize your inbox. Press and hold down on a message for all options.</string>
<string name="engagement_subtitle_encryption">Your inbox is now protected with end-to-end encryption. To automatically send secure emails to your contacts, invite them to use ProtonMail! You can also manually encrypt messages to them if they don\'t use ProtonMail.</string>
<string name="engagement_subtitle_expire">Messages you send can be set to auto delete after a certain time period.</string>
<string name="engagement_subtitle_help">You can get help and support at protonmail.com/support. Bugs can also be reported with the app.</string>
<string name="attachment_exists">Attachment already attached</string>
<string name="eo_password_not_completed">Message Password not completed.</string>