This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
devDebugRuntimeClasspath - Runtime classpath of compilation 'devDebug' (target (androidJvm)). | |
+--- androidx.databinding:databinding-common:7.3.1 | |
+--- androidx.databinding:databinding-runtime:7.3.1 | |
| +--- androidx.collection:collection:1.0.0 -> 1.1.0 | |
| | \--- androidx.annotation:annotation:1.1.0 -> 1.3.0 | |
| +--- androidx.databinding:databinding-common:7.3.1 | |
| +--- androidx.databinding:viewbinding:7.3.1 | |
| | \--- androidx.annotation:annotation:1.0.0 -> 1.3.0 | |
| \--- androidx.lifecycle:lifecycle-runtime:2.4.0 -> 2.5.1 | |
| +--- androidx.annotation:annotation:1.1.0 -> 1.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
defaultConfig { | |
vectorDrawables.useSupportLibrary = true | |
buildConfigField "java.lang.String", "BASE_URL", "\"https://MY_URL/\"" | |
} | |
dexOptions { | |
jumboMode = true | |
javaMaxHeapSize "6g" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserController { | |
@Inject | |
protected UserRepository mUserRepo; | |
@Inject | |
public UserController(){} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
public class RepositoryModule { | |
@Provides | |
@Singleton | |
ConnectionSource providesConnectionSource(Application app) { | |
return new AndroidConnectionSource(new DatabaseHelper(app.getApplicationContext())); | |
} | |
@Provides | |
@Singleton |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class UserSQLImpl extends BaseSQLImpl<User, Integer> implements UserRepository{ | |
public UserSQLImpl(ConnectionSource connectionSource){ | |
try { | |
mDao = DaoManager.createDao(connectionSource, User.class); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseSQLImpl<T, I> implements BaseRepository<T, I> { | |
protected Dao<T,I> mDao; | |
@Override | |
public List<T> findAll() { | |
try { | |
return mDao.queryForAll(); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface BaseRepository<T,I> { | |
List<T> findAll(); | |
T findById(I id); | |
boolean create(T r); | |
boolean update(T r); | |
boolean delete(T r); | |
boolean deleteAll(); | |
void bathCreate(List<T> objectList); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DatabaseHelper extends OrmLiteSqliteOpenHelper { | |
// name of the database file for your application -- change to something | |
// appropriate for your app | |
private static final String DATABASE_NAME = "DB_NAME.db"; | |
// any time you make changes to your database objects, you may have to | |
// increase the database version | |
private static final int DATABASE_VERSION = 1; | |
// the DAO object we use to access the SimpleData table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@DatabaseTable(tableName = "user_table") | |
public class User { | |
@DatabaseField(id = true) | |
private int userID; | |
@DatabaseField | |
private String userName; | |
@DatabaseField | |
private String userPhone; | |
public User(){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- You can change the parent around to whatever you normally use --> | |
<style name="DebugColors" parent="Theme.AppCompat"> | |
<!-- System colors --> | |
<item name="android:windowBackground">@color/__debugWindowBackground</item> | |
<item name="android:colorPressedHighlight">#FF4400</item> | |
<item name="android:colorLongPressedHighlight">#FF0044</item> | |
<item name="android:colorFocusedHighlight">#44FF00</item> | |
<item name="android:colorActivatedHighlight">#00FF44</item> |