Skip to content

Commit

Permalink
Merge pull request #777 from meganz/release/v3.5.2.225
Browse files Browse the repository at this point in the history
Release/v3.5.2.225
  • Loading branch information
javiergm1983 authored Mar 1, 2019
2 parents 79da818 + 24de9a6 commit e0f48fd
Show file tree
Hide file tree
Showing 133 changed files with 12,604 additions and 4,512 deletions.
22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

13 changes: 9 additions & 4 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "mega.privacy.android.app"
minSdkVersion 21
targetSdkVersion 27
versionCode 222
versionName "3.5.1 (222)"
versionCode 225
versionName "3.5.2 (225)"
multiDexEnabled true
}

Expand Down
21 changes: 10 additions & 11 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mega.privacy.android.app"
android:installLocation="internalOnly"
android:versionCode="222"
android:versionName="3.5.1 (222)" >
android:versionCode="225"
android:versionName="3.5.2 (225)" >

<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false"/>
Expand Down Expand Up @@ -35,8 +35,8 @@
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
<uses-permission android:name="android.permission.FLAG_SHOW_WHEN_LOCKED" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS"/>
<uses-permission android:name="android.permission.READ_CALL_LOG"/>
<uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
<!--<uses-permission android:name="android.permission.READ_CALL_LOG"/>-->
<!--<uses-permission android:name="android.permission.WRITE_CALL_LOG"/>-->

<application
android:name="mega.privacy.android.app.MegaApplication"
Expand Down Expand Up @@ -189,6 +189,12 @@
android:theme="@style/Theme.Megaactionbar.Secondary">
</activity>

<activity
android:name="mega.privacy.android.app.lollipop.megachat.NodeAttachmentHistoryActivity"
android:label="@string/app_name"
android:theme="@style/Theme.Megaactionbar">
</activity>

<activity android:name="mega.privacy.android.app.providers.PinFileProviderActivity"
android:label="@string/app_name">
</activity>
Expand Down Expand Up @@ -248,13 +254,6 @@
android:theme="@style/Theme.Megaactionbar.Secondary">
</activity>

<activity
android:name="mega.privacy.android.app.lollipop.megachat.NodeAttachmentActivityLollipop"
android:label="@string/app_name"
android:configChanges="orientation|screenSize"
android:theme="@style/Theme.Megaactionbar.Secondary">
</activity>

<activity
android:name="mega.privacy.android.app.lollipop.megachat.ContactAttachmentActivityLollipop"
android:label="@string/app_name"
Expand Down
152 changes: 136 additions & 16 deletions app/src/main/java/com/github/barteksc/pdfviewer/PDFView.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,28 @@
import android.graphics.Paint.Style;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.PointF;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.HandlerThread;
import android.support.v4.content.ContextCompat;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.github.barteksc.pdfviewer.exception.PageRenderingException;
import com.github.barteksc.pdfviewer.link.DefaultLinkHandler;
Expand Down Expand Up @@ -700,6 +712,124 @@ void loadComplete(PdfFile pdfFile) {
// ((PdfViewerActivityLollipop) getContext()).progressDialog.hide();
}

public void showHidePassword (EditText passwordText, ImageView toggleButton) {
boolean passwdVisible;
if (passwordText.getInputType() == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
passwdVisible = true;
}
else {
passwdVisible = false;
}
if(passwdVisible){
toggleButton.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_b_shared_read));
passwordText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
passwordText.setTypeface(Typeface.SANS_SERIF,Typeface.NORMAL);
passwordText.setSelection(passwordText.getText().length());
}
else{
toggleButton.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_b_see));
passwordText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
passwordText.setSelection(passwordText.getText().length());
}
}

void showErrorDialog(final Throwable t) {
AlertDialog.Builder builder;
builder = new AlertDialog.Builder(getContext());

builder.setCancelable(false);
if (t.getLocalizedMessage().equals("Password required or incorrect password.") || t.getMessage().equals("Password required or incorrect password.")) {
if (((PdfViewerActivityLollipop) getContext()).getMaxIntents() > 0) {
LayoutInflater inflater = ((PdfViewerActivityLollipop) getContext()).getLayoutInflater();
View layout = inflater.inflate(R.layout.dialog_pdf_password, null);
final EditText passwordText = layout.findViewById(R.id.password_text);
final ImageView toggleButton = (ImageView) layout.findViewById(R.id.toggle_button);
toggleButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
showHidePassword(passwordText, toggleButton);
}
});
final RelativeLayout errorLayout = layout.findViewById(R.id.password_text_error);
if (((PdfViewerActivityLollipop) getContext()).getPassword() != null) {
errorLayout.setVisibility(VISIBLE);
String text = ((PdfViewerActivityLollipop) getContext()).getPassword();
passwordText.setText(text);
passwordText.setSelection(text.length());
passwordText.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.login_warning), PorterDuff.Mode.SRC_ATOP);
} else {
errorLayout.setVisibility(GONE);
}
passwordText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
showHidePassword(passwordText, toggleButton);
((PdfViewerActivityLollipop) getContext()).reloadPDFwithPassword(textView.getText().toString());
return true;
}
return false;
}
});
passwordText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void afterTextChanged(Editable editable) {
if (errorLayout.getVisibility() == VISIBLE) {
errorLayout.setVisibility(GONE);
passwordText.getBackground().mutate().setColorFilter(ContextCompat.getColor(getContext(), R.color.accentColor), PorterDuff.Mode.SRC_ATOP);
}
}
});
builder.setView(layout);
builder.setTitle(getContext().getString(R.string.title_pdf_password))
.setMessage(getContext().getString(R.string.text_pdf_password, ((PdfViewerActivityLollipop) getContext()).getPdfFileName()))
.setNegativeButton(R.string.general_cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
showHidePassword(passwordText, toggleButton);
((PdfViewerActivityLollipop) getContext()).finish();
}
})
.setPositiveButton(R.string.contact_accept, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
showHidePassword(passwordText, toggleButton);
((PdfViewerActivityLollipop) getContext()).reloadPDFwithPassword(passwordText.getText().toString());
}
}).show();
}
else {
builder.setTitle(getResources().getString(R.string.general_error_word))
.setMessage(getResources().getString(R.string.error_max_pdf_password))
.setPositiveButton(R.string.contact_accept, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
((PdfViewerActivityLollipop) getContext()).finish();
}
}).show();
}
}
else {
builder.setMessage(R.string.corrupt_pdf_dialog_text)
.setPositiveButton(R.string.cam_sync_ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
((PdfViewerActivityLollipop) getContext()).finish();
}
})
.show();
}
}

void loadError(Throwable t) {
state = State.ERROR;
// store reference, because callbacks will be cleared in recycle() method
Expand All @@ -709,22 +839,8 @@ void loadError(Throwable t) {
if (onErrorListener != null) {
onErrorListener.onError(t);
} else {
showErrorDialog(t);
Log.e("PDFView", "load pdf error", t);
AlertDialog.Builder builder;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
builder = new AlertDialog.Builder(getContext(), R.style.AppCompatAlertDialogStyle);
} else {
builder = new AlertDialog.Builder(getContext());
}
builder.setCancelable(false);
String accept = getResources().getString(R.string.cam_sync_ok).toUpperCase();
builder.setMessage(R.string.corrupt_pdf_dialog_text)
.setPositiveButton(accept, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
((PdfViewerActivityLollipop) getContext()).finish();
}
})
.show();
}
}

Expand Down Expand Up @@ -1332,4 +1448,8 @@ public void run() {
});
}
}

public static void log(String log) {
mega.privacy.android.app.utils.Util.log("PdfView", log);
}
}
Loading

0 comments on commit e0f48fd

Please sign in to comment.