layout fix, added progress bar dialog builder, bug fix, removed unused resources

This commit is contained in:
nuclearfog 2021-01-26 23:22:49 +01:00
parent 3848fd2264
commit d8c4ba4b22
No known key found for this signature in database
GPG Key ID: D5490E4A81F97B14
25 changed files with 124 additions and 144 deletions

View File

@ -1,7 +1,6 @@
package org.nuclearfog.twidda.activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
@ -28,8 +27,6 @@ import org.nuclearfog.twidda.backend.utils.ErrorHandler;
import org.nuclearfog.twidda.database.GlobalSettings;
import static android.os.AsyncTask.Status.RUNNING;
import static android.view.View.VISIBLE;
import static android.view.Window.FEATURE_NO_TITLE;
import static org.nuclearfog.twidda.activity.ListDetail.RET_LIST_CHANGED;
import static org.nuclearfog.twidda.activity.ListDetail.RET_LIST_DATA;
import static org.nuclearfog.twidda.activity.UserLists.RET_LIST_CREATED;
@ -40,7 +37,7 @@ import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.LISTP
*
* @author nuclearfog
*/
public class ListEditor extends AppCompatActivity implements OnClickListener, OnDialogClick, DialogInterface.OnDismissListener {
public class ListEditor extends AppCompatActivity implements OnClickListener, OnDialogClick, DialogBuilder.OnProgressStop {
/**
* Key for the list ID of the list if an existing list should be updated
@ -65,9 +62,8 @@ public class ListEditor extends AppCompatActivity implements OnClickListener, On
titleInput = findViewById(R.id.list_edit_title);
subTitleInput = findViewById(R.id.list_edit_descr);
visibility = findViewById(R.id.list_edit_public_sw);
View load = View.inflate(this, R.layout.item_load, null);
View cancelButton = load.findViewById(R.id.kill_button);
loadingCircle = new Dialog(this, R.style.LoadingDialog);
loadingCircle = DialogBuilder.createProgress(this, this);
leaveDialog = DialogBuilder.create(this, LISTPOPUP_LEAVE, this);
GlobalSettings settings = GlobalSettings.getInstance(this);
AppStyles.setEditorTheme(settings, root, background);
@ -81,14 +77,7 @@ public class ListEditor extends AppCompatActivity implements OnClickListener, On
popupTitle.setText(R.string.menu_edit_list);
updateButton.setText(R.string.update_list);
}
loadingCircle.requestWindowFeature(FEATURE_NO_TITLE);
loadingCircle.setCancelable(false);
loadingCircle.setContentView(load);
cancelButton.setVisibility(VISIBLE);
leaveDialog = DialogBuilder.create(this, LISTPOPUP_LEAVE, this);
updateButton.setOnClickListener(this);
cancelButton.setOnClickListener(this);
loadingCircle.setOnDismissListener(this);
}
@ -132,15 +121,11 @@ public class ListEditor extends AppCompatActivity implements OnClickListener, On
loadingCircle.show();
}
}
// stop updating list
else if (view.getId() == R.id.kill_button) {
loadingCircle.dismiss();
}
}
@Override
public void onDismiss(DialogInterface dialog) {
public void stopProgress() {
if (updaterAsync != null && updaterAsync.getStatus() == RUNNING) {
updaterAsync.cancel(true);
}

View File

@ -1,7 +1,6 @@
package org.nuclearfog.twidda.activity;
import android.graphics.Bitmap;
import android.graphics.PorterDuffColorFilter;
import android.location.Location;
import android.media.MediaPlayer;
import android.media.MediaPlayer.OnErrorListener;
@ -25,11 +24,11 @@ import org.nuclearfog.twidda.adapter.ImageAdapter.OnImageClickListener;
import org.nuclearfog.twidda.backend.ImageLoader;
import org.nuclearfog.twidda.backend.engine.EngineException;
import org.nuclearfog.twidda.backend.holder.ImageHolder;
import org.nuclearfog.twidda.backend.utils.AppStyles;
import org.nuclearfog.twidda.backend.utils.ErrorHandler;
import org.nuclearfog.twidda.database.GlobalSettings;
import org.nuclearfog.zoomview.ZoomView;
import static android.graphics.PorterDuff.Mode.SRC_ATOP;
import static android.media.MediaPlayer.MEDIA_ERROR_UNKNOWN;
import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_END;
import static android.media.MediaPlayer.MEDIA_INFO_BUFFERING_START;
@ -107,7 +106,7 @@ public class MediaViewer extends MediaActivity implements OnImageClickListener,
videoView.setOnErrorListener(this);
GlobalSettings settings = GlobalSettings.getInstance(this);
media_progress.getIndeterminateDrawable().setColorFilter(new PorterDuffColorFilter(settings.getHighlightColor(), SRC_ATOP));
AppStyles.setProgressColor(media_progress, settings.getHighlightColor());
mediaLinks = getIntent().getStringArrayExtra(KEY_MEDIA_LINK);
type = getIntent().getIntExtra(KEY_MEDIA_TYPE, 0);

View File

@ -1,8 +1,6 @@
package org.nuclearfog.twidda.activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
@ -28,7 +26,6 @@ import org.nuclearfog.twidda.database.GlobalSettings;
import static android.os.AsyncTask.Status.RUNNING;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static android.view.Window.FEATURE_NO_TITLE;
import static android.widget.Toast.LENGTH_SHORT;
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_LINK;
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_TYPE;
@ -40,7 +37,7 @@ import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.MSG_P
*
* @author nuclearfog
*/
public class MessageEditor extends MediaActivity implements OnClickListener, OnDismissListener, OnDialogClick {
public class MessageEditor extends MediaActivity implements OnClickListener, OnDialogClick, DialogBuilder.OnProgressStop {
/**
* key for the screen name if any
@ -68,9 +65,8 @@ public class MessageEditor extends MediaActivity implements OnClickListener, OnD
preview = findViewById(R.id.dm_preview);
receiver = findViewById(R.id.dm_receiver);
message = findViewById(R.id.dm_text);
loadingCircle = new Dialog(this, R.style.LoadingDialog);
View load = View.inflate(this, R.layout.item_load, null);
View cancelButton = load.findViewById(R.id.kill_button);
loadingCircle = DialogBuilder.createProgress(this, this);
leaveDialog = DialogBuilder.create(this, MSG_POPUP_LEAVE, this);
String prefix = getIntent().getStringExtra(KEY_DM_PREFIX);
if (prefix != null) {
@ -79,22 +75,13 @@ public class MessageEditor extends MediaActivity implements OnClickListener, OnD
send.setImageResource(R.drawable.right);
media.setImageResource(R.drawable.image_add);
preview.setImageResource(R.drawable.image);
leaveDialog = DialogBuilder.create(this, MSG_POPUP_LEAVE, this);
loadingCircle.requestWindowFeature(FEATURE_NO_TITLE);
loadingCircle.setCanceledOnTouchOutside(false);
loadingCircle.setContentView(load);
preview.setVisibility(GONE);
cancelButton.setVisibility(VISIBLE);
GlobalSettings settings = GlobalSettings.getInstance(this);
AppStyles.setEditorTheme(settings, root, background);
send.setOnClickListener(this);
media.setOnClickListener(this);
preview.setOnClickListener(this);
cancelButton.setOnClickListener(this);
loadingCircle.setOnDismissListener(this);
}
@ -156,15 +143,11 @@ public class MessageEditor extends MediaActivity implements OnClickListener, OnD
image.putExtra(KEY_MEDIA_TYPE, MEDIAVIEWER_IMG_S);
startActivity(image);
}
// stop updating
else if (v.getId() == R.id.kill_button) {
loadingCircle.dismiss();
}
}
@Override
public void onDismiss(DialogInterface dialog) {
public void stopProgress() {
if (messageAsync != null && messageAsync.getStatus() == RUNNING) {
messageAsync.cancel(true);
}

View File

@ -1,8 +1,6 @@
package org.nuclearfog.twidda.activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
@ -44,7 +42,6 @@ import jp.wasabeef.picasso.transformations.RoundedCornersTransformation;
import static android.os.AsyncTask.Status.RUNNING;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static android.view.Window.FEATURE_NO_TITLE;
import static org.nuclearfog.twidda.activity.UserProfile.RETURN_PROFILE_CHANGED;
import static org.nuclearfog.twidda.activity.UserProfile.RETURN_PROFILE_DATA;
import static org.nuclearfog.twidda.activity.UserProfile.TOOLBAR_TRANSPARENCY;
@ -57,7 +54,7 @@ import static org.nuclearfog.twidda.database.GlobalSettings.PROFILE_IMG_HIGH_RES
*
* @author nuclearfog
*/
public class ProfileEditor extends MediaActivity implements OnClickListener, OnDismissListener, OnDialogClick, Callback {
public class ProfileEditor extends MediaActivity implements OnClickListener, DialogBuilder.OnProgressStop, OnDialogClick, Callback {
/**
* key to preload user data
@ -93,9 +90,8 @@ public class ProfileEditor extends MediaActivity implements OnClickListener, OnD
link = findViewById(R.id.edit_link);
loc = findViewById(R.id.edit_location);
bio = findViewById(R.id.edit_bio);
loadingCircle = new Dialog(this, R.style.LoadingDialog);
View load = View.inflate(this, R.layout.item_load, null);
View cancelButton = load.findViewById(R.id.kill_button);
loadingCircle = DialogBuilder.createProgress(this, this);
closeDialog = DialogBuilder.create(this, PROFILE_EDIT_LEAVE, this);
toolbar.setTitle(R.string.page_profile_edior);
setSupportActionBar(toolbar);
@ -107,12 +103,6 @@ public class ProfileEditor extends MediaActivity implements OnClickListener, OnD
profile_banner.setDrawingCacheEnabled(true);
AppStyles.setTheme(settings, root);
closeDialog = DialogBuilder.create(this, PROFILE_EDIT_LEAVE, this);
loadingCircle.requestWindowFeature(FEATURE_NO_TITLE);
loadingCircle.setCanceledOnTouchOutside(false);
loadingCircle.setContentView(load);
cancelButton.setVisibility(VISIBLE);
Object data = getIntent().getSerializableExtra(KEY_USER_DATA);
if (data instanceof User) {
user = (User) data;
@ -121,8 +111,6 @@ public class ProfileEditor extends MediaActivity implements OnClickListener, OnD
profile_image.setOnClickListener(this);
profile_banner.setOnClickListener(this);
addBannerBtn.setOnClickListener(this);
cancelButton.setOnClickListener(this);
loadingCircle.setOnDismissListener(this);
}
@ -221,15 +209,11 @@ public class ProfileEditor extends MediaActivity implements OnClickListener, OnD
else if (v.getId() == R.id.edit_add_banner || v.getId() == R.id.edit_banner) {
getMedia(REQUEST_BANNER);
}
// stop update
else if (v.getId() == R.id.kill_button) {
loadingCircle.dismiss();
}
}
@Override
public void onDismiss(DialogInterface dialog) {
public void stopProgress() {
if (editorAsync != null && editorAsync.getStatus() == RUNNING) {
editorAsync.cancel(true);
}

View File

@ -483,7 +483,7 @@ public class TweetActivity extends AppCompatActivity implements OnClickListener,
favButton.setText(buttonNumber.format(tweetUpdate.getFavorCount()));
rtwButton.setText(buttonNumber.format(tweetUpdate.getRetweetCount()));
tweet_api.setText(R.string.tweet_sent_from);
tweet_api.append(" " + tweetUpdate.getSource());
tweet_api.append(tweetUpdate.getSource());
if (tweetUpdate.containsTweetText()) {
Spannable sTweet = Tagger.makeTextWithLinks(tweetUpdate.getTweet(), settings.getHighlightColor(), this);

View File

@ -2,8 +2,6 @@ package org.nuclearfog.twidda.activity;
import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.location.Location;
import android.os.Bundle;
@ -34,7 +32,6 @@ import static android.os.AsyncTask.Status.RUNNING;
import static android.view.View.GONE;
import static android.view.View.INVISIBLE;
import static android.view.View.VISIBLE;
import static android.view.Window.FEATURE_NO_TITLE;
import static android.widget.Toast.LENGTH_LONG;
import static android.widget.Toast.LENGTH_SHORT;
import static org.nuclearfog.twidda.activity.MediaViewer.KEY_MEDIA_LINK;
@ -49,7 +46,7 @@ import static org.nuclearfog.twidda.backend.utils.DialogBuilder.DialogType.TWEET
*
* @author nuclearfog
*/
public class TweetEditor extends MediaActivity implements OnClickListener, OnDismissListener, OnDialogClick {
public class TweetEditor extends MediaActivity implements OnClickListener, DialogBuilder.OnProgressStop, OnDialogClick {
private enum MediaType {
NONE,
@ -105,9 +102,9 @@ public class TweetEditor extends MediaActivity implements OnClickListener, OnDis
previewBtn = findViewById(R.id.tweet_prev_media);
tweetText = findViewById(R.id.tweet_input);
locationProg = findViewById(R.id.location_progress);
loadingCircle = new Dialog(this, R.style.LoadingDialog);
View load = View.inflate(this, R.layout.item_load, null);
View cancelButton = load.findViewById(R.id.kill_button);
loadingCircle = DialogBuilder.createProgress(this, this);
errorDialog = DialogBuilder.create(this, TWEETPOPUP_ERROR, this);
closingDialog = DialogBuilder.create(this, TWEETPOPUP_LEAVE, this);
settings = GlobalSettings.getInstance(this);
mediaPath = new LinkedList<>();
@ -123,12 +120,6 @@ public class TweetEditor extends MediaActivity implements OnClickListener, OnDis
locationBtn.setImageResource(R.drawable.location);
tweetButton.setImageResource(R.drawable.tweet);
closeButton.setImageResource(R.drawable.cross);
errorDialog = DialogBuilder.create(this, TWEETPOPUP_ERROR, this);
closingDialog = DialogBuilder.create(this, TWEETPOPUP_LEAVE, this);
loadingCircle.requestWindowFeature(FEATURE_NO_TITLE);
loadingCircle.setCancelable(false);
loadingCircle.setContentView(load);
cancelButton.setVisibility(VISIBLE);
AppStyles.setEditorTheme(settings, root, background);
closeButton.setOnClickListener(this);
@ -136,8 +127,6 @@ public class TweetEditor extends MediaActivity implements OnClickListener, OnDis
mediaBtn.setOnClickListener(this);
previewBtn.setOnClickListener(this);
locationBtn.setOnClickListener(this);
cancelButton.setOnClickListener(this);
loadingCircle.setOnDismissListener(this);
}
@ -213,10 +202,6 @@ public class TweetEditor extends MediaActivity implements OnClickListener, OnDis
else if (v.getId() == R.id.tweet_add_location) {
getLocation();
}
// stop uploading tweet
else if (v.getId() == R.id.kill_button) {
loadingCircle.dismiss();
}
}
@ -286,7 +271,7 @@ public class TweetEditor extends MediaActivity implements OnClickListener, OnDis
@Override
public void onDismiss(DialogInterface dialog) {
public void stopProgress() {
if (uploaderAsync != null && uploaderAsync.getStatus() == RUNNING) {
uploaderAsync.cancel(true);
}

View File

@ -2,7 +2,6 @@ package org.nuclearfog.twidda.adapter;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.PorterDuffColorFilter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
@ -18,12 +17,12 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.holder.ImageHolder;
import org.nuclearfog.twidda.backend.utils.AppStyles;
import org.nuclearfog.twidda.database.GlobalSettings;
import java.util.LinkedList;
import java.util.List;
import static android.graphics.PorterDuff.Mode.SRC_ATOP;
import static android.view.View.VISIBLE;
import static androidx.recyclerview.widget.RecyclerView.NO_POSITION;
@ -124,7 +123,7 @@ public class ImageAdapter extends Adapter<ViewHolder> {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
if (viewType == PICTURE) {
View view = inflater.inflate(R.layout.item_image, parent, false);
final ImageItem item = new ImageItem(view);
final ImageItem item = new ImageItem(view, settings);
item.preview.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@ -172,10 +171,13 @@ public class ImageAdapter extends Adapter<ViewHolder> {
final ImageView preview;
final ImageButton saveButton;
ImageItem(View view) {
ImageItem(View view, GlobalSettings settings) {
super(view);
preview = view.findViewById(R.id.item_image_preview);
saveButton = view.findViewById(R.id.item_image_save);
saveButton.setImageResource(R.drawable.save);
AppStyles.setButtonColor(saveButton, settings.getFontColor());
AppStyles.setDrawableColor(saveButton, settings.getIconColor());
}
}
@ -187,7 +189,7 @@ public class ImageAdapter extends Adapter<ViewHolder> {
LoadItem(View v, int color) {
super(v);
ProgressBar progress = v.findViewById(R.id.imageitem_progress);
progress.getIndeterminateDrawable().setColorFilter(new PorterDuffColorFilter(color, SRC_ATOP));
AppStyles.setProgressColor(progress, color);
}
}

View File

@ -2,7 +2,6 @@ package org.nuclearfog.twidda.adapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
@ -27,6 +26,7 @@ import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.holder.UserListList;
import org.nuclearfog.twidda.backend.items.User;
import org.nuclearfog.twidda.backend.items.UserList;
import org.nuclearfog.twidda.backend.utils.AppStyles;
import org.nuclearfog.twidda.database.GlobalSettings;
import org.nuclearfog.twidda.fragment.UserListFragment;
@ -346,7 +346,7 @@ public class ListAdapter extends Adapter<ViewHolder> {
loadBtn.setTypeface(settings.getFontFace());
loadBtn.setTextColor(settings.getFontColor());
loadCircle.getIndeterminateDrawable().mutate().setColorFilter(new PorterDuffColorFilter(settings.getHighlightColor(), SRC_ATOP));
AppStyles.setProgressColor(loadCircle, settings.getHighlightColor());
background.setCardBackgroundColor(settings.getCardColor());
}
}

View File

@ -62,9 +62,11 @@ public class MessageAdapter extends Adapter<ViewHolder> {
for (int index = 0; index < drawables.length(); index++) {
int resId = drawables.getResourceId(index, 0);
icons[index] = AppCompatResources.getDrawable(context, resId);
if (icons[index] != null) {
icons[index].setColorFilter(settings.getIconColor(), SRC_ATOP);
}
}
drawables.recycle();
setIconColor();
}
/**
@ -194,15 +196,6 @@ public class MessageAdapter extends Adapter<ViewHolder> {
tv.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
}
/**
* set color for all icons
*/
private void setIconColor() {
for (Drawable icon : icons) {
icon.setColorFilter(settings.getIconColor(), SRC_ATOP);
}
}
/**
* Holder class for a message view
*/
@ -233,7 +226,7 @@ public class MessageAdapter extends Adapter<ViewHolder> {
button.setTypeface(settings.getFontFace());
}
background.setCardBackgroundColor(settings.getCardColor());
textViews[2].setCompoundDrawables(icons[2], null, null, null);
textViews[2].setCompoundDrawablesWithIntrinsicBounds(icons[2], null, null, null);
textViews[4].setMovementMethod(LinkMovementMethod.getInstance());
}
}

View File

@ -3,7 +3,6 @@ package org.nuclearfog.twidda.adapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.text.Spanned;
import android.view.LayoutInflater;
@ -29,6 +28,7 @@ import org.nuclearfog.tag.Tagger;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.items.Tweet;
import org.nuclearfog.twidda.backend.items.User;
import org.nuclearfog.twidda.backend.utils.AppStyles;
import org.nuclearfog.twidda.database.GlobalSettings;
import java.text.NumberFormat;
@ -380,7 +380,7 @@ public class TweetAdapter extends Adapter<ViewHolder> {
tv.setTextColor(settings.getFontColor());
tv.setTypeface(settings.getFontFace());
}
background.setBackgroundColor(settings.getCardColor());
background.setCardBackgroundColor(settings.getCardColor());
textViews[5].setCompoundDrawablesWithIntrinsicBounds(icons[2], null, null, null);
}
}
@ -399,7 +399,7 @@ public class TweetAdapter extends Adapter<ViewHolder> {
loadCircle = v.findViewById(R.id.placeholder_loading);
background.setCardBackgroundColor(settings.getCardColor());
loadCircle.getIndeterminateDrawable().mutate().setColorFilter(new PorterDuffColorFilter(settings.getHighlightColor(), SRC_ATOP));
AppStyles.setProgressColor(loadCircle, settings.getHighlightColor());
}
}

View File

@ -2,7 +2,6 @@ package org.nuclearfog.twidda.adapter;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
@ -27,6 +26,7 @@ import com.squareup.picasso.Picasso;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.backend.holder.TwitterUserList;
import org.nuclearfog.twidda.backend.items.User;
import org.nuclearfog.twidda.backend.utils.AppStyles;
import org.nuclearfog.twidda.database.GlobalSettings;
import java.text.NumberFormat;
@ -352,7 +352,7 @@ public class UserAdapter extends Adapter<ViewHolder> {
loadBtn = v.findViewById(R.id.placeholder_button);
background.setCardBackgroundColor(settings.getCardColor());
loadCircle.getIndeterminateDrawable().mutate().setColorFilter(new PorterDuffColorFilter(settings.getHighlightColor(), SRC_ATOP));
AppStyles.setProgressColor(loadCircle, settings.getHighlightColor());
}
}

View File

@ -17,6 +17,7 @@ import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.SeekBar;
import android.widget.TextView;
@ -207,6 +208,14 @@ public final class AppStyles {
}
}
public static void setProgressColor(ProgressBar circle, int color) {
Drawable icon = circle.getIndeterminateDrawable();
if (icon != null) {
icon.setColorFilter(new PorterDuffColorFilter(color, SRC_ATOP));
}
}
/**
* sets color of a single menu item
*

View File

@ -4,10 +4,17 @@ import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import androidx.appcompat.app.AlertDialog;
import org.nuclearfog.twidda.R;
import org.nuclearfog.twidda.database.GlobalSettings;
import static android.view.View.VISIBLE;
import static android.view.Window.FEATURE_NO_TITLE;
/**
* this class creates alert dialogs with a custom listener
@ -140,6 +147,36 @@ public final class DialogBuilder {
return builder.create();
}
/**
* creates an animated circle to show a progress
*
* @param context Activity context
* @param l stop listener
* @return dialog instance to show
*/
public static Dialog createProgress(Context context, final OnProgressStop l) {
View load = View.inflate(context, R.layout.item_load, null);
ImageView cancel = load.findViewById(R.id.kill_button);
ProgressBar circle = load.findViewById(R.id.progress_item);
cancel.setImageResource(R.drawable.cross);
final Dialog loadingCircle = new Dialog(context, R.style.LoadingDialog);
GlobalSettings settings = GlobalSettings.getInstance(context);
AppStyles.setProgressColor(circle, settings.getHighlightColor());
AppStyles.setDrawableColor(cancel, settings.getIconColor());
loadingCircle.requestWindowFeature(FEATURE_NO_TITLE);
loadingCircle.setCancelable(false);
loadingCircle.setContentView(load);
cancel.setVisibility(VISIBLE);
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
l.stopProgress();
loadingCircle.dismiss();
}
});
return loadingCircle;
}
/**
* listener for dialog
*/
@ -152,4 +189,12 @@ public final class DialogBuilder {
*/
void onConfirm(DialogType type);
}
/**
* listener for progress
*/
public interface OnProgressStop {
void stopProgress();
}
}

View File

@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="16dp"
android:height="16dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:fillColor="#000000"
android:pathData="M15.173,2H4C2.899,2 2,2.9 2,4v12c0,1.1 0.899,2 2,2h12c1.101,0 2,-0.9 2,-2V5.127L15.173,2zM14,8c0,0.549 -0.45,1 -1,1H7C6.45,9 6,8.549 6,8V3h8V8zM13,4h-2v4h2V4z" />
</vector>

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -20,7 +19,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/badge_twitter4j"
app:srcCompat="@drawable/twitter4j_badge" />
android:src="@drawable/twitter4j_badge" />
<TextView
android:layout_width="match_parent"

View File

@ -50,7 +50,7 @@
<TextView
android:id="@+id/dm_screenname"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dmitem_text_margin"
android:layout_marginLeft="@dimen/dmitem_text_margin"

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/imageitem_layout_margin"
@ -24,7 +23,6 @@
android:layout_margin="@dimen/imageitem_button_margin"
android:contentDescription="@string/item_image_save"
android:visibility="gone"
app:srcCompat="@drawable/save_img"
style="@style/RoundButton" />
</FrameLayout>

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<ProgressBar
android:id="@+id/progress_item"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -17,9 +17,7 @@
android:layout_width="@dimen/loaditem_button_size"
android:layout_height="@dimen/loaditem_button_size"
android:layout_gravity="center"
android:visibility="invisible"
android:background="@android:color/transparent"
android:contentDescription="@android:string/cancel"
app:srcCompat="@drawable/cross" />
android:contentDescription="@android:string/cancel" />
</FrameLayout>

View File

@ -7,11 +7,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="@dimen/tweetitem_layout_padding"
app:layout_constraintBottom_toBottomOf="@+id/tweetPb"
app:layout_constraintTop_toBottomOf="@+id/tweetPb">
android:layout_height="match_parent"
android:padding="@dimen/tweetitem_layout_padding">
<ImageView
android:id="@+id/tweetPb"
@ -34,7 +31,8 @@
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toStartOf="@+id/time"
app:layout_constraintStart_toEndOf="@+id/tweetPb"
app:layout_constraintTop_toTopOf="@id/tweetPb" />
app:layout_constraintTop_toTopOf="@id/tweetPb"
app:layout_constraintBottom_toTopOf="@id/screenname" />
<TextView
android:id="@+id/time"
@ -89,7 +87,8 @@
android:textSize="@dimen/tweetitem_textsize_button"
app:layout_constraintEnd_toStartOf="@+id/retweet_number"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tweettext" />
app:layout_constraintTop_toBottomOf="@id/tweettext"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:id="@+id/retweet_number"
@ -104,7 +103,8 @@
android:textSize="@dimen/tweetitem_textsize_button"
app:layout_constraintEnd_toStartOf="@+id/favorite_number"
app:layout_constraintStart_toEndOf="@+id/retweeter"
app:layout_constraintTop_toBottomOf="@id/tweettext" />
app:layout_constraintTop_toBottomOf="@id/tweettext"
app:layout_constraintBottom_toBottomOf="parent" />
<TextView
android:id="@+id/favorite_number"
@ -117,7 +117,8 @@
android:textSize="@dimen/tweetitem_textsize_button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/retweet_number"
app:layout_constraintTop_toBottomOf="@id/tweettext" />
app:layout_constraintTop_toBottomOf="@id/tweettext"
app:layout_constraintBottom_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/editprofile_layout_margin"
android:gravity="center_vertical">
android:fitsSystemWindows="true">
<ImageView
android:id="@+id/edit_banner"

View File

@ -169,7 +169,8 @@
android:text="@string/tweet_sensitive_media"
android:textSize="@dimen/tweet_textsize_small"
android:visibility="invisible"
app:layout_constraintStart_toEndOf="@+id/tweet_retweeter"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tweet_media_attach" />
<TextView

View File

@ -15,7 +15,7 @@
app:layout_constraintHeight_percent="0.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.75"
app:layout_constraintWidth_percent="0.85"
tools:ignore="ContentDescription" />
<EditText
@ -30,7 +30,7 @@
android:importantForAutofill="no"
android:inputType="text"
android:singleLine="true"
app:layout_constraintBottom_toBottomOf="@+id/dm_media"
app:layout_constraintBottom_toBottomOf="@+id/dm_send"
app:layout_constraintEnd_toStartOf="@+id/dm_preview"
app:layout_constraintStart_toStartOf="@+id/dm_background"
app:layout_constraintTop_toTopOf="@+id/dm_background" />
@ -40,8 +40,13 @@
style="@style/RoundButton"
android:layout_width="@dimen/dmpopup_button_size"
android:layout_height="@dimen/dmpopup_button_size"
android:layout_marginStart="@dimen/dmpopup_button_margin"
android:layout_marginLeft="@dimen/dmpopup_button_margin"
android:layout_marginTop="@dimen/dmpopup_button_margin"
android:layout_marginEnd="@dimen/dmpopup_button_margin"
android:layout_marginRight="@dimen/dmpopup_button_margin"
android:contentDescription="@string/tweet_add_image"
app:layout_constraintBottom_toBottomOf="@+id/dm_send"
app:layout_constraintEnd_toStartOf="@+id/dm_media"
app:layout_constraintStart_toEndOf="@id/dm_receiver"
app:layout_constraintTop_toTopOf="@+id/dm_background" />
@ -55,8 +60,9 @@
android:layout_marginEnd="@dimen/dmpopup_button_margin"
android:layout_marginRight="@dimen/dmpopup_button_margin"
android:contentDescription="@string/tweet_add_image"
app:layout_constraintStart_toEndOf="@+id/dm_preview"
app:layout_constraintBottom_toBottomOf="@+id/dm_send"
app:layout_constraintEnd_toStartOf="@+id/dm_send"
app:layout_constraintStart_toEndOf="@+id/dm_preview"
app:layout_constraintTop_toTopOf="@+id/dm_background" />
<ImageButton
@ -68,8 +74,8 @@
android:layout_marginEnd="@dimen/dmpopup_button_margin"
android:layout_marginRight="@dimen/dmpopup_button_margin"
android:contentDescription="@string/close_dm"
app:layout_constraintStart_toEndOf="@id/dm_media"
app:layout_constraintEnd_toEndOf="@+id/dm_background"
app:layout_constraintStart_toEndOf="@id/dm_media"
app:layout_constraintTop_toTopOf="@+id/dm_background" />
<EditText
@ -89,7 +95,9 @@
android:inputType="textMultiLine"
app:layout_constraintBottom_toBottomOf="@+id/dm_background"
app:layout_constraintEnd_toEndOf="@+id/dm_background"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="@+id/dm_background"
app:layout_constraintTop_toBottomOf="@+id/dm_receiver" />
app:layout_constraintTop_toBottomOf="@+id/dm_send"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -15,7 +15,7 @@
app:layout_constraintHeight_percent="0.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.8"
app:layout_constraintWidth_percent="0.85"
tools:ignore="ContentDescription" />
<EditText

View File

@ -15,7 +15,7 @@
app:layout_constraintHeight_percent="0.4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintWidth_percent="0.75"
app:layout_constraintWidth_percent="0.85"
tools:ignore="ContentDescription" />
<TextView

View File

@ -63,7 +63,6 @@
<dimen name="editprofile_image_overlap_banner">@dimen/profile_image_overlap_banner</dimen>
<dimen name="editprofile_add_btn_size">40dp</dimen>
<dimen name="editprofile_profile_image_left_margin">10dp</dimen>
<dimen name="editprofile_image_layer_height">180dp</dimen>
<integer name="editprofile_username_max_length">50</integer>
<!--dimens of item_tweet.xml-->