diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-03-25 17:02:10 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-03-25 17:02:10 +0300 |
commit | 4268054637aa236109f492c8ef32d8dd17194298 (patch) | |
tree | 30d8eefb005dcb76db57029e6dfa84ec65322dd7 /app/src/main/java/it/niedermann/nextcloud/deck/ui/widget | |
parent | ab2330fc9a7f7dd1cffa2640adab652cd20964ca (diff) |
Move all pure view into one package
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/widget')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/SquareRelativeLayout.java | 34 | ||||
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/ToggleAutoCompleteTextView.java | 66 |
2 files changed, 0 insertions, 100 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/SquareRelativeLayout.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/SquareRelativeLayout.java deleted file mode 100644 index 86a48d6d2..000000000 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/SquareRelativeLayout.java +++ /dev/null @@ -1,34 +0,0 @@ -package it.niedermann.nextcloud.deck.ui.widget; - -import android.annotation.TargetApi; -import android.content.Context; -import android.os.Build; -import android.util.AttributeSet; -import android.widget.RelativeLayout; - -public class SquareRelativeLayout extends RelativeLayout { - - public SquareRelativeLayout(Context context) { - super(context); - } - - public SquareRelativeLayout(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public SquareRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - } - - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public SquareRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - // Set a square layout. - super.onMeasure(widthMeasureSpec, widthMeasureSpec); - } - -}
\ No newline at end of file diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/ToggleAutoCompleteTextView.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/ToggleAutoCompleteTextView.java deleted file mode 100644 index 8c4334251..000000000 --- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/widget/ToggleAutoCompleteTextView.java +++ /dev/null @@ -1,66 +0,0 @@ -package it.niedermann.nextcloud.deck.ui.widget; - -import android.content.Context; -import android.graphics.Rect; -import android.os.Build; -import android.util.AttributeSet; -import android.widget.AdapterView; - -import androidx.annotation.RequiresApi; -import androidx.appcompat.widget.AppCompatAutoCompleteTextView; - -/** - * This AutoCompleteTextView implementation closes the dropdown on each second click - */ -public class ToggleAutoCompleteTextView extends AppCompatAutoCompleteTextView { - - private boolean hideOnNextClick = false; - - public ToggleAutoCompleteTextView(Context context, AttributeSet attrs) { - super(context, attrs); - setOnClickListener((v) -> { - if (hideOnNextClick) { - dismissDropDown(); - } else { - performFiltering(getText(), 0); - showDropDown(); - } - hideOnNextClick = !hideOnNextClick; - }); - } - - @Override - public void setOnItemClickListener(AdapterView.OnItemClickListener l) { - super.setOnItemClickListener((parent, view, position, id) -> { - l.onItemClick(parent, view, position, id); - hideOnNextClick = false; - }); - } - - @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1) - @Override - public void setOnDismissListener(OnDismissListener dismissListener) { - super.setOnDismissListener(() -> { - dismissListener.onDismiss(); - hideOnNextClick = true; - }); - } - - @Override - public boolean enoughToFilter() { - return true; - } - - @Override - protected void onFocusChanged(boolean focused, int direction, - Rect previouslyFocusedRect) { - super.onFocusChanged(focused, direction, previouslyFocusedRect); - if (focused && getAdapter() != null) { - hideOnNextClick = true; - performFiltering(getText(), 0); - showDropDown(); - } else { - hideOnNextClick = false; - } - } -} |