This commit is contained in:
Tobias Kaminsky 2017-08-04 12:46:34 +00:00 committed by GitHub
commit 7eaba89ae3
13 changed files with 58 additions and 69 deletions

1
.gitignore vendored
View file

@ -18,7 +18,6 @@ target/
# Local configuration files (sdk path, etc) # Local configuration files (sdk path, etc)
local.properties local.properties
tests/local.properties tests/local.properties
lint.xml
# Mac .DS_Store files # Mac .DS_Store files
.DS_Store .DS_Store

6
lint.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<issue id="InvalidPackage">
<ignore path="**/freemarker-2.3.23.jar"/>
</issue>
</lint>

View file

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 32 errors and 678 warnings</span> <span class="mdl-layout-title">Lint Report: 20 errors and 676 warnings</span>

View file

@ -563,7 +563,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
/// step 2 - set properties of UI elements (text, visibility, enabled...) /// step 2 - set properties of UI elements (text, visibility, enabled...)
Button welcomeLink = (Button) findViewById(R.id.welcome_link); Button welcomeLink = (Button) findViewById(R.id.welcome_link);
welcomeLink.setVisibility(isWelcomeLinkVisible ? View.VISIBLE : View.GONE); welcomeLink.setVisibility(isWelcomeLinkVisible ? View.VISIBLE : View.GONE);
welcomeLink.setText(String.format(getString(R.string.auth_register), getString(R.string.app_name))); welcomeLink.setText(getString(R.string.auth_register));
TextView instructionsView = (TextView) findViewById(R.id.instructions_message); TextView instructionsView = (TextView) findViewById(R.id.instructions_message);
if (instructionsMessageText != null) { if (instructionsMessageText != null) {

View file

@ -23,6 +23,7 @@ import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Build;
import android.os.PowerManager; import android.os.PowerManager;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.view.WindowManager; import android.view.WindowManager;
@ -71,26 +72,22 @@ public class PassCodeManager {
} }
public void onActivityStarted(Activity activity) { public void onActivityStarted(Activity activity) {
if (!sExemptOfPasscodeActivites.contains(activity.getClass()) && if (!sExemptOfPasscodeActivites.contains(activity.getClass()) && passCodeShouldBeRequested()) {
passCodeShouldBeRequested()
){
Intent i = new Intent(MainApp.getAppContext(), PassCodeActivity.class); Intent i = new Intent(MainApp.getAppContext(), PassCodeActivity.class);
i.setAction(PassCodeActivity.ACTION_CHECK); i.setAction(PassCodeActivity.ACTION_CHECK);
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
activity.startActivity(i); activity.startActivity(i);
} }
if (!sExemptOfPasscodeActivites.contains(activity.getClass()) && if (!sExemptOfPasscodeActivites.contains(activity.getClass()) &&
fingerprintShouldBeRequested() && FingerprintActivity.isFingerprintReady(MainApp.getAppContext()) Build.VERSION.SDK_INT >= Build.VERSION_CODES.M &&
){ fingerprintShouldBeRequested() && FingerprintActivity.isFingerprintReady(MainApp.getAppContext())) {
Intent i = new Intent(MainApp.getAppContext(), FingerprintActivity.class); Intent i = new Intent(MainApp.getAppContext(), FingerprintActivity.class);
i.setAction(PassCodeActivity.ACTION_CHECK); i.setAction(PassCodeActivity.ACTION_CHECK);
i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); i.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
activity.startActivity(i); activity.startActivity(i);
} }
mVisibleActivitiesCounter++; // keep it AFTER passCodeShouldBeRequested was checked mVisibleActivitiesCounter++; // keep it AFTER passCodeShouldBeRequested was checked

View file

@ -224,7 +224,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
super.onCreate(); super.onCreate();
Log_OC.d(TAG, "Creating ownCloud media service"); Log_OC.d(TAG, "Creating ownCloud media service");
mWifiLock = ((WifiManager) getSystemService(Context.WIFI_SERVICE)). mWifiLock = ((WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE)).
createWifiLock(WifiManager.WIFI_MODE_FULL, MEDIA_WIFI_LOCK_TAG); createWifiLock(WifiManager.WIFI_MODE_FULL, MEDIA_WIFI_LOCK_TAG);
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
@ -499,7 +499,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
/** Called when media player is done playing current song. */ /** Called when media player is done playing current song. */
public void onCompletion(MediaPlayer player) { public void onCompletion(MediaPlayer player) {
Toast.makeText(this, String.format(getString(R.string.media_event_done, mFile.getFileName())), Toast.LENGTH_LONG).show(); Toast.makeText(this, String.format(getString(R.string.media_event_done), mFile.getFileName()), Toast.LENGTH_LONG).show();
if (mMediaController != null) { if (mMediaController != null) {
// somebody is still bound to the service // somebody is still bound to the service
player.seekTo(0); player.seekTo(0);

View file

@ -95,7 +95,7 @@ public class ConflictsResolveActivity extends FileActivity implements OnConflict
// current Account // current Account
if (file != null) { if (file != null) {
setFile(file); setFile(file);
ConflictsResolveDialog d = ConflictsResolveDialog.newInstance(file.getRemotePath(), this); ConflictsResolveDialog d = ConflictsResolveDialog.newInstance(this);
d.showDialog(this); d.showDialog(this);
} else { } else {

View file

@ -237,7 +237,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
if (mIsAccountChooserActive) { if (mIsAccountChooserActive) {
toggleAccountList(); toggleAccountList();
} }
invalidateOptionsMenu(); supportInvalidateOptionsMenu();
mDrawerToggle.setDrawerIndicatorEnabled(isDrawerIndicatorAvailable()); mDrawerToggle.setDrawerIndicatorEnabled(isDrawerIndicatorAvailable());
if (pendingRunnable != null) { if (pendingRunnable != null) {
@ -250,7 +250,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
public void onDrawerOpened(View drawerView) { public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView); super.onDrawerOpened(drawerView);
mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerToggle.setDrawerIndicatorEnabled(true);
invalidateOptionsMenu(); supportInvalidateOptionsMenu();
} }
}; };

View file

@ -40,7 +40,6 @@ import com.owncloud.android.MainApp;
import com.owncloud.android.R; import com.owncloud.android.R;
import com.owncloud.android.authentication.AccountUtils; import com.owncloud.android.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity; import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.OCFile; import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader; import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder; import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
@ -448,7 +447,7 @@ public abstract class FileActivity extends DrawerActivity
operation, getResources()), Toast.LENGTH_LONG); operation, getResources()), Toast.LENGTH_LONG);
msg.show(); msg.show();
} }
invalidateOptionsMenu(); supportInvalidateOptionsMenu();
} }
} }

View file

@ -99,7 +99,6 @@ import com.owncloud.android.ui.preview.PreviewMediaFragment;
import com.owncloud.android.ui.preview.PreviewTextFragment; import com.owncloud.android.ui.preview.PreviewTextFragment;
import com.owncloud.android.ui.preview.PreviewVideoActivity; import com.owncloud.android.ui.preview.PreviewVideoActivity;
import com.owncloud.android.utils.DataHolderUtil; import com.owncloud.android.utils.DataHolderUtil;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter; import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.MimeTypeUtil; import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.PermissionUtil; import com.owncloud.android.utils.PermissionUtil;
@ -1650,7 +1649,7 @@ public class FileDisplayActivity extends HookActivity
showDetails(file); showDetails(file);
} }
} }
invalidateOptionsMenu(); supportInvalidateOptionsMenu();
} }
} }
@ -1681,7 +1680,7 @@ public class FileDisplayActivity extends HookActivity
if (getStorageManager().getFileById(removedFile.getParentId()).equals(getCurrentDir())) { if (getStorageManager().getFileById(removedFile.getParentId()).equals(getCurrentDir())) {
refreshListOfFilesFragment(false); refreshListOfFilesFragment(false);
} }
invalidateOptionsMenu(); supportInvalidateOptionsMenu();
} else { } else {
if (result.isSslRecoverableException()) { if (result.isSslRecoverableException()) {
mLastSslUntrustedServerResult = result; mLastSslUntrustedServerResult = result;
@ -1799,7 +1798,7 @@ public class FileDisplayActivity extends HookActivity
if (result.isSuccess() && operation.transferWasRequested()) { if (result.isSuccess() && operation.transferWasRequested()) {
OCFile syncedFile = operation.getLocalFile(); OCFile syncedFile = operation.getLocalFile();
onTransferStateChanged(syncedFile, true, true); onTransferStateChanged(syncedFile, true, true);
invalidateOptionsMenu(); supportInvalidateOptionsMenu();
refreshShowDetails(); refreshShowDetails();
} }
} }

View file

@ -20,8 +20,6 @@
package com.owncloud.android.ui.activity; package com.owncloud.android.ui.activity;
import android.Manifest; import android.Manifest;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.KeyguardManager; import android.app.KeyguardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
@ -71,7 +69,7 @@ import javax.crypto.SecretKey;
/** /**
* Activity to handle access to the app based on the fingerprint. * Activity to handle access to the app based on the fingerprint.
*/ */
@TargetApi(Build.VERSION_CODES.M) @RequiresApi(Build.VERSION_CODES.M)
public class FingerprintActivity extends AppCompatActivity { public class FingerprintActivity extends AppCompatActivity {
private static final String TAG = FingerprintActivity.class.getSimpleName(); private static final String TAG = FingerprintActivity.class.getSimpleName();
@ -274,28 +272,21 @@ public class FingerprintActivity extends AppCompatActivity {
return false; return false;
} }
@RequiresApi(api = Build.VERSION_CODES.M)
static public boolean isFingerprintReady(Context context) { static public boolean isFingerprintReady(Context context) {
try { try {
FingerprintManager fingerprintManager = FingerprintManager fingerprintManager =
(FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE); (FingerprintManager) context.getSystemService(Context.FINGERPRINT_SERVICE);
if (ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) return ActivityCompat.checkSelfPermission(context, Manifest.permission.USE_FINGERPRINT) ==
!= PackageManager.PERMISSION_GRANTED) { PackageManager.PERMISSION_GRANTED && fingerprintManager.isHardwareDetected() &&
return false; fingerprintManager.hasEnrolledFingerprints();
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return fingerprintManager.isHardwareDetected() && fingerprintManager.hasEnrolledFingerprints();
}
} catch (Exception e) { } catch (Exception e) {
return false; return false;
} }
return false;
} }
} }
@SuppressLint("NewApi") @RequiresApi(Build.VERSION_CODES.M)
class FingerprintHandler extends FingerprintManager.AuthenticationCallback { class FingerprintHandler extends FingerprintManager.AuthenticationCallback {
private TextView text; private TextView text;

View file

@ -1,4 +1,4 @@
/** /*
* ownCloud Android client application * ownCloud Android client application
* *
* @author Bartek Przybylski * @author Bartek Przybylski
@ -24,6 +24,7 @@ package com.owncloud.android.ui.dialog;
import android.app.Dialog; import android.app.Dialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment; import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentTransaction;
@ -38,7 +39,7 @@ import com.owncloud.android.R;
*/ */
public class ConflictsResolveDialog extends DialogFragment { public class ConflictsResolveDialog extends DialogFragment {
public static enum Decision { public enum Decision {
CANCEL, CANCEL,
KEEP_BOTH, KEEP_BOTH,
OVERWRITE, OVERWRITE,
@ -47,22 +48,19 @@ public class ConflictsResolveDialog extends DialogFragment {
OnConflictDecisionMadeListener mListener; OnConflictDecisionMadeListener mListener;
public static ConflictsResolveDialog newInstance(String path, OnConflictDecisionMadeListener listener) { public static ConflictsResolveDialog newInstance(OnConflictDecisionMadeListener listener) {
ConflictsResolveDialog f = new ConflictsResolveDialog(); ConflictsResolveDialog f = new ConflictsResolveDialog();
Bundle args = new Bundle();
args.putString("remotepath", path);
f.setArguments(args);
f.mListener = listener; f.mListener = listener;
return f; return f;
} }
@NonNull
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) { public Dialog onCreateDialog(Bundle savedInstanceState) {
String remotepath = getArguments().getString("remotepath");
return new AlertDialog.Builder(getActivity(), R.style.Theme_ownCloud_Dialog) return new AlertDialog.Builder(getActivity(), R.style.Theme_ownCloud_Dialog)
.setIcon(R.drawable.ic_warning) .setIcon(R.drawable.ic_warning)
.setTitle(R.string.conflict_title) .setTitle(R.string.conflict_title)
.setMessage(String.format(getString(R.string.conflict_message), remotepath)) .setMessage(getString(R.string.conflict_message))
.setPositiveButton(R.string.conflict_use_local_version, .setPositiveButton(R.string.conflict_use_local_version,
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@ -120,6 +118,6 @@ public class ConflictsResolveDialog extends DialogFragment {
} }
public interface OnConflictDecisionMadeListener { public interface OnConflictDecisionMadeListener {
public void conflictDecisionMade(Decision decision); void conflictDecisionMade(Decision decision);
} }
} }

View file

@ -195,7 +195,7 @@ public class PreviewImageActivity extends FileActivity implements
private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation, private void onSynchronizeFileOperationFinish(SynchronizeFileOperation operation,
RemoteOperationResult result) { RemoteOperationResult result) {
if (result.isSuccess()) { if (result.isSuccess()) {
invalidateOptionsMenu(); supportInvalidateOptionsMenu();
} }
} }