Skip to content

Commit

Permalink
- release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Balcan committed Sep 7, 2018
1 parent 8d54d36 commit cdc1c4b
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 16 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "org.dhis2"
applicationId "com.dhis2"
minSdkVersion 19
targetSdkVersion 27
versionCode 27
versionName "1.0.0-BETA12"
versionCode 30
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.dhis2.databinding.FormDateTimeTextBinding;
import org.dhis2.databinding.FormTimeTextBinding;
import org.dhis2.utils.DateUtils;

import org.hisp.dhis.android.core.common.ValueType;

import java.util.Date;
Expand All @@ -28,8 +27,8 @@ public class DateTimeHolder extends FormViewHolder implements OnDateSelected {

private final CompositeDisposable disposable;
private final FlowableProcessor<RowAction> processor;
/* @NonNull
private BehaviorProcessor<DateTimeViewModel> model;*/
/* @NonNull
private BehaviorProcessor<DateTimeViewModel> model;*/
private DateTimeViewModel dateTimeViewModel;

DateTimeHolder(ViewDataBinding binding, FlowableProcessor<RowAction> processor) {
Expand Down Expand Up @@ -167,13 +166,13 @@ public void update(DateTimeViewModel viewModel) {
@Override
public void onDateSelected(Date date) {
String dateFormatted = "";
if(date != null) //Always stores a DATE in database format
if(dateTimeViewModel.valueType() == ValueType.DATE)
dateFormatted = DateUtils.databaseDateFormat().format(date);
else if(dateTimeViewModel.valueType() == ValueType.TIME)
dateFormatted = DateUtils.databaseDateFormat().format(date);
if (date != null)
if (dateTimeViewModel.valueType() == ValueType.DATE)
dateFormatted = DateUtils.uiDateFormat().format(date);
else if (dateTimeViewModel.valueType() == ValueType.TIME)
dateFormatted = DateUtils.timeFormat().format(date);
else {
dateFormatted = DateUtils.databaseDateFormat().format(date);
dateFormatted = DateUtils.databaseDateFormatNoMillis().format(date);
}
processor.onNext(
RowAction.create(dateTimeViewModel.uid(), date != null ? dateFormatted : null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.PopupMenu;
import android.widget.TextView;
Expand All @@ -29,6 +30,7 @@
import com.google.gson.reflect.TypeToken;

import org.dhis2.App;
import org.dhis2.BuildConfig;
import org.dhis2.R;
import org.dhis2.usescases.login.LoginActivity;
import org.dhis2.usescases.main.MainActivity;
Expand Down Expand Up @@ -93,8 +95,8 @@ public void setScreenName(String name) {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {

/* if (!BuildConfig.DEBUG)
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);TODO:ACTIVATE FOR FINAL BUILD*/
if (!BuildConfig.DEBUG)
getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
SharedPreferences prefs = getSharedPreferences();
if (this instanceof MainActivity || this instanceof LoginActivity || this instanceof SplashActivity) {
prefs.edit().remove(Constants.PROGRAM_THEME).apply();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ public void initData(String data) {
} catch (ParseException e) {
Timber.e(e);
}

if (date == null)
try {
date = DateUtils.databaseDateFormatNoMillis().parse(data);
} catch (ParseException e) {
Timber.e(e);
}

data = DateUtils.dateTimeFormat().format(date);
} else {
editText.setText("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void initData(String data) {
if (data != null) {
Date date = null;
try {
date = DateUtils.databaseDateFormat().parse(data);
date = DateUtils.timeFormat().parse(data);
} catch (ParseException e) {
Timber.e(e);
}
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/org/dhis2/utils/DateUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static DateUtils getInstance() {
}

public static final String DATABASE_FORMAT_EXPRESSION = "yyyy-MM-dd'T'HH:mm:ss.SSS";
public static final String DATABASE_FORMAT_EXPRESSION_NO_MILLIS = "yyyy-MM-dd'T'HH:mm:ss";
private static final String DATE_TIME_FORMAT_EXPRESSION = "yyyy-MM-dd HH:mm";
private static final String DATE_FORMAT_EXPRESSION = "yyyy-MM-dd";

Expand Down Expand Up @@ -229,6 +230,12 @@ public static SimpleDateFormat dateTimeFormat() {
public static SimpleDateFormat databaseDateFormat() {
return new SimpleDateFormat(DATABASE_FORMAT_EXPRESSION, Locale.US);
}
@NonNull
public static SimpleDateFormat databaseDateFormatNoMillis() {
return new SimpleDateFormat(DATABASE_FORMAT_EXPRESSION_NO_MILLIS, Locale.US);
}



/**********************
FORMAT REGION*/
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/testing_env.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
android:id="@+id/env_url_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="https://play.dhis2.org/2.29\nhttps://play.dhis2.org/demo"
android:text="https://play.dhis2.org/android-previous1\nhttps://play.dhis2.org/android-current"
android:textStyle="bold"
android:layout_marginStart="40dp"
app:layout_constraintStart_toEndOf="@id/env_url"
Expand Down

0 comments on commit cdc1c4b

Please sign in to comment.