Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replaced AlertDialog without AppCompatAlertDialog #924

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ dependencies {
compile 'com.viewpagerindicator:library:2.4.1@aar'
compile 'com.squareup.okio:okio:1.1.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile('com.afollestad.material-dialogs:core:0.8.0.1@aar') {
transitive = true
}
compile 'com.bugsnag:bugsnag-android:+'

//Self compiled .aar version of wishlist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.util.Log;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
import static android.app.Activity.RESULT_OK;
import static android.content.DialogInterface.BUTTON_NEGATIVE;
import static android.content.DialogInterface.BUTTON_POSITIVE;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AlertDialog;

/**
* Helper to display a confirmation dialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
package com.github.pockethub.ui;

import static android.app.Activity.RESULT_CANCELED;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;

import roboguice.fragment.RoboDialogFragment;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
*/
package com.github.pockethub.ui;

import android.app.AlertDialog;
import android.content.Context;
import android.support.v7.app.AlertDialog;

import com.github.pockethub.R;

/**
* Alert dialog using the Holo Light theme
Expand All @@ -30,7 +32,7 @@ public class LightAlertDialog extends AlertDialog {
* @return dialog
*/
public static AlertDialog create(final Context context) {
return new LightAlertDialog(context, THEME_HOLO_LIGHT);
return new LightAlertDialog(context, R.style.Theme_GitHub_Alert_Dialog_Style);
}

private LightAlertDialog(final Context context, final int theme) {
Expand All @@ -53,7 +55,7 @@ public static class Builder extends AlertDialog.Builder {
* @return dialog builder
*/
public static LightAlertDialog.Builder create(final Context context) {
return new LightAlertDialog.Builder(context, THEME_HOLO_LIGHT);
return new LightAlertDialog.Builder(context, R.style.Theme_GitHub_Alert_Dialog_Style);
}

private Builder(Context context) {
Expand Down
18 changes: 7 additions & 11 deletions app/src/main/java/com/github/pockethub/ui/NewsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@
*/
package com.github.pockethub.ui;

import static android.content.Intent.ACTION_VIEW;
import static android.content.Intent.CATEGORY_BROWSABLE;
import static com.alorma.github.sdk.bean.dto.response.events.EventType.*;
import static org.eclipse.egit.github.core.event.Event.TYPE_COMMIT_COMMENT;
import static org.eclipse.egit.github.core.event.Event.TYPE_DOWNLOAD;
import static org.eclipse.egit.github.core.event.Event.TYPE_PUSH;
import android.app.AlertDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
Expand All @@ -33,13 +27,11 @@
import com.alorma.github.sdk.bean.dto.response.Commit;
import com.alorma.github.sdk.bean.dto.response.CommitComment;
import com.alorma.github.sdk.bean.dto.response.Gist;
import com.alorma.github.sdk.bean.dto.response.GitReference;
import com.alorma.github.sdk.bean.dto.response.GithubEvent;
import com.alorma.github.sdk.bean.dto.response.Issue;
import com.alorma.github.sdk.bean.dto.response.Release;
import com.alorma.github.sdk.bean.dto.response.Repo;
import com.alorma.github.sdk.bean.dto.response.User;
import com.alorma.github.sdk.bean.dto.response.events.EventType;
import com.alorma.github.sdk.bean.dto.response.events.payload.CommitCommentEventPayload;
import com.alorma.github.sdk.bean.dto.response.events.payload.PushEventPayload;
import com.alorma.github.sdk.bean.dto.response.events.payload.ReleaseEventPayload;
Expand All @@ -63,10 +55,14 @@
import com.google.gson.Gson;
import com.google.inject.Inject;

import org.eclipse.egit.github.core.event.CommitCommentPayload;

import java.util.List;

import static android.content.Intent.ACTION_VIEW;
import static android.content.Intent.CATEGORY_BROWSABLE;
import static com.alorma.github.sdk.bean.dto.response.events.EventType.CommitCommentEvent;
import static com.alorma.github.sdk.bean.dto.response.events.EventType.DownloadEvent;
import static com.alorma.github.sdk.bean.dto.response.events.EventType.PushEvent;

/**
* Base news fragment class with utilities for subclasses to built on
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
import static com.github.pockethub.RequestCodes.COMMENT_CREATE;
import android.accounts.Account;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.Menu;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import static android.content.DialogInterface.BUTTON_NEGATIVE;
import static android.content.DialogInterface.BUTTON_NEUTRAL;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
import static android.content.DialogInterface.BUTTON_NEUTRAL;
import static android.content.DialogInterface.BUTTON_POSITIVE;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import static android.content.DialogInterface.BUTTON_NEGATIVE;
import static android.content.DialogInterface.BUTTON_NEUTRAL;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import static android.app.Activity.RESULT_OK;
import static android.content.DialogInterface.BUTTON_NEGATIVE;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import static com.github.pockethub.ResultCodes.RESOURCE_CHANGED;
import static java.util.Locale.US;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.Loader;
import android.support.v7.app.AlertDialog;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ListView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@
*/
package com.github.pockethub.ui.repo;

import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
import static com.github.pockethub.Intents.EXTRA_REPOSITORY;
import static com.github.pockethub.ResultCodes.RESOURCE_CHANGED;
import static com.github.pockethub.ui.repo.RepositoryPagerAdapter.ITEM_CODE;
import static com.github.pockethub.util.TypefaceUtils.ICON_CODE;
import static com.github.pockethub.util.TypefaceUtils.ICON_COMMIT;
import static com.github.pockethub.util.TypefaceUtils.ICON_ISSUE_OPEN;
import static com.github.pockethub.util.TypefaceUtils.ICON_NEWS;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
Expand All @@ -33,7 +25,6 @@
import android.view.MenuItem;
import android.widget.ProgressBar;

import com.afollestad.materialdialogs.MaterialDialog;
import com.alorma.github.basesdk.client.BaseClient;
import com.alorma.github.sdk.bean.dto.response.Repo;
import com.alorma.github.sdk.bean.dto.response.User;
Expand All @@ -48,11 +39,11 @@
import com.github.pockethub.Intents.Builder;
import com.github.pockethub.R;
import com.github.pockethub.core.repo.RepositoryUtils;
import com.github.pockethub.ui.LightAlertDialog;
import com.github.pockethub.ui.TabPagerActivity;
import com.github.pockethub.ui.user.UriLauncherActivity;
import com.github.pockethub.ui.user.UserViewActivity;
import com.github.pockethub.util.AvatarLoader;
import com.github.pockethub.util.ConvertUtils;
import com.github.pockethub.util.InfoUtils;
import com.github.pockethub.util.ShareUtils;
import com.github.pockethub.util.ToastUtils;
Expand All @@ -61,10 +52,20 @@
import retrofit.RetrofitError;
import retrofit.client.Response;

import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
import static android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP;
import static com.github.pockethub.Intents.EXTRA_REPOSITORY;
import static com.github.pockethub.ResultCodes.RESOURCE_CHANGED;
import static com.github.pockethub.ui.repo.RepositoryPagerAdapter.ITEM_CODE;
import static com.github.pockethub.util.TypefaceUtils.ICON_CODE;
import static com.github.pockethub.util.TypefaceUtils.ICON_COMMIT;
import static com.github.pockethub.util.TypefaceUtils.ICON_ISSUE_OPEN;
import static com.github.pockethub.util.TypefaceUtils.ICON_NEWS;

/**
* Activity to view a repository
*/
public class RepositoryViewActivity extends TabPagerActivity<RepositoryPagerAdapter>{
public class RepositoryViewActivity extends TabPagerActivity<RepositoryPagerAdapter> {
public static final String TAG = "RepositoryViewActivity";

/**
Expand Down Expand Up @@ -237,7 +238,7 @@ public void onFail(RetrofitError error) {
}
});
unstarRepoClient.execute();
}else {
} else {
StarRepoClient starRepoClient = new StarRepoClient(this, repository.owner.login, repository.name);
starRepoClient.setOnResultCallback(new BaseClient.OnResultCallback<Response>() {
@Override
Expand Down Expand Up @@ -298,40 +299,30 @@ public void onFail(RetrofitError error) {
}

private void deleteRepository() {
new MaterialDialog.Builder(this)
.title(R.string.are_you_sure)
.content(R.string.unexpected_bad_things)
.positiveText(R.string.not_sure)
.negativeText(R.string.delete_cap)
.callback(new MaterialDialog.ButtonCallback() {
LightAlertDialog.Builder builder = LightAlertDialog.Builder.create(getApplicationContext());
builder.setTitle(R.string.are_you_sure);
builder.setMessage(getString(R.string.unexpected_bad_things));
builder.setPositiveButton(R.string.not_sure, null);
builder.setNegativeButton(R.string.delete_cap, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
DeleteRepoClient repoClient = new DeleteRepoClient(RepositoryViewActivity.this,
InfoUtils.createRepoInfo(repository));
repoClient.setOnResultCallback(new BaseClient.OnResultCallback<Response>() {
@Override
public void onPositive(MaterialDialog dialog) {
super.onPositive(dialog);
dialog.dismiss();
public void onResponseOk(Response response, Response r) {
onBackPressed();
ToastUtils.show(RepositoryViewActivity.this, R.string.delete_successful);
}

@Override
public void onNegative(MaterialDialog dialog) {
super.onNegative(dialog);
dialog.dismiss();

DeleteRepoClient repoClient = new DeleteRepoClient(RepositoryViewActivity.this,
InfoUtils.createRepoInfo(repository));
repoClient.setOnResultCallback(new BaseClient.OnResultCallback<Response>() {
@Override
public void onResponseOk(Response response, Response r) {
onBackPressed();
ToastUtils.show(RepositoryViewActivity.this, R.string.delete_successful);
}

@Override
public void onFail(RetrofitError error) {
ToastUtils.show(RepositoryViewActivity.this, R.string.error_deleting_repository);
}
});
repoClient.execute();
public void onFail(RetrofitError error) {
ToastUtils.show(RepositoryViewActivity.this, R.string.error_deleting_repository);
}
})
.show();
});
repoClient.execute();
}
});
builder.create().show();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
import static org.eclipse.egit.github.core.client.IGitHubConstants.HOST_GISTS;
import static org.eclipse.egit.github.core.client.IGitHubConstants.PROTOCOL_HTTPS;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.text.TextUtils;

import com.alorma.github.sdk.bean.dto.response.Issue;
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/res/values/theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@
<item name="colorAccent">@color/accent</item>
</style>

</resources>
<style name="Theme.GitHub.Alert.Dialog.Style" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:textColorPrimary">@color/accent</item>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be the default value for android:textColorPrimary at this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on your main style. With our GitHub . Light it is black...

</style>

</resources>