Skip to content
This repository has been archived by the owner on Apr 9, 2021. It is now read-only.

Commit

Permalink
Migrate to android jetpack (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
udhay24 authored and shobhitagarwal1612 committed Apr 1, 2019
1 parent 7287929 commit d1ff99e
Show file tree
Hide file tree
Showing 54 changed files with 189 additions and 153 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ local.properties
*.*~

# gradle env props
gradle.properties
secrets.properties

# built application files
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ task clean(type: Delete) {
}

ext {
supportLibraryVersion = '27.1.1'
butterknifeVersion = '8.8.1'
daggerVersion = '2.19'
supportLibraryVersion = '1.0.2'
butterknifeVersion = '10.1.0'
daggerVersion = '2.20'
}
13 changes: 13 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# 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
android.useAndroidX=true
android.enableJetifier=true
Binary file added skunkworks-crow.zip
Binary file not shown.
16 changes: 8 additions & 8 deletions skunkworks_crow/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ apply plugin: 'com.android.application'
apply from: '../config/quality.gradle'

android {
compileSdkVersion 27
compileSdkVersion 28
defaultConfig {
applicationId "org.odk.share"
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
Expand All @@ -25,12 +25,12 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:appcompat-v7:${rootProject.supportLibraryVersion}"
implementation "com.android.support:design:${rootProject.supportLibraryVersion}"
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "com.google.android.material:material:1.1.0-alpha04"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'

// butterknife
implementation "com.jakewharton:butterknife:${rootProject.butterknifeVersion}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.odk.share;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import static org.junit.Assert.assertEquals;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import android.database.Cursor;
import android.net.Uri;
import android.provider.BaseColumns;
import android.support.v4.content.CursorLoader;
import androidx.loader.content.CursorLoader;

import org.odk.collect.android.dto.Form;
import org.odk.collect.android.provider.FormsProviderAPI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.support.v4.content.CursorLoader;
import androidx.loader.content.CursorLoader;

import org.odk.collect.android.dto.Instance;
import org.odk.collect.android.provider.InstanceProviderAPI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;

import android.view.View;

import org.odk.share.R;
import org.odk.share.adapters.AboutAdapter;
import org.odk.share.listeners.OnItemClickListener;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;

Expand Down Expand Up @@ -40,7 +41,7 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);

LinearLayoutManager llm = new LinearLayoutManager(this);
llm.setOrientation(LinearLayoutManager.VERTICAL);
llm.setOrientation(RecyclerView.VERTICAL);
recyclerView.setLayoutManager(llm);
int[][] listItems = {{R.string.open_source_licenses, R.drawable.ic_stars}};
adapter = new AboutAdapter(this, listItems, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,24 @@
import android.content.DialogInterface;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.design.widget.BottomSheetDialog;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.MenuItemCompat;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;

import androidx.appcompat.widget.SearchView;
import androidx.core.content.ContextCompat;
import androidx.core.view.MenuItemCompat;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.google.android.material.bottomsheet.BottomSheetDialog;

import org.odk.share.R;
import org.odk.share.adapters.SortDialogAdapter;

import java.util.LinkedHashSet;

import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import timber.log.Timber;

import static org.odk.share.utilities.ApplicationConstants.SortingOrder.BY_NAME_ASC;
Expand Down Expand Up @@ -102,7 +104,7 @@ public boolean onCreateOptionsMenu(final Menu menu) {
searchView.setQueryHint(getResources().getString(R.string.search));
searchView.setMaxWidth(Integer.MAX_VALUE);
SearchView.SearchAutoComplete searchAutoComplete =
(SearchView.SearchAutoComplete) searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text);
(SearchView.SearchAutoComplete) searchView.findViewById(androidx.appcompat.R.id.search_src_text);
searchAutoComplete.setCursorVisible(true);
searchAutoComplete.setHintTextColor(ContextCompat.getColor(this, android.R.color.white));
searchAutoComplete.setTextColor(ContextCompat.getColor(this, android.R.color.white));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
package org.odk.share.activities;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;

import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.google.android.material.tabs.TabLayout;

import org.odk.share.R;
import org.odk.share.adapters.ViewPagerAdapter;
import org.odk.share.fragments.ReceivedInstancesFragment;
import org.odk.share.fragments.ReviewedInstancesFragment;
import org.odk.share.fragments.SentInstancesFragment;
import org.odk.share.fragments.StatisticsFragment;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;

import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
Expand All @@ -24,6 +21,10 @@

import javax.inject.Inject;

import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
Expand All @@ -32,8 +33,10 @@

public class InstancesList extends InstanceListActivity implements LoaderManager.LoaderCallbacks<Cursor> {

@BindView(R.id.recyclerview) RecyclerView recyclerView;
@BindView(R.id.toolbar) Toolbar toolbar;
@BindView(R.id.recyclerview)
RecyclerView recyclerView;
@BindView(R.id.toolbar)
Toolbar toolbar;
@BindView(R.id.send_button) Button sendButton;
@BindView(R.id.toggle_button) Button toggleButton;

Expand All @@ -59,7 +62,7 @@ protected void onCreate(Bundle savedInstanceState) {

selectedInstances = new LinkedHashSet<>();
LinearLayoutManager llm = new LinearLayoutManager(this);
llm.setOrientation(LinearLayoutManager.VERTICAL);
llm.setOrientation(RecyclerView.VERTICAL);
recyclerView.setLayoutManager(llm);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
Expand All @@ -35,6 +27,14 @@

import javax.inject.Inject;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.loader.app.LoaderManager;
import androidx.loader.content.Loader;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.provider.Settings;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.Toolbar;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
Expand All @@ -38,6 +34,10 @@

import javax.inject.Inject;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import butterknife.BindView;
import butterknife.ButterKnife;
import io.reactivex.disposables.CompositeDisposable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package org.odk.share.activities;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.Toolbar;

import com.google.android.material.tabs.TabLayout;

import org.odk.share.R;
import org.odk.share.adapters.ViewPagerAdapter;
import org.odk.share.fragments.BlankFormsFragment;
import org.odk.share.fragments.FilledFormsFragment;

import androidx.appcompat.widget.Toolbar;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
Expand All @@ -27,6 +25,9 @@

import org.odk.share.R;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;

public class WebViewActivity extends AppCompatActivity {

public static final String OPEN_URL = "url";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
import android.net.wifi.WifiInfo;
import android.net.wifi.WifiManager;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.text.InputType;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -50,6 +45,11 @@

import javax.inject.Inject;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package org.odk.share.adapters;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand All @@ -12,6 +10,8 @@
import org.odk.share.R;
import org.odk.share.listeners.OnItemClickListener;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;

Expand Down
Loading

0 comments on commit d1ff99e

Please sign in to comment.