Skip to content

Commit

Permalink
Update most dialogs to use material design style.
Browse files Browse the repository at this point in the history
This updates most dialogs to use the appcompat AlertDialog. This patch
also improves the layouts on some of the dialogs, and brings up the
keyboard by default for "add tag" and "jump" dialogs.

This does not update any ProgressDialogs (since ProgressDialogs are not
mentioned in the material design guidelines and are considered "bad ui,"
appcompat will not support them - Quran should likely move away from
using these in the few places remaining within the app).

It also does not update the list preference for "download amount," but
this can easily be done later on insha'Allah.
  • Loading branch information
ahmedre committed May 31, 2015
1 parent d0d7307 commit fe9f19c
Show file tree
Hide file tree
Showing 10 changed files with 45 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.quran.labs.androidquran.util.QuranScreenInfo;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
Expand All @@ -21,6 +20,7 @@
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;

public class QuranDataActivity extends Activity implements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import com.quran.labs.androidquran.widgets.SlidingUpPanelLayout;

import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.app.SearchManager;
import android.content.BroadcastReceiver;
import android.content.Context;
Expand All @@ -76,6 +75,7 @@
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.quran.labs.androidquran.util.UpgradeTranslationListener;
import com.quran.labs.androidquran.widgets.SlidingTabLayout;

import android.app.AlertDialog;
import android.app.SearchManager;
import android.content.Context;
import android.content.DialogInterface;
Expand All @@ -39,6 +38,7 @@
import android.support.v4.view.MenuItemCompat;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.SearchView;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.quran.labs.androidquran.util.QuranFileUtils;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
Expand All @@ -22,6 +21,7 @@
import android.preference.PreferenceManager;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
import com.quran.labs.androidquran.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;

public class AddTagDialog extends DialogFragment {
Expand Down Expand Up @@ -84,7 +85,13 @@ public void onClick(DialogInterface dialog, int which) {
return builder.create();
}

public interface OnTagChangedListener {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

public interface OnTagChangedListener {
void onTagAdded(String name);
void onTagUpdated(long id, String name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@
import com.quran.labs.androidquran.widgets.spinner.SpinnerCompat;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.ArrayAdapter;
import android.widget.EditText;
Expand Down Expand Up @@ -147,7 +148,7 @@ public void onNothingSelected(AdapterViewCompat<?> arg0) {
});

builder.setView(layout);
builder.setNeutralButton(getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
builder.setPositiveButton(getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
try {
Expand Down Expand Up @@ -177,6 +178,12 @@ public void onClick(DialogInterface dialog, int which) {
return builder.create();
}

@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}

private void goToPage(String text) {
int page;
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
package com.quran.labs.androidquran.ui.fragment;

import android.app.AlertDialog;
import com.quran.labs.androidquran.QuranPreferenceActivity;
import com.quran.labs.androidquran.R;
import com.quran.labs.androidquran.data.Constants;
import com.quran.labs.androidquran.ui.preference.DataListPreference;
import com.quran.labs.androidquran.util.QuranFileUtils;
import com.quran.labs.androidquran.util.QuranScreenInfo;
import com.quran.labs.androidquran.util.QuranSettings;
import com.quran.labs.androidquran.util.StorageUtils;

import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
Expand All @@ -12,19 +20,11 @@
import android.preference.Preference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceFragment;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.Log;
import android.widget.Toast;

import com.quran.labs.androidquran.QuranPreferenceActivity;
import com.quran.labs.androidquran.R;
import com.quran.labs.androidquran.data.Constants;
import com.quran.labs.androidquran.ui.preference.DataListPreference;
import com.quran.labs.androidquran.util.QuranFileUtils;
import com.quran.labs.androidquran.util.QuranScreenInfo;
import com.quran.labs.androidquran.util.QuranSettings;
import com.quran.labs.androidquran.util.StorageUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.quran.labs.androidquran.ui.helpers.BookmarkHandler;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
Expand All @@ -17,6 +16,7 @@
import android.support.annotation.NonNull;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
Expand Down
13 changes: 7 additions & 6 deletions app/src/main/res/layout/jump_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp">
android:paddingTop="8dp"
android:paddingLeft="24dp"
android:paddingRight="24dp">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/gotoPage"
android:textStyle="bold"/>
android:text="@string/gotoPage"/>

<EditText
android:id="@+id/page_number"
Expand All @@ -23,8 +23,9 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/menu_jump"
android:textStyle="bold"/>
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:text="@string/menu_jump"/>

<LinearLayout
android:layout_width="match_parent"
Expand Down
11 changes: 5 additions & 6 deletions app/src/main/res/layout/tag_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="8dp"
android:paddingRight="8dp" >
android:paddingLeft="24dp"
android:paddingRight="24dp"
android:paddingTop="8dp">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/tag_name"
android:textStyle="bold" />
android:text="@string/tag_name"/>

<EditText
android:id="@+id/tag_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text|textMultiLine" />

android:inputType="text" />
</LinearLayout>

0 comments on commit fe9f19c

Please sign in to comment.