Skip to content
This repository has been archived by the owner on Nov 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #95 from code4romania/translations
Browse files Browse the repository at this point in the history
Translations
  • Loading branch information
aniri authored Dec 11, 2018
2 parents 799d809 + 2ace54d commit 5d6f0a8
Show file tree
Hide file tree
Showing 107 changed files with 694 additions and 538 deletions.
6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

10 changes: 7 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
compileSdkVersion 28
buildToolsVersion '28.0.2'

defaultConfig {
applicationId "ro.code4.monitorizarevot"
minSdkVersion 17
targetSdkVersion 27
versionCode 12
versionName "0.9.8"
targetSdkVersion 28
versionCode 16
versionName "0.9.11"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "String", "WEB_BASE_URL", '"http://viuat.azurewebsites.net/"'
buildConfigField "String", "WEB_BASE_URL", '"https://mv-mobile-prod.azurewebsites.net/"'
}

debug {
debuggable true
buildConfigField "String", "WEB_BASE_URL", '"http://viuat.azurewebsites.net/"'
buildConfigField "String", "WEB_BASE_URL", '"https://mv-mobile-prod.azurewebsites.net/"'
}
}
}
Expand All @@ -33,13 +33,13 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'

implementation 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.pixplicity.easyprefs:library:1.9.0@aar'

implementation 'io.reactivex:rxandroid:1.2.1'
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
android:allowBackup="false">
<activity
android:name=".StartActivity"
android:screenOrientation="portrait"
Expand Down
Binary file modified app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app/src/main/java/ro/code4/monitorizarevot/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import ro.code4.monitorizarevot.util.ActivityOperations;
import ro.code4.monitorizarevot.util.AuthUtils;

public class BaseActivity extends AppCompatActivity implements ActivityOperations {
public abstract class BaseActivity extends AppCompatActivity implements ActivityOperations {
private ProgressDialog loadingIndicator;

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
loadingIndicator = new ProgressDialog(this);
loadingIndicator.setMessage("Vă rugăm așteptaţi...");
loadingIndicator.setMessage(getString(R.string.please_wait));
loadingIndicator.setCancelable(false);
}

Expand Down
23 changes: 19 additions & 4 deletions app/src/main/java/ro/code4/monitorizarevot/LoginActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.app.ActivityOptions;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.text.TextUtils;
Expand All @@ -18,28 +19,37 @@
import ro.code4.monitorizarevot.observable.ObservableListenerDetacher;
import vn.tungdx.mediapicker.activities.MediaPickerErrorDialog;

import static ro.code4.monitorizarevot.constants.Constants.ORGANISATION_WEB_URL;

public class LoginActivity extends BaseActivity {
private EditText username;
private EditText password;
private Button loginButton;
private ObservableListenerDetacher mListenerDetacher;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
username = (EditText) findViewById(R.id.phone);
password = (EditText) findViewById(R.id.branch);
username = findViewById(R.id.phone);
password = findViewById(R.id.branch);
username.getText();

loginButton = (Button) findViewById(R.id.login_button);
Button loginButton = findViewById(R.id.login_button);
loginButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
login();
}
});

View organisationLink = findViewById(R.id.login_organisation_link);
organisationLink.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
openOrganisationWebpage();
}
});

setAppVersion((TextView) findViewById(R.id.app_version));
}

Expand All @@ -51,6 +61,11 @@ protected void onDestroy() {
}
}

private void openOrganisationWebpage() {
Intent openBrowser = new Intent(Intent.ACTION_VIEW, Uri.parse(ORGANISATION_WEB_URL));
startActivity(openBrowser);
}

private void setAppVersion(TextView appVersion) {
appVersion.setText(getString(R.string.app_version, BuildConfig.VERSION_NAME));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_toolbar);

toolbarTitle = (TextView) findViewById(R.id.toolbar_title);
toolbarTitle = findViewById(R.id.toolbar_title);
menuButton = findViewById(R.id.toolbar_menu);
drawerLayout = (DrawerLayout) findViewById(R.id.navigation_drawer);
drawerLayout = findViewById(R.id.navigation_drawer);

initNavigationDrawer();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ro.code4.monitorizarevot.adapter;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
Expand Down Expand Up @@ -28,18 +29,19 @@ public QuestionsOverviewAdapter(Context context, Form form, QuestionsOverviewNav
this.questions = FormUtils.getAllQuestions(form.getId());
}

@NonNull
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.view_holder_question_overview, parent, false);
return new QuestionsOverviewViewHolder(itemView);
}

@Override
public void onBindViewHolder(RecyclerView.ViewHolder vh, int position) {
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
final QuestionsOverviewViewHolder holder = (QuestionsOverviewViewHolder) vh;
Question question = questions.get(position);
boolean hasAnswer = question.getRaspunsuriIntrebare().size() > 0;
boolean hasAnswer = question.getAnswers().size() > 0;
holder.header.setText(question.getCode());
holder.description.setText(question.getText());
holder.status.setText(hasAnswer ?
Expand Down Expand Up @@ -67,10 +69,10 @@ private class QuestionsOverviewViewHolder extends RecyclerView.ViewHolder {

QuestionsOverviewViewHolder(View itemView) {
super(itemView);
cardView = (CardView) itemView.findViewById(R.id.card_view);
header = (TextView) itemView.findViewById(R.id.header);
description = (TextView) itemView.findViewById(R.id.description);
status = (TextView) itemView.findViewById(R.id.status);
cardView = itemView.findViewById(R.id.card_view);
header = itemView.findViewById(R.id.header);
description = itemView.findViewById(R.id.description);
status = itemView.findViewById(R.id.status);
}
}
}
32 changes: 18 additions & 14 deletions app/src/main/java/ro/code4/monitorizarevot/adapter/SyncAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.ArrayList;
import java.util.List;

import ro.code4.monitorizarevot.LoginActivity;
import ro.code4.monitorizarevot.constants.FormType;
import ro.code4.monitorizarevot.constants.Sync;
import ro.code4.monitorizarevot.db.Data;
import ro.code4.monitorizarevot.net.NetworkService;
Expand All @@ -35,15 +35,15 @@
public class SyncAdapter extends AbstractThreadedSyncAdapter {
public SyncAdapter(Context context, boolean autoInitialize) {
super(context, autoInitialize);
init(context);
init();
}

public SyncAdapter(Context context, boolean autoInitialize, boolean allowParallelSyncs) {
super(context, autoInitialize, allowParallelSyncs);
init(context);
init();
}

private void init(Context context) {
private void init() {

}

Expand Down Expand Up @@ -84,9 +84,9 @@ private void postBranchDetails(){
private void postQuestionAnswers() {
try{
List<QuestionAnswer> questionAnswers = new ArrayList<>();
getAnswersFromForm(Data.getInstance().getFormA(), questionAnswers);
getAnswersFromForm(Data.getInstance().getFormB(), questionAnswers);
getAnswersFromForm(Data.getInstance().getFormC(), questionAnswers);
getAnswersFromForm(Data.getInstance().getFirstForm(), questionAnswers);
getAnswersFromForm(Data.getInstance().getSecondForm(), questionAnswers);
getAnswersFromForm(Data.getInstance().getThirdForm(), questionAnswers);
NetworkService.postQuestionAnswer(new ResponseAnswerContainer(questionAnswers));
}catch (IOException e){
e.printStackTrace();
Expand Down Expand Up @@ -139,27 +139,31 @@ private boolean versionsEqual(Version before, Version current) {
&& before.getC().equals(current.getC());
}

private void getForms(Version version) throws IOException {
private void getForms(Version version) {
FormDefinitionSubscriber subscriber = new FormDefinitionSubscriber(version, 3);
NetworkService.doGetForm("A").startRequest(subscriber);
NetworkService.doGetForm("B").startRequest(subscriber);
NetworkService.doGetForm("C").startRequest(subscriber);
NetworkService.doGetForm(FormType.FIRST).startRequest(subscriber);
NetworkService.doGetForm(FormType.SECOND).startRequest(subscriber);
NetworkService.doGetForm(FormType.THIRD).startRequest(subscriber);
}

public static void requestSync(Context context) {
ContentResolver.requestSync(createSyncAccount(context), Sync.AUTHORITY, getBundle(false));
Account account = createSyncAccount(context);
ContentResolver.setSyncAutomatically(account, Sync.AUTHORITY, true);
ContentResolver.requestSync(account, Sync.AUTHORITY, getBundle(false));
}

public static void requestUploadSync(Context context) {
if (ContentResolver.getMasterSyncAutomatically()) {
ContentResolver.requestSync(createSyncAccount(context), Sync.AUTHORITY, getBundle(true));
Account account = createSyncAccount(context);
ContentResolver.setSyncAutomatically(account, Sync.AUTHORITY, true);
ContentResolver.requestSync(account, Sync.AUTHORITY, getBundle(true));
}
}

@NonNull
private static Bundle getBundle(boolean isUpload) {
Bundle extras = new Bundle();
extras.putBoolean( ContentResolver.SYNC_EXTRAS_MANUAL, true);
extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true);
extras.putBoolean(ContentResolver.SYNC_EXTRAS_UPLOAD, isUpload);
return extras;
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/ro/code4/monitorizarevot/constants/Api.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package ro.code4.monitorizarevot.constants;

public class Api {
public static final String AUTH = "/api/v1/access/token";
public static final String FORM = "/api/v1/formular";
public static final String FORM_VERSION = "/api/v1/formular/versiune";
public static final String BRANCH = "/api/v1/sectie";
public static final String QUESTION_ANSWER = "/api/v1/raspuns";
public static final String NOTE = "/api/v1/note/ataseaza";
public static final String KEY_FORM_ID = "idformular";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ro.code4.monitorizarevot.constants;

public class Auth {
public static final String ACCESS_TOKEN = "access_token";
public static final String KEY = "Authorization";
public static final String BEARER = "Bearer";
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package ro.code4.monitorizarevot.constants;

public class Constants {
public static final String GUIDE_URL = "http://monitorizare-vot-ghid.azurewebsites.net/";
public static final String ORGANISATION_WEB_URL = "https://code4.ro/";
public static final String SERVICE_CENTER_PHONE_NUMBER = "0800 080 200";
public static String AUTHORIZATION_KEY = "Authorization";

public static final String TIME_FORMAT = "HH:mm";
public static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
}
Loading

0 comments on commit 5d6f0a8

Please sign in to comment.