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

Update dependencies #297

Merged
merged 7 commits into from
Jan 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ android {
targetCompatibility = java_version
}

applicationVariants.all {
it.generateBuildConfigProvider.configure {
it.enabled = false
}
buildFeatures {
buildConfig = false
}

lintOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,10 @@

package com.evrencoskun.tableviewsample;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction().add(R.id.activity_container, new
MainFragment(), MainFragment.class.getSimpleName()).commit();
}
public MainActivity() {
super(R.layout.activity_main);
}
}
80 changes: 41 additions & 39 deletions app/src/main/java/com/evrencoskun/tableviewsample/MainFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageButton;
Expand All @@ -49,38 +47,36 @@ public class MainFragment extends Fragment {
private ImageButton previousButton, nextButton;
private TextView tablePaginationDetails;
private TableView mTableView;
@Nullable
private Filter mTableFilter; // This is used for filtering the table.
@Nullable
private Pagination mPagination; // This is used for paginating the table.

private boolean mPaginationEnabled = false;

public MainFragment() {
// Required empty public constructor
super(R.layout.fragment_main);
}

@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle
savedInstanceState) {
View layout = inflater.inflate(R.layout.fragment_main, container, false);

EditText searchField = layout.findViewById(R.id.query_string);
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
EditText searchField = view.findViewById(R.id.query_string);
searchField.addTextChangedListener(mSearchTextWatcher);

moodFilter = layout.findViewById(R.id.mood_spinner);
moodFilter = view.findViewById(R.id.mood_spinner);
moodFilter.setOnItemSelectedListener(mItemSelectionListener);

genderFilter = layout.findViewById(R.id.gender_spinner);
genderFilter = view.findViewById(R.id.gender_spinner);
genderFilter.setOnItemSelectedListener(mItemSelectionListener);

Spinner itemsPerPage = layout.findViewById(R.id.items_per_page_spinner);
Spinner itemsPerPage = view.findViewById(R.id.items_per_page_spinner);

View tableTestContainer = layout.findViewById(R.id.table_test_container);
View tableTestContainer = view.findViewById(R.id.table_test_container);

previousButton = layout.findViewById(R.id.previous_button);
nextButton = layout.findViewById(R.id.next_button);
EditText pageNumberField = layout.findViewById(R.id.page_number_text);
tablePaginationDetails = layout.findViewById(R.id.table_details);
previousButton = view.findViewById(R.id.previous_button);
nextButton = view.findViewById(R.id.next_button);
EditText pageNumberField = view.findViewById(R.id.page_number_text);
tablePaginationDetails = view.findViewById(R.id.table_details);

if (mPaginationEnabled) {
tableTestContainer.setVisibility(View.VISIBLE);
Expand All @@ -94,7 +90,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
}

// Let's get TableView
mTableView = layout.findViewById(R.id.tableview);
mTableView = view.findViewById(R.id.tableview);

initializeTableView();

Expand All @@ -109,9 +105,6 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
// pagination actions. See onTableViewPageTurnedListener variable declaration below.
mPagination.setOnTableViewPageTurnedListener(onTableViewPageTurnedListener);
}


return layout;
}

private void initializeTableView() {
Expand Down Expand Up @@ -149,43 +142,57 @@ private void initializeTableView() {

public void filterTable(@NonNull String filter) {
// Sets a filter to the table, this will filter ALL the columns.
mTableFilter.set(filter);
if (mTableFilter != null) {
mTableFilter.set(filter);
}
}

public void filterTableForMood(@NonNull String filter) {
// Sets a filter to the table, this will only filter a specific column.
// In the example data, this will filter the mood column.
mTableFilter.set(TableViewModel.MOOD_COLUMN_INDEX, filter);
if (mTableFilter != null) {
mTableFilter.set(TableViewModel.MOOD_COLUMN_INDEX, filter);
}
}

public void filterTableForGender(@NonNull String filter) {
// Sets a filter to the table, this will only filter a specific column.
// In the example data, this will filter the gender column.
mTableFilter.set(TableViewModel.GENDER_COLUMN_INDEX, filter);
if (mTableFilter != null) {
mTableFilter.set(TableViewModel.GENDER_COLUMN_INDEX, filter);
}
}

// The following four methods below: nextTablePage(), previousTablePage(),
// goToTablePage(int page) and setTableItemsPerPage(int itemsPerPage)
// are for controlling the TableView pagination.
public void nextTablePage() {
mPagination.nextPage();
if (mPagination != null) {
mPagination.nextPage();
}
}

public void previousTablePage() {
mPagination.previousPage();
if (mPagination != null) {
mPagination.previousPage();
}
}

public void goToTablePage(int page) {
mPagination.goToPage(page);
if (mPagination != null) {
mPagination.goToPage(page);
}
}

public void setTableItemsPerPage(int itemsPerPage) {
mPagination.setItemsPerPage(itemsPerPage);
if (mPagination != null) {
mPagination.setItemsPerPage(itemsPerPage);
}
}

// Handler for the changing of pages in the paginated TableView.
@NonNull
private Pagination.OnTableViewPageTurnedListener onTableViewPageTurnedListener = new
private final Pagination.OnTableViewPageTurnedListener onTableViewPageTurnedListener = new
Pagination.OnTableViewPageTurnedListener() {
@Override
public void onPageTurned(int numItems, int itemsStart, int itemsEnd) {
Expand Down Expand Up @@ -214,7 +221,7 @@ public void onPageTurned(int numItems, int itemsStart, int itemsEnd) {
};

@NonNull
private AdapterView.OnItemSelectedListener mItemSelectionListener = new AdapterView
private final AdapterView.OnItemSelectedListener mItemSelectionListener = new AdapterView
.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Expand All @@ -238,10 +245,9 @@ public void onNothingSelected(AdapterView<?> parent) {
};

@NonNull
private TextWatcher mSearchTextWatcher = new TextWatcher() {
private final TextWatcher mSearchTextWatcher = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

}

@Override
Expand All @@ -251,12 +257,11 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {

@Override
public void afterTextChanged(Editable s) {

}
};

@NonNull
private AdapterView.OnItemSelectedListener onItemsPerPageSelectedListener = new AdapterView
private final AdapterView.OnItemSelectedListener onItemsPerPageSelectedListener = new AdapterView
.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
Expand All @@ -272,12 +277,11 @@ public void onItemSelected(AdapterView<?> parent, View view, int position, long

@Override
public void onNothingSelected(AdapterView<?> parent) {

}
};

@NonNull
private View.OnClickListener mClickListener = new View.OnClickListener() {
private final View.OnClickListener mClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (v == previousButton) {
Expand All @@ -289,10 +293,9 @@ public void onClick(View v) {
};

@NonNull
private TextWatcher onPageTextChanged = new TextWatcher() {
private final TextWatcher onPageTextChanged = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {

}

@Override
Expand All @@ -309,7 +312,6 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {

@Override
public void afterTextChanged(Editable s) {

}
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class TableViewAdapter extends AbstractTableAdapter<ColumnHeader, RowHead
private static final String LOG_TAG = TableViewAdapter.class.getSimpleName();

@NonNull
private TableViewModel mTableViewModel;
private final TableViewModel mTableViewModel;

public TableViewAdapter(@NonNull TableViewModel tableViewModel) {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

public class TableViewListener implements ITableViewListener {
@NonNull
private Context mContext;
private final Context mContext;
@NonNull
private TableView mTableView;
private final TableView mTableView;

public TableViewListener(@NonNull TableView tableView) {
this.mContext = tableView.getContext();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void setColumnHeader(@Nullable ColumnHeader columnHeader) {
}

@NonNull
private View.OnClickListener mSortButtonClickListener = new View.OnClickListener() {
private final View.OnClickListener mSortButtonClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
if (getSortState() == SortState.ASCENDING) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@

public class Cell implements ISortableModel, IFilterableModel {
@NonNull
private String mId;
private final String mId;
@Nullable
private Object mData;
private final Object mData;
@NonNull
private String mFilterKeyword;
private final String mFilterKeyword;

public Cell(@NonNull String id, @Nullable Object data) {
this.mId = id;
Expand Down Expand Up @@ -66,10 +66,6 @@ public Object getData() {
return mData;
}

public void setData(@Nullable Object data) {
mData = data;
}

@NonNull
@Override
public String getFilterableKeyword() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public class ColumnHeaderLongPressPopup extends PopupMenu implements PopupMenu
private static final int SCROLL_ROW = 5;

@NonNull
private TableView mTableView;
private int mXPosition;
private final TableView mTableView;
private final int mXPosition;

public ColumnHeaderLongPressPopup(@NonNull ColumnHeaderViewHolder viewHolder, @NonNull TableView tableView) {
super(viewHolder.itemView.getContext(), viewHolder.itemView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class RowHeaderLongPressPopup extends PopupMenu implements PopupMenu
private static final int REMOVE_ROW = 3;

@NonNull
private TableView mTableView;
private int mRowPosition;
private final TableView mTableView;
private final int mRowPosition;

public RowHeaderLongPressPopup(@NonNull RecyclerView.ViewHolder viewHolder, @NonNull TableView tableView) {
super(viewHolder.itemView.getContext(), viewHolder.itemView);
Expand Down
10 changes: 6 additions & 4 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/activity_container"
xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.fragment.app.FragmentContainerView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fragment_main"
android:name="com.evrencoskun.tableviewsample.MainFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
tools:layout="@layout/fragment_main" />

12 changes: 5 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.android_gradle_plugin_version = '4.1.1'
ext.androidx_annotation_version = '1.1.0'
ext.androidx_appcompat_version = '1.1.0'
ext.androidx_core_version = '1.1.0'
ext.androidx_fragment_version = '1.1.0'
ext.androidx_appcompat_version = '1.2.0'
ext.androidx_core_version = '1.3.2'
ext.androidx_fragment_version = '1.2.5'
ext.androidx_recyclerview_version = '1.1.0'
ext.compile_sdk_version = 29
ext.java_version = '1.8'
Expand All @@ -34,10 +35,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This plugin didn't seem to be used, so I removed it

classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This plugin didn't seem to be used, and is no longer maintained so I removed it

classpath 'com.novoda:bintray-release:0.9.1'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This plugin is not yet compatible with Gradle 6+

classpath "com.android.tools.build:gradle:$android_gradle_plugin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ org.gradle.jvmargs=-Xmx1536m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true

android.useAndroidX=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
#
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading