Tighten access restrictions

pull/996/head
Alex Baker 5 years ago
parent aed4614eb1
commit 688baad5a6

@ -202,7 +202,7 @@ public class TranslationTests {
/** the original string */
final String string;
public FormatStringData(String string) {
FormatStringData(String string) {
this.string = string;
int pos = -1;

@ -18,13 +18,13 @@ import org.tasks.injection.ForApplication;
import org.tasks.preferences.Preferences;
import timber.log.Timber;
public class BuildSetup {
class BuildSetup {
private final Context context;
private final Preferences preferences;
@Inject
public BuildSetup(@ForApplication Context context, Preferences preferences) {
BuildSetup(@ForApplication Context context, Preferences preferences) {
this.context = context;
this.preferences = preferences;
}

@ -21,7 +21,7 @@ import java.util.List;
import java.util.Map;
import timber.log.Timber;
public class FlipperHttpInterceptor<T> implements HttpExecuteInterceptor, HttpResponseInterceptor {
class FlipperHttpInterceptor<T> implements HttpExecuteInterceptor, HttpResponseInterceptor {
private final Class<T> responseClass;
private final String requestId = UUIDHelper.newUUID();
@ -43,7 +43,7 @@ public class FlipperHttpInterceptor<T> implements HttpExecuteInterceptor, HttpRe
plugin.reportResponse(toResponseInfo(response, now()));
}
public void report(HttpResponse response, long start, long end) throws IOException {
void report(HttpResponse response, long start, long end) throws IOException {
plugin.reportRequest(toRequestInfo(response.getRequest(), start));
plugin.reportResponse(toResponseInfo(response, end));
}

@ -33,7 +33,7 @@ import java.security.spec.X509EncodedKeySpec;
* Security-related methods. For a secure implementation, all of this code should be implemented on
* a server that communicates with the application on the device.
*/
public class Security {
class Security {
private static final String TAG = "IABUtil/Security";
private static final String KEY_FACTORY_ALGORITHM = "RSA";
@ -47,7 +47,7 @@ public class Security {
* @param signature the signature for the data, signed with the private key
* @throws IOException if encoding algorithm is not supported or key specification is invalid
*/
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature)
static boolean verifyPurchase(String base64PublicKey, String signedData, String signature)
throws IOException {
if (TextUtils.isEmpty(signedData)
|| TextUtils.isEmpty(base64PublicKey)
@ -66,7 +66,7 @@ public class Security {
* @param encodedPublicKey Base64-encoded public key
* @throws IOException if encoding algorithm is not supported or key specification is invalid
*/
public static PublicKey generatePublicKey(String encodedPublicKey) throws IOException {
private static PublicKey generatePublicKey(String encodedPublicKey) throws IOException {
try {
byte[] decodedKey = Base64.decode(encodedPublicKey, Base64.DEFAULT);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
@ -90,7 +90,7 @@ public class Security {
* @param signature server signature
* @return true if the data and signature match
*/
public static boolean verify(PublicKey publicKey, String signedData, String signature) {
private static boolean verify(PublicKey publicKey, String signedData, String signature) {
byte[] signatureBytes;
try {
signatureBytes = Base64.decode(signature, Base64.DEFAULT);

@ -7,16 +7,16 @@ import org.tasks.R;
import org.tasks.injection.ForApplication;
import timber.log.Timber;
public class SignatureVerifier {
class SignatureVerifier {
private final String billingKey;
@Inject
public SignatureVerifier(@ForApplication Context context) {
SignatureVerifier(@ForApplication Context context) {
billingKey = context.getString(R.string.gp_key);
}
public boolean verifySignature(Purchase purchase) {
boolean verifySignature(Purchase purchase) {
try {
return Security.verifyPurchase(
billingKey, purchase.getOriginalJson(), purchase.getSignature());

@ -90,7 +90,7 @@ public class PlayServices {
}
}
public String getStatus() {
private String getStatus() {
return GoogleApiAvailability.getInstance().getErrorString(getResult());
}

@ -14,11 +14,11 @@ import org.tasks.location.PlaceSearchProvider;
import org.tasks.preferences.Preferences;
@Module
public class LocationModule {
class LocationModule {
@Provides
@ActivityScope
public PlaceSearchProvider getPlaceSearchProvider(
PlaceSearchProvider getPlaceSearchProvider(
@ForApplication Context context,
Preferences preferences,
PlayServices playServices,
@ -32,7 +32,7 @@ public class LocationModule {
@Provides
@ActivityScope
public MapFragment getMapFragment(@ForApplication Context context, Preferences preferences) {
MapFragment getMapFragment(@ForApplication Context context, Preferences preferences) {
return preferences.useGoogleMaps()
? new GoogleMapFragment(context)
: new MapboxMapFragment(context);

@ -104,7 +104,7 @@ public class MainActivity extends InjectingAppCompatActivity
private Filter filter;
private ActionMode actionMode = null;
TaskListActivityBinding binding;
private TaskListActivityBinding binding;
/** @see android.app.Activity#onCreate(Bundle) */
@Override

@ -144,7 +144,7 @@ public final class TaskListFragment extends InjectingFragment
private static final int SEARCH_DEBOUNCE_TIMEOUT = 300;
private final RefreshReceiver refreshReceiver = new RefreshReceiver();
protected CompositeDisposable disposables;
private CompositeDisposable disposables;
@Inject SyncAdapters syncAdapters;
@Inject TaskDeleter taskDeleter;
@Inject @ForActivity Context context;
@ -536,7 +536,7 @@ public final class TaskListFragment extends InjectingFragment
return makeSnackbar(getString(res, args));
}
public Snackbar makeSnackbar(String text) {
private Snackbar makeSnackbar(String text) {
Snackbar snackbar =
Snackbar.make(coordinatorLayout, text, 8000)
.setTextColor(getColor(context, R.color.snackbar_text_color))

@ -141,7 +141,7 @@ public class FilterAdapter extends BaseAdapter {
return convertView;
}
public ArrayList<FilterListItem> getItems() {
private ArrayList<FilterListItem> getItems() {
assertMainThread();
return newArrayList(items);
}

@ -9,8 +9,8 @@ import org.tasks.tasklist.ViewHolder;
public class GoogleTaskManualSortAdapter extends TaskAdapter {
protected final TaskDao taskDao;
protected final GoogleTaskDao googleTaskDao;
final TaskDao taskDao;
final GoogleTaskDao googleTaskDao;
GoogleTaskManualSortAdapter(TaskDao taskDao, GoogleTaskDao googleTaskDao) {
this.taskDao = taskDao;

@ -19,7 +19,7 @@ import org.tasks.preferences.Preferences;
import org.tasks.preferences.SyncPreferences;
import org.tasks.themes.DrawableUtil;
public class SubheaderViewHolder extends RecyclerView.ViewHolder {
class SubheaderViewHolder extends RecyclerView.ViewHolder {
private final Preferences preferences;
private final GoogleTaskDao googleTaskDao;

@ -28,7 +28,7 @@ public class TaskAdapter {
private final Set<Long> selected = new HashSet<>();
private TaskListRecyclerAdapter helper;
public int getCount() {
int getCount() {
return helper.getItemCount();
}
@ -96,7 +96,7 @@ public class TaskAdapter {
public void moved(int from, int to, int indent) {}
public TaskContainer getTask(int position) {
TaskContainer getTask(int position) {
return helper.getItem(position);
}

@ -69,7 +69,7 @@ public class CustomFilterActivity extends ThemedInjectingAppCompatActivity
@Inject FilterCriteriaProvider filterCriteriaProvider;
@Inject Locale locale;
CustomFilterActivityBinding binding;
private CustomFilterActivityBinding binding;
private ListView listView;
private CustomFilterAdapter adapter;

@ -61,7 +61,7 @@ class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
// --- view event handling
public CustomFilterAdapter(
CustomFilterAdapter(
CustomFilterActivity activity,
DialogBuilder dialogBuilder,
List<CriterionInstance> objects,
@ -73,7 +73,7 @@ class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
inflater = activity.getLayoutInflater();
}
public void onCreateContextMenu(ContextMenu menu, View v) {
void onCreateContextMenu(ContextMenu menu, View v) {
// view holder
ViewHolder viewHolder = (ViewHolder) v.getTag();
if (viewHolder == null || viewHolder.item.type == CriterionInstance.TYPE_UNIVERSE) {
@ -115,7 +115,7 @@ class CustomFilterAdapter extends ArrayAdapter<CriterionInstance> {
}
/** Show options menu for the given criterioninstance */
public void showOptionsFor(final CriterionInstance item, final Runnable onComplete) {
void showOptionsFor(final CriterionInstance item, final Runnable onComplete) {
AlertDialogBuilder dialog = dialogBuilder.newDialog(item.criterion.name);
if (item.criterion instanceof MultipleSelectCriterion) {

@ -5,7 +5,7 @@ import java.io.IOException;
public class HttpNotFoundException extends IOException {
public HttpNotFoundException(HttpResponseException e) {
HttpNotFoundException(HttpResponseException e) {
super(e.getMessage());
}
}

@ -138,7 +138,7 @@ public class ReminderControlSet extends TaskEditControlFragment {
}
}
void addAlarm(String selected) {
private void addAlarm(String selected) {
if (selected.equals(getString(R.string.when_due))) {
addDue();
} else if (selected.equals(getString(R.string.when_overdue))) {

@ -11,6 +11,7 @@ import org.tasks.preferences.Preferences;
import org.tasks.time.DateTime;
import timber.log.Timber;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class AACRecorder extends ViewModel {
private MediaRecorder mediaRecorder;

@ -185,7 +185,7 @@ public abstract class BaseCaldavAccountSettingsActivity extends ThemedInjectingA
return binding.user.getText().toString().trim();
}
protected boolean passwordChanged() {
boolean passwordChanged() {
return caldavAccount == null || !PASSWORD_MASK.equals(binding.password.getText().toString().trim());
}

@ -57,7 +57,7 @@ public class CaldavAccountSettingsActivity extends BaseCaldavAccountSettingsActi
finish();
}
protected void updateAccount(String principal) {
private void updateAccount(String principal) {
hideProgressIndicator();
caldavAccount.setName(getNewName());

@ -6,16 +6,16 @@ import java.util.ArrayList;
import kotlin.Unit;
import kotlin.jvm.functions.Function2;
public class ResponseList extends ArrayList<Response>
class ResponseList extends ArrayList<Response>
implements Function2<Response, HrefRelation, Unit> {
private final HrefRelation filter;
public ResponseList() {
ResponseList() {
this(null);
}
public ResponseList(HrefRelation filter) {
ResponseList(HrefRelation filter) {
this.filter = filter;
}

@ -12,7 +12,7 @@ import org.tasks.injection.ForApplication;
import org.tasks.preferences.PermissionChecker;
import timber.log.Timber;
public class CalendarEventAttendeeProvider {
class CalendarEventAttendeeProvider {
private static final String[] COLUMNS = {
CalendarContract.Attendees.ATTENDEE_NAME, CalendarContract.Attendees.ATTENDEE_EMAIL,

@ -14,7 +14,7 @@ import org.tasks.security.Encryption;
@Entity(tableName = "caldav_accounts")
public class CaldavAccount implements Parcelable {
public static final int TYPE_CALDAV = 0;
private static final int TYPE_CALDAV = 0;
public static final int TYPE_ETESYNC = 1;
public static final Parcelable.Creator<CaldavAccount> CREATOR =
new Parcelable.Creator<CaldavAccount>() {

@ -19,11 +19,11 @@ import org.tasks.preferences.Preferences;
@Entity(tableName = TABLE_NAME, indices = @Index(name = "geo_task", value = "task"))
public class Geofence implements Serializable, Parcelable {
public static final String TABLE_NAME = "geofences";
static final String TABLE_NAME = "geofences";
public static final Table TABLE = new Table(TABLE_NAME);
public static final LongProperty TASK = new LongProperty(TABLE, "task");
public static final StringProperty PLACE = new StringProperty(TABLE, "place");
static final StringProperty PLACE = new StringProperty(TABLE, "place");
public static final Parcelable.Creator<Geofence> CREATOR =
new Parcelable.Creator<Geofence>() {

@ -76,7 +76,7 @@ public abstract class GoogleTaskDao {
@Update
public abstract void update(GoogleTask googleTask);
public void update(SubsetGoogleTask googleTask) {
private void update(SubsetGoogleTask googleTask) {
update(googleTask.getId(), googleTask.getParent(), googleTask.getOrder());
}

@ -35,7 +35,7 @@ public class Location implements Serializable, Parcelable {
}
@Ignore
protected Location(Parcel in) {
private Location(Parcel in) {
geofence = in.readParcelable(Geofence.class.getClassLoader());
place = in.readParcelable(Place.class.getClassLoader());
}

@ -36,7 +36,7 @@ import org.tasks.themes.CustomIcons;
public class Place implements Serializable, Parcelable {
public static final String KEY = "place";
public static final String TABLE_NAME = "places";
static final String TABLE_NAME = "places";
public static final Table TABLE = new Table(TABLE_NAME);
public static final StringProperty UID = new StringProperty(TABLE, "uid");

@ -31,7 +31,7 @@ public class DbUtils {
batch(items, MAX_SQLITE_ARGS, callback);
}
public static <T> void batch(List<T> items, int size, Callback<List<T>> callback) {
private static <T> void batch(List<T> items, int size, Callback<List<T>> callback) {
if (items.isEmpty()) {
return;
}

@ -73,7 +73,7 @@ class ColorPalettePicker : InjectingDialogFragment() {
@BindView(R.id.icons) lateinit var recyclerView: RecyclerView
private lateinit var colors: List<Pickable>
lateinit var palette: Palette
private lateinit var palette: Palette
var callback: ColorPickedCallback? = null
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {

@ -14,14 +14,14 @@ import org.tasks.R;
import org.tasks.billing.Inventory;
import org.tasks.themes.CustomIcons;
public class IconPickerAdapter extends ListAdapter<Integer, IconPickerHolder> {
class IconPickerAdapter extends ListAdapter<Integer, IconPickerHolder> {
private final Activity activity;
private final Inventory inventory;
private final int current;
private final Callback<Integer> onSelected;
public IconPickerAdapter(
IconPickerAdapter(
Activity activity, Inventory inventory, int current, Callback<Integer> onSelected) {
super(new DiffCallback());
this.activity = activity;

@ -27,7 +27,7 @@ import org.tasks.preferences.Preferences;
*/
public class DriveLoginActivity extends InjectingAppCompatActivity {
public static final String EXTRA_ERROR = "extra_error";
private static final String EXTRA_ERROR = "extra_error";
private static final int RC_CHOOSE_ACCOUNT = 10988;
@Inject DialogBuilder dialogBuilder;
@Inject GoogleAccountManager googleAccountManager;

@ -3,6 +3,7 @@ package org.tasks.etesync;
import org.tasks.data.CaldavAccount;
import org.tasks.ui.CompletableViewModel;
@SuppressWarnings("WeakerAccess")
public class CreateUserInfoViewModel extends CompletableViewModel<String> {
void createUserInfo(EteSyncClient client, CaldavAccount caldavAccount, String derivedKey) {

@ -42,10 +42,10 @@ public class EncryptionSettingsActivity extends ThemedInjectingAppCompatActivity
@Inject EteSyncClient client;
@Inject Encryption encryption;
ActivityEtesyncEncryptionSettingsBinding binding;
private ActivityEtesyncEncryptionSettingsBinding binding;
private UserInfo userInfo;
private CaldavAccount caldavAccount;
CreateUserInfoViewModel createUserInfoViewModel;
private CreateUserInfoViewModel createUserInfoViewModel;
@Override
protected void onCreate(Bundle savedInstanceState) {

@ -8,7 +8,7 @@ public class CaldavFilters {
@Embedded public CaldavCalendar caldavCalendar;
public int count;
public CaldavFilter toCaldavFilter() {
CaldavFilter toCaldavFilter() {
CaldavFilter filter = new CaldavFilter(caldavCalendar);
filter.count = count;
return filter;

@ -8,7 +8,7 @@ public class GoogleTaskFilters {
@Embedded public GoogleTaskList googleTaskList;
public int count;
public GtasksFilter toGtasksFilter() {
GtasksFilter toGtasksFilter() {
GtasksFilter filter = new GtasksFilter(googleTaskList);
filter.count = count;
return filter;

@ -7,7 +7,7 @@ public class LocationFilters {
@Embedded public Place place;
public int count;
public PlaceFilter toLocationFilter() {
PlaceFilter toLocationFilter() {
PlaceFilter filter = new PlaceFilter(place);
filter.count = count;
return filter;

@ -8,7 +8,7 @@ public class TagFilters {
@Embedded public TagData tagData;
public int count;
public TagFilter toTagFilter() {
TagFilter toTagFilter() {
TagFilter filter = new TagFilter(tagData);
filter.count = count;
return filter;

@ -13,7 +13,7 @@ import org.tasks.themes.ThemeBase;
import org.tasks.themes.ThemeColor;
@Module
public class ActivityModule {
class ActivityModule {
private final Activity activity;
@ -28,13 +28,13 @@ public class ActivityModule {
@Provides
@ForActivity
public Context getActivityContext() {
Context getActivityContext() {
return activity;
}
@Provides
@ActivityScope
public ThemeBase getThemeBase(Preferences preferences, Inventory inventory) {
ThemeBase getThemeBase(Preferences preferences, Inventory inventory) {
return ThemeBase.getThemeBase(preferences, inventory, activity.getIntent());
}
@ -46,7 +46,7 @@ public class ActivityModule {
@Provides
@ActivityScope
public ThemeAccent getThemeAccent(ColorProvider colorProvider, Preferences preferences) {
ThemeAccent getThemeAccent(ColorProvider colorProvider, Preferences preferences) {
return colorProvider.getThemeAccent(preferences.getInt(R.string.p_theme_accent, 1));
}
}

@ -33,7 +33,7 @@ import org.tasks.security.KeyStoreEncryption;
import org.tasks.security.NoEncryption;
@Module
public class ApplicationModule {
class ApplicationModule {
private final Context context;
@ -54,79 +54,79 @@ public class ApplicationModule {
@Provides
@ApplicationScope
public NotificationDao getNotificationDao(Database database) {
NotificationDao getNotificationDao(Database database) {
return database.notificationDao();
}
@Provides
@ApplicationScope
public TagDataDao getTagDataDao(Database database) {
TagDataDao getTagDataDao(Database database) {
return database.getTagDataDao();
}
@Provides
@ApplicationScope
public UserActivityDao getUserActivityDao(Database database) {
UserActivityDao getUserActivityDao(Database database) {
return database.getUserActivityDao();
}
@Provides
@ApplicationScope
public TaskAttachmentDao getTaskAttachmentDao(Database database) {
TaskAttachmentDao getTaskAttachmentDao(Database database) {
return database.getTaskAttachmentDao();
}
@Provides
@ApplicationScope
public TaskListMetadataDao getTaskListMetadataDao(Database database) {
TaskListMetadataDao getTaskListMetadataDao(Database database) {
return database.getTaskListMetadataDao();
}
@Provides
@ApplicationScope
public GoogleTaskDao getGoogleTaskDao(Database database) {
GoogleTaskDao getGoogleTaskDao(Database database) {
return database.getGoogleTaskDao();
}
@Provides
@ApplicationScope
public AlarmDao getAlarmDao(Database database) {
AlarmDao getAlarmDao(Database database) {
return database.getAlarmDao();
}
@Provides
@ApplicationScope
public LocationDao getGeofenceDao(Database database) {
LocationDao getGeofenceDao(Database database) {
return database.getLocationDao();
}
@Provides
@ApplicationScope
public TagDao getTagDao(Database database) {
TagDao getTagDao(Database database) {
return database.getTagDao();
}
@Provides
@ApplicationScope
public FilterDao getFilterDao(Database database) {
FilterDao getFilterDao(Database database) {
return database.getFilterDao();
}
@Provides
@ApplicationScope
public GoogleTaskListDao getGoogleTaskListDao(Database database) {
GoogleTaskListDao getGoogleTaskListDao(Database database) {
return database.getGoogleTaskListDao();
}
@Provides
@ApplicationScope
public CaldavDao getCaldavDao(Database database) {
CaldavDao getCaldavDao(Database database) {
return database.getCaldavDao();
}
@Provides
@ApplicationScope
public TaskDao getTaskDao(Database database, WorkManager workManager) {
TaskDao getTaskDao(Database database, WorkManager workManager) {
TaskDao taskDao = database.getTaskDao();
taskDao.initialize(workManager);
return taskDao;
@ -134,7 +134,7 @@ public class ApplicationModule {
@Provides
@ApplicationScope
public DeletionDao getDeletionDao(Database database) {
DeletionDao getDeletionDao(Database database) {
return database.getDeletionDao();
}
@ -145,12 +145,12 @@ public class ApplicationModule {
}
@Provides
public BillingClient getBillingClient(Inventory inventory, Tracker tracker) {
BillingClient getBillingClient(Inventory inventory, Tracker tracker) {
return new BillingClientImpl(context, inventory, tracker);
}
@Provides
public Geocoder getGeocoder(@ForApplication Context context) {
Geocoder getGeocoder(@ForApplication Context context) {
return new MapboxGeocoder(context);
}
}

@ -3,4 +3,4 @@ package org.tasks.injection;
import dagger.Module;
@Module
public class BroadcastModule {}
class BroadcastModule {}

@ -3,4 +3,4 @@ package org.tasks.injection;
import dagger.Module;
@Module(includes = ProductionModule.class)
public class ContentProviderModule {}
class ContentProviderModule {}

@ -6,11 +6,11 @@ import dagger.Module;
import dagger.Provides;
@Module
public class DialogFragmentModule {
class DialogFragmentModule {
private final DialogFragment dialogFragment;
public DialogFragmentModule(DialogFragment dialogFragment) {
DialogFragmentModule(DialogFragment dialogFragment) {
this.dialogFragment = dialogFragment;
}

@ -9,10 +9,10 @@ import org.tasks.db.Migrations;
import org.tasks.preferences.Preferences;
@Module(includes = ApplicationModule.class)
public class ProductionModule {
class ProductionModule {
@Provides
@ApplicationScope
public Database getAppDatabase(@ForApplication Context context) {
Database getAppDatabase(@ForApplication Context context) {
return Room.databaseBuilder(context, Database.class, Database.NAME)
.allowMainThreadQueries() // TODO: remove me
.addMigrations(Migrations.MIGRATIONS)
@ -20,7 +20,7 @@ public class ProductionModule {
}
@Provides
public Preferences getPreferences(@ForApplication Context context) {
Preferences getPreferences(@ForApplication Context context) {
return new Preferences(context);
}
}

@ -3,4 +3,4 @@ package org.tasks.injection;
import dagger.Module;
@Module
public class ServiceModule {}
class ServiceModule {}

@ -3,4 +3,4 @@ package org.tasks.injection;
import dagger.Module;
@Module
public class WorkModule {}
class WorkModule {}

@ -30,9 +30,9 @@ import timber.log.Timber;
public class BackupWork extends RepeatingWorker {
public static final int DAYS_TO_KEEP_BACKUP = 7;
static final int DAYS_TO_KEEP_BACKUP = 7;
static final String BACKUP_FILE_NAME_REGEX = "auto\\.[-\\d]+\\.json";
static final Predicate<String> FILENAME_FILTER = f -> f.matches(BACKUP_FILE_NAME_REGEX);
private static final Predicate<String> FILENAME_FILTER = f -> f.matches(BACKUP_FILE_NAME_REGEX);
static final FileFilter FILE_FILTER = f -> FILENAME_FILTER.apply(f.getName());
private static final Comparator<File> BY_LAST_MODIFIED =
(f1, f2) -> Long.compare(f2.lastModified(), f1.lastModified());
@ -86,7 +86,7 @@ public class BackupWork extends RepeatingWorker {
component.inject(this);
}
void startBackup(Context context) {
private void startBackup(Context context) {
try {
deleteOldLocalBackups();
} catch (Exception e) {

@ -2,7 +2,7 @@ package org.tasks.jobs;
import org.tasks.notifications.Notification;
public interface NotificationQueueEntry {
interface NotificationQueueEntry {
long getId();

@ -7,7 +7,7 @@ import org.tasks.injection.InjectingWorker;
public abstract class RepeatingWorker extends InjectingWorker {
public RepeatingWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
RepeatingWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
super(context, workerParams);
}

@ -15,7 +15,7 @@ import org.threeten.bp.LocalTime;
import org.threeten.bp.format.DateTimeFormatter;
import timber.log.Timber;
public class TaskerTaskCreator {
class TaskerTaskCreator {
private static final DateTimeFormatter dateFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
private static final DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_LOCAL_TIME;
@ -24,7 +24,7 @@ public class TaskerTaskCreator {
private final TaskDao taskDao;
@Inject
public TaskerTaskCreator(TaskCreator taskCreator, TaskDao taskDao) {
TaskerTaskCreator(TaskCreator taskCreator, TaskDao taskDao) {
this.taskCreator = taskCreator;
this.taskDao = taskDao;
}

@ -22,7 +22,7 @@ public final class TaskerCreateTaskActivity extends AbstractFragmentPluginAppCom
@Inject Inventory inventory;
@Inject LocalBroadcastManager localBroadcastManager;
ActivityTaskerCreateBinding binding;
private ActivityTaskerCreateBinding binding;
private Bundle previousBundle;

@ -106,7 +106,7 @@ public class LocationPickerAdapter extends ListAdapter<PlaceUsage, PlaceViewHold
.setOnClickListener(v -> onLocationPicked.settings(place));
}
public void bind(PlaceUsage placeUsage, int color, int icon) {
void bind(PlaceUsage placeUsage, int color, int icon) {
place = placeUsage.place;
String name = place.getDisplayName();
String address = place.getDisplayAddress();
@ -124,7 +124,7 @@ public class LocationPickerAdapter extends ListAdapter<PlaceUsage, PlaceViewHold
}
}
public static class DiffCallback extends ItemCallback<PlaceUsage> {
static class DiffCallback extends ItemCallback<PlaceUsage> {
@Override
public boolean areItemsTheSame(@NonNull PlaceUsage oldItem, @NonNull PlaceUsage newItem) {

@ -18,7 +18,7 @@ import com.google.common.base.Strings;
import java.util.List;
import org.tasks.R;
public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
implements ListUpdateCallback {
private final int attributionRes;
@ -98,7 +98,7 @@ public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
void picked(PlaceSearchResult prediction);
}
public static class SearchViewHolder extends RecyclerView.ViewHolder {
static class SearchViewHolder extends RecyclerView.ViewHolder {
private final TextView name;
private final TextView address;
private PlaceSearchResult prediction;
@ -111,7 +111,7 @@ public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
itemView.findViewById(R.id.place_icon).setVisibility(View.INVISIBLE);
}
public void bind(PlaceSearchResult prediction) {
void bind(PlaceSearchResult prediction) {
this.prediction = prediction;
CharSequence name = prediction.getName();
CharSequence address = prediction.getAddress();
@ -127,7 +127,7 @@ public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
}
}
public static class FooterViewHolder extends RecyclerView.ViewHolder {
static class FooterViewHolder extends RecyclerView.ViewHolder {
final View divider;
@ -143,7 +143,7 @@ public class LocationSearchAdapter extends RecyclerView.Adapter<ViewHolder>
}
}
public static class DiffCallback extends ItemCallback<PlaceSearchResult> {
static class DiffCallback extends ItemCallback<PlaceSearchResult> {
@Override
public boolean areItemsTheSame(

@ -31,7 +31,7 @@ public class MapPosition implements Parcelable {
this.zoom = zoom;
}
protected MapPosition(Parcel in) {
private MapPosition(Parcel in) {
latitude = in.readDouble();
longitude = in.readDouble();
zoom = in.readFloat();
@ -45,7 +45,7 @@ public class MapPosition implements Parcelable {
return longitude;
}
public float getZoom() {
float getZoom() {
return zoom;
}

@ -2,14 +2,13 @@ package org.tasks.location;
import org.tasks.data.Place;
public class PlaceSearchResult {
class PlaceSearchResult {
private final String id;
private final String name;
private final String address;
private final Place place;
@SuppressWarnings("unused")
PlaceSearchResult(String id, String name, String address) {
this(id, name, address, null);
}

@ -14,6 +14,7 @@ import java.util.List;
import org.tasks.Event;
import org.tasks.data.Place;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class PlaceSearchViewModel extends ViewModel {
private PlaceSearchProvider searchProvider;

@ -12,7 +12,7 @@ import com.todoroo.andlib.data.Table;
indices = {@Index(value = "task", unique = true)})
public class Notification {
public static final String TABLE_NAME = "notification";
static final String TABLE_NAME = "notification";
public static final Table TABLE = new Table(TABLE_NAME);
public static final LongProperty TASK = new LongProperty(TABLE, "task");

@ -80,7 +80,7 @@ public class AttributionActivity extends ThemedInjectingAppCompatActivity {
component.inject(this);
}
public static class AttributionList {
static class AttributionList {
List<LibraryAttribution> libraries;
}
@ -103,6 +103,7 @@ public class AttributionActivity extends ThemedInjectingAppCompatActivity {
}
}
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public static class ViewModel extends androidx.lifecycle.ViewModel {
private final MutableLiveData<List<LibraryAttribution>> attributions = new MutableLiveData<>();
private final CompositeDisposable disposables = new CompositeDisposable();

@ -23,7 +23,7 @@ import java.util.Map.Entry;
import org.tasks.R;
import org.tasks.preferences.AttributionActivity.LibraryAttribution;
public class AttributionSection extends StatelessSection {
class AttributionSection extends StatelessSection {
private final String license;
private final List<Entry<String, String>> attributions;
@ -102,7 +102,7 @@ public class AttributionSection extends StatelessSection {
ButterKnife.bind(this, itemView);
}
public void bind(String copyrightHolder, String libraries) {
void bind(String copyrightHolder, String libraries) {
this.copyrightHolder.setText(copyrightHolder);
this.libraries.setText(libraries);
}

@ -16,7 +16,7 @@ public class PermissionChecker {
private final Context context;
@Inject
public PermissionChecker(@ForApplication Context context) {
PermissionChecker(@ForApplication Context context) {
this.context = context;
}

@ -5,7 +5,7 @@ import androidx.recyclerview.widget.DiffUtil;
import com.google.common.base.Objects;
import org.tasks.data.TagData;
public class TagDiffCallback extends DiffUtil.ItemCallback<TagData> {
class TagDiffCallback extends DiffUtil.ItemCallback<TagData> {
@Override
public boolean areItemsTheSame(@NonNull TagData oldItem, @NonNull TagData newItem) {

@ -22,6 +22,7 @@ import org.tasks.data.TagData;
import org.tasks.data.TagDataDao;
import org.tasks.tags.CheckBoxTriStates.State;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class TagPickerViewModel extends ViewModel {
private final MutableLiveData<List<TagData>> tags = new MutableLiveData<>();
@ -48,7 +49,7 @@ public class TagPickerViewModel extends ViewModel {
return newArrayList(selected);
}
public ArrayList<TagData> getPartiallySelected() {
ArrayList<TagData> getPartiallySelected() {
return newArrayList(partiallySelected);
}
@ -84,7 +85,7 @@ public class TagPickerViewModel extends ViewModel {
return selected.contains(tagData);
}
public State getState(TagData tagData) {
State getState(TagData tagData) {
if (partiallySelected.contains(tagData)) {
return State.PARTIALLY_CHECKED;
}

@ -19,7 +19,7 @@ import org.tasks.themes.ColorProvider;
import org.tasks.themes.CustomIcons;
import org.tasks.themes.ThemeColor;
public class TagRecyclerAdapter extends RecyclerView.Adapter<TagPickerViewHolder> {
class TagRecyclerAdapter extends RecyclerView.Adapter<TagPickerViewHolder> {
private final AsyncListDiffer<TagData> differ;
private final Context context;

@ -4,7 +4,7 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil;
import org.tasks.data.TaskContainer;
public class ItemCallback extends DiffUtil.ItemCallback<TaskContainer> {
class ItemCallback extends DiffUtil.ItemCallback<TaskContainer> {
@Override
public boolean areItemsTheSame(@NonNull TaskContainer oldItem, @NonNull TaskContainer newItem) {

@ -29,7 +29,7 @@ public class SubtaskViewHolder extends RecyclerView.ViewHolder {
private final ChipProvider chipProvider;
private final CheckBoxProvider checkBoxProvider;
public TaskContainer task;
private TaskContainer task;
@BindView(R.id.rowBody)
ViewGroup rowBody;
@ -128,8 +128,7 @@ public class SubtaskViewHolder extends RecyclerView.ViewHolder {
return indent;
}
@SuppressLint("NewApi")
public void setIndent(int indent) {
private void setIndent(int indent) {
this.indent = indent;
int indentSize = getIndentSize(indent);
if (atLeastLollipop()) {

@ -54,17 +54,13 @@ public class SubtasksRecyclerAdapter extends RecyclerView.Adapter<SubtaskViewHol
@Override
public void onBindViewHolder(@NonNull SubtaskViewHolder holder, int position) {
TaskContainer task = getItem(position);
TaskContainer task = differ.getCurrentList().get(position);
if (task != null) {
task.setIndent(multiLevelSubtasks ? task.indent : 0);
holder.bindView(task);
}
}
public TaskContainer getItem(int position) {
return differ.getCurrentList().get(position);
}
public void submitList(List<TaskContainer> list) {
differ.submitList(list);
}

@ -2,7 +2,7 @@ package org.tasks.themes;
import android.graphics.Color;
public class ColorUtil {
class ColorUtil {
/**
* https://stackoverflow.com/a/40964456

@ -60,7 +60,7 @@ public class Theme {
themeAccent.applyStyle(theme);
}
public Context wrap(Context context) {
private Context wrap(Context context) {
ContextThemeWrapper wrapper = themeBase.wrap(context);
applyToContext(wrapper);
return wrapper;

@ -270,7 +270,7 @@ public class DateTime {
return isAfter(dateTime.getMillis());
}
public boolean isAfter(long timestamp) {
private boolean isAfter(long timestamp) {
return this.timestamp > timestamp;
}

@ -12,6 +12,7 @@ import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.functions.Action;
import io.reactivex.schedulers.Schedulers;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class ActionViewModel extends ViewModel {
private final MutableLiveData<Boolean> completed = new MutableLiveData<>();
private final MutableLiveData<Throwable> error = new MutableLiveData<>();

@ -18,7 +18,7 @@ import org.tasks.data.TagDataDao;
import org.tasks.injection.ApplicationScope;
@ApplicationScope
public class ChipListCache {
class ChipListCache {
private final Map<String, GtasksFilter> googleTaskLists = new HashMap<>();
private final Map<String, CaldavFilter> caldavCalendars = new HashMap<>();
@ -26,7 +26,7 @@ public class ChipListCache {
private final LocalBroadcastManager localBroadcastManager;
@Inject
public ChipListCache(
ChipListCache(
GoogleTaskListDao googleTaskListDao,
CaldavDao caldavDao,
TagDataDao tagDataDao,

@ -7,21 +7,13 @@ import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import java.util.ArrayList;
import java.util.List;
import org.tasks.R;
public class HiddenTopArrayAdapter<T> extends ArrayAdapter<T> {
private final List<String> hints;
public HiddenTopArrayAdapter(Context context, int resources, List<T> objects) {
this(context, resources, objects, new ArrayList<>());
}
public HiddenTopArrayAdapter(Context context, int resource, List<T> objects, List<String> hints) {
super(context, resource, objects);
this.hints = hints;
protected HiddenTopArrayAdapter(Context context, int resources, List<T> objects) {
super(context, resources, objects);
}
@Override
@ -40,9 +32,6 @@ public class HiddenTopArrayAdapter<T> extends ArrayAdapter<T> {
LayoutInflater.from(getContext())
.inflate(R.layout.simple_spinner_dropdown_item, parent, false);
((TextView) vg.findViewById(R.id.text1)).setText(getItem(position).toString());
if (position < hints.size()) {
((TextView) vg.findViewById(R.id.text2)).setText(hints.get(position));
}
v = vg;
}

@ -30,6 +30,7 @@ import org.tasks.data.TaskContainer;
import org.tasks.preferences.Preferences;
import timber.log.Timber;
@SuppressWarnings({"WeakerAccess", "RedundantSuppression"})
public class TaskListViewModel extends ViewModel implements Observer<PagedList<TaskContainer>> {
private static final PagedList.Config PAGED_LIST_CONFIG =

Loading…
Cancel
Save