Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit dae57fe

Browse files
author
Evgenii Kanivets
committed
#69[30m]. Add help for import feature.
1 parent e64c870 commit dae57fe

File tree

12 files changed

+75
-11
lines changed

12 files changed

+75
-11
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
android:screenOrientation="portrait"
6060
android:theme="@style/Theme.Default" />
6161
<activity
62-
android:name=".activity.ExportActivity"
62+
android:name=".activity.external.ExportActivity"
6363
android:label="@string/title_export"
6464
android:screenOrientation="portrait"
6565
android:theme="@style/Theme.Default" />
@@ -74,7 +74,7 @@
7474
android:screenOrientation="portrait"
7575
android:theme="@style/Theme.Default" />
7676
<activity
77-
android:name=".activity.ImportActivity"
77+
android:name=".activity.external.ImportActivity"
7878
android:label="@string/title_import"
7979
android:screenOrientation="portrait"
8080
android:theme="@style/Theme.Default" />

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/base/BaseDrawerActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
import com.blogspot.e_kanivets.moneytracker.R;
1212
import com.blogspot.e_kanivets.moneytracker.activity.ChartsActivity;
13-
import com.blogspot.e_kanivets.moneytracker.activity.ExportActivity;
14-
import com.blogspot.e_kanivets.moneytracker.activity.ImportActivity;
13+
import com.blogspot.e_kanivets.moneytracker.activity.external.ExportActivity;
14+
import com.blogspot.e_kanivets.moneytracker.activity.external.ImportActivity;
1515
import com.blogspot.e_kanivets.moneytracker.activity.SettingsActivity;
1616
import com.blogspot.e_kanivets.moneytracker.activity.account.AccountsActivity;
1717
import com.blogspot.e_kanivets.moneytracker.activity.exchange_rate.ExchangeRatesActivity;

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/ExportActivity.java renamed to app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/external/ExportActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.blogspot.e_kanivets.moneytracker.activity;
1+
package com.blogspot.e_kanivets.moneytracker.activity.external;
22

33
import android.content.Intent;
44
import android.net.Uri;

app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/ImportActivity.java renamed to app/src/main/java/com/blogspot/e_kanivets/moneytracker/activity/external/ImportActivity.java

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
package com.blogspot.e_kanivets.moneytracker.activity;
1+
package com.blogspot.e_kanivets.moneytracker.activity.external;
22

3+
import android.support.v7.app.AlertDialog;
4+
import android.view.Menu;
5+
import android.view.MenuItem;
36
import android.widget.EditText;
47

58
import com.blogspot.e_kanivets.moneytracker.R;
@@ -33,6 +36,28 @@ protected boolean initData() {
3336
return result;
3437
}
3538

39+
@Override
40+
public boolean onCreateOptionsMenu(Menu menu) {
41+
getMenuInflater().inflate(R.menu.menu_import, menu);
42+
return true;
43+
}
44+
45+
@Override
46+
public boolean onOptionsItemSelected(MenuItem item) {
47+
switch (item.getItemId()) {
48+
case R.id.action_help:
49+
AlertDialog.Builder builder = new AlertDialog.Builder(ImportActivity.this);
50+
builder.setTitle(R.string.help)
51+
.setMessage(R.string.import_help)
52+
.setPositiveButton(android.R.string.ok, null)
53+
.show();
54+
return true;
55+
56+
default:
57+
return super.onOptionsItemSelected(item);
58+
}
59+
}
60+
3661
@OnClick(R.id.btn_import)
3762
public void importRecords() {
3863
String data = etImportData.getText().toString().trim();

app/src/main/java/com/blogspot/e_kanivets/moneytracker/di/AppComponent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.blogspot.e_kanivets.moneytracker.di;
22

33
import com.blogspot.e_kanivets.moneytracker.activity.ChartsActivity;
4-
import com.blogspot.e_kanivets.moneytracker.activity.ExportActivity;
5-
import com.blogspot.e_kanivets.moneytracker.activity.ImportActivity;
4+
import com.blogspot.e_kanivets.moneytracker.activity.external.ExportActivity;
5+
import com.blogspot.e_kanivets.moneytracker.activity.external.ImportActivity;
66
import com.blogspot.e_kanivets.moneytracker.activity.ReportActivity;
77
import com.blogspot.e_kanivets.moneytracker.activity.SettingsActivity;
88
import com.blogspot.e_kanivets.moneytracker.activity.account.AccountsActivity;
1.44 KB
Loading

app/src/main/res/layout/activity_export.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
77
android:fitsSystemWindows="true"
8-
tools:context=".activity.ExportActivity">
8+
tools:context=".activity.external.ExportActivity">
99

1010
<android.support.design.widget.AppBarLayout
1111
android:layout_width="match_parent"

app/src/main/res/layout/activity_import.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
android:layout_width="match_parent"
66
android:layout_height="match_parent"
77
android:fitsSystemWindows="true"
8-
tools:context=".activity.ImportActivity">
8+
tools:context=".activity.external.ImportActivity">
99

1010
<android.support.design.widget.AppBarLayout
1111
android:layout_width="match_parent"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/apk/res-auto">
4+
5+
<item
6+
android:id="@+id/action_help"
7+
android:icon="@drawable/ic_help"
8+
android:title="@string/help"
9+
tools:showAsAction="ifRoom" />
10+
11+
</menu>

app/src/main/res/values-ru/strings.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,13 @@
6767

6868
<string name="title_import">Импорт</string>
6969
<string name="records_imported">%1$s записей было импортировано</string>
70+
<string name="help">Справка</string>
71+
<string name="import_help">Для импорта записей в приложение:\n
72+
1. Создайте CSV файл в формате - \n
73+
<b>время;заголовок;категория;цена;валюта.</b>\n
74+
2. Скопируйте его контент в текстовое поле.\n
75+
3. Нажмите кнопку импорта. Через несколько секунд Вы увидите сколько записей было импортировано.\n
76+
\n
77+
<b>Важно:</b> время - метка времени в миллисекундах; валюта - 3-х символьный код валюты.\n
78+
<b>Пример:</b> 1466948795712;метро;транспорт;-20.0;UAH</string>
7079
</resources>

0 commit comments

Comments
 (0)