Skip to content

Commit

Permalink
Include switch to allow or disallow touch filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
davigonz committed Feb 1, 2019
1 parent 216d5a8 commit bb2c288
Show file tree
Hide file tree
Showing 91 changed files with 719 additions and 413 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;
import android.widget.Toast;
Expand Down Expand Up @@ -113,6 +114,7 @@
import com.owncloud.android.ui.dialog.SslUntrustedCertDialog.OnSslUntrustedCertListener;
import com.owncloud.android.ui.errorhandling.ErrorMessageAdapter;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.PreferenceUtils;

import java.security.cert.X509Certificate;
import java.util.ArrayList;
Expand Down Expand Up @@ -305,9 +307,15 @@ protected void onCreate(Bundle savedInstanceState) {
/// load user interface
setContentView(R.layout.account_setup);

// Allow or disallow touches with other visible windows
FrameLayout loginLayout = findViewById(R.id.login_layout);
loginLayout.setFilterTouchesWhenObscured(
PreferenceUtils.shouldAllowTouchesWithOtherVisibleWindows(this)
);

// Set login background color or image
if (!getResources().getBoolean(R.bool.use_login_background_image)) {
findViewById(R.id.login_layout).setBackgroundColor(
loginLayout.setBackgroundColor(
getResources().getColor(R.color.login_background_color)
);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,51 +40,58 @@
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;

import java.util.Formatter;
import java.util.Locale;

import com.owncloud.android.R;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.PreferenceUtils;

import java.util.Formatter;
import java.util.Locale;


/**
* View containing controls for a {@link MediaPlayer}.
*
*
* Holds buttons "play / pause", "rewind", "fast forward"
* and a progress slider.
*
*
* It synchronizes itself with the state of the
* {@link MediaPlayer}.
*/

public class MediaControlView extends FrameLayout implements OnClickListener, OnSeekBarChangeListener {

private MediaPlayerControl mPlayer;
private Context mContext;
private View mRoot;
private ProgressBar mProgress;
private TextView mEndTime, mCurrentTime;
private boolean mDragging;
private static final int SHOW_PROGRESS = 1;
StringBuilder mFormatBuilder;
Formatter mFormatter;
private ImageButton mPauseButton;
private ImageButton mFfwdButton;
private ImageButton mRewButton;
private MediaPlayerControl mPlayer;
private Context mContext;
private View mRoot;
private ProgressBar mProgress;
private TextView mEndTime, mCurrentTime;
private boolean mDragging;
private static final int SHOW_PROGRESS = 1;
StringBuilder mFormatBuilder;
Formatter mFormatter;
private ImageButton mPauseButton;
private ImageButton mFfwdButton;
private ImageButton mRewButton;

public MediaControlView(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;

FrameLayout.LayoutParams frameParams = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
);
LayoutInflater inflate = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mRoot = inflate.inflate(R.layout.media_control, null);

// Allow or disallow touches with other visible windows
mRoot.setFilterTouchesWhenObscured(
PreferenceUtils.shouldAllowTouchesWithOtherVisibleWindows(context)
);

initControllerView(mRoot);
addView(mRoot, frameParams);

setFocusable(true);
setFocusableInTouchMode(true);
setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import com.owncloud.android.lib.common.OwnCloudAccount;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.PreferenceUtils;

/**
* Base class to handle setup of the drawer implementation including user switching and avatar fetching and fallback
Expand Down Expand Up @@ -105,8 +106,19 @@ protected void setupDrawer(int menuItemId) {
*/
protected void setupDrawer() {
mDrawerLayout = findViewById(R.id.drawer_layout);

// Allow or disallow touches with other visible windows
mDrawerLayout.setFilterTouchesWhenObscured(
PreferenceUtils.shouldAllowTouchesWithOtherVisibleWindows(this)
);

mNavigationView = findViewById(R.id.nav_view);

// Allow or disallow touches with other visible windows
mNavigationView.setFilterTouchesWhenObscured(
PreferenceUtils.shouldAllowTouchesWithOtherVisibleWindows(this)
);

if (mNavigationView != null) {
mDrawerLogo = findViewById(R.id.drawer_logo);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
Expand All @@ -48,26 +49,28 @@
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.lib.common.utils.Log_OC;

import com.owncloud.android.ui.dialog.LoadingDialog;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.PreferenceUtils;

import java.io.File;
import java.util.ArrayList;


/**
* Activity reporting errors occurred when local files uploaded to an ownCloud account with an app
* in version under 1.3.16 where being copied to the ownCloud local folder.
*
*
* Allows the user move the files to the ownCloud local folder. let them unlinked to the remote
* files.
*
*
* Shown when the error notification summarizing the list of errors is clicked by the user.
*/
public class ErrorsWhileCopyingHandlerActivity extends AppCompatActivity
public class ErrorsWhileCopyingHandlerActivity extends AppCompatActivity
implements OnClickListener {

private static final String TAG = ErrorsWhileCopyingHandlerActivity.class.getSimpleName();

public static final String EXTRA_ACCOUNT =
ErrorsWhileCopyingHandlerActivity.class.getCanonicalName() + ".KEY_ACCOUNT";
public static final String EXTRA_LOCAL_PATHS =
Expand Down Expand Up @@ -114,7 +117,13 @@ protected void onCreate(Bundle savedInstanceState) {
appName, appName, appName, appName, mAccount.name);
textView.setText(message);
textView.setMovementMethod(new ScrollingMovementMethod());


// Allow or disallow touches with other visible windows
LinearLayout alertDialogListViewLayout = findViewById(R.id.alertDialogListViewLayout);
alertDialogListViewLayout.setFilterTouchesWhenObscured(
PreferenceUtils.shouldAllowTouchesWithOtherVisibleWindows(this)
);

/// load the list of local and remote files that failed
ListView listView = findViewById(R.id.list);
if (mLocalPaths != null && mLocalPaths.size() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
import com.owncloud.android.utils.Extras;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.PermissionUtil;
import com.owncloud.android.utils.PreferenceUtils;

import java.io.File;
import java.util.ArrayList;
Expand Down Expand Up @@ -526,10 +527,12 @@ public boolean onPrepareOptionsMenu(Menu menu) {
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();

// Prevent tapjacking
// Allow or disallow touches with other visible windows
View actionBarView = findViewById(R.id.action_bar);
if (actionBarView != null) {
actionBarView.setFilterTouchesWhenObscured(true);
actionBarView.setFilterTouchesWhenObscured(
PreferenceUtils.shouldAllowTouchesWithOtherVisibleWindows(getApplicationContext())
);
}

inflater.inflate(R.menu.main_menu, menu);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* ownCloud Android client application
*
* @author Shashvat Kedia
* Copyright (C) 2018 ownCloud GmbH.
* @author David González Verdugo
* Copyright (C) 2019 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -40,6 +41,7 @@
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;

import com.owncloud.android.R;
import com.owncloud.android.datamodel.OCFile;
Expand All @@ -52,10 +54,10 @@
import com.owncloud.android.operations.common.SyncOperation;
import com.owncloud.android.syncadapter.FileSyncAdapter;
import com.owncloud.android.ui.dialog.CreateFolderDialogFragment;
import com.owncloud.android.ui.errorhandling.ErrorMessageAdapter;
import com.owncloud.android.ui.fragment.FileFragment;
import com.owncloud.android.ui.fragment.OCFileListFragment;
import com.owncloud.android.ui.errorhandling.ErrorMessageAdapter;
import com.owncloud.android.utils.FileStorageUtils;
import com.owncloud.android.utils.PreferenceUtils;

import java.util.ArrayList;

Expand Down Expand Up @@ -85,6 +87,12 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.files_folder_picker); // beware - inflated in other activities too

// Allow or disallow touches with other visible windows
LinearLayout filesFolderPickerLayout = findViewById(R.id.filesFolderPickerLayout);
filesFolderPickerLayout.setFilterTouchesWhenObscured(
PreferenceUtils.shouldAllowTouchesWithOtherVisibleWindows(this)
);

if (savedInstanceState == null) {
createFragments();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,56 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

import com.owncloud.android.R;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.PreferenceUtils;

import java.util.ArrayList;


/**
* Activity showing a text message and, optionally, a couple list of single or paired text strings.
*
*
* Added to show explanations for notifications when the user clicks on them, and there no place
* better to show them.
*/
public class GenericExplanationActivity extends AppCompatActivity {
public class GenericExplanationActivity extends AppCompatActivity {

public static final String EXTRA_LIST = GenericExplanationActivity.class.getCanonicalName() +
".EXTRA_LIST";
public static final String EXTRA_LIST_2 = GenericExplanationActivity.class.getCanonicalName() +
".EXTRA_LIST_2";
public static final String MESSAGE = GenericExplanationActivity.class.getCanonicalName() +
".MESSAGE";


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Intent intent = getIntent();
String message = intent.getStringExtra(MESSAGE);
String message = intent.getStringExtra(MESSAGE);
ArrayList<String> list = intent.getStringArrayListExtra(EXTRA_LIST);
ArrayList<String> list2 = intent.getStringArrayListExtra(EXTRA_LIST_2);

setContentView(R.layout.generic_explanation);

if (message != null) {
TextView textView = findViewById(R.id.message);
textView.setText(message);
textView.setMovementMethod(new ScrollingMovementMethod());
}


// Allow or disallow touches with other visible windows
LinearLayout alertDialogListViewLayout = findViewById(R.id.alertDialogListViewLayout);
alertDialogListViewLayout.setFilterTouchesWhenObscured(
PreferenceUtils.shouldAllowTouchesWithOtherVisibleWindows(this)
);

ListView listView = findViewById(R.id.list);
if (list != null && list.size() > 0) {
//ListAdapter adapter = new ArrayAdapter<String>(this,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*
* @author David A. Velasco
* @author Christian Schabesberger
* Copyright (C) 2018 ownCloud GmbH.
* @author David González Verdugo
* Copyright (C) 2019 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand Down Expand Up @@ -33,10 +34,12 @@
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.LinearLayout;

import com.owncloud.android.R;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.fragment.LocalFileListFragment;
import com.owncloud.android.utils.PreferenceUtils;

import java.io.File;

Expand Down Expand Up @@ -99,6 +102,13 @@ public void onCreate(Bundle savedInstanceState) {

// inflate and set the layout view
setContentView(R.layout.files_folder_picker); // beware - inflated in other activities too

// Allow or disallow touches with other visible windows
LinearLayout filesFolderPickerLayout = findViewById(R.id.filesFolderPickerLayout);
filesFolderPickerLayout.setFilterTouchesWhenObscured(
PreferenceUtils.shouldAllowTouchesWithOtherVisibleWindows(this)
);

if (savedInstanceState == null) {
createFragments();
}
Expand Down
Loading

0 comments on commit bb2c288

Please sign in to comment.