Improve alert dialog colors - #546

This commit is contained in:
stom79 2018-11-03 14:45:55 +01:00
parent 47ae159a41
commit 713d12dfa9
38 changed files with 393 additions and 101 deletions

View File

@ -203,6 +203,7 @@ public abstract class BaseMainActivity extends BaseActivity
public static String displayPeertube = null;
private PopupMenu popup;
private String instance_id;
private int style;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -321,7 +322,13 @@ public abstract class BaseMainActivity extends BaseActivity
iconGlobal.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.dark_text), PorterDuff.Mode.SRC_IN);
}
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
FloatingActionButton federatedTimelines = findViewById(R.id.federated_timeline);
delete_instance.setOnClickListener(new View.OnClickListener() {
@ -329,7 +336,7 @@ public abstract class BaseMainActivity extends BaseActivity
public void onClick(View v) {
try{
String title = toolbarTitle.getText().toString();
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this, style);
dialogBuilder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
@ -480,7 +487,7 @@ public abstract class BaseMainActivity extends BaseActivity
public boolean onMenuItemClick(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_add_instance:
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this, style);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.search_instance, null);
dialogBuilder.setView(dialogView);
@ -1188,7 +1195,7 @@ public abstract class BaseMainActivity extends BaseActivity
startActivity(intent);
return true;
case R.id.action_cache:
AlertDialog.Builder builder = new AlertDialog.Builder(BaseMainActivity.this);
AlertDialog.Builder builder = new AlertDialog.Builder(BaseMainActivity.this, style);
builder.setTitle(R.string.cache_title);
long sizeCache = Helper.cacheSize(getCacheDir());
float cacheSize = 0;
@ -1224,7 +1231,7 @@ public abstract class BaseMainActivity extends BaseActivity
int textSize = sharedpreferences.getInt(Helper.SET_TEXT_SIZE,110);
int iconSize = sharedpreferences.getInt(Helper.SET_ICON_SIZE,130);
builder = new AlertDialog.Builder(BaseMainActivity.this);
builder = new AlertDialog.Builder(BaseMainActivity.this, style);
builder.setTitle(R.string.text_size);
@SuppressLint("InflateParams") View popup_quick_settings = getLayoutInflater().inflate( R.layout.popup_text_size, null );
@ -1362,7 +1369,7 @@ public abstract class BaseMainActivity extends BaseActivity
// Asked once for notification opt-in
boolean popupShown = sharedpreferences.getBoolean(Helper.SET_POPUP_PUSH, false);
if(!popupShown){
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this, style);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.popup_quick_settings, null);
dialogBuilder.setView(dialogView);
@ -1551,7 +1558,7 @@ public abstract class BaseMainActivity extends BaseActivity
editor.apply();
break;
case R.id.action_filter:
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this, style);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.filter_regex, null);
dialogBuilder.setView(dialogView);
@ -2364,7 +2371,7 @@ public abstract class BaseMainActivity extends BaseActivity
tabStrip.getChildAt(position).setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(BaseMainActivity.this, style);
dialogBuilder.setPositiveButton(R.string.validate, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {

View File

@ -387,7 +387,8 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
if( account.getHeader() == null || account.getHeader().contains("missing.png"))
set_header_picture_overlay.setVisibility(View.VISIBLE);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
set_profile_save.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -400,8 +401,15 @@ public class EditProfileActivity extends BaseActivity implements OnRetrieveAccou
profile_note = set_profile_description.getText().toString().trim();
else
profile_note = null;
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(EditProfileActivity.this);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(EditProfileActivity.this, style);
LayoutInflater inflater = EditProfileActivity.this.getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.dialog_profile, null);
dialogBuilder.setView(dialogView);

View File

@ -15,6 +15,8 @@
package fr.gouv.etalab.mastodon.activities;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
@ -22,9 +24,14 @@ import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.ActionBar;
import android.support.v7.widget.Toolbar;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
@ -38,6 +45,7 @@ import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveInstanceInterface;
import static fr.gouv.etalab.mastodon.helper.Helper.THEME_LIGHT;
import static fr.gouv.etalab.mastodon.helper.Helper.changeDrawableColor;
@ -73,6 +81,27 @@ public class InstanceActivity extends BaseActivity implements OnRetrieveInstance
if( getSupportActionBar() != null)
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ActionBar actionBar = getSupportActionBar();
if( actionBar != null ) {
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
assert inflater != null;
@SuppressLint("InflateParams") View view = inflater.inflate(R.layout.simple_bar, null);
actionBar.setCustomView(view, new ActionBar.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ImageView toolbar_close = actionBar.getCustomView().findViewById(R.id.toolbar_close);
TextView toolbar_title = actionBar.getCustomView().findViewById(R.id.toolbar_title);
toolbar_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolbar_title.setText(R.string.action_about_instance);
if (theme == THEME_LIGHT){
Toolbar toolbar = actionBar.getCustomView().findViewById(R.id.toolbar);
Helper.colorizeToolbar(toolbar, R.color.black, InstanceActivity.this);
}
}
setContentView(R.layout.activity_instance);
changeDrawableColor(getApplicationContext(), R.drawable.ic_mail_outline,R.color.white);
instance_container = findViewById(R.id.instance_container);

View File

@ -215,7 +215,17 @@ public class ListActivity extends BaseActivity implements OnListActionInterface
startActivity(intent);
return true;
case R.id.action_edit_list:
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ListActivity.this);
int style;
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ListActivity.this, style);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.add_list, null);
dialogBuilder.setView(dialogView);

View File

@ -294,7 +294,16 @@ public class LoginActivity extends BaseActivity {
login_issue.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this, style);
builder.setTitle(R.string.issue_login_title);
TextView message = new TextView(LoginActivity.this);
final SpannableString s =

View File

@ -143,8 +143,6 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
ImageView close_toot = actionBar.getCustomView().findViewById(R.id.close_toot);
if( theme == THEME_LIGHT)
close_toot.setColorFilter(ContextCompat.getColor(getApplicationContext(), R.color.black));
close_toot.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -153,6 +151,9 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
});
TextView toolbarTitle = actionBar.getCustomView().findViewById(R.id.toolbar_title);
pp_actionBar = actionBar.getCustomView().findViewById(R.id.pp_actionBar);
if (theme == THEME_LIGHT){
Helper.colorizeToolbar(actionBar.getCustomView().findViewById(R.id.toolbar), R.color.black, OwnerStatusActivity.this);
}
toolbarTitle.setText(getString(R.string.owner_cached_toots));
}
statuses = new ArrayList<>();
@ -265,6 +266,10 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.option_owner_cache, menu);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if( theme == THEME_LIGHT)
Helper.colorizeIconMenu(menu, R.color.black);
return true;
}
@ -304,7 +309,16 @@ public class OwnerStatusActivity extends BaseActivity implements OnRetrieveFeeds
startService(backupIntent);
return true;
case R.id.action_filter:
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(OwnerStatusActivity.this);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(OwnerStatusActivity.this, style);
LayoutInflater inflater = this.getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.filter_owner_toots, null);
dialogBuilder.setView(dialogView);

View File

@ -404,8 +404,17 @@ public class PeertubeActivity extends BaseActivity implements OnRetrievePeertube
}
public void displayResolution(){
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PeertubeActivity.this);
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder builderSingle = new AlertDialog.Builder(PeertubeActivity.this, style);
builderSingle.setTitle(R.string.pickup_resolution);
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(PeertubeActivity.this, android.R.layout.select_dialog_item);
for(String resolution: peertube.getResolution())

View File

@ -293,6 +293,16 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
public boolean onMenuItemClick(MenuItem item) {
AlertDialog.Builder builderInner;
SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
switch (item.getItemId()) {
case R.id.action_follow_instance:
@ -383,12 +393,12 @@ public class ShowAccountActivity extends BaseActivity implements OnPostActionInt
startActivity(intent);
return true;
case R.id.action_mute:
builderInner = new AlertDialog.Builder(ShowAccountActivity.this);
builderInner = new AlertDialog.Builder(ShowAccountActivity.this, style);
builderInner.setTitle(stringArrayConf[0]);
doActionAccount = API.StatusAction.MUTE;
break;
case R.id.action_block:
builderInner = new AlertDialog.Builder(ShowAccountActivity.this);
builderInner = new AlertDialog.Builder(ShowAccountActivity.this, style);
builderInner.setTitle(stringArrayConf[1]);
doActionAccount = API.StatusAction.BLOCK;
break;

View File

@ -197,6 +197,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
private boolean removed;
private boolean restoredScheduled;
static boolean active = false;
private int style;
@Override
@ -219,7 +220,13 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
default:
setTheme(R.style.AppThemeDark);
}
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
setContentView(R.layout.activity_toot);
ActionBar actionBar = getSupportActionBar();
if( actionBar != null ) {
@ -888,7 +895,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
finish();
return true;
case R.id.action_view_reply:
AlertDialog.Builder alert = new AlertDialog.Builder(TootActivity.this);
AlertDialog.Builder alert = new AlertDialog.Builder(TootActivity.this, style);
alert.setTitle(R.string.toot_reply_content_title);
final TextView input = new TextView(TootActivity.this);
//Set the padding
@ -940,7 +947,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
@Override
public void onSelectCountry(String name, String locale, int flagDrawableResID) {
picker.dismiss();
AlertDialog.Builder transAlert = new AlertDialog.Builder(TootActivity.this);
AlertDialog.Builder transAlert = new AlertDialog.Builder(TootActivity.this, style);
transAlert.setTitle(R.string.translate_toot);
popup_trans = getLayoutInflater().inflate( R.layout.popup_translate, null );
@ -1075,7 +1082,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
return true;
case R.id.action_emoji:
final List<Emojis> emojis = new CustomEmojiDAO(getApplicationContext(), db).getAllEmojis();
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
final AlertDialog.Builder builder = new AlertDialog.Builder(this, style);
int paddingPixel = 15;
float density = getResources().getDisplayMetrics().density;
int paddingDp = (int)(paddingPixel * density);
@ -1136,7 +1143,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
Toast.makeText(getApplicationContext(), R.string.no_draft, Toast.LENGTH_LONG).show();
return true;
}
AlertDialog.Builder builderSingle = new AlertDialog.Builder(TootActivity.this);
AlertDialog.Builder builderSingle = new AlertDialog.Builder(TootActivity.this, style);
builderSingle.setTitle(getString(R.string.choose_toot));
final DraftsListAdapter draftsListAdapter = new DraftsListAdapter(TootActivity.this, drafts);
final int[] ids = new int[drafts.size()];
@ -1154,7 +1161,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
builderSingle.setPositiveButton(R.string.delete_all, new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, int which) {
AlertDialog.Builder builder = new AlertDialog.Builder(TootActivity.this);
AlertDialog.Builder builder = new AlertDialog.Builder(TootActivity.this, style);
builder.setTitle(R.string.delete_all);
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@ -1194,7 +1201,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
Toast.makeText(getApplicationContext(),R.string.toot_error_no_content, Toast.LENGTH_LONG).show();
return true;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(TootActivity.this);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(TootActivity.this, style);
LayoutInflater inflater = this.getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.datetime_picker, null);
dialogBuilder.setView(dialogView);
@ -1465,7 +1472,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
}
private void showAddDescription(final Attachment attachment){
AlertDialog.Builder builderInner = new AlertDialog.Builder(TootActivity.this);
AlertDialog.Builder builderInner = new AlertDialog.Builder(TootActivity.this, style);
builderInner.setTitle(R.string.upload_form_description);
@SuppressLint("InflateParams") View popup_media_description = getLayoutInflater().inflate( R.layout.popup_media_description, null );
@ -1521,7 +1528,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
*/
private void showRemove(final int viewId){
AlertDialog.Builder dialog = new AlertDialog.Builder(TootActivity.this);
AlertDialog.Builder dialog = new AlertDialog.Builder(TootActivity.this, style);
dialog.setMessage(R.string.toot_delete_media);
dialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@ -1569,7 +1576,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
private void tootVisibilityDialog(){
AlertDialog.Builder dialog = new AlertDialog.Builder(TootActivity.this);
AlertDialog.Builder dialog = new AlertDialog.Builder(TootActivity.this, style);
dialog.setTitle(R.string.toot_visibility_tilte);
final String[] stringArray = getResources().getStringArray(R.array.toot_visibility);
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(TootActivity.this, android.R.layout.simple_list_item_1, stringArray);
@ -2213,7 +2220,7 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
checkedValues[i] = toot_content.getText().toString().contains("@" + account.getAcct());
i++;
}
final AlertDialog.Builder builderSingle = new AlertDialog.Builder(TootActivity.this);
final AlertDialog.Builder builderSingle = new AlertDialog.Builder(TootActivity.this, style);
AccountsReplyAdapter accountsReplyAdapter = new AccountsReplyAdapter(TootActivity.this, accounts, checkedValues);
builderSingle.setTitle(getString(R.string.select_accounts)).setAdapter(accountsReplyAdapter, null);
builderSingle.setNegativeButton(R.string.validate, new DialogInterface.OnClickListener() {

View File

@ -82,7 +82,17 @@ public class DomainsListAdapter extends RecyclerView.Adapter implements OnRetrie
holder.domain_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
builder.setMessage(context.getString(R.string.unblock_domain_confirm_message, domain));
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.unblock_domain_confirm)

View File

@ -137,8 +137,17 @@ public class DraftsListAdapter extends BaseAdapter {
holder.draft_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
builder.setMessage(draft.getStatus().getContent() + '\n' + Helper.dateToString(draft.getCreation_date()));
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.remove_draft)

View File

@ -105,11 +105,20 @@ public class FilterAdapter extends BaseAdapter implements OnFilterActionInterfac
for(String ct: filter.getContext())
contextString.append(ct).append(" ");
holder.filter_context.setText(contextString.toString());
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
holder.edit_filter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, style);
LayoutInflater inflater = ((BaseMainActivity)context).getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.add_filter, null);
dialogBuilder.setView(dialogView);
@ -229,7 +238,7 @@ public class FilterAdapter extends BaseAdapter implements OnFilterActionInterfac
holder.delete_filter.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
builder.setTitle(context.getString(R.string.action_filter_delete) );
builder.setMessage(context.getString(R.string.action_lists_confirm_delete) );
builder.setIcon(android.R.drawable.ic_dialog_alert)

View File

@ -125,11 +125,18 @@ public class ListAdapter extends BaseAdapter implements OnListActionInterface {
context.startActivity(intent);
}
});
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
holder.search_container.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
builder.setTitle(context.getString(R.string.action_lists_delete) + ": " + list.getTitle());
builder.setMessage(context.getString(R.string.action_lists_confirm_delete) );
builder.setIcon(android.R.drawable.ic_dialog_alert)

View File

@ -102,6 +102,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
private int behaviorWithAttachments;
private boolean isOnWifi;
private NotificationsListAdapter.ViewHolder holder;
private int style;
public NotificationsListAdapter(Context context, boolean isOnWifi, int behaviorWithAttachments, List<Notification> notifications){
this.context = context;
@ -131,6 +132,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
int textSizePercent = sharedpreferences.getInt(Helper.SET_TEXT_SIZE, 110);
final float scale = context.getResources().getDisplayMetrics().density;
String type = notification.getType();
String typeString = "";
@ -142,6 +144,13 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
}else {
holder.main_container_trans.setAlpha(.1f);
}
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
Drawable imgH = null;
switch (type){
case "mention":
@ -639,7 +648,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
final API.StatusAction doAction;
switch (item.getItemId()) {
case R.id.action_remove:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[0]);
doAction = API.StatusAction.UNSTATUS;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
@ -649,7 +658,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
builderInner.setMessage(Html.fromHtml(status.getContent()));
break;
case R.id.action_mute:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[0]);
doAction = API.StatusAction.MUTE;
break;
@ -657,12 +666,12 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
Helper.openBrowser(context, status.getUrl());
return true;
case R.id.action_block:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[1]);
doAction = API.StatusAction.BLOCK;
break;
case R.id.action_report:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[2]);
doAction = API.StatusAction.REPORT;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
@ -823,7 +832,7 @@ public class NotificationsListAdapter extends RecyclerView.Adapter implements On
private void displayConfirmationNotificationDialog(final Notification notification){
final ArrayList seletedItems = new ArrayList();
AlertDialog dialog = new AlertDialog.Builder(context)
AlertDialog dialog = new AlertDialog.Builder(context, style)
.setTitle(R.string.delete_notification_ask)
.setMultiChoiceItems(new String[]{context.getString(R.string.delete_notification_ask_all)}, null, new DialogInterface.OnMultiChoiceClickListener() {
@Override

View File

@ -149,12 +149,19 @@ public class ScheduledTootsListAdapter extends BaseAdapter {
break;
}
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
//Delete scheduled toot
holder.scheduled_toot_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
builder.setMessage(status.getContent() + '\n' + Helper.dateToString(storedStatus.getCreation_date()));
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.remove_scheduled)
@ -195,7 +202,7 @@ public class ScheduledTootsListAdapter extends BaseAdapter {
holder.scheduled_toot_date.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, style);
LayoutInflater inflater = ((MainActivity)context).getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.datetime_picker, null);
SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, android.content.Context.MODE_PRIVATE);

View File

@ -123,11 +123,18 @@ public class SearchTootsListAdapter extends BaseAdapter {
}
});
final SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
holder.search_container.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
builder.setMessage(context.getString(R.string.delete) + ": " + search);
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

View File

@ -1267,7 +1267,14 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
}
});
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
if( type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE)
holder.status_more.setVisibility(View.GONE);
@ -1322,7 +1329,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
final API.StatusAction doAction;
switch (item.getItemId()) {
case R.id.action_redraft:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[1]);
redraft = true;
doAction = API.StatusAction.UNSTATUS;
@ -1336,7 +1343,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
Helper.openBrowser(context, status.getReblog()!=null?status.getReblog().getUrl():status.getUrl());
return true;
case R.id.action_remove:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[0]);
doAction = API.StatusAction.UNSTATUS;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
@ -1346,14 +1353,14 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
builderInner.setMessage(Html.fromHtml(status.getContent()));
break;
case R.id.action_block_domain:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[3]);
doAction = API.StatusAction.BLOCK_DOMAIN;
String domain = status.getAccount().getAcct().split("@")[1];
builderInner.setMessage(context.getString(R.string.block_domain_confirm_message, domain));
break;
case R.id.action_mute:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[0]);
doAction = API.StatusAction.MUTE;
break;
@ -1388,7 +1395,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
return true;
case R.id.action_timed_mute:
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, style);
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.datetime_picker, null);
dialogBuilder.setView(dialogView);
@ -1472,7 +1479,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
alertDialog.show();
return true;
case R.id.action_block:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[1]);
doAction = API.StatusAction.BLOCK;
break;
@ -1480,7 +1487,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
translateToot(status);
return true;
case R.id.action_report:
builderInner = new AlertDialog.Builder(context);
builderInner = new AlertDialog.Builder(context, style);
builderInner.setTitle(stringArrayConf[2]);
doAction = API.StatusAction.REPORT;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)

View File

@ -72,6 +72,7 @@ public class DisplayBookmarksFragment extends Fragment implements OnRetrieveFeed
textviewNoAction = rootView.findViewById(R.id.no_action);
mainLoader.setVisibility(View.VISIBLE);
new RetrieveFeedsAsyncTask(context, RetrieveFeedsAsyncTask.Type.CACHE_BOOKMARKS, null, DisplayBookmarksFragment.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
return rootView;
}
@ -117,7 +118,17 @@ public class DisplayBookmarksFragment extends Fragment implements OnRetrieveFeed
delete_all.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
builder.setTitle(R.string.delete_all);
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

View File

@ -92,7 +92,17 @@ public class DisplayDraftsFragment extends Fragment {
delete_all.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
builder.setTitle(R.string.delete_all);
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

View File

@ -16,6 +16,7 @@ package fr.gouv.etalab.mastodon.fragments;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.os.Bundle;
@ -39,6 +40,7 @@ import fr.gouv.etalab.mastodon.asynctasks.RetrieveFeedsAsyncTask;
import fr.gouv.etalab.mastodon.client.APIResponse;
import fr.gouv.etalab.mastodon.client.Entities.Peertube;
import fr.gouv.etalab.mastodon.drawers.PeertubeAdapter;
import fr.gouv.etalab.mastodon.helper.Helper;
import fr.gouv.etalab.mastodon.interfaces.OnRetrieveFeedsInterface;
import fr.gouv.etalab.mastodon.sqlite.PeertubeFavoritesDAO;
import fr.gouv.etalab.mastodon.sqlite.Sqlite;
@ -119,7 +121,17 @@ public class DisplayFavoritesPeertubeFragment extends Fragment implements OnRetr
delete_all.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
builder.setTitle(R.string.delete_all);
builder.setIcon(android.R.drawable.ic_dialog_alert)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {

View File

@ -94,7 +94,17 @@ public class DisplayFiltersFragment extends Fragment implements OnFilterActionIn
add_new.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, style);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.add_filter, null);
dialogBuilder.setView(dialogView);

View File

@ -92,7 +92,17 @@ public class DisplayListsFragment extends Fragment implements OnListActionInterf
add_new.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, style);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.add_list, null);
dialogBuilder.setView(dialogView);

View File

@ -93,7 +93,17 @@ public class DisplaySearchFragment extends Fragment {
add_new.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context, style);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") View dialogView = inflater.inflate(R.layout.search_toot, null);
dialogBuilder.setView(dialogView);

View File

@ -611,7 +611,17 @@ public class SettingsFragment extends Fragment {
set_toot_visibility.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder dialog = new AlertDialog.Builder(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
AlertDialog.Builder dialog = new AlertDialog.Builder(context, style);
dialog.setTitle(R.string.toot_visibility_tilte);
final String[] stringArray = getResources().getStringArray(R.array.toot_visibility);
final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<>(context, android.R.layout.simple_list_item_1, stringArray);

View File

@ -58,6 +58,7 @@ import fr.gouv.etalab.mastodon.sqlite.StatusCacheDAO;
public class CrossActions {
private static int style;
/**
* Returns the list of connected accounts when cross actions are allowed otherwise, returns the current account
@ -119,6 +120,15 @@ public class CrossActions {
boolean undoAction = (doAction == API.StatusAction.UNPIN || doAction == API.StatusAction.UNREBLOG || doAction == API.StatusAction.UNFAVOURITE);
//Undo actions won't ask for choosing a user
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
if(type != null && type == RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE && limitedToOwner){
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
@ -144,7 +154,7 @@ public class CrossActions {
pinAction(context, status, baseAdapter, onPostActionInterface);
}
} else {
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context);
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context, style);
builderSingle.setTitle(context.getString(R.string.choose_accounts));
final AccountsSearchAdapter accountsSearchAdapter = new AccountsSearchAdapter(context, accounts, true);
final Account[] accountArray = new Account[accounts.size()];
@ -336,7 +346,7 @@ public class CrossActions {
Toast.makeText(context, R.string.toast_error, Toast.LENGTH_LONG).show();
}
}else {
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context);
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context, style);
builderSingle.setTitle(context.getString(R.string.choose_accounts));
final AccountsSearchAdapter accountsSearchAdapter = new AccountsSearchAdapter(context, accounts, true);
final Account[] accountArray = new Account[accounts.size()];
@ -421,7 +431,7 @@ public class CrossActions {
}
}else {
if( type != RetrieveFeedsAsyncTask.Type.REMOTE_INSTANCE){
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context);
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context, style);
builderSingle.setTitle(context.getString(R.string.choose_accounts));
final AccountsSearchAdapter accountsSearchAdapter = new AccountsSearchAdapter(context, accounts, true);
final Account[] accountArray = new Account[accounts.size()];
@ -570,7 +580,7 @@ public class CrossActions {
context.startActivity(intentToot);
((BaseActivity)context).finish();
}else {
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context);
AlertDialog.Builder builderSingle = new AlertDialog.Builder(context, style);
builderSingle.setTitle(context.getString(R.string.choose_accounts));
final AccountsSearchAdapter accountsSearchAdapter = new AccountsSearchAdapter(context, accounts, true);
final Account[] accountArray = new Account[accounts.size()];
@ -624,7 +634,7 @@ public class CrossActions {
title = context.getString(R.string.pin_remove);
}
AlertDialog.Builder builder = new AlertDialog.Builder(context);
AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
builder.setMessage(Html.fromHtml(status.getContent(), Html.FROM_HTML_MODE_LEGACY));

View File

@ -760,8 +760,17 @@ public class Helper {
* @param url String download url
*/
public static void manageDownloads(final Context context, final String url){
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
final SharedPreferences sharedpreferences = context.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
final AlertDialog.Builder builder = new AlertDialog.Builder(context, style);
final DownloadManager.Request request;
try {
request = new DownloadManager.Request(Uri.parse(url.trim()));
@ -1143,7 +1152,17 @@ public class Helper {
deleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(activity)
final SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
int theme = sharedpreferences.getInt(Helper.SET_THEME, Helper.THEME_DARK);
int style;
if (theme == Helper.THEME_DARK) {
style = R.style.DialogDark;
} else if (theme == Helper.THEME_BLACK){
style = R.style.DialogBlack;
}else {
style = R.style.Dialog;
}
new AlertDialog.Builder(activity, style)
.setTitle(activity.getString(R.string.delete_account_title))
.setMessage(activity.getString(R.string.delete_account_message, "@" + account.getAcct() + "@" + account.getInstance()))
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {

View File

@ -118,7 +118,7 @@
android:padding="5dp"
android:text="@string/cw"
android:layout_gravity="center"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="50dp"
android:layout_height="50dp" />
<ImageButton
@ -129,7 +129,7 @@
android:padding="2dp"
android:scaleType="fitXY"
android:src="@drawable/emoji_one_category_smileysandpeople"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="30dp"
android:layout_height="30dp"
/>

View File

@ -72,7 +72,7 @@
android:textSize="12sp"
android:textAllCaps="false"
android:text="@string/choose_picture"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
@ -121,7 +121,7 @@
android:gravity="center"
android:textAllCaps="false"
android:text="@string/choose_picture"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View File

@ -84,7 +84,7 @@
android:textAllCaps="false"
android:text="@string/close"
android:textColor="@color/buttonb"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@ -119,7 +119,7 @@
android:padding="5dp"
android:text="@string/cw"
android:layout_gravity="center"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="40dp"
android:layout_height="40dp" />
<ImageButton
@ -130,7 +130,7 @@
android:padding="2dp"
android:scaleType="fitXY"
android:src="@drawable/emoji_one_category_smileysandpeople"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="30dp"
android:layout_height="30dp"
/>

View File

@ -113,7 +113,7 @@
android:maxLines="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/load_attachment_spoiler" />
</LinearLayout>
@ -252,7 +252,7 @@
android:maxLines="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/load_attachment" />
</LinearLayout>
<LinearLayout

View File

@ -75,7 +75,7 @@
android:layout_marginLeft="10dp"
android:focusableInTouchMode="false"
android:id="@+id/scheduled_toot_date"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View File

@ -141,7 +141,7 @@
<ImageButton
android:id="@+id/status_translate"
android:gravity="center"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_translate"
@ -152,7 +152,7 @@
android:gravity="center"
android:visibility="gone"
android:tint="@android:color/white"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_bookmark_border"
@ -231,7 +231,7 @@
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/load_attachment_spoiler" />
</LinearLayout>
<LinearLayout
@ -602,7 +602,7 @@
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/load_attachment" />
</LinearLayout>
<LinearLayout
@ -698,6 +698,6 @@
android:maxLines="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/fetch_more_toots" />
</LinearLayout>

View File

@ -205,7 +205,7 @@
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/load_attachment_spoiler" />
</LinearLayout>
<LinearLayout
@ -229,7 +229,7 @@
android:id="@+id/status_translate"
android:gravity="center"
android:tint="@android:color/white"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_translate"
@ -240,7 +240,7 @@
android:id="@+id/status_bookmark"
android:gravity="center"
android:tint="@android:color/white"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_bookmark_border"
@ -598,7 +598,7 @@
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/load_attachment" />
</LinearLayout>
<LinearLayout
@ -731,6 +731,6 @@
android:maxLines="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/fetch_more_toots" />
</LinearLayout>

View File

@ -135,7 +135,7 @@
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/load_attachment_spoiler" />
</LinearLayout>
<LinearLayout
@ -158,7 +158,7 @@
<ImageButton
android:id="@+id/status_translate"
android:gravity="center"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_translate"
@ -168,7 +168,7 @@
<ImageButton
android:id="@+id/status_bookmark"
android:gravity="center"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_bookmark_border"
@ -518,7 +518,7 @@
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/load_attachment" />
</LinearLayout>
<LinearLayout
@ -629,6 +629,6 @@
android:maxLines="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Base.Widget.AppCompat.Button.Borderless"
style="?attr/borderless"
android:text="@string/fetch_more_toots" />
</LinearLayout>

View File

@ -44,7 +44,7 @@
android:layout_marginLeft="10dp"
android:focusableInTouchMode="false"
android:id="@+id/settings_time_from"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
@ -57,7 +57,7 @@
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:focusableInTouchMode="false"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:id="@+id/settings_time_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View File

@ -149,7 +149,7 @@
android:layout_marginLeft="10dp"
android:focusableInTouchMode="false"
android:id="@+id/settings_time_from"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
@ -162,7 +162,7 @@
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:focusableInTouchMode="false"
style="@style/Base.Widget.AppCompat.Button.Borderless.Colored"
style="?attr/borderlessColored"
android:id="@+id/settings_time_to"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

View File

@ -6,6 +6,9 @@
<attr format="color" name="color_in_account_header"/>
<attr format="reference" name="popupOverlay"/>
<attr format="reference" name="appTheme"/>
<attr format="reference" name="borderless"/>
<attr format="reference" name="borderlessColored"/>
<!-- Light theme -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:textColor">@color/black</item>
@ -17,6 +20,8 @@
<item name="android:windowBackground">@color/white</item>
<item name="shapeBorder">@style/Shape.Light</item>
<item name="imgbd">@style/Image.Border.Light</item>
<item name="borderless">@style/borderLessLightStyle</item>
<item name="borderlessColored">@style/borderlessColoredStyle</item>
<item name="windowActionModeOverlay">true</item>
<item name="popupOverlay">@style/AppTheme.PopupOverlay</item>
<item name="android:spinnerStyle">@style/SpinnerStyle</item>
@ -50,6 +55,8 @@
<item name="colorAccent">@color/mastodonC4</item>
<item name="android:buttonStyle">@style/ButtonColor</item>
<item name="headerbg">@style/Header.Light</item>
<item name="borderless">@style/borderLessLightStyle</item>
<item name="borderlessColored">@style/borderlessColoredStyle</item>
<item name="android:windowBackground">@color/white</item>
<item name="shapeBorder">@style/Shape.Light</item>
<item name="imgbd">@style/Image.Border.Light</item>
@ -69,6 +76,13 @@
<item name="android:colorBackground">@color/white</item>
</style>
<style name="borderLessLightStyle" parent="Base.Widget.AppCompat.Button.Borderless">
<item name="android:textColor">?attr/colorAccent</item>
</style>
<style name="borderlessColoredStyle" parent="Base.Widget.AppCompat.Button.Borderless.Colored">
<item name="android:textColor">?attr/colorAccent</item>
</style>
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="colorPrimaryDark">@color/transparent</item>
@ -148,6 +162,8 @@
<item name="headerbg">@style/Header.Black</item>
<item name="android:windowBackground">@color/black</item>
<item name="shapeBorder">@style/Shape.Black</item>
<item name="borderless">@style/borderLessLightStyle</item>
<item name="borderlessColored">@style/borderlessColoredStyle</item>
<item name="imgbd">@style/Image.Border.Black</item>
<item name="windowActionModeOverlay">true</item>
<item name="popupOverlay">@style/AppThemeBlack.PopupOverlay</item>
@ -172,6 +188,8 @@
<item name="android:buttonStyle">@style/BlackButtonColor</item>
<item name="headerbg">@style/Header.Black</item>
<item name="android:windowBackground">@color/black</item>
<item name="borderless">@style/borderLessLightStyle</item>
<item name="borderlessColored">@style/borderlessColoredStyle</item>
<item name="shapeBorder">@style/Shape.Black</item>
<item name="imgbd">@style/Image.Border.Black</item>
<item name="windowActionModeOverlay">true</item>
@ -258,6 +276,8 @@
<item name="android:buttonStyle">@style/DarkButtonColor</item>
<item name="headerbg">@style/Header.Dark</item>
<item name="android:windowBackground">@color/mastodonC1</item>
<item name="borderless">@style/borderLessLightStyle</item>
<item name="borderlessColored">@style/borderlessColoredStyle</item>
<item name="shapeBorder">@style/Shape.Dark</item>
<item name="imgbd">@style/Image.Border.Dark</item>
<item name="windowActionModeOverlay">true</item>
@ -283,6 +303,8 @@
<item name="android:buttonStyle">@style/DarkButtonColor</item>
<item name="headerbg">@style/Header.Dark</item>
<item name="android:windowBackground">@color/mastodonC1</item>
<item name="borderless">@style/borderLessLightStyle</item>
<item name="borderlessColored">@style/borderlessColoredStyle</item>
<item name="shapeBorder">@style/Shape.Dark</item>
<item name="imgbd">@style/Image.Border.Dark</item>
<item name="windowActionModeOverlay">true</item>