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.properties
tests/local.properties
lint.xml
# Mac .DS_Store files
.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
<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...)
Button welcomeLink = (Button) findViewById(R.id.welcome_link);
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);
if (instructionsMessageText != null) {

View file

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

View file

@ -224,7 +224,7 @@ public class MediaService extends Service implements OnCompletionListener, OnPre
super.onCreate();
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);
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. */
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) {
// somebody is still bound to the service
player.seekTo(0);

View file

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

View file

@ -237,7 +237,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
if (mIsAccountChooserActive) {
toggleAccountList();
}
invalidateOptionsMenu();
supportInvalidateOptionsMenu();
mDrawerToggle.setDrawerIndicatorEnabled(isDrawerIndicatorAvailable());
if (pendingRunnable != null) {
@ -250,7 +250,7 @@ public abstract class DrawerActivity extends ToolbarActivity implements DisplayU
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
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.authentication.AccountUtils;
import com.owncloud.android.authentication.AuthenticatorActivity;
import com.owncloud.android.datamodel.ArbitraryDataProvider;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.services.FileDownloader;
import com.owncloud.android.files.services.FileDownloader.FileDownloaderBinder;
@ -448,7 +447,7 @@ public abstract class FileActivity extends DrawerActivity
operation, getResources()), Toast.LENGTH_LONG);
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.PreviewVideoActivity;
import com.owncloud.android.utils.DataHolderUtil;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.ErrorMessageAdapter;
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.PermissionUtil;
@ -1650,7 +1649,7 @@ public class FileDisplayActivity extends HookActivity
showDetails(file);
}
}
invalidateOptionsMenu();
supportInvalidateOptionsMenu();
}
}
@ -1681,7 +1680,7 @@ public class FileDisplayActivity extends HookActivity
if (getStorageManager().getFileById(removedFile.getParentId()).equals(getCurrentDir())) {
refreshListOfFilesFragment(false);
}
invalidateOptionsMenu();
supportInvalidateOptionsMenu();
} else {
if (result.isSslRecoverableException()) {
mLastSslUntrustedServerResult = result;
@ -1799,7 +1798,7 @@ public class FileDisplayActivity extends HookActivity
if (result.isSuccess() && operation.transferWasRequested()) {
OCFile syncedFile = operation.getLocalFile();
onTransferStateChanged(syncedFile, true, true);
invalidateOptionsMenu();
supportInvalidateOptionsMenu();
refreshShowDetails();
}
}

View file

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

View file

@ -1,4 +1,4 @@
/**
/*
* ownCloud Android client application
*
* @author Bartek Przybylski
@ -24,6 +24,7 @@ package com.owncloud.android.ui.dialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
@ -38,7 +39,7 @@ import com.owncloud.android.R;
*/
public class ConflictsResolveDialog extends DialogFragment {
public static enum Decision {
public enum Decision {
CANCEL,
KEEP_BOTH,
OVERWRITE,
@ -47,34 +48,31 @@ public class ConflictsResolveDialog extends DialogFragment {
OnConflictDecisionMadeListener mListener;
public static ConflictsResolveDialog newInstance(String path, OnConflictDecisionMadeListener listener) {
public static ConflictsResolveDialog newInstance(OnConflictDecisionMadeListener listener) {
ConflictsResolveDialog f = new ConflictsResolveDialog();
Bundle args = new Bundle();
args.putString("remotepath", path);
f.setArguments(args);
f.mListener = listener;
return f;
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
String remotepath = getArguments().getString("remotepath");
return new AlertDialog.Builder(getActivity(), R.style.Theme_ownCloud_Dialog)
.setIcon(R.drawable.ic_warning)
.setTitle(R.string.conflict_title)
.setMessage(String.format(getString(R.string.conflict_message), remotepath))
.setPositiveButton(R.string.conflict_use_local_version,
new DialogInterface.OnClickListener() {
.setIcon(R.drawable.ic_warning)
.setTitle(R.string.conflict_title)
.setMessage(getString(R.string.conflict_message))
.setPositiveButton(R.string.conflict_use_local_version,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (mListener != null) {
mListener.conflictDecisionMade(Decision.OVERWRITE);
}
}
})
.setNeutralButton(R.string.conflict_keep_both,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (mListener != null) {
mListener.conflictDecisionMade(Decision.OVERWRITE);
}
}
})
.setNeutralButton(R.string.conflict_keep_both,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (mListener != null) {
@ -82,16 +80,16 @@ public class ConflictsResolveDialog extends DialogFragment {
}
}
})
.setNegativeButton(R.string.conflict_use_server_version,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (mListener != null) {
mListener.conflictDecisionMade(Decision.SERVER);
.setNegativeButton(R.string.conflict_use_server_version,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (mListener != null) {
mListener.conflictDecisionMade(Decision.SERVER);
}
}
})
.create();
}
})
.create();
}
public void showDialog(AppCompatActivity activity) {
@ -120,6 +118,6 @@ public class ConflictsResolveDialog extends DialogFragment {
}
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,
RemoteOperationResult result) {
if (result.isSuccess()) {
invalidateOptionsMenu();
supportInvalidateOptionsMenu();
}
}