Skip to content

Commit

Permalink
Bug fixes and UI improvements
Browse files Browse the repository at this point in the history
Fixed bugs in Notification Schedule app setting, "Setup Apps" page
regarding badly sorted app list and with the "What's New" section not
showing up on app update correctly. Additionally, made UI improvements.
  • Loading branch information
abhijitvalluri committed Feb 8, 2017
1 parent 84d46d6 commit 70029a4
Show file tree
Hide file tree
Showing 10 changed files with 244 additions and 188 deletions.
Binary file modified app/app-release.apk
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ protected void onPostExecute(Void result) {
setupAdapter();
}
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -237,14 +238,6 @@ private AppSelection getAppSelection(String appPackageName) {

private Void appListTask() {
List<ResolveInfo> packages = Func.getInstalledPackages(mPackageManager);
Collections.sort(packages, new Comparator<ResolveInfo>() {
@Override
public int compare(ResolveInfo lhs, ResolveInfo rhs) {
return String.CASE_INSENSITIVE_ORDER.compare(
lhs.loadLabel(mPackageManager).toString(),
rhs.loadLabel(mPackageManager).toString());
}
});

// getAppSelectionsSubList is also needed for the subsequent calls to contains()
List<AppSelection> appSelections = mAppSelectionsStore.getAppSelections();
Expand Down Expand Up @@ -402,6 +395,12 @@ private class ActivityAdapter extends RecyclerView.Adapter<ActivityHolder> {

public ActivityAdapter(List<AppSelection> appSelectionsSubList) {
mAppSelectionsSubList = appSelectionsSubList;
Collections.sort(mAppSelectionsSubList, new Comparator<AppSelection>() {
@Override
public int compare(AppSelection lhs, AppSelection rhs) {
return String.CASE_INSENSITIVE_ORDER.compare(lhs.getAppName(), rhs.getAppName());
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

if (mPreferences.getInt(getString(R.string.version_key), 0) < Constants.VERSION_CODE
&& mPreferences.getInt(getString(R.string.version_key), 0) > 0) {
&& mPreferences.getBoolean(getString(R.string.done_first_launch_key), false)) {
// App has been updated
AppSelectionsStore store = AppSelectionsStore.get(this);
List<AppSelection> appSelections = store.getAppSelections();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,12 @@ public void onClick(View v) {
setButtonNextFunction(BUTTON_NEXT_FUNCTION_NEXT_FINISH);
}

@Override
public void onBackPressed() {
super.onBackPressed();
overridePendingTransition(R.transition.right_in, R.transition.right_out);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(requestCode) {
Expand Down
117 changes: 69 additions & 48 deletions app/src/main/res/layout-land/fragment_home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,90 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/white">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/instructionsTV"
android:textSize="18sp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin_landscape"
android:paddingBottom="@dimen/activity_vertical_margin_landscape"
android:text="@string/instructions"

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:foreground="@color/lightGrey_translucent"
android:textColor="@color/material_grey900"/>
android:orientation="vertical"
android:background="@drawable/bottom_gray_border">
<TextView
android:id="@+id/instructionsTV"
android:textSize="18sp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin_landscape"
android:paddingBottom="@dimen/activity_vertical_margin_landscape"
android:text="@string/instructions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:textColor="@color/material_grey900"/>
</LinearLayout>

<TextView
android:id="@+id/appSelectionTV"
android:textSize="18sp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin_landscape"
android:paddingBottom="@dimen/activity_vertical_margin_landscape"
android:text="@string/app_choices"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:foreground="@color/veryLightGrey_translucent"
android:textColor="@color/material_grey900"/>
android:orientation="vertical"
android:background="@drawable/bottom_gray_border">
<TextView
android:id="@+id/appSelectionTV"
android:textSize="18sp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin_landscape"
android:paddingBottom="@dimen/activity_vertical_margin_landscape"
android:text="@string/app_choices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:textColor="@color/material_grey900"/>
</LinearLayout>

<TextView
android:id="@+id/demoNotifTV"
android:textSize="18sp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin_landscape"
android:paddingBottom="@dimen/activity_vertical_margin_landscape"
android:text="@string/test_notification"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:foreground="@color/superLightGrey_translucent"
android:textColor="@color/material_grey900"/>
android:orientation="vertical"
android:background="@drawable/bottom_gray_border">
<TextView
android:id="@+id/demoNotifTV"
android:textSize="18sp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin_landscape"
android:paddingBottom="@dimen/activity_vertical_margin_landscape"
android:text="@string/test_notification"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:textColor="@color/material_grey900"/>
</LinearLayout>

<TextView
android:id="@+id/notificationAccessTV"
android:textSize="18sp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin_landscape"
android:paddingBottom="@dimen/activity_vertical_margin_landscape"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/notification_access_enable_textView"
android:background="?attr/selectableItemBackground"
android:foreground="@color/ultraLightGrey_translucent"
android:textColor="@color/material_grey900"/>

android:orientation="vertical"
android:background="@drawable/bottom_gray_border">
<TextView
android:id="@+id/notificationAccessTV"
android:textSize="18sp"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin_landscape"
android:paddingBottom="@dimen/activity_vertical_margin_landscape"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/notification_access_enable_textView"
android:background="?attr/selectableItemBackground"
android:textColor="@color/material_grey900"/>
</LinearLayout>
</LinearLayout>


Expand Down
157 changes: 84 additions & 73 deletions app/src/main/res/layout/activity_app_settings.xml
Original file line number Diff line number Diff line change
@@ -1,93 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="@dimen/activity_padding">
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:labelFor="@+id/filterText"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/filter_heading"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:labelFor="@+id/filterText"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/filter_desc"/>

<EditText
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:id="@+id/filterText"/>
android:orientation="vertical"
android:padding="@dimen/activity_padding"
android:descendantFocusability="beforeDescendants"
android:focusable="true"
android:focusableInTouchMode="true">

<Space
android:layout_width="match_parent"
android:layout_height="@dimen/activity_padding"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:labelFor="@+id/filterText"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/filter_heading"/>

<Switch
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/discard_empty_notifications"
android:id="@+id/discard_empty"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:labelFor="@+id/filterText"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/filter_desc"/>

<Space
android:layout_width="match_parent"
android:layout_height="@dimen/activity_padding"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:id="@+id/filterText"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/schedule_heading"/>
<Space
android:layout_width="match_parent"
android:layout_height="@dimen/activity_padding"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/schedule_desc"/>
<Switch
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/discard_empty_notifications"
android:id="@+id/discard_empty"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
style="?android:attr/buttonBarStyle">
<Space
android:layout_width="match_parent"
android:layout_height="@dimen/activity_padding"/>

<Button
android:id="@+id/start_time"
android:layout_width="0dp"
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
style="?android:attr/buttonBarButtonStyle"
tools:text="12:00 AM"
android:textStyle="bold"
android:textSize="16sp"/>
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/schedule_heading"/>

<TextView
android:layout_width="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="to"
android:gravity="center"/>
android:text="@string/schedule_desc"/>

<Button
android:id="@+id/stop_time"
android:layout_width="0dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
style="?android:attr/buttonBarButtonStyle"
tools:text="11:59 PM"
android:textStyle="bold"
android:textSize="16sp"/>
android:orientation="horizontal"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
style="?android:attr/buttonBarStyle">

<Button
android:id="@+id/start_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
style="?android:attr/buttonBarButtonStyle"
tools:text="12:00 AM"
android:textStyle="bold"
android:textSize="16sp"/>

<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="to"
android:gravity="center"/>

<Button
android:id="@+id/stop_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
style="?android:attr/buttonBarButtonStyle"
tools:text="11:59 PM"
android:textStyle="bold"
android:textSize="16sp"/>
</LinearLayout>
</LinearLayout>
</ScrollView>

</LinearLayout>
2 changes: 1 addition & 1 deletion app/src/main/res/layout/app_select_list_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@null"
android:background="?attr/selectableItemBackground"
android:src="@drawable/ic_settings_black_24dp"
android:alpha="0.5"/>

Expand Down
Loading

0 comments on commit 70029a4

Please sign in to comment.