Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit d5dcd1d

Browse files
Merge pull request #1 from FrogDevelopment/update_app
Update app
2 parents 6aedd3f + 4c44d56 commit d5dcd1d

9 files changed

Lines changed: 919 additions & 935 deletions

File tree

app/build.gradle

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,59 +3,59 @@ apply plugin: 'com.android.application'
33
android {
44

55
compileSdkVersion 28
6-
buildToolsVersion '28.0.2'
6+
buildToolsVersion '28.0.3'
77

88
defaultConfig {
99
applicationId "fr.frogdevelopment.pregnancycalendar"
1010

1111
minSdkVersion 24
1212
targetSdkVersion 28
1313

14-
versionCode 4
15-
versionName "1.3.0"
14+
versionCode 5
15+
versionName "1.4.0"
1616

1717
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1818
}
19-
20-
signingConfigs {
21-
Properties props = new Properties()
22-
def propFile = new File(System.getenv("SIGNING_PROPERTIES"))
23-
if (propFile.canRead()) {
24-
props.load(new FileInputStream(propFile))
25-
if (props == null || props.isEmpty()) {
26-
println 'signing.properties found but entries are missing'
27-
debug = null
28-
release = null
29-
} else {
30-
debug {
31-
keyAlias props['pc_key_alias']
32-
keyPassword props['pc_key_password']
33-
storePassword props['store_password']
34-
storeFile file(props['store_file'])
35-
}
36-
release {
37-
keyAlias props['pc_key_alias']
38-
keyPassword props['pc_key_password']
39-
storePassword props['store_password']
40-
storeFile file(props['store_file'])
41-
}
42-
}
43-
} else {
44-
println 'signing.properties not found'
45-
}
46-
}
19+
//
20+
// signingConfigs {
21+
// Properties props = new Properties()
22+
// def propFile = new File(System.getenv("SIGNING_PROPERTIES"))
23+
// if (propFile.canRead()) {
24+
// props.load(new FileInputStream(propFile))
25+
// if (props == null || props.isEmpty()) {
26+
// println 'signing.properties found but entries are missing'
27+
// debug = null
28+
// release = null
29+
// } else {
30+
// debug {
31+
// keyAlias props['pc_key_alias']
32+
// keyPassword props['pc_key_password']
33+
// storePassword props['store_password']
34+
// storeFile file(props['store_file'])
35+
// }
36+
// release {
37+
// keyAlias props['pc_key_alias']
38+
// keyPassword props['pc_key_password']
39+
// storePassword props['store_password']
40+
// storeFile file(props['store_file'])
41+
// }
42+
// }
43+
// } else {
44+
// println 'signing.properties not found'
45+
// }
46+
// }
4747

4848
buildTypes {
4949
debug {
5050
debuggable true
5151
minifyEnabled false
52-
signingConfig signingConfigs.debug
52+
// signingConfig signingConfigs.debug
5353
}
5454
release {
5555
// shrinkResources true
5656
minifyEnabled true
5757
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
58-
signingConfig signingConfigs.release
58+
// signingConfig signingConfigs.release
5959
}
6060
}
6161

@@ -75,30 +75,30 @@ android {
7575
}
7676

7777
dependencies {
78-
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
78+
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
7979
exclude group: 'com.android.support', module: 'support-annotations'
8080
})
8181

82-
implementation group: 'com.android.support', name: 'support-v13', version: '28.0.0-rc01'
83-
implementation group: 'com.android.support', name: 'appcompat-v7', version: '28.0.0-rc01'
84-
implementation group: 'com.android.support', name: 'design', version: '28.0.0-rc01'
85-
implementation group: 'com.android.support', name: 'recyclerview-v7', version: '28.0.0-rc01'
82+
implementation group: 'com.android.support', name: 'support-v13', version: '28.0.0'
83+
implementation group: 'com.android.support', name: 'appcompat-v7', version: '28.0.0'
84+
implementation group: 'com.android.support', name: 'design', version: '28.0.0'
85+
implementation group: 'com.android.support', name: 'recyclerview-v7', version: '28.0.0'
8686

8787

8888

8989
// Required -- JUnit 4 framework
90-
testImplementation 'junit:junit:4.12'
90+
testImplementation 'junit:junit:4.13-beta-3'
9191
// Optional -- Mockito framework
92-
testImplementation 'org.mockito:mockito-core:2.7.6'
92+
testImplementation 'org.mockito:mockito-core:3.0.0'
9393
// androidTestCompile 'com.android.support.test:runner:0.5'
9494
// Set this dependency to use JUnit 4 rules
9595
// androidTestCompile 'com.android.support.test:rules:0.5'
9696

9797
// pour manip des dates
98-
implementation 'com.jakewharton.threetenabp:threetenabp:1.0.5'
99-
testImplementation ('org.threeten:threetenbp:1.3.1') {
98+
implementation 'com.jakewharton.threetenabp:threetenabp:1.2.1'
99+
testImplementation ('org.threeten:threetenbp:1.4.0') {
100100
exclude module: 'com.jakewharton.threetenabp:threetenabp:1.0.4'
101101
}
102102
//
103-
implementation 'org.apache.commons:commons-lang3:3.8'
103+
implementation 'org.apache.commons:commons-lang3:3.9'
104104
}

app/src/main/java/fr/frogdevelopment/pregnancycalendar/MainActivity.java

Lines changed: 79 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -18,85 +18,83 @@
1818

1919
public class MainActivity extends AppCompatActivity {
2020

21-
SectionsPagerAdapter mSectionsPagerAdapter;
22-
private ViewPager mViewPager;
23-
24-
@Override
25-
protected void onCreate(Bundle savedInstanceState) {
26-
super.onCreate(savedInstanceState);
27-
setContentView(R.layout.activity_main);
28-
29-
AndroidThreeTen.init(this);
30-
31-
mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
32-
33-
mViewPager = (ViewPager) findViewById(R.id.container);
34-
mViewPager.setAdapter(mSectionsPagerAdapter);
35-
}
36-
37-
@Override
38-
public boolean onCreateOptionsMenu(Menu menu) {
39-
switch (mViewPager.getCurrentItem()) {
40-
case 0:
41-
getMenuInflater().inflate(R.menu.menu_main, menu);
42-
break;
43-
44-
case 1:
45-
getMenuInflater().inflate(R.menu.menu_contraction, menu);
46-
break;
47-
}
48-
49-
return true;
50-
}
51-
52-
@Override
53-
public boolean onOptionsItemSelected(MenuItem item) {
54-
switch (item.getItemId()) {
55-
case R.id.action_settings:
56-
Intent i = new Intent(this, SettingsActivity.class);
57-
startActivity(i);
58-
return true;
59-
default:
60-
return super.onOptionsItemSelected(item);
61-
}
62-
}
63-
64-
private class SectionsPagerAdapter extends FragmentPagerAdapter {
65-
66-
SectionsPagerAdapter(FragmentManager fm) {
67-
super(fm);
68-
}
69-
70-
@Override
71-
public Fragment getItem(int position) {
72-
Fragment item = null;
73-
switch (position) {
74-
case 0:
75-
item = new InformationFragment();
76-
break;
77-
case 1:
78-
item = new ContractionFragment();
79-
break;
80-
}
81-
82-
return item;
83-
}
84-
85-
@Override
86-
public int getCount() {
87-
return 2;
88-
}
89-
90-
@Override
91-
public CharSequence getPageTitle(int position) {
92-
93-
switch (position) {
94-
case 0:
95-
return getResources().getString(R.string.tab_1);
96-
case 1:
97-
return getResources().getString(R.string.tab_2);
98-
}
99-
return null;
100-
}
101-
}
21+
SectionsPagerAdapter mSectionsPagerAdapter;
22+
private ViewPager mViewPager;
23+
24+
@Override
25+
protected void onCreate(Bundle savedInstanceState) {
26+
super.onCreate(savedInstanceState);
27+
setContentView(R.layout.activity_main);
28+
29+
AndroidThreeTen.init(this);
30+
31+
mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
32+
33+
mViewPager = findViewById(R.id.container);
34+
mViewPager.setAdapter(mSectionsPagerAdapter);
35+
}
36+
37+
@Override
38+
public boolean onCreateOptionsMenu(Menu menu) {
39+
switch (mViewPager.getCurrentItem()) {
40+
case 0:
41+
getMenuInflater().inflate(R.menu.menu_main, menu);
42+
break;
43+
44+
case 1:
45+
getMenuInflater().inflate(R.menu.menu_contraction, menu);
46+
break;
47+
}
48+
49+
return true;
50+
}
51+
52+
@Override
53+
public boolean onOptionsItemSelected(MenuItem item) {
54+
if (item.getItemId() == R.id.action_settings) {
55+
Intent i = new Intent(this, SettingsActivity.class);
56+
startActivity(i);
57+
return true;
58+
}
59+
return super.onOptionsItemSelected(item);
60+
}
61+
62+
private class SectionsPagerAdapter extends FragmentPagerAdapter {
63+
64+
SectionsPagerAdapter(FragmentManager fm) {
65+
super(fm);
66+
}
67+
68+
@Override
69+
public Fragment getItem(int position) {
70+
Fragment item = null;
71+
switch (position) {
72+
case 0:
73+
item = new InformationFragment();
74+
break;
75+
case 1:
76+
item = new ContractionFragment();
77+
break;
78+
}
79+
80+
return item;
81+
}
82+
83+
@Override
84+
public int getCount() {
85+
return 2;
86+
}
87+
88+
@Override
89+
public CharSequence getPageTitle(int position) {
90+
91+
switch (position) {
92+
case 0:
93+
return getResources().getString(R.string.tab_1);
94+
case 1:
95+
return getResources().getString(R.string.tab_2);
96+
}
97+
return null;
98+
}
99+
}
102100
}

app/src/main/java/fr/frogdevelopment/pregnancycalendar/contraction/ContractionContentProvider.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,10 @@ public Cursor query(@NonNull Uri uri, String[] projection, String selection, Str
8989
SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder();
9090

9191
SQLiteDatabase db = mOpenHelper.getReadableDatabase();
92-
switch (sURIMatcher.match(uri)) {
93-
94-
case CONTRACTIONS:
95-
queryBuilder.setTables(ContractionContract.TABLE_NAME);
96-
break;
97-
98-
default:
99-
throw new IllegalArgumentException("Unknown URI: " + uri);
92+
if (sURIMatcher.match(uri) == CONTRACTIONS) {
93+
queryBuilder.setTables(ContractionContract.TABLE_NAME);
94+
} else {
95+
throw new IllegalArgumentException("Unknown URI: " + uri);
10096
}
10197

10298
Cursor cursor = queryBuilder.query(db, projection, selection, selectionArgs, null, null, sortOrder);
@@ -112,13 +108,10 @@ public Uri insert(@NonNull Uri uri, ContentValues contentValues) {
112108
SQLiteDatabase sqlDB = mOpenHelper.getWritableDatabase();
113109

114110
long id;
115-
switch (sURIMatcher.match(uri)) {
116-
case CONTRACTIONS:
117-
id = sqlDB.insert(ContractionContract.TABLE_NAME, null, contentValues);
118-
break;
119-
120-
default:
121-
throw new IllegalArgumentException("Unknown URI: " + uri);
111+
if (sURIMatcher.match(uri) == CONTRACTIONS) {
112+
id = sqlDB.insert(ContractionContract.TABLE_NAME, null, contentValues);
113+
} else {
114+
throw new IllegalArgumentException("Unknown URI: " + uri);
122115
}
123116

124117
Uri newUri = ContentUris.withAppendedId(uri, id);

app/src/main/java/fr/frogdevelopment/pregnancycalendar/contraction/ContractionContract.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,38 @@
1212

1313
class ContractionContract implements BaseColumns {
1414

15-
static final String TABLE_NAME = "CONTRACTION";
15+
static final String TABLE_NAME = "CONTRACTION";
1616

17-
static final String DATETIME = "DATETIME";
18-
static final String DURATION = "DURATION";
17+
static final String DATETIME = "DATETIME";
18+
static final String DURATION = "DURATION";
1919

20-
static final int INDEX_ID = 0;
21-
static final int INDEX_DATETIME = 1;
22-
static final int INDEX_DURATION = 2;
20+
static final int INDEX_ID = 0;
21+
static final int INDEX_DATETIME = 1;
22+
static final int INDEX_DURATION = 2;
2323

24-
static final String[] COLUMNS = {_ID, DATETIME, DURATION};
24+
static final String[] COLUMNS = {_ID, DATETIME, DURATION};
2525

26-
// Queries
27-
private static final String SQL_CREATE = String.format("CREATE TABLE %s ( %s INTEGER PRIMARY KEY AUTOINCREMENT, %s INTEGER NOT NULL, %s INTEGER NOT NULL);", TABLE_NAME, _ID, DATETIME, DURATION);
26+
// Queries
27+
private static final String SQL_CREATE = String.format("CREATE TABLE %s ( %s INTEGER PRIMARY KEY AUTOINCREMENT, %s INTEGER NOT NULL, %s INTEGER NOT NULL);", TABLE_NAME, _ID, DATETIME, DURATION);
2828

29-
static void create(SQLiteDatabase db) {
30-
db.execSQL(SQL_CREATE);
31-
}
29+
static void create(SQLiteDatabase db) {
30+
db.execSQL(SQL_CREATE);
31+
}
3232

33-
static class Contraction {
33+
static class Contraction {
3434

35-
String id;
36-
LocalDateTime dateTime;
37-
Long duration;
35+
String id;
36+
LocalDateTime dateTime;
37+
Long duration;
3838

39-
@Override
40-
public String toString() {
41-
return new ToStringBuilder(this)
42-
.append("id", id)
43-
.append("dateTime", dateTime)
44-
.append("duration", duration)
45-
.toString();
46-
}
47-
}
39+
@Override
40+
public String toString() {
41+
return new ToStringBuilder(this)
42+
.append("id", id)
43+
.append("dateTime", dateTime)
44+
.append("duration", duration)
45+
.toString();
46+
}
47+
}
4848

4949
}

0 commit comments

Comments
 (0)