android-boilerplate icon indicating copy to clipboard operation
android-boilerplate copied to clipboard

Activity package hardcoded in some imports

Open MasterAM opened this issue 10 years ago • 2 comments

Some of the generated files (I noticed this in activities) have the package and/or imports hard-coded to the default (original author's) path, e.g:

import com.mparaiso.crud.R;
import com.mparaiso.crud.dao.*;
import com.mparaiso.crud.model.*;

These should be changed to the path indicated by the manifest.

MasterAM avatar Mar 10 '14 19:03 MasterAM

Hi! thanks sorry i did not see it before(dont know why github is not sending me notifications when an issue is opened ) ,i'll look into it ! if you have other suggestions dont hesitate,just be patient.

Mparaiso avatar Apr 22 '14 21:04 Mparaiso

Cool. I have a few more suggestions:

  1. db/provider/provider.java has a redundant semicolon at the end of the static segment`.

  2. formatting could be better (indentation etc.), but it is easily resolved using automated tools.

  3. I thing that it will be beneficial to abstract the models findAll()` method: Replace:

    public ArrayList<ExtractedFeature> findAll() {
        ArrayList<ExtractedFeature> result = new ArrayList<ExtractedFeature>();
        try {
            Cursor c = context.getContentResolver().
                    acquireContentProviderClient(Provider.CONTENT_URI)
                    .query(Uri.withAppendedPath(Provider.CONTENT_URI, TABLE_NAME), PROJECTION, null, null, null);
            if (c.moveToFirst()) {
                do {
                ...
    

    by:

    public ArrayList<ExtractedFeature> findAll() {
        return query(null, null, null);
    }
    
    
    protected ArrayList<ExtractedFeature> query(String selection,
                                                String[] selectionArgs, String sortOrder) {
        ArrayList<ExtractedFeature> result = new ArrayList<ExtractedFeature>();
        try {
            Cursor c = context.getContentResolver().
                    acquireContentProviderClient(Provider.CONTENT_URI)
                    .query(Uri.withAppendedPath(Provider.CONTENT_URI, TABLE_NAME), PROJECTION,
                            selection, selectionArgs, sortOrder);
            if (c.moveToFirst()) {
                do {
                ...
    

    will make it easier to filter data by calling the query() method.

Thanks for fixing the imports issue :)

MasterAM avatar May 06 '14 14:05 MasterAM