Skip to content

Commit 90079fd

Browse files
committed
Finished implementation of all the alert dialogs.
Streamlined the flow.
1 parent 732dbb7 commit 90079fd

17 files changed

+241
-49
lines changed

app/src/main/java/net/codebuff/intentio/preferences/SettingsActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private void setupSimplePreferencesScreen() {
7575
// Add 'general' preferences.
7676
addPreferencesFromResource(R.xml.pref_general);
7777
PreferenceCategory fakeHeader2 = new PreferenceCategory(this);
78-
fakeHeader2.setTitle("choose file to parse");
78+
fakeHeader2.setTitle("Update Schedule");
7979
getPreferenceScreen().addPreference(fakeHeader2);
8080
addPreferencesFromResource(R.xml.pref_file_chooser);
8181

app/src/main/java/net/codebuff/intentio/ui/MainActivity.java

+5-9
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,10 @@
55
import android.support.v4.app.DialogFragment;
66
import android.support.v7.app.ActionBarActivity;
77
import android.support.v7.app.ActionBar;
8-
import android.support.v4.app.Fragment;
98
import android.content.Context;
10-
import android.os.Build;
119
import android.os.Bundle;
12-
import android.util.Log;
13-
import android.view.Gravity;
14-
import android.view.LayoutInflater;
1510
import android.view.Menu;
1611
import android.view.MenuItem;
17-
import android.view.View;
18-
import android.view.ViewGroup;
1912
import android.widget.ArrayAdapter;
2013
import android.widget.TextView;
2114

@@ -25,8 +18,6 @@
2518
import net.codebuff.intentio.preferences.PrefsManager;
2619
import net.codebuff.intentio.preferences.SettingsActivity;
2720

28-
import org.apache.poi.ss.formula.functions.Now;
29-
3021
import java.util.Calendar;
3122
import java.util.HashMap;
3223

@@ -163,6 +154,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
163154
about.show(getSupportFragmentManager(),"about");
164155
return true;
165156
}
157+
/* if (id == R.id.action_help) {
158+
DialogFragment help = new setup_help();
159+
help.show(getSupportFragmentManager(),"about");
160+
return true;
161+
}*/
166162

167163
return super.onOptionsItemSelected(item);
168164
}

app/src/main/java/net/codebuff/intentio/ui/first_run.java

+27-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import android.support.v4.app.FragmentTransaction;
77
import android.support.v7.app.ActionBarActivity;
88
import android.os.Bundle;
9+
import android.support.v7.widget.CardView;
910
import android.util.Log;
1011
import android.view.View;
1112
import android.widget.Button;
@@ -25,6 +26,7 @@ public class first_run extends ActionBarActivity {
2526
private TextView txt;
2627
private Button choose_file;
2728
private Button done;
29+
private CardView fr_help;
2830
private PrefsManager app;
2931
@Override
3032
protected void onCreate(Bundle savedInstanceState) {
@@ -35,13 +37,18 @@ protected void onCreate(Bundle savedInstanceState) {
3537
txt = (TextView) findViewById(R.id.fr_textview);
3638
choose_file = (Button) findViewById(R.id.fr_choose_file);
3739
done = (Button) findViewById(R.id.fr_done);
40+
fr_help = (CardView)findViewById(R.id.fr_help);
3841
app = new PrefsManager(getApplicationContext());
3942
}
4043

4144
@Override
4245
protected void onStart() {
4346
super.onStart();
4447

48+
DialogFragment help = new setup_help();
49+
help.show(getSupportFragmentManager(),"about");
50+
51+
4552
choose_file.setOnClickListener(new View.OnClickListener() {
4653
@Override
4754
public void onClick(View v) {
@@ -51,6 +58,13 @@ public void onClick(View v) {
5158
}
5259
});
5360

61+
fr_help.setOnClickListener(new View.OnClickListener() {
62+
@Override
63+
public void onClick(View v) {
64+
DialogFragment help = new setup_help();
65+
help.show(getSupportFragmentManager(),"about");
66+
}
67+
});
5468
done.setOnClickListener(new View.OnClickListener() {
5569
@Override
5670
public void onClick(View v) {
@@ -67,6 +81,9 @@ public void onClick(View v) {
6781
@Override
6882
protected void onResume() {
6983
super.onResume();
84+
85+
86+
7087
choose_file.setOnClickListener(new View.OnClickListener() {
7188
@Override
7289
public void onClick(View v) {
@@ -76,6 +93,14 @@ public void onClick(View v) {
7693
}
7794
});
7895

96+
fr_help.setOnClickListener(new View.OnClickListener() {
97+
@Override
98+
public void onClick(View v) {
99+
DialogFragment help = new setup_help();
100+
help.show(getSupportFragmentManager(),"about");
101+
}
102+
});
103+
79104
done.setOnClickListener(new View.OnClickListener() {
80105
@Override
81106
public void onClick(View v) {
@@ -106,14 +131,14 @@ protected void onActivityResult(int requestCode, int resultCode, Intent intent)
106131
if(!xls_content.equals("file not found")) {
107132
txt_main.setText("Intentio Setup Complete");
108133
txt_main.setTextColor(getResources().getColor(R.color.grab_attention));
109-
txt.setText("File parsed successfully and data saved, Click Done to finish setup\n (if you want you can also see the raw data of your excel file)");
134+
txt.setText("File parsed successfully and data saved, Click Done to finish setup\n (follwoing raw data is displayed just for satisfying coder's itch and has no other purpose whatsoever)");
110135
parser_dump.setText(xls_content);
111136
choose_file.setVisibility(View.GONE);
112137
app.update_pref_settings("reset",false);
113138
}else{
114139
DialogFragment incorrect_file = new incorrect_file_dialog();
115140
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
116-
ft.add(incorrect_file,null);
141+
ft.add(incorrect_file, null);
117142
ft.commitAllowingStateLoss();
118143
}
119144
} catch (IOException e) {

app/src/main/java/net/codebuff/intentio/ui/help.java app/src/main/java/net/codebuff/intentio/ui/setup_help.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/**
1313
* Created by deepankar on 11/1/15.
1414
*/
15-
public class help extends DialogFragment{
15+
public class setup_help extends DialogFragment{
1616

1717
@Override
1818
public Dialog onCreateDialog(Bundle savedInstanceState) {
@@ -24,10 +24,10 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
2424

2525
// Inflate and set the layout for the dialog
2626
// Pass null as the parent view because its going in the dialog layout
27-
builder.setView(inflater.inflate(R.layout.help, null))
28-
.setTitle("Help")
27+
builder.setView(inflater.inflate(R.layout.setup_help, null))
28+
.setTitle("Setup Help")
2929
// Add action buttons
30-
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
30+
.setPositiveButton("Dismiss", new DialogInterface.OnClickListener() {
3131
@Override
3232
public void onClick(DialogInterface dialog, int id) {
3333

app/src/main/res/drawable/s1.jpg

17.3 KB
Loading

app/src/main/res/drawable/s2.jpg

51.7 KB
Loading

app/src/main/res/drawable/s3.png

109 KB
Loading

app/src/main/res/drawable/s4.png

99.5 KB
Loading

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

+35-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,49 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
33
android:layout_width="match_parent" android:layout_height="match_parent"
4-
android:id="@+id/about">
4+
android:id="@+id/about"
5+
android:background="@color/background_material_light">
56

67
<ScrollView
78
android:layout_width="fill_parent"
89
android:layout_height="fill_parent">
910
<LinearLayout
1011
android:layout_width="fill_parent"
11-
android:layout_height="wrap_content">
12+
android:layout_height="wrap_content"
13+
android:orientation="vertical">
1214

1315

14-
</LinearLayout>
16+
<TextView
17+
android:layout_width="fill_parent"
18+
android:layout_height="wrap_content"
19+
android:textAppearance="?android:attr/textAppearanceMedium"
20+
android:text="@string/string_description"
21+
android:id="@+id/description"
22+
android:gravity="center_horizontal"
23+
android:textStyle="italic"
24+
android:padding="@dimen/margin_small"
25+
android:layout_marginBottom="@dimen/margin_medium"
26+
android:layout_margin="@dimen/margin_medium" />
27+
28+
<TextView
29+
android:layout_width="fill_parent"
30+
android:layout_height="wrap_content"
31+
android:textAppearance="?android:attr/textAppearanceMedium"
32+
android:text="Developed by : \nDeepankar Tyagi(codebuff)"
33+
android:id="@+id/developer"
34+
android:gravity="center_horizontal"
35+
android:layout_margin="@dimen/margin_medium"
36+
android:textStyle="italic" />
37+
38+
<TextView
39+
android:layout_width="fill_parent"
40+
android:layout_height="wrap_content"
41+
android:textAppearance="?android:attr/textAppearanceMedium"
42+
android:text="Icon by : \nChhavi Sharma"
43+
android:id="@+id/icon_by"
44+
android:gravity="center_horizontal"
45+
android:layout_margin="@dimen/margin_medium" />
46+
</LinearLayout>
1547

1648
</ScrollView>
1749

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
android:layout_width="wrap_content"
103103
android:layout_height="wrap_content"
104104
android:layout_margin="@dimen/margin_medium"
105-
android:text="@string/string_description" />
105+
android:text="See Setup Help" />
106106
</android.support.v7.widget.CardView>
107107

108108

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

+2-11
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,15 @@
55
android:paddingTop="@dimen/activity_vertical_margin"
66
android:paddingBottom="@dimen/activity_vertical_margin"
77
tools:context="net.codebuff.intentio.ui.week">
8-
<TextView
9-
android:text="@string/hello_world"
10-
android:layout_width="wrap_content"
11-
android:layout_height="wrap_content"/>
12-
<TextView
13-
android:text="@string/hello_world"
14-
android:layout_width="wrap_content"
15-
android:layout_height="wrap_content"
16-
android:id="@+id/textView4"
17-
android:layout_alignParentTop="true"/>
8+
9+
1810

1911
<TextView
2012
android:layout_width="wrap_content"
2113
android:layout_height="wrap_content"
2214
android:textAppearance="?android:attr/textAppearanceLarge"
2315
android:text="Scroll down to see full schedule"
2416
android:id="@+id/week"
25-
android:layout_below="@+id/textView4"
2617
android:layout_centerHorizontal="true"/>
2718

2819
<ScrollView

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

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,43 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="match_parent" android:layout_height="match_parent">
2+
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent" android:layout_height="match_parent"
4+
android:id="@+id/about"
5+
android:background="@color/background_material_light">
46

5-
</LinearLayout>
7+
<ScrollView
8+
android:layout_width="fill_parent"
9+
android:layout_height="fill_parent">
10+
<LinearLayout
11+
android:layout_width="fill_parent"
12+
android:layout_height="wrap_content"
13+
android:orientation="vertical">
14+
15+
16+
<TextView
17+
android:layout_width="fill_parent"
18+
android:layout_height="wrap_content"
19+
android:textAppearance="?android:attr/textAppearanceMedium"
20+
android:text="@string/string_incorrect_file"
21+
android:id="@+id/incorrect_file"
22+
android:gravity="center_horizontal"
23+
android:textStyle="italic"
24+
android:padding="@dimen/margin_small"
25+
android:layout_marginBottom="@dimen/margin_medium"
26+
android:layout_margin="@dimen/margin_medium" />
27+
28+
29+
30+
<TextView
31+
android:layout_width="fill_parent"
32+
android:layout_height="wrap_content"
33+
android:textAppearance="?android:attr/textAppearanceMedium"
34+
android:text=""
35+
android:id="@+id/faq_link"
36+
android:gravity="center_horizontal"
37+
android:layout_margin="@dimen/margin_medium" />
38+
</LinearLayout>
39+
40+
</ScrollView>
41+
42+
43+
</android.support.v7.widget.CardView>

0 commit comments

Comments
 (0)