Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern Lock Added #2083

Merged
merged 13 commits into from
Mar 2, 2018
26 changes: 11 additions & 15 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
</activity>
<activity
android:name=".ui.activity.Preferences"
android:theme="@style/Theme.ownCloud"></activity>
android:theme="@style/Theme.ownCloud" />
<activity
android:name=".ui.preview.PreviewImageActivity"
android:theme="@style/Theme.ownCloud.Overlay" />
Expand All @@ -129,18 +129,14 @@
android:name="android.content.SyncAdapter"
android:resource="@xml/syncadapter_files" />
</service>

<service
android:name=".files.services.RetryUploadJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true">
</service>

android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name=".files.services.RetryDownloadJobService"
android:permission="android.permission.BIND_JOB_SERVICE"
android:exported="true">
</service>
android:exported="true"
android:permission="android.permission.BIND_JOB_SERVICE" />

<service
android:name=".files.services.CameraUploadsSyncJobService"
Expand Down Expand Up @@ -221,13 +217,12 @@
android:name=".broadcastreceivers.ConnectivityActionReceiver"
android:enabled="true"
android:label="ConnectivityActionReceiver">

<intent-filter>

<!-- action android:name="android.net.conn.CONNECTIVITY_CHANGE"/ -->
<action android:name="android.net.wifi.STATE_CHANGE" />
</intent-filter>
</receiver>

<receiver android:name=".broadcastreceivers.BootupBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
Expand Down Expand Up @@ -261,11 +256,12 @@
android:name=".ui.activity.ManageSpaceActivity"
android:label="@string/manage_space_title"
android:theme="@style/Theme.ownCloud" />
<activity android:name=".ui.activity.PrivacyPolicyActivity"></activity>
<activity android:name=".ui.preview.PreviewVideoActivity"
<activity android:name=".ui.activity.PrivacyPolicyActivity" />
<activity
android:name=".ui.preview.PreviewVideoActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
android:theme="@style/Theme.ownCloud.Fullscreen">
</activity>
android:theme="@style/Theme.ownCloud.Fullscreen" />
<activity android:name=".ui.activity.PatternLockActivity" />
</application>

</manifest>
23 changes: 14 additions & 9 deletions THIRD_PARTY.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###################################################################
ownCloud Android client
ownCloud Android client

Copyright (C) 2016 ownCloud GmbH.
Copyright (C) 2012 Bartek Przybylski
Expand All @@ -20,7 +20,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

The source distribution of this program should include a full copy
of the GNU GPL version 2 license in the LICENSE.txt file located
of the GNU GPL version 2 license in the LICENSE.txt file located
in its root directory. If not, see <http://www.gnu.org/licenses/>.


Expand All @@ -30,8 +30,8 @@ in its root directory. If not, see <http://www.gnu.org/licenses/>.

Both the source and binary distributions of this software contain
some third party software. All the third party software included
or linked is redistributed under the terms and conditions of their
original licenses. These licenses are compatible the GPL license
or linked is redistributed under the terms and conditions of their
original licenses. These licenses are compatible the GPL license
that govern this software, for the purposes they are being used.

The third party software included and used by this project is:
Expand All @@ -43,24 +43,29 @@ The third party software included and used by this project is:
The jar file must be included in the ownCloud client APK.
Original license document included at libs/LICENSE.txt
See http://jackrabbit.apache.org/

* Transifex client.
Copyright (C) Transifex.
Licensed under GNU General Public License.
Placed at third_party/transifex-client.
Used as a helper tool, not included in the ownCloud client APK.
Original license document included at third_party/transifex-client/LICENSE.
See http://help.transifex.com/features/client/

* TouchImageView, commit 6dbeac4f11936185ba374c73144ac431c23c9aab
Copyright (c) 2012 Michael Ortiz
Licensed under MIT License
JAR file libs/touch-image-view.jar has been generated by ownCloud GmbH., including without
modifications com.ortiz.touch.ExtendedViewPager and com.ortiz.touch.TouchImageView classes.
modifications com.ortiz.touch.ExtendedViewPager and com.ortiz.touch.TouchImageView classes.
See https://github.com/MikeOrtiz/TouchImageView

* floatingactionbutton 1.10.1.
Copyright (c) 2014 Jerzy Chalupski
Licensed under Apache License, Version 2.0.
placed at libs/com-getbase-floatingactionbutton-1-10-0-exploded-aar has been exploded by ownCloud GmbH.
See https://github.com/futuresimple/android-floating-action-button

* PatternLockView, version 1.0.0
Copyright (C) 2017 aritraroy
Licensed under Apache License, Version 2.0.
Included in the ownCloud client APK.
See https://github.com/aritraroy/PatternLockView
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ dependencies {
compile "com.android.support:design:${supportLibraryVersion}"
compile 'com.jakewharton:disklrucache:2.0.2'
compile 'com.google.android.exoplayer:exoplayer:r2.2.0'
compile 'com.andrognito.patternlockview:patternlockview:1.0.0'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we use a third-party library we usually include the information in our THIRD_PARTY.txt file. Could you do the same with this library? You can have a look at the format we followed with other libraries in that file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in this picture for the floating action button dependency it is written that it is placed in libs/com-getbase-floatingactionbutton-1-10-0-exploded-aar. Similarly what should I write for the placed at point (for the pattern lock view dependency).What I mean is what does placed at signify.

screen shot 2018-02-05 at 9 23 36 pm

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forget this change for the moment, it seems that our THIRD_PARTY.txt is not properly updated, I will ping you when is ready.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davigonz Then I will commit the other changes. Thanks.

compile "com.android.support:appcompat-v7:${supportLibraryVersion}"
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile group: 'commons-io', name: 'commons-io', version: '2.5'

/// dependencies for local unit tests
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'


/// dependencies for instrumented tests
// JUnit4 Rules
androidTestCompile 'com.android.support.test:rules:0.5'
Expand Down Expand Up @@ -127,14 +128,12 @@ android {
res.srcDirs = ['beta/res']
}


// move whole local unit tests structure as a whole from src/test/* to test/*
test.setRoot('test')

// move whole instrumented tests structure as a whole from src/androidTest/* to androidTest/*
androidTest.setRoot('androidTest')


// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
Expand Down
64 changes: 64 additions & 0 deletions res/layout-land/activity_pattern_lock.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need a specific landscape view? Does not the CANCEL button fit below the pattern? If so, portrait view would be enough

screenshot_1518431499

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davigonz Yes in some devices the cancel button does not fit in landscape orientation. So should I remove this view?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, if it does not fit in some devices, keep this landscape view 👍

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:filterTouchesWhenObscured="true"
android:gravity="center_horizontal"
android:padding="@dimen/standard_padding">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center_horizontal"
android:orientation="vertical">

<TextView
android:id="@+id/header_pattern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pattern_enter_pattern"
android:textColor="@android:color/black"
android:textSize="16sp" />

<TextView
android:id="@+id/explanation_pattern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/pattern_configure_your_pattern_explanation"
android:textAppearance="@android:style/TextAppearance.Small"
android:textSize="14sp" />

<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<com.andrognito.patternlockview.PatternLockView
android:id="@+id/pattern_lock_view"
android:layout_width="250dp"
android:layout_height="250dp"
android:focusable="true"
app:correctStateColor="@color/primary"
app:dotCount="3"
app:normalStateColor="@color/primary"
app:wrongStateColor="@color/primary">

<requestFocus />
</com.andrognito.patternlockview.PatternLockView>

<android.support.v7.widget.AppCompatButton
android:id="@+id/cancel_pattern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/pattern_lock_view"
android:text="@string/common_cancel"
android:theme="@style/Button.Primary" />

</RelativeLayout>

</LinearLayout>

</RelativeLayout>
56 changes: 56 additions & 0 deletions res/layout/activity_pattern_lock.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:filterTouchesWhenObscured="true"
android:gravity="center_horizontal"
android:padding="@dimen/standard_padding">

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center_horizontal"
android:orientation="vertical">

<TextView
android:id="@+id/header_pattern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/pattern_enter_pattern"
android:textColor="@android:color/black"
android:textSize="16sp" />

<TextView
android:id="@+id/explanation_pattern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:text="@string/pattern_configure_your_pattern_explanation"
android:textAppearance="@android:style/TextAppearance.Small"
android:textSize="14sp" />

<com.andrognito.patternlockview.PatternLockView
android:id="@+id/pattern_lock_view"
android:layout_width="280dp"
android:layout_height="280dp"
android:focusable="true"
app:correctStateColor="@color/primary"
app:dotCount="3"
app:normalStateColor="@color/primary"
app:wrongStateColor="@color/primary">

<requestFocus />
</com.andrognito.patternlockview.PatternLockView>

<android.support.v7.widget.AppCompatButton
android:id="@+id/cancel_pattern"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/common_cancel"
android:theme="@style/Button.Primary" />

</LinearLayout>

</RelativeLayout>
15 changes: 15 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<string name="drawer_open">Open</string>
<string name="prefs_category_general">General</string>
<string name="prefs_category_more">More</string>
<string name="prefs_category_security">Security</string>
<string name="prefs_accounts">Accounts</string>
<string name="prefs_manage_accounts">Manage accounts</string>
<string name="prefs_passcode">Passcode lock</string>
Expand All @@ -46,6 +47,20 @@
<string name="prefs_imprint">Imprint</string>
<string name="prefs_remember_last_share_location">Remember share location</string>
<string name="prefs_remember_last_upload_location_summary">Remember last share upload location</string>
<string name="prefs_pattern"> Pattern lock </string>
<string name="pattern_enter_pattern">Please enter your pattern</string>
<string name="pattern_configure_pattern">Enter your pattern</string>
<string name="pattern_remove_pattern">Remove your pattern</string>
<string name="pattern_incorrect_pattern">Incorrect pattern</string>
<string name="pattern_reenter_pattern">Please re-enter your pattern</string>
<string name="pattern_not_same_pattern">The patterns are not same</string>
<string name="pattern_stored">Pattern Stored</string>
<string name="pattern_removed">Pattern Removed</string>
<string name="pattern_already_set">Pattern and passcode locks cannot be enabled at the same time, please disable pattern first</string>
<string name="passcode_already_set">Pattern and passcode locks cannot be enabled at the same time, please disable passcode first</string>
<string name="pattern_no_longer_required">The pattern will not be asked anymore</string>
<string name="pattern_configure_your_pattern_explanation">The pattern will be requested every time the app is started</string>
<string name="illegal_argument_exception_message">A valid ACTION is needed in the Intent passed to</string>

<string name="recommend_subject">"Try %1$s on your smartphone!"</string>
<string name="recommend_text">"I want to invite you to use %1$s on your smartphone!\nDownload here: %2$s"</string>
Expand Down
8 changes: 7 additions & 1 deletion res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@
android:title="@string/prefs_camera_upload_behaviour_title" />
</PreferenceCategory>

<PreferenceCategory android:title="@string/prefs_category_details">
<PreferenceCategory android:title="@string/prefs_category_security">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, "Security" name is much better than "Details" for the section.

<android.preference.CheckBoxPreference
android:key="set_pincode"
android:title="@string/prefs_passcode" />
/>

<android.preference.CheckBoxPreference
android:title="@string/prefs_pattern"
android:key="set_pattern"
/>
</PreferenceCategory>

<PreferenceCategory
Expand Down
Loading