Skip to content

Commit 6ced587

Browse files
octacodecroozeus
authored andcommitted
<#Issue 5><Addition of a Create Project in Saved Projects> (#170)
* <#Issue 5><Addition of a Create Project in Saved Projects> * Made the following changes: 1)Replaced text with FAB 2) RemovedBuildmLearn logo from the SavedProjects. * Making the PR independent of Yoyo class and displaying the message of 'No Saved Projects yet' in the Saved Projects Fragment. * Implemented the suggestions from @opticod
1 parent 90b8b70 commit 6ced587

6 files changed

Lines changed: 105 additions & 53 deletions

File tree

source-code/app/src/main/java/org/buildmlearn/toolkit/fragment/DraftsFragment.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,13 @@ private void setAdapter(DraftProjectAdapter adapter) {
149149
}
150150

151151
private void setEmptyText() {
152-
152+
getView().findViewById(R.id.newProject).setVisibility(View.GONE);
153+
getView().findViewById(R.id.no_saved_project).setVisibility(View.GONE);
154+
getView().findViewById(R.id.no_saved_apks).setVisibility(View.GONE);
153155
if (mListView.getAdapter().getCount() == 0) {
154-
getView().findViewById(R.id.empty).setVisibility(View.VISIBLE);
156+
getView().findViewById(R.id.no_saved_drafts).setVisibility(View.VISIBLE);
155157
} else {
156-
getView().findViewById(R.id.empty).setVisibility(View.GONE);
158+
getView().findViewById(R.id.no_saved_drafts).setVisibility(View.GONE);
157159
}
158160
}
159161

source-code/app/src/main/java/org/buildmlearn/toolkit/fragment/LoadApkFragment.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,13 @@ private void setAdapter(SavedApiAdapter adapter) {
186186
}
187187

188188
private void setEmptyText() {
189+
getView().findViewById(R.id.newProject).setVisibility(View.GONE);
190+
getView().findViewById(R.id.no_saved_project).setVisibility(View.GONE);
191+
getView().findViewById(R.id.no_saved_drafts).setVisibility(View.GONE);
189192
if (mListView.getAdapter().getCount() == 0) {
190-
getView().findViewById(R.id.empty).setVisibility(View.VISIBLE);
193+
getView().findViewById(R.id.no_saved_apks).setVisibility(View.VISIBLE);
191194
} else {
192-
getView().findViewById(R.id.empty).setVisibility(View.GONE);
195+
getView().findViewById(R.id.no_saved_apks).setVisibility(View.GONE);
193196
}
194197
}
195198

source-code/app/src/main/java/org/buildmlearn/toolkit/fragment/LoadProjectFragment.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
import org.buildmlearn.toolkit.R;
3636
import org.buildmlearn.toolkit.ToolkitApplication;
37+
import org.buildmlearn.toolkit.activity.TemplateActivity;
3738
import org.buildmlearn.toolkit.activity.TemplateEditor;
3839
import org.buildmlearn.toolkit.adapter.SavedProjectAdapter;
3940
import org.buildmlearn.toolkit.constant.Constants;
@@ -209,11 +210,21 @@ private void setAdapter(SavedProjectAdapter adapter) {
209210
}
210211

211212
private void setEmptyText() {
212-
213+
getView().findViewById(R.id.no_saved_drafts).setVisibility(View.GONE);
214+
getView().findViewById(R.id.no_saved_apks).setVisibility(View.GONE);
213215
if (mListView.getAdapter().getCount() == 0) {
214-
getView().findViewById(R.id.empty).setVisibility(View.VISIBLE);
216+
getView().findViewById(R.id.no_saved_project).setVisibility(View.VISIBLE);
217+
View view= getView().findViewById(R.id.newProject);
218+
view.setVisibility(View.VISIBLE);
219+
view.setOnClickListener(new View.OnClickListener() {
220+
@Override
221+
public void onClick(View v) {
222+
startActivity(new Intent(getActivity(),TemplateActivity.class));
223+
}
224+
});
215225
} else {
216-
getView().findViewById(R.id.empty).setVisibility(View.GONE);
226+
getView().findViewById(R.id.newProject).setVisibility(View.GONE);
227+
getView().findViewById(R.id.no_saved_project).setVisibility(View.GONE);
217228
}
218229
}
219230

source-code/app/src/main/res/layout/fragment_loadproject_grid.xml

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:tools="http://schemas.android.com/tools"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6+
xmlns:fab="http://schemas.android.com/apk/res-auto"
67
tools:context="org.buildmlearn.toolkit.fragment.LoadProjectFragment">
78

89
<GridView
@@ -11,30 +12,47 @@
1112
android:layout_height="match_parent"
1213
android:numColumns="2" />
1314

14-
<LinearLayout
15-
android:id="@+id/empty"
15+
<android.support.design.widget.FloatingActionButton
16+
android:id="@+id/newProject"
1617
android:layout_width="wrap_content"
1718
android:layout_height="wrap_content"
18-
android:layout_centerHorizontal="true"
19-
android:layout_centerVertical="true"
20-
android:gravity="center"
21-
android:orientation="vertical">
22-
23-
24-
<ImageView
25-
android:layout_width="wrap_content"
26-
android:layout_height="wrap_content"
27-
android:contentDescription="@string/buildmlearn_logo"
28-
android:src="@drawable/logo_bg_dark" />
29-
30-
<view
31-
android:id="@+id/title"
32-
style="@style/TextView.Empty"
33-
class="org.buildmlearn.toolkit.views.TextViewPlus"
34-
android:layout_width="wrap_content"
35-
android:layout_height="wrap_content"
36-
android:padding="@dimen/md_simplelist_icon_margin"
37-
android:text="@string/no_item" />
38-
</LinearLayout>
19+
android:layout_alignParentBottom="true"
20+
android:layout_alignParentEnd="true"
21+
android:layout_alignParentRight="true"
22+
android:layout_marginBottom="@dimen/floating_action_button_padding_bottom_right"
23+
android:layout_marginEnd="@dimen/floating_action_button_padding_bottom_right"
24+
android:layout_marginRight="@dimen/floating_action_button_padding_bottom_right"
25+
android:src="@drawable/ic_add_white_24dp"
26+
fab:backgroundTint="@color/color_accent"
27+
fab:fabSize="normal" />
28+
29+
<TextView
30+
android:id="@+id/no_saved_project"
31+
android:textAppearance="?android:textAppearanceMedium"
32+
android:layout_centerInParent="true"
33+
android:layout_width="wrap_content"
34+
android:layout_height="wrap_content"
35+
android:padding="@dimen/md_simplelist_icon_margin"
36+
android:text="@string/no_saved_projects" />
37+
38+
<TextView
39+
android:id="@+id/no_saved_apks"
40+
android:textAppearance="?android:textAppearanceMedium"
41+
android:layout_centerInParent="true"
42+
android:layout_width="wrap_content"
43+
android:layout_height="wrap_content"
44+
android:padding="@dimen/md_simplelist_icon_margin"
45+
android:text="@string/no_saved_apks" />
46+
47+
<TextView
48+
android:id="@+id/no_saved_drafts"
49+
android:textAppearance="?android:textAppearanceMedium"
50+
android:layout_centerInParent="true"
51+
android:layout_width="wrap_content"
52+
android:layout_height="wrap_content"
53+
android:padding="@dimen/md_simplelist_icon_margin"
54+
android:text="@string/no_saved_drafts" />
55+
56+
3957

4058
</RelativeLayout>

source-code/app/src/main/res/layout/fragment_loadproject_list.xml

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
xmlns:tools="http://schemas.android.com/tools"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6+
xmlns:fab="http://schemas.android.com/apk/res-auto"
67
tools:context="org.buildmlearn.toolkit.fragment.LoadProjectFragment">
78

89
<ListView
@@ -11,30 +12,45 @@
1112
android:layout_height="match_parent"
1213
android:divider="@android:color/transparent" />
1314

14-
<LinearLayout
15-
android:id="@+id/empty"
15+
<android.support.design.widget.FloatingActionButton
16+
android:id="@+id/newProject"
1617
android:layout_width="wrap_content"
1718
android:layout_height="wrap_content"
18-
android:layout_centerHorizontal="true"
19-
android:layout_centerVertical="true"
20-
android:gravity="center"
21-
android:orientation="vertical">
19+
android:layout_alignParentBottom="true"
20+
android:layout_alignParentEnd="true"
21+
android:layout_alignParentRight="true"
22+
android:layout_marginBottom="@dimen/floating_action_button_padding_bottom_right"
23+
android:layout_marginEnd="@dimen/floating_action_button_padding_bottom_right"
24+
android:layout_marginRight="@dimen/floating_action_button_padding_bottom_right"
25+
android:src="@drawable/ic_add_white_24dp"
26+
fab:backgroundTint="@color/color_accent"
27+
fab:fabSize="normal" />
2228

29+
<TextView
30+
android:id="@+id/no_saved_project"
31+
android:textAppearance="?android:textAppearanceMedium"
32+
android:layout_centerInParent="true"
33+
android:layout_width="wrap_content"
34+
android:layout_height="wrap_content"
35+
android:padding="@dimen/md_simplelist_icon_margin"
36+
android:text="@string/no_saved_projects" />
2337

24-
<ImageView
25-
android:layout_width="wrap_content"
26-
android:layout_height="wrap_content"
27-
android:contentDescription="@string/buildmlearn_logo"
28-
android:src="@drawable/logo_bg_dark" />
38+
<TextView
39+
android:id="@+id/no_saved_apks"
40+
android:textAppearance="?android:textAppearanceMedium"
41+
android:layout_centerInParent="true"
42+
android:layout_width="wrap_content"
43+
android:layout_height="wrap_content"
44+
android:padding="@dimen/md_simplelist_icon_margin"
45+
android:text="@string/no_saved_apks" />
2946

30-
<view
31-
android:id="@+id/title"
32-
style="@style/TextView.Empty"
33-
class="org.buildmlearn.toolkit.views.TextViewPlus"
34-
android:layout_width="wrap_content"
35-
android:layout_height="wrap_content"
36-
android:padding="@dimen/md_simplelist_icon_margin"
37-
android:text="@string/no_item" />
38-
</LinearLayout>
47+
<TextView
48+
android:id="@+id/no_saved_drafts"
49+
android:textAppearance="?android:textAppearanceMedium"
50+
android:layout_centerInParent="true"
51+
android:layout_width="wrap_content"
52+
android:layout_height="wrap_content"
53+
android:padding="@dimen/md_simplelist_icon_margin"
54+
android:text="@string/no_saved_drafts" />
3955

4056
</RelativeLayout>

source-code/app/src/main/res/values/strings.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<string name="dialog_delete_all_msg">Are you sure you clear you Draft?</string>
2222
<string name="dialog_delete_multiple">Are you sure you want to delete the selected items?</string>
2323
<string name="dialog_delete_all_title">Delete All</string>
24-
24+
<string name="no_saved_drafts">"No Saved Drafts Yet"</string>
2525

2626
<!-- Restore Dialog-->
2727

@@ -60,6 +60,7 @@
6060
<string name="list_empty_info">List is Empty!</string>
6161
<string name="previous_info">PREVIOUS</string>
6262
<string name="next_info">NEXT</string>
63+
<string name="no_saved_projects">No Saved Projects yet</string>
6364
<string name="exit_info">EXIT</string>
6465
<string name="about_text_info">This application has been developed using the BuildmLearn Toolkit.\n\nTo know more about BuildmLearn Toolkit visit <a href="https://buildmlearn.org/">here</a>.</string>
6566
<string name="info_thumbnail_info">Info Thumbnail</string>
@@ -383,5 +384,6 @@
383384
<string name="template_thumbnail">Template thumbnail</string>
384385
<string name="show_more">Show more</string>
385386
<string name="tutorial_image">Tutorial image</string>
386-
387+
<string name="create_project">Create Project</string>
388+
<string name="no_saved_apks">"No Saved Apks yet"</string>
387389
</resources>

0 commit comments

Comments
 (0)