2015-09-24 22:52:02 +02:00
|
|
|
/*
|
2019-01-23 18:03:33 +01:00
|
|
|
* This is the source code of Telegram for Android v. 5.x.x.
|
2015-09-24 22:52:02 +02:00
|
|
|
* It is licensed under GNU GPL v. 2 or later.
|
|
|
|
* You should have received a copy of the license in this archive (see LICENSE).
|
|
|
|
*
|
2019-01-23 18:03:33 +01:00
|
|
|
* Copyright Nikolai Kudashov, 2013-2018.
|
2015-09-24 22:52:02 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package org.telegram.ui;
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
import android.animation.Animator;
|
|
|
|
import android.animation.AnimatorListenerAdapter;
|
|
|
|
import android.animation.AnimatorSet;
|
|
|
|
import android.animation.ObjectAnimator;
|
2020-07-26 10:03:38 +02:00
|
|
|
import android.app.Dialog;
|
2015-09-24 22:52:02 +02:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
2019-01-23 18:03:33 +01:00
|
|
|
import android.graphics.Canvas;
|
|
|
|
import android.graphics.Paint;
|
2015-09-24 22:52:02 +02:00
|
|
|
import android.os.Bundle;
|
|
|
|
import android.text.Editable;
|
|
|
|
import android.text.InputFilter;
|
|
|
|
import android.text.InputType;
|
2021-01-28 15:15:51 +01:00
|
|
|
import android.text.TextUtils;
|
2015-09-24 22:52:02 +02:00
|
|
|
import android.text.TextWatcher;
|
|
|
|
import android.util.TypedValue;
|
|
|
|
import android.view.Gravity;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.view.inputmethod.EditorInfo;
|
|
|
|
import android.widget.FrameLayout;
|
2019-01-23 18:03:33 +01:00
|
|
|
import android.widget.ImageView;
|
2015-09-24 22:52:02 +02:00
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.ScrollView;
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
import org.telegram.messenger.AndroidUtilities;
|
|
|
|
import org.telegram.messenger.ChatObject;
|
|
|
|
import org.telegram.messenger.FileLog;
|
2019-05-14 14:08:05 +02:00
|
|
|
import org.telegram.messenger.ImageLocation;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.LocaleController;
|
|
|
|
import org.telegram.messenger.MessagesController;
|
|
|
|
import org.telegram.messenger.NotificationCenter;
|
|
|
|
import org.telegram.messenger.R;
|
|
|
|
import org.telegram.tgnet.ConnectionsManager;
|
|
|
|
import org.telegram.tgnet.TLRPC;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBar;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.AlertDialog;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.ui.ActionBar.BaseFragment;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.Theme;
|
|
|
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
2016-10-11 13:57:01 +02:00
|
|
|
import org.telegram.ui.Cells.AdminedChannelCell;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.ui.Cells.HeaderCell;
|
2016-10-11 13:57:01 +02:00
|
|
|
import org.telegram.ui.Cells.LoadingCell;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.ui.Cells.RadioButtonCell;
|
|
|
|
import org.telegram.ui.Cells.ShadowSectionCell;
|
|
|
|
import org.telegram.ui.Cells.TextBlockCell;
|
|
|
|
import org.telegram.ui.Cells.TextInfoPrivacyCell;
|
|
|
|
import org.telegram.ui.Components.AvatarDrawable;
|
|
|
|
import org.telegram.ui.Components.BackupImageView;
|
2017-12-08 18:35:59 +01:00
|
|
|
import org.telegram.ui.Components.EditTextBoldCursor;
|
2020-07-26 18:07:20 +02:00
|
|
|
import org.telegram.ui.Components.EditTextEmoji;
|
|
|
|
import org.telegram.ui.Components.ImageUpdater;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.ui.Components.LayoutHelper;
|
2021-01-28 15:15:51 +01:00
|
|
|
import org.telegram.ui.Components.LinkActionView;
|
|
|
|
import org.telegram.ui.Components.RLottieDrawable;
|
|
|
|
import org.telegram.ui.Components.RLottieImageView;
|
2019-01-23 18:03:33 +01:00
|
|
|
import org.telegram.ui.Components.RadialProgressView;
|
|
|
|
import org.telegram.ui.Components.SizeNotifierFrameLayout;
|
2015-09-24 22:52:02 +02:00
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
2020-06-25 17:28:24 +02:00
|
|
|
import kotlin.Unit;
|
2022-01-17 08:45:37 +01:00
|
|
|
import tw.nekomimi.nekogram.ui.BottomBuilder;
|
2020-07-26 18:07:20 +02:00
|
|
|
import tw.nekomimi.nekogram.utils.VibrateUtil;
|
2020-06-25 17:28:24 +02:00
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
public class ChannelCreateActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate, ImageUpdater.ImageUpdaterDelegate {
|
2015-09-24 22:52:02 +02:00
|
|
|
|
|
|
|
private View doneButton;
|
2019-01-23 18:03:33 +01:00
|
|
|
private EditTextEmoji nameTextView;
|
2017-03-31 01:58:05 +02:00
|
|
|
private AlertDialog progressDialog;
|
2016-10-11 13:57:01 +02:00
|
|
|
private ShadowSectionCell sectionCell;
|
2015-09-24 22:52:02 +02:00
|
|
|
private BackupImageView avatarImage;
|
2019-01-23 18:03:33 +01:00
|
|
|
private View avatarOverlay;
|
2021-01-28 15:15:51 +01:00
|
|
|
private RLottieImageView avatarEditor;
|
2019-01-23 18:03:33 +01:00
|
|
|
private AnimatorSet avatarAnimation;
|
|
|
|
private RadialProgressView avatarProgressView;
|
2015-09-24 22:52:02 +02:00
|
|
|
private AvatarDrawable avatarDrawable;
|
2018-07-30 04:07:02 +02:00
|
|
|
private ImageUpdater imageUpdater;
|
2017-12-08 18:35:59 +01:00
|
|
|
private EditTextBoldCursor descriptionTextView;
|
2015-09-24 22:52:02 +02:00
|
|
|
private TLRPC.FileLocation avatar;
|
2019-01-23 18:03:33 +01:00
|
|
|
private TLRPC.FileLocation avatarBig;
|
2016-10-11 13:57:01 +02:00
|
|
|
private String nameToSet;
|
2017-03-31 01:58:05 +02:00
|
|
|
private LinearLayout linearLayout2;
|
2019-12-31 14:08:08 +01:00
|
|
|
private HeaderCell headerCell2;
|
|
|
|
private EditTextBoldCursor editText;
|
2015-09-24 22:52:02 +02:00
|
|
|
|
2021-01-28 15:15:51 +01:00
|
|
|
private RLottieDrawable cameraDrawable;
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
private LinearLayout linearLayout;
|
2017-03-31 01:58:05 +02:00
|
|
|
private LinearLayout adminnedChannelsLayout;
|
2015-09-24 22:52:02 +02:00
|
|
|
private LinearLayout linkContainer;
|
|
|
|
private LinearLayout publicContainer;
|
2021-01-28 15:15:51 +01:00
|
|
|
private LinearLayout privateContainer;
|
|
|
|
private LinkActionView permanentLinkView;
|
2015-09-24 22:52:02 +02:00
|
|
|
private RadioButtonCell radioButtonCell1;
|
|
|
|
private RadioButtonCell radioButtonCell2;
|
|
|
|
private TextInfoPrivacyCell typeInfoCell;
|
2017-03-31 01:58:05 +02:00
|
|
|
private TextView helpTextView;
|
2015-09-24 22:52:02 +02:00
|
|
|
private TextView checkTextView;
|
|
|
|
private HeaderCell headerCell;
|
2016-10-11 13:57:01 +02:00
|
|
|
private int checkReqId;
|
|
|
|
private String lastCheckName;
|
|
|
|
private Runnable checkRunnable;
|
|
|
|
private boolean lastNameAvailable;
|
|
|
|
private boolean isPrivate;
|
2015-09-24 22:52:02 +02:00
|
|
|
private boolean loadingInvite;
|
2021-01-28 15:15:51 +01:00
|
|
|
private TLRPC.TL_chatInviteExported invite;
|
2015-09-24 22:52:02 +02:00
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
private boolean loadingAdminedChannels;
|
|
|
|
private TextInfoPrivacyCell adminedInfoCell;
|
|
|
|
private ArrayList<AdminedChannelCell> adminedChannelCells = new ArrayList<>();
|
|
|
|
private LoadingCell loadingAdminedCell;
|
|
|
|
|
2015-09-24 22:52:02 +02:00
|
|
|
private int currentStep;
|
2021-09-20 00:10:42 +02:00
|
|
|
private long chatId;
|
2015-09-24 22:52:02 +02:00
|
|
|
private boolean canCreatePublic = true;
|
2020-07-26 10:03:38 +02:00
|
|
|
private TLRPC.InputFile inputPhoto;
|
|
|
|
private TLRPC.InputFile inputVideo;
|
|
|
|
private String inputVideoPath;
|
|
|
|
private double videoTimestamp;
|
2015-09-24 22:52:02 +02:00
|
|
|
|
|
|
|
private boolean createAfterUpload;
|
|
|
|
private boolean donePressed;
|
|
|
|
|
|
|
|
private final static int done_button = 1;
|
|
|
|
|
|
|
|
public ChannelCreateActivity(Bundle args) {
|
|
|
|
super(args);
|
|
|
|
currentStep = args.getInt("step", 0);
|
|
|
|
if (currentStep == 0) {
|
|
|
|
avatarDrawable = new AvatarDrawable();
|
2020-07-26 10:03:38 +02:00
|
|
|
imageUpdater = new ImageUpdater(true);
|
2015-09-24 22:52:02 +02:00
|
|
|
|
|
|
|
TLRPC.TL_channels_checkUsername req = new TLRPC.TL_channels_checkUsername();
|
|
|
|
req.username = "1";
|
|
|
|
req.channel = new TLRPC.TL_inputChannelEmpty();
|
2019-01-23 18:03:33 +01:00
|
|
|
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> canCreatePublic = error == null || !error.text.equals("CHANNELS_ADMIN_PUBLIC_TOO_MUCH")));
|
2015-09-24 22:52:02 +02:00
|
|
|
} else {
|
|
|
|
if (currentStep == 1) {
|
|
|
|
canCreatePublic = args.getBoolean("canCreatePublic", true);
|
|
|
|
isPrivate = !canCreatePublic;
|
2016-10-11 13:57:01 +02:00
|
|
|
if (!canCreatePublic) {
|
|
|
|
loadAdminedChannels();
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2021-09-20 00:10:42 +02:00
|
|
|
chatId = args.getLong("chat_id", 0);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onFragmentCreate() {
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.chatDidCreated);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.chatDidFailCreate);
|
2017-03-31 01:58:05 +02:00
|
|
|
if (currentStep == 1) {
|
2015-09-24 22:52:02 +02:00
|
|
|
generateLink();
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
if (imageUpdater != null) {
|
|
|
|
imageUpdater.parentFragment = this;
|
2020-07-26 10:03:38 +02:00
|
|
|
imageUpdater.setDelegate(this);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
return super.onFragmentCreate();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFragmentDestroy() {
|
|
|
|
super.onFragmentDestroy();
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatDidCreated);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.chatDidFailCreate);
|
|
|
|
if (imageUpdater != null) {
|
|
|
|
imageUpdater.clear();
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid);
|
2019-01-23 18:03:33 +01:00
|
|
|
if (nameTextView != null) {
|
|
|
|
nameTextView.onDestroy();
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
2019-01-23 18:03:33 +01:00
|
|
|
if (nameTextView != null) {
|
|
|
|
nameTextView.onResume();
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
|
2020-07-26 10:03:38 +02:00
|
|
|
if (imageUpdater != null) {
|
|
|
|
imageUpdater.onResume();
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
@Override
|
|
|
|
public void onPause() {
|
|
|
|
super.onPause();
|
|
|
|
if (nameTextView != null) {
|
|
|
|
nameTextView.onPause();
|
|
|
|
}
|
2020-07-26 10:03:38 +02:00
|
|
|
if (imageUpdater != null) {
|
|
|
|
imageUpdater.onPause();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void dismissCurrentDialog() {
|
|
|
|
if (imageUpdater != null && imageUpdater.dismissCurrentDialog(visibleDialog)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
super.dismissCurrentDialog();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean dismissDialogOnPause(Dialog dialog) {
|
|
|
|
return (imageUpdater == null || imageUpdater.dismissDialogOnPause(dialog)) && super.dismissDialogOnPause(dialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onRequestPermissionsResultFragment(int requestCode, String[] permissions, int[] grantResults) {
|
|
|
|
if (imageUpdater != null) {
|
|
|
|
imageUpdater.onRequestPermissionsResultFragment(requestCode, permissions, grantResults);
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean onBackPressed() {
|
|
|
|
if (nameTextView != null && nameTextView.isPopupShowing()) {
|
|
|
|
nameTextView.hidePopup(true);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-09-24 22:52:02 +02:00
|
|
|
@Override
|
|
|
|
public View createView(Context context) {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (nameTextView != null) {
|
|
|
|
nameTextView.onDestroy();
|
|
|
|
}
|
|
|
|
|
2015-09-24 22:52:02 +02:00
|
|
|
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
|
|
|
actionBar.setAllowOverlayTitle(true);
|
|
|
|
|
|
|
|
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
|
|
|
@Override
|
|
|
|
public void onItemClick(int id) {
|
|
|
|
if (id == -1) {
|
|
|
|
finishFragment();
|
|
|
|
} else if (id == done_button) {
|
|
|
|
if (currentStep == 0) {
|
2019-05-14 14:08:05 +02:00
|
|
|
if (donePressed || getParentActivity() == null) {
|
2015-09-24 22:52:02 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (nameTextView.length() == 0) {
|
2020-07-26 18:07:20 +02:00
|
|
|
VibrateUtil.vibrate();
|
2015-09-24 22:52:02 +02:00
|
|
|
AndroidUtilities.shakeView(nameTextView, 2, 0);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
donePressed = true;
|
2020-07-26 10:03:38 +02:00
|
|
|
if (imageUpdater.isUploadingImage()) {
|
2015-09-24 22:52:02 +02:00
|
|
|
createAfterUpload = true;
|
2019-01-23 18:03:33 +01:00
|
|
|
progressDialog = new AlertDialog(getParentActivity(), 3);
|
|
|
|
progressDialog.setOnCancelListener(dialog -> {
|
|
|
|
createAfterUpload = false;
|
|
|
|
progressDialog = null;
|
|
|
|
donePressed = false;
|
2015-09-24 22:52:02 +02:00
|
|
|
});
|
|
|
|
progressDialog.show();
|
|
|
|
return;
|
|
|
|
}
|
2021-01-28 15:15:51 +01:00
|
|
|
final int reqId = MessagesController.getInstance(currentAccount).createChat(nameTextView.getText().toString(), new ArrayList<>(), descriptionTextView.getText().toString(), ChatObject.CHAT_TYPE_CHANNEL, false, null, null, ChannelCreateActivity.this);
|
2019-01-23 18:03:33 +01:00
|
|
|
progressDialog = new AlertDialog(getParentActivity(), 3);
|
|
|
|
progressDialog.setOnCancelListener(dialog -> {
|
|
|
|
ConnectionsManager.getInstance(currentAccount).cancelRequest(reqId, true);
|
|
|
|
donePressed = false;
|
2015-09-24 22:52:02 +02:00
|
|
|
});
|
|
|
|
progressDialog.show();
|
|
|
|
} else if (currentStep == 1) {
|
|
|
|
if (!isPrivate) {
|
2019-01-23 18:03:33 +01:00
|
|
|
if (descriptionTextView.length() == 0) {
|
2015-09-24 22:52:02 +02:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2019-12-31 14:08:08 +01:00
|
|
|
builder.setTitle(LocaleController.getString("ChannelPublicEmptyUsernameTitle", R.string.ChannelPublicEmptyUsernameTitle));
|
2015-09-24 22:52:02 +02:00
|
|
|
builder.setMessage(LocaleController.getString("ChannelPublicEmptyUsername", R.string.ChannelPublicEmptyUsername));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("Close", R.string.Close), null);
|
|
|
|
showDialog(builder.create());
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
if (!lastNameAvailable) {
|
2020-07-26 18:07:20 +02:00
|
|
|
VibrateUtil.vibrate();
|
2015-09-24 22:52:02 +02:00
|
|
|
AndroidUtilities.shakeView(checkTextView, 2, 0);
|
|
|
|
return;
|
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).updateChannelUserName(chatId, lastCheckName);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("step", 2);
|
2021-09-20 00:10:42 +02:00
|
|
|
args.putLong("chatId", chatId);
|
2017-03-31 01:58:05 +02:00
|
|
|
args.putInt("chatType", ChatObject.CHAT_TYPE_CHANNEL);
|
|
|
|
presentFragment(new GroupCreateActivity(args), true);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
2020-12-24 06:36:01 +01:00
|
|
|
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56), LocaleController.getString("Done", R.string.Done));
|
2015-09-24 22:52:02 +02:00
|
|
|
|
|
|
|
if (currentStep == 0) {
|
|
|
|
actionBar.setTitle(LocaleController.getString("NewChannel", R.string.NewChannel));
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2020-09-30 15:48:47 +02:00
|
|
|
SizeNotifierFrameLayout sizeNotifierFrameLayout = new SizeNotifierFrameLayout(context) {
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
private boolean ignoreLayout;
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
@Override
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
|
|
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
|
|
|
|
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
|
|
|
|
|
|
|
|
setMeasuredDimension(widthSize, heightSize);
|
|
|
|
heightSize -= getPaddingTop();
|
|
|
|
|
|
|
|
measureChildWithMargins(actionBar, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
|
|
|
|
2020-09-30 15:48:47 +02:00
|
|
|
int keyboardSize = measureKeyboardHeight();
|
2019-05-14 14:08:05 +02:00
|
|
|
if (keyboardSize > AndroidUtilities.dp(20)) {
|
|
|
|
ignoreLayout = true;
|
|
|
|
nameTextView.hideEmojiView();
|
|
|
|
ignoreLayout = false;
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
int childCount = getChildCount();
|
2019-01-23 18:03:33 +01:00
|
|
|
for (int i = 0; i < childCount; i++) {
|
|
|
|
View child = getChildAt(i);
|
|
|
|
if (child == null || child.getVisibility() == GONE || child == actionBar) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (nameTextView != null && nameTextView.isPopupView(child)) {
|
|
|
|
if (AndroidUtilities.isInMultiwindow || AndroidUtilities.isTablet()) {
|
|
|
|
if (AndroidUtilities.isTablet()) {
|
|
|
|
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(AndroidUtilities.isTablet() ? 200 : 320), heightSize - AndroidUtilities.statusBarHeight + getPaddingTop()), MeasureSpec.EXACTLY));
|
|
|
|
} else {
|
|
|
|
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightSize - AndroidUtilities.statusBarHeight + getPaddingTop(), MeasureSpec.EXACTLY));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(child.getLayoutParams().height, MeasureSpec.EXACTLY));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
|
|
|
final int count = getChildCount();
|
|
|
|
|
2020-09-30 15:48:47 +02:00
|
|
|
int keyboardSize = measureKeyboardHeight();
|
2020-02-13 19:26:53 +01:00
|
|
|
int paddingBottom = keyboardSize <= AndroidUtilities.dp(20) && !AndroidUtilities.isInMultiwindow && !AndroidUtilities.isTablet() ? nameTextView.getEmojiPadding() : 0;
|
2019-01-23 18:03:33 +01:00
|
|
|
setBottomClip(paddingBottom);
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
final View child = getChildAt(i);
|
|
|
|
if (child.getVisibility() == GONE) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
|
|
|
|
|
|
|
|
final int width = child.getMeasuredWidth();
|
|
|
|
final int height = child.getMeasuredHeight();
|
|
|
|
|
|
|
|
int childLeft;
|
|
|
|
int childTop;
|
|
|
|
|
|
|
|
int gravity = lp.gravity;
|
|
|
|
if (gravity == -1) {
|
|
|
|
gravity = Gravity.TOP | Gravity.LEFT;
|
|
|
|
}
|
|
|
|
|
|
|
|
final int absoluteGravity = gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
|
|
|
|
final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
|
|
|
|
|
|
|
|
switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
|
|
|
|
case Gravity.CENTER_HORIZONTAL:
|
|
|
|
childLeft = (r - l - width) / 2 + lp.leftMargin - lp.rightMargin;
|
|
|
|
break;
|
|
|
|
case Gravity.RIGHT:
|
|
|
|
childLeft = r - width - lp.rightMargin;
|
|
|
|
break;
|
|
|
|
case Gravity.LEFT:
|
|
|
|
default:
|
|
|
|
childLeft = lp.leftMargin;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (verticalGravity) {
|
|
|
|
case Gravity.TOP:
|
|
|
|
childTop = lp.topMargin + getPaddingTop();
|
|
|
|
break;
|
|
|
|
case Gravity.CENTER_VERTICAL:
|
|
|
|
childTop = ((b - paddingBottom) - t - height) / 2 + lp.topMargin - lp.bottomMargin;
|
|
|
|
break;
|
|
|
|
case Gravity.BOTTOM:
|
|
|
|
childTop = ((b - paddingBottom) - t) - height - lp.bottomMargin;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
childTop = lp.topMargin;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nameTextView != null && nameTextView.isPopupView(child)) {
|
|
|
|
if (AndroidUtilities.isTablet()) {
|
|
|
|
childTop = getMeasuredHeight() - child.getMeasuredHeight();
|
|
|
|
} else {
|
2020-02-13 19:26:53 +01:00
|
|
|
childTop = getMeasuredHeight() + keyboardSize - child.getMeasuredHeight();
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
child.layout(childLeft, childTop, childLeft + width, childTop + height);
|
|
|
|
}
|
|
|
|
|
|
|
|
notifyHeightChanged();
|
|
|
|
}
|
2019-05-14 14:08:05 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void requestLayout() {
|
|
|
|
if (ignoreLayout) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
super.requestLayout();
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
};
|
|
|
|
sizeNotifierFrameLayout.setOnTouchListener((v, event) -> true);
|
|
|
|
fragmentView = sizeNotifierFrameLayout;
|
2017-03-31 01:58:05 +02:00
|
|
|
fragmentView.setTag(Theme.key_windowBackgroundWhite);
|
|
|
|
fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
2019-01-23 18:03:33 +01:00
|
|
|
|
|
|
|
linearLayout = new LinearLayout(context);
|
|
|
|
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
|
|
|
sizeNotifierFrameLayout.addView(linearLayout, new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
|
|
|
|
2016-06-24 12:27:15 +02:00
|
|
|
FrameLayout frameLayout = new FrameLayout(context);
|
2015-09-24 22:52:02 +02:00
|
|
|
linearLayout.addView(frameLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
avatarImage = new BackupImageView(context) {
|
|
|
|
@Override
|
|
|
|
public void invalidate() {
|
|
|
|
if (avatarOverlay != null) {
|
|
|
|
avatarOverlay.invalidate();
|
|
|
|
}
|
|
|
|
super.invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void invalidate(int l, int t, int r, int b) {
|
|
|
|
if (avatarOverlay != null) {
|
|
|
|
avatarOverlay.invalidate();
|
|
|
|
}
|
|
|
|
super.invalidate(l, t, r, b);
|
|
|
|
}
|
|
|
|
};
|
2015-09-24 22:52:02 +02:00
|
|
|
avatarImage.setRoundRadius(AndroidUtilities.dp(32));
|
2019-09-10 12:56:11 +02:00
|
|
|
avatarDrawable.setInfo(5, null, null);
|
2015-09-24 22:52:02 +02:00
|
|
|
avatarImage.setImageDrawable(avatarDrawable);
|
|
|
|
frameLayout.addView(avatarImage, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 12));
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
|
|
|
paint.setColor(0x55000000);
|
2015-09-24 22:52:02 +02:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
avatarOverlay = new View(context) {
|
|
|
|
@Override
|
|
|
|
protected void onDraw(Canvas canvas) {
|
|
|
|
if (avatarImage != null && avatarImage.getImageReceiver().hasNotThumb()) {
|
|
|
|
paint.setAlpha((int) (0x55 * avatarImage.getImageReceiver().getCurrentAlpha()));
|
2020-07-26 10:03:38 +02:00
|
|
|
canvas.drawCircle(getMeasuredWidth() / 2.0f, getMeasuredHeight() / 2.0f, getMeasuredWidth() / 2.0f, paint);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
frameLayout.addView(avatarOverlay, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 12));
|
2021-01-28 15:15:51 +01:00
|
|
|
avatarOverlay.setOnClickListener(view -> {
|
|
|
|
imageUpdater.openMenu(avatar != null, () -> {
|
|
|
|
avatar = null;
|
|
|
|
avatarBig = null;
|
|
|
|
inputPhoto = null;
|
|
|
|
inputVideo = null;
|
|
|
|
inputVideoPath = null;
|
|
|
|
videoTimestamp = 0;
|
|
|
|
showAvatarProgress(false, true);
|
|
|
|
avatarImage.setImage(null, null, avatarDrawable, null);
|
|
|
|
avatarEditor.setAnimation(cameraDrawable);
|
|
|
|
cameraDrawable.setCurrentFrame(0);
|
|
|
|
}, dialog -> {
|
2021-08-31 21:06:39 +02:00
|
|
|
if (!imageUpdater.isUploadingImage()) {
|
|
|
|
cameraDrawable.setCustomEndFrame(86);
|
|
|
|
avatarEditor.playAnimation();
|
|
|
|
} else {
|
|
|
|
cameraDrawable.setCurrentFrame(0, false);
|
|
|
|
}
|
2021-01-28 15:15:51 +01:00
|
|
|
});
|
|
|
|
cameraDrawable.setCurrentFrame(0);
|
|
|
|
cameraDrawable.setCustomEndFrame(43);
|
|
|
|
avatarEditor.playAnimation();
|
|
|
|
});
|
|
|
|
|
|
|
|
cameraDrawable = new RLottieDrawable(R.raw.camera, "" + R.raw.camera, AndroidUtilities.dp(60), AndroidUtilities.dp(60), false, null);
|
2019-01-23 18:03:33 +01:00
|
|
|
|
2021-01-28 15:15:51 +01:00
|
|
|
avatarEditor = new RLottieImageView(context) {
|
2019-01-23 18:03:33 +01:00
|
|
|
@Override
|
|
|
|
public void invalidate(int l, int t, int r, int b) {
|
|
|
|
super.invalidate(l, t, r, b);
|
|
|
|
avatarOverlay.invalidate();
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
@Override
|
|
|
|
public void invalidate() {
|
|
|
|
super.invalidate();
|
|
|
|
avatarOverlay.invalidate();
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
};
|
|
|
|
avatarEditor.setScaleType(ImageView.ScaleType.CENTER);
|
2021-01-28 15:15:51 +01:00
|
|
|
avatarEditor.setAnimation(cameraDrawable);
|
2019-01-23 18:03:33 +01:00
|
|
|
avatarEditor.setEnabled(false);
|
|
|
|
avatarEditor.setClickable(false);
|
2021-01-28 15:15:51 +01:00
|
|
|
avatarEditor.setPadding(AndroidUtilities.dp(2), 0, 0, AndroidUtilities.dp(1));
|
2019-01-23 18:03:33 +01:00
|
|
|
frameLayout.addView(avatarEditor, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 12));
|
|
|
|
|
|
|
|
avatarProgressView = new RadialProgressView(context);
|
|
|
|
avatarProgressView.setSize(AndroidUtilities.dp(30));
|
|
|
|
avatarProgressView.setProgressColor(0xffffffff);
|
2020-07-26 10:03:38 +02:00
|
|
|
avatarProgressView.setNoProgress(false);
|
2019-01-23 18:03:33 +01:00
|
|
|
frameLayout.addView(avatarProgressView, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 12));
|
2015-09-24 22:52:02 +02:00
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
showAvatarProgress(false, false);
|
|
|
|
|
2019-05-14 14:08:05 +02:00
|
|
|
nameTextView = new EditTextEmoji(context, sizeNotifierFrameLayout, this, EditTextEmoji.STYLE_FRAGMENT);
|
2015-09-24 22:52:02 +02:00
|
|
|
nameTextView.setHint(LocaleController.getString("EnterChannelName", R.string.EnterChannelName));
|
|
|
|
if (nameToSet != null) {
|
|
|
|
nameTextView.setText(nameToSet);
|
|
|
|
nameToSet = null;
|
|
|
|
}
|
|
|
|
InputFilter[] inputFilters = new InputFilter[1];
|
|
|
|
inputFilters[0] = new InputFilter.LengthFilter(100);
|
|
|
|
nameTextView.setFilters(inputFilters);
|
2021-01-28 15:15:51 +01:00
|
|
|
nameTextView.getEditText().setSingleLine(true);
|
|
|
|
nameTextView.getEditText().setImeOptions(EditorInfo.IME_ACTION_NEXT);
|
|
|
|
nameTextView.getEditText().setOnEditorActionListener((textView, i, keyEvent) -> {
|
|
|
|
if (i == EditorInfo.IME_ACTION_NEXT && !TextUtils.isEmpty(nameTextView.getEditText().getText())) {
|
|
|
|
descriptionTextView.requestFocus();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
2019-01-23 18:03:33 +01:00
|
|
|
frameLayout.addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 5 : 96, 0, LocaleController.isRTL ? 96 : 5, 0));
|
2015-09-24 22:52:02 +02:00
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
descriptionTextView = new EditTextBoldCursor(context);
|
2015-09-24 22:52:02 +02:00
|
|
|
descriptionTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
2017-03-31 01:58:05 +02:00
|
|
|
descriptionTextView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
|
|
|
|
descriptionTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
descriptionTextView.setBackgroundDrawable(Theme.createEditTextDrawable(context, false));
|
2015-09-24 22:52:02 +02:00
|
|
|
descriptionTextView.setPadding(0, 0, 0, AndroidUtilities.dp(6));
|
|
|
|
descriptionTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
|
|
|
descriptionTextView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
|
|
|
|
descriptionTextView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
|
|
|
inputFilters = new InputFilter[1];
|
|
|
|
inputFilters[0] = new InputFilter.LengthFilter(120);
|
|
|
|
descriptionTextView.setFilters(inputFilters);
|
|
|
|
descriptionTextView.setHint(LocaleController.getString("DescriptionPlaceholder", R.string.DescriptionPlaceholder));
|
2017-12-08 18:35:59 +01:00
|
|
|
descriptionTextView.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
descriptionTextView.setCursorSize(AndroidUtilities.dp(20));
|
|
|
|
descriptionTextView.setCursorWidth(1.5f);
|
2015-09-24 22:52:02 +02:00
|
|
|
linearLayout.addView(descriptionTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 24, 18, 24, 0));
|
2019-01-23 18:03:33 +01:00
|
|
|
descriptionTextView.setOnEditorActionListener((textView, i, keyEvent) -> {
|
|
|
|
if (i == EditorInfo.IME_ACTION_DONE && doneButton != null) {
|
|
|
|
doneButton.performClick();
|
|
|
|
return true;
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
return false;
|
2015-09-24 22:52:02 +02:00
|
|
|
});
|
|
|
|
descriptionTextView.addTextChangedListener(new TextWatcher() {
|
|
|
|
@Override
|
|
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void afterTextChanged(Editable editable) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
helpTextView = new TextView(context);
|
2015-09-24 22:52:02 +02:00
|
|
|
helpTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
2017-03-31 01:58:05 +02:00
|
|
|
helpTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText8));
|
2015-09-24 22:52:02 +02:00
|
|
|
helpTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
|
|
|
helpTextView.setText(LocaleController.getString("DescriptionInfo", R.string.DescriptionInfo));
|
|
|
|
linearLayout.addView(helpTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 24, 10, 24, 20));
|
|
|
|
} else if (currentStep == 1) {
|
2019-01-23 18:03:33 +01:00
|
|
|
fragmentView = new ScrollView(context);
|
|
|
|
ScrollView scrollView = (ScrollView) fragmentView;
|
|
|
|
scrollView.setFillViewport(true);
|
|
|
|
linearLayout = new LinearLayout(context);
|
|
|
|
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
|
|
|
scrollView.addView(linearLayout, new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
actionBar.setTitle(LocaleController.getString("ChannelSettingsTitle", R.string.ChannelSettingsTitle));
|
2017-03-31 01:58:05 +02:00
|
|
|
fragmentView.setTag(Theme.key_windowBackgroundGray);
|
|
|
|
fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
|
2015-09-24 22:52:02 +02:00
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
headerCell2 = new HeaderCell(context, 23);
|
|
|
|
headerCell2.setHeight(46);
|
|
|
|
headerCell2.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
|
|
headerCell2.setText(LocaleController.getString("ChannelTypeHeader", R.string.ChannelTypeHeader));
|
|
|
|
linearLayout.addView(headerCell2);
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
linearLayout2 = new LinearLayout(context);
|
2015-09-24 22:52:02 +02:00
|
|
|
linearLayout2.setOrientation(LinearLayout.VERTICAL);
|
2017-03-31 01:58:05 +02:00
|
|
|
linearLayout2.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
2015-09-24 22:52:02 +02:00
|
|
|
linearLayout.addView(linearLayout2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
|
|
|
|
|
|
|
radioButtonCell1 = new RadioButtonCell(context);
|
2017-03-31 01:58:05 +02:00
|
|
|
radioButtonCell1.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
2020-06-25 17:28:24 +02:00
|
|
|
radioButtonCell1.setTextAndValueAndCheck(LocaleController.getString("ChannelPublic", R.string.ChannelPublic), LocaleController.getString("ChannelPublicInfo", R.string.ChannelPublicInfo), false, !isPrivate);
|
2015-09-24 22:52:02 +02:00
|
|
|
linearLayout2.addView(radioButtonCell1, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
2019-01-23 18:03:33 +01:00
|
|
|
radioButtonCell1.setOnClickListener(v -> {
|
|
|
|
if (!isPrivate) {
|
|
|
|
return;
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
isPrivate = false;
|
|
|
|
updatePrivatePublic();
|
2015-09-24 22:52:02 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
radioButtonCell2 = new RadioButtonCell(context);
|
2017-03-31 01:58:05 +02:00
|
|
|
radioButtonCell2.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
2020-06-25 17:28:24 +02:00
|
|
|
radioButtonCell2.setTextAndValueAndCheck(LocaleController.getString("ChannelPrivate", R.string.ChannelPrivate), LocaleController.getString("ChannelPrivateInfo", R.string.ChannelPrivateInfo), false, isPrivate);
|
2015-09-24 22:52:02 +02:00
|
|
|
linearLayout2.addView(radioButtonCell2, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
2019-01-23 18:03:33 +01:00
|
|
|
radioButtonCell2.setOnClickListener(v -> {
|
|
|
|
if (isPrivate) {
|
|
|
|
return;
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
isPrivate = true;
|
|
|
|
updatePrivatePublic();
|
2015-09-24 22:52:02 +02:00
|
|
|
});
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
sectionCell = new ShadowSectionCell(context);
|
2015-09-24 22:52:02 +02:00
|
|
|
linearLayout.addView(sectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
|
|
|
|
|
|
|
linkContainer = new LinearLayout(context);
|
|
|
|
linkContainer.setOrientation(LinearLayout.VERTICAL);
|
2017-03-31 01:58:05 +02:00
|
|
|
linkContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
2015-09-24 22:52:02 +02:00
|
|
|
linearLayout.addView(linkContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
|
|
|
|
|
|
|
headerCell = new HeaderCell(context);
|
|
|
|
linkContainer.addView(headerCell);
|
|
|
|
|
|
|
|
publicContainer = new LinearLayout(context);
|
|
|
|
publicContainer.setOrientation(LinearLayout.HORIZONTAL);
|
|
|
|
linkContainer.addView(publicContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36, 17, 7, 17, 0));
|
|
|
|
|
2019-12-31 14:08:08 +01:00
|
|
|
editText = new EditTextBoldCursor(context);
|
2018-07-30 04:07:02 +02:00
|
|
|
editText.setText(MessagesController.getInstance(currentAccount).linkPrefix + "/");
|
2015-09-24 22:52:02 +02:00
|
|
|
editText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
2017-03-31 01:58:05 +02:00
|
|
|
editText.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
|
|
|
|
editText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
2015-09-24 22:52:02 +02:00
|
|
|
editText.setMaxLines(1);
|
|
|
|
editText.setLines(1);
|
|
|
|
editText.setEnabled(false);
|
|
|
|
editText.setBackgroundDrawable(null);
|
|
|
|
editText.setPadding(0, 0, 0, 0);
|
|
|
|
editText.setSingleLine(true);
|
|
|
|
editText.setInputType(InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
|
|
|
|
editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
|
|
|
publicContainer.addView(editText, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, 36));
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
descriptionTextView = new EditTextBoldCursor(context);
|
|
|
|
descriptionTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
|
|
|
descriptionTextView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
|
|
|
|
descriptionTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
descriptionTextView.setMaxLines(1);
|
|
|
|
descriptionTextView.setLines(1);
|
|
|
|
descriptionTextView.setBackgroundDrawable(null);
|
|
|
|
descriptionTextView.setPadding(0, 0, 0, 0);
|
|
|
|
descriptionTextView.setSingleLine(true);
|
|
|
|
descriptionTextView.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
|
|
|
|
descriptionTextView.setImeOptions(EditorInfo.IME_ACTION_DONE);
|
|
|
|
descriptionTextView.setHint(LocaleController.getString("ChannelUsernamePlaceholder", R.string.ChannelUsernamePlaceholder));
|
|
|
|
descriptionTextView.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
descriptionTextView.setCursorSize(AndroidUtilities.dp(20));
|
|
|
|
descriptionTextView.setCursorWidth(1.5f);
|
|
|
|
publicContainer.addView(descriptionTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 36));
|
|
|
|
descriptionTextView.addTextChangedListener(new TextWatcher() {
|
2015-09-24 22:52:02 +02:00
|
|
|
@Override
|
|
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
2019-01-23 18:03:33 +01:00
|
|
|
checkUserName(descriptionTextView.getText().toString());
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void afterTextChanged(Editable editable) {
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-01-28 15:15:51 +01:00
|
|
|
privateContainer = new LinearLayout(context);
|
|
|
|
privateContainer.setOrientation(LinearLayout.VERTICAL);
|
|
|
|
linkContainer.addView(privateContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
|
|
|
|
2021-02-23 12:53:38 +01:00
|
|
|
permanentLinkView = new LinkActionView(context, this, null, chatId, true, ChatObject.isChannel(getMessagesController().getChat(chatId)));
|
|
|
|
//permanentLinkView.showOptions(false);
|
2021-02-25 17:58:14 +01:00
|
|
|
permanentLinkView.hideRevokeOption(true);
|
2021-01-28 15:15:51 +01:00
|
|
|
permanentLinkView.setUsers(0, null);
|
|
|
|
privateContainer.addView(permanentLinkView);
|
2015-09-24 22:52:02 +02:00
|
|
|
|
|
|
|
checkTextView = new TextView(context);
|
|
|
|
checkTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
|
|
|
checkTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
|
|
|
checkTextView.setVisibility(View.GONE);
|
|
|
|
linkContainer.addView(checkTextView, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT, 17, 3, 17, 7));
|
|
|
|
|
|
|
|
typeInfoCell = new TextInfoPrivacyCell(context);
|
2017-03-31 01:58:05 +02:00
|
|
|
typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
2015-09-24 22:52:02 +02:00
|
|
|
linearLayout.addView(typeInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
loadingAdminedCell = new LoadingCell(context);
|
|
|
|
linearLayout.addView(loadingAdminedCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
adminnedChannelsLayout = new LinearLayout(context);
|
|
|
|
adminnedChannelsLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
|
|
|
adminnedChannelsLayout.setOrientation(LinearLayout.VERTICAL);
|
|
|
|
linearLayout.addView(adminnedChannelsLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
adminedInfoCell = new TextInfoPrivacyCell(context);
|
2017-03-31 01:58:05 +02:00
|
|
|
adminedInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
2016-10-11 13:57:01 +02:00
|
|
|
linearLayout.addView(adminedInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
|
|
|
|
|
2015-09-24 22:52:02 +02:00
|
|
|
updatePrivatePublic();
|
|
|
|
}
|
|
|
|
|
|
|
|
return fragmentView;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void generateLink() {
|
|
|
|
if (loadingInvite || invite != null) {
|
|
|
|
return;
|
|
|
|
}
|
2021-02-23 12:53:38 +01:00
|
|
|
TLRPC.ChatFull chatFull = getMessagesController().getChatFull(chatId);
|
|
|
|
if (chatFull != null) {
|
|
|
|
invite = chatFull.exported_invite;
|
|
|
|
}
|
|
|
|
if (invite != null) {
|
|
|
|
return;
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
loadingInvite = true;
|
2021-02-23 12:53:38 +01:00
|
|
|
TLRPC.TL_messages_getExportedChatInvites req = new TLRPC.TL_messages_getExportedChatInvites();
|
2021-01-28 15:15:51 +01:00
|
|
|
req.peer = getMessagesController().getInputPeer(-chatId);
|
|
|
|
req.admin_id = getMessagesController().getInputUser(getUserConfig().getCurrentUser());
|
|
|
|
req.limit = 1;
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
|
|
|
if (error == null) {
|
2021-01-28 15:15:51 +01:00
|
|
|
TLRPC.TL_messages_exportedChatInvites invites = (TLRPC.TL_messages_exportedChatInvites) response;
|
|
|
|
invite = (TLRPC.TL_chatInviteExported) invites.invites.get(0);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
loadingInvite = false;
|
2021-01-28 15:15:51 +01:00
|
|
|
permanentLinkView.setLink(invite != null ? invite.link : null);
|
2021-02-23 12:53:38 +01:00
|
|
|
}));
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void updatePrivatePublic() {
|
2016-10-11 13:57:01 +02:00
|
|
|
if (sectionCell == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!isPrivate && !canCreatePublic) {
|
|
|
|
typeInfoCell.setText(LocaleController.getString("ChangePublicLimitReached", R.string.ChangePublicLimitReached));
|
2017-03-31 01:58:05 +02:00
|
|
|
typeInfoCell.setTag(Theme.key_windowBackgroundWhiteRedText4);
|
|
|
|
typeInfoCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
|
2016-10-11 13:57:01 +02:00
|
|
|
linkContainer.setVisibility(View.GONE);
|
|
|
|
sectionCell.setVisibility(View.GONE);
|
|
|
|
if (loadingAdminedChannels) {
|
|
|
|
loadingAdminedCell.setVisibility(View.VISIBLE);
|
2017-03-31 01:58:05 +02:00
|
|
|
adminnedChannelsLayout.setVisibility(View.GONE);
|
|
|
|
typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
2016-10-11 13:57:01 +02:00
|
|
|
adminedInfoCell.setVisibility(View.GONE);
|
|
|
|
} else {
|
2017-03-31 01:58:05 +02:00
|
|
|
typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
|
2016-10-11 13:57:01 +02:00
|
|
|
loadingAdminedCell.setVisibility(View.GONE);
|
2017-03-31 01:58:05 +02:00
|
|
|
adminnedChannelsLayout.setVisibility(View.VISIBLE);
|
2016-10-11 13:57:01 +02:00
|
|
|
adminedInfoCell.setVisibility(View.VISIBLE);
|
|
|
|
}
|
|
|
|
} else {
|
2017-03-31 01:58:05 +02:00
|
|
|
typeInfoCell.setTag(Theme.key_windowBackgroundWhiteGrayText4);
|
|
|
|
typeInfoCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
|
2016-10-11 13:57:01 +02:00
|
|
|
sectionCell.setVisibility(View.VISIBLE);
|
|
|
|
adminedInfoCell.setVisibility(View.GONE);
|
2017-03-31 01:58:05 +02:00
|
|
|
adminnedChannelsLayout.setVisibility(View.GONE);
|
|
|
|
typeInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(typeInfoCell.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
|
2016-10-11 13:57:01 +02:00
|
|
|
linkContainer.setVisibility(View.VISIBLE);
|
|
|
|
loadingAdminedCell.setVisibility(View.GONE);
|
|
|
|
typeInfoCell.setText(isPrivate ? LocaleController.getString("ChannelPrivateLinkHelp", R.string.ChannelPrivateLinkHelp) : LocaleController.getString("ChannelUsernameHelp", R.string.ChannelUsernameHelp));
|
|
|
|
headerCell.setText(isPrivate ? LocaleController.getString("ChannelInviteLinkTitle", R.string.ChannelInviteLinkTitle) : LocaleController.getString("ChannelLinkTitle", R.string.ChannelLinkTitle));
|
|
|
|
publicContainer.setVisibility(isPrivate ? View.GONE : View.VISIBLE);
|
|
|
|
privateContainer.setVisibility(isPrivate ? View.VISIBLE : View.GONE);
|
|
|
|
linkContainer.setPadding(0, 0, 0, isPrivate ? 0 : AndroidUtilities.dp(7));
|
2021-01-28 15:15:51 +01:00
|
|
|
permanentLinkView.setLink(invite != null ? invite.link : null);
|
2016-10-11 13:57:01 +02:00
|
|
|
checkTextView.setVisibility(!isPrivate && checkTextView.length() != 0 ? View.VISIBLE : View.GONE);
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
radioButtonCell1.setChecked(!isPrivate, true);
|
|
|
|
radioButtonCell2.setChecked(isPrivate, true);
|
2019-01-23 18:03:33 +01:00
|
|
|
descriptionTextView.clearFocus();
|
|
|
|
AndroidUtilities.hideKeyboard(descriptionTextView);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-07-26 10:03:38 +02:00
|
|
|
public void onUploadProgressChanged(float progress) {
|
|
|
|
if (avatarProgressView == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
avatarProgressView.setProgress(progress);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void didStartUpload(boolean isVideo) {
|
|
|
|
if (avatarProgressView == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
avatarProgressView.setProgress(0.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void didUploadPhoto(final TLRPC.InputFile photo, final TLRPC.InputFile video, double videoStartTimestamp, String videoPath, final TLRPC.PhotoSize bigSize, final TLRPC.PhotoSize smallSize) {
|
2019-01-23 18:03:33 +01:00
|
|
|
AndroidUtilities.runOnUIThread(() -> {
|
2020-07-26 10:03:38 +02:00
|
|
|
if (photo != null || video != null) {
|
|
|
|
inputPhoto = photo;
|
|
|
|
inputVideo = video;
|
|
|
|
inputVideoPath = videoPath;
|
|
|
|
videoTimestamp = videoStartTimestamp;
|
2015-09-24 22:52:02 +02:00
|
|
|
if (createAfterUpload) {
|
|
|
|
try {
|
|
|
|
if (progressDialog != null && progressDialog.isShowing()) {
|
|
|
|
progressDialog.dismiss();
|
|
|
|
progressDialog = null;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
donePressed = false;
|
2015-09-24 22:52:02 +02:00
|
|
|
doneButton.performClick();
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
showAvatarProgress(false, true);
|
|
|
|
} else {
|
|
|
|
avatar = smallSize.location;
|
|
|
|
avatarBig = bigSize.location;
|
2019-05-14 14:08:05 +02:00
|
|
|
avatarImage.setImage(ImageLocation.getForLocal(avatar), "50_50", avatarDrawable, null);
|
2019-01-23 18:03:33 +01:00
|
|
|
showAvatarProgress(true, false);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
@Override
|
|
|
|
public String getInitialSearchString() {
|
|
|
|
return nameTextView.getText().toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void showAvatarProgress(boolean show, boolean animated) {
|
|
|
|
if (avatarEditor == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (avatarAnimation != null) {
|
2021-09-20 00:10:42 +02:00
|
|
|
avatarAnimation.removeAllListeners();
|
2019-01-23 18:03:33 +01:00
|
|
|
avatarAnimation.cancel();
|
|
|
|
avatarAnimation = null;
|
|
|
|
}
|
|
|
|
if (animated) {
|
|
|
|
avatarAnimation = new AnimatorSet();
|
|
|
|
if (show) {
|
|
|
|
avatarProgressView.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
avatarAnimation.playTogether(ObjectAnimator.ofFloat(avatarEditor, View.ALPHA, 0.0f),
|
|
|
|
ObjectAnimator.ofFloat(avatarProgressView, View.ALPHA, 1.0f));
|
|
|
|
} else {
|
2021-09-20 00:10:42 +02:00
|
|
|
if (avatarEditor.getVisibility() != View.VISIBLE) {
|
|
|
|
avatarEditor.setAlpha(0f);
|
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
avatarEditor.setVisibility(View.VISIBLE);
|
|
|
|
|
|
|
|
avatarAnimation.playTogether(ObjectAnimator.ofFloat(avatarEditor, View.ALPHA, 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(avatarProgressView, View.ALPHA, 0.0f));
|
|
|
|
}
|
|
|
|
avatarAnimation.setDuration(180);
|
|
|
|
avatarAnimation.addListener(new AnimatorListenerAdapter() {
|
|
|
|
@Override
|
|
|
|
public void onAnimationEnd(Animator animation) {
|
|
|
|
if (avatarAnimation == null || avatarEditor == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (show) {
|
|
|
|
avatarEditor.setVisibility(View.INVISIBLE);
|
|
|
|
} else {
|
|
|
|
avatarProgressView.setVisibility(View.INVISIBLE);
|
|
|
|
}
|
|
|
|
avatarAnimation = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onAnimationCancel(Animator animation) {
|
|
|
|
avatarAnimation = null;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
avatarAnimation.start();
|
|
|
|
} else {
|
|
|
|
if (show) {
|
|
|
|
avatarEditor.setAlpha(1.0f);
|
|
|
|
avatarEditor.setVisibility(View.INVISIBLE);
|
|
|
|
avatarProgressView.setAlpha(1.0f);
|
|
|
|
avatarProgressView.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
avatarEditor.setAlpha(1.0f);
|
|
|
|
avatarEditor.setVisibility(View.VISIBLE);
|
|
|
|
avatarProgressView.setAlpha(0.0f);
|
|
|
|
avatarProgressView.setVisibility(View.INVISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-09-24 22:52:02 +02:00
|
|
|
@Override
|
|
|
|
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
|
2020-01-01 19:32:12 +01:00
|
|
|
if (imageUpdater != null) {
|
|
|
|
imageUpdater.onActivityResult(requestCode, resultCode, data);
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void saveSelfArgs(Bundle args) {
|
|
|
|
if (currentStep == 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (imageUpdater != null && imageUpdater.currentPicturePath != null) {
|
|
|
|
args.putString("path", imageUpdater.currentPicturePath);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
if (nameTextView != null) {
|
|
|
|
String text = nameTextView.getText().toString();
|
2021-01-28 15:15:51 +01:00
|
|
|
if (text.length() != 0) {
|
2015-09-24 22:52:02 +02:00
|
|
|
args.putString("nameTextView", text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void restoreSelfArgs(Bundle args) {
|
|
|
|
if (currentStep == 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (imageUpdater != null) {
|
|
|
|
imageUpdater.currentPicturePath = args.getString("path");
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
String text = args.getString("nameTextView");
|
|
|
|
if (text != null) {
|
|
|
|
if (nameTextView != null) {
|
|
|
|
nameTextView.setText(text);
|
|
|
|
} else {
|
|
|
|
nameToSet = text;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-10-29 18:10:07 +01:00
|
|
|
public void onTransitionAnimationEnd(boolean isOpen, boolean backward) {
|
|
|
|
if (isOpen && currentStep != 1) {
|
2020-01-23 07:15:40 +01:00
|
|
|
nameTextView.requestFocus();
|
2019-01-23 18:03:33 +01:00
|
|
|
nameTextView.openKeyboard();
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-07-30 04:07:02 +02:00
|
|
|
public void didReceivedNotification(int id, int account, Object... args) {
|
2017-03-31 01:58:05 +02:00
|
|
|
if (id == NotificationCenter.chatDidFailCreate) {
|
2015-09-24 22:52:02 +02:00
|
|
|
if (progressDialog != null) {
|
|
|
|
try {
|
|
|
|
progressDialog.dismiss();
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
donePressed = false;
|
|
|
|
} else if (id == NotificationCenter.chatDidCreated) {
|
|
|
|
if (progressDialog != null) {
|
|
|
|
try {
|
|
|
|
progressDialog.dismiss();
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
2021-09-20 00:10:42 +02:00
|
|
|
long chat_id = (Long) args[0];
|
2015-09-24 22:52:02 +02:00
|
|
|
Bundle bundle = new Bundle();
|
|
|
|
bundle.putInt("step", 1);
|
2021-09-20 00:10:42 +02:00
|
|
|
bundle.putLong("chat_id", chat_id);
|
2015-09-24 22:52:02 +02:00
|
|
|
bundle.putBoolean("canCreatePublic", canCreatePublic);
|
2020-07-26 10:03:38 +02:00
|
|
|
if (inputPhoto != null || inputVideo != null) {
|
2021-04-14 03:44:46 +02:00
|
|
|
MessagesController.getInstance(currentAccount).changeChatAvatar(chat_id, null, inputPhoto, inputVideo, videoTimestamp, inputVideoPath, avatar, avatarBig, null);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
presentFragment(new ChannelCreateActivity(bundle), true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
private void loadAdminedChannels() {
|
|
|
|
if (loadingAdminedChannels) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
loadingAdminedChannels = true;
|
|
|
|
updatePrivatePublic();
|
|
|
|
TLRPC.TL_channels_getAdminedPublicChannels req = new TLRPC.TL_channels_getAdminedPublicChannels();
|
2019-01-23 18:03:33 +01:00
|
|
|
ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
|
|
|
loadingAdminedChannels = false;
|
|
|
|
if (response != null) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (int a = 0; a < adminedChannelCells.size(); a++) {
|
|
|
|
linearLayout.removeView(adminedChannelCells.get(a));
|
|
|
|
}
|
|
|
|
adminedChannelCells.clear();
|
|
|
|
TLRPC.TL_messages_chats res = (TLRPC.TL_messages_chats) response;
|
|
|
|
|
|
|
|
for (int a = 0; a < res.chats.size(); a++) {
|
|
|
|
AdminedChannelCell adminedChannelCell = new AdminedChannelCell(getParentActivity(), view -> {
|
|
|
|
AdminedChannelCell cell = (AdminedChannelCell) view.getParent();
|
|
|
|
final TLRPC.Chat channel = cell.getCurrentChannel();
|
2020-06-25 17:28:24 +02:00
|
|
|
BottomBuilder builder = new BottomBuilder(getParentActivity());
|
2019-01-23 18:03:33 +01:00
|
|
|
if (channel.megagroup) {
|
2020-06-25 17:28:24 +02:00
|
|
|
builder.addTitle(AndroidUtilities.replaceTags(LocaleController.formatString("RevokeLinkAlert", R.string.RevokeLinkAlert, MessagesController.getInstance(currentAccount).linkPrefix + "/" + channel.username, channel.title)));
|
2019-01-23 18:03:33 +01:00
|
|
|
} else {
|
2020-12-23 10:13:40 +01:00
|
|
|
builder.addTitle(AndroidUtilities.replaceTags(LocaleController.formatString("RevokeLinkAlertChannel", R.string.RevokeLinkAlertChannel, MessagesController.getInstance(currentAccount).linkPrefix + "/" + channel.username, channel.title)));
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
2020-12-23 10:13:40 +01:00
|
|
|
builder.addItem(LocaleController.getString("RevokeButton", R.string.RevokeButton), R.drawable.baseline_delete_forever_24, (i) -> {
|
2019-01-23 18:03:33 +01:00
|
|
|
TLRPC.TL_channels_updateUsername req1 = new TLRPC.TL_channels_updateUsername();
|
|
|
|
req1.channel = MessagesController.getInputChannel(channel);
|
|
|
|
req1.username = "";
|
|
|
|
ConnectionsManager.getInstance(currentAccount).sendRequest(req1, (response1, error1) -> {
|
|
|
|
if (response1 instanceof TLRPC.TL_boolTrue) {
|
|
|
|
AndroidUtilities.runOnUIThread(() -> {
|
|
|
|
canCreatePublic = true;
|
|
|
|
if (descriptionTextView.length() > 0) {
|
|
|
|
checkUserName(descriptionTextView.getText().toString());
|
|
|
|
}
|
|
|
|
updatePrivatePublic();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, ConnectionsManager.RequestFlagInvokeAfter);
|
2020-06-25 17:28:24 +02:00
|
|
|
return Unit.INSTANCE;
|
2019-01-23 18:03:33 +01:00
|
|
|
});
|
2020-06-25 17:28:24 +02:00
|
|
|
builder.addCancelItem();
|
2019-01-23 18:03:33 +01:00
|
|
|
showDialog(builder.create());
|
|
|
|
});
|
|
|
|
adminedChannelCell.setChannel(res.chats.get(a), a == res.chats.size() - 1);
|
|
|
|
adminedChannelCells.add(adminedChannelCell);
|
|
|
|
adminnedChannelsLayout.addView(adminedChannelCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 72));
|
|
|
|
}
|
|
|
|
updatePrivatePublic();
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}));
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private boolean checkUserName(final String name) {
|
2015-09-24 22:52:02 +02:00
|
|
|
if (name != null && name.length() > 0) {
|
|
|
|
checkTextView.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
checkTextView.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
if (checkRunnable != null) {
|
|
|
|
AndroidUtilities.cancelRunOnUIThread(checkRunnable);
|
|
|
|
checkRunnable = null;
|
|
|
|
lastCheckName = null;
|
|
|
|
if (checkReqId != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
ConnectionsManager.getInstance(currentAccount).cancelRequest(checkReqId, true);
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
lastNameAvailable = false;
|
|
|
|
if (name != null) {
|
|
|
|
if (name.startsWith("_") || name.endsWith("_")) {
|
|
|
|
checkTextView.setText(LocaleController.getString("LinkInvalid", R.string.LinkInvalid));
|
2017-03-31 01:58:05 +02:00
|
|
|
checkTextView.setTag(Theme.key_windowBackgroundWhiteRedText4);
|
|
|
|
checkTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
|
2015-09-24 22:52:02 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (int a = 0; a < name.length(); a++) {
|
|
|
|
char ch = name.charAt(a);
|
|
|
|
if (a == 0 && ch >= '0' && ch <= '9') {
|
2016-10-11 13:57:01 +02:00
|
|
|
checkTextView.setText(LocaleController.getString("LinkInvalidStartNumber", R.string.LinkInvalidStartNumber));
|
2017-03-31 01:58:05 +02:00
|
|
|
checkTextView.setTag(Theme.key_windowBackgroundWhiteRedText4);
|
|
|
|
checkTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
|
2015-09-24 22:52:02 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (!(ch >= '0' && ch <= '9' || ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z' || ch == '_')) {
|
2016-10-11 13:57:01 +02:00
|
|
|
checkTextView.setText(LocaleController.getString("LinkInvalid", R.string.LinkInvalid));
|
2017-03-31 01:58:05 +02:00
|
|
|
checkTextView.setTag(Theme.key_windowBackgroundWhiteRedText4);
|
|
|
|
checkTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
|
2015-09-24 22:52:02 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (name == null || name.length() < 5) {
|
2016-10-11 13:57:01 +02:00
|
|
|
checkTextView.setText(LocaleController.getString("LinkInvalidShort", R.string.LinkInvalidShort));
|
2017-03-31 01:58:05 +02:00
|
|
|
checkTextView.setTag(Theme.key_windowBackgroundWhiteRedText4);
|
|
|
|
checkTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
|
2015-09-24 22:52:02 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (name.length() > 32) {
|
2016-10-11 13:57:01 +02:00
|
|
|
checkTextView.setText(LocaleController.getString("LinkInvalidLong", R.string.LinkInvalidLong));
|
2017-03-31 01:58:05 +02:00
|
|
|
checkTextView.setTag(Theme.key_windowBackgroundWhiteRedText4);
|
|
|
|
checkTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
|
2015-09-24 22:52:02 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
checkTextView.setText(LocaleController.getString("LinkChecking", R.string.LinkChecking));
|
2017-03-31 01:58:05 +02:00
|
|
|
checkTextView.setTag(Theme.key_windowBackgroundWhiteGrayText8);
|
|
|
|
checkTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText8));
|
2016-10-11 13:57:01 +02:00
|
|
|
lastCheckName = name;
|
2019-01-23 18:03:33 +01:00
|
|
|
checkRunnable = () -> {
|
|
|
|
TLRPC.TL_channels_checkUsername req = new TLRPC.TL_channels_checkUsername();
|
|
|
|
req.username = name;
|
|
|
|
req.channel = MessagesController.getInstance(currentAccount).getInputChannel(chatId);
|
|
|
|
checkReqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
|
|
|
|
checkReqId = 0;
|
|
|
|
if (lastCheckName != null && lastCheckName.equals(name)) {
|
|
|
|
if (error == null && response instanceof TLRPC.TL_boolTrue) {
|
|
|
|
checkTextView.setText(LocaleController.formatString("LinkAvailable", R.string.LinkAvailable, name));
|
|
|
|
checkTextView.setTag(Theme.key_windowBackgroundWhiteGreenText);
|
|
|
|
checkTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGreenText));
|
|
|
|
lastNameAvailable = true;
|
|
|
|
} else {
|
|
|
|
if (error != null && error.text.equals("CHANNELS_ADMIN_PUBLIC_TOO_MUCH")) {
|
|
|
|
canCreatePublic = false;
|
|
|
|
loadAdminedChannels();
|
|
|
|
} else {
|
|
|
|
checkTextView.setText(LocaleController.getString("LinkInUse", R.string.LinkInUse));
|
|
|
|
}
|
|
|
|
checkTextView.setTag(Theme.key_windowBackgroundWhiteRedText4);
|
|
|
|
checkTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText4));
|
|
|
|
lastNameAvailable = false;
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
2019-01-23 18:03:33 +01:00
|
|
|
}
|
|
|
|
}), ConnectionsManager.RequestFlagFailOnServerErrors);
|
2016-10-11 13:57:01 +02:00
|
|
|
};
|
|
|
|
AndroidUtilities.runOnUIThread(checkRunnable, 300);
|
2015-09-24 22:52:02 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void showErrorAlert(String error) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
|
|
|
switch (error) {
|
|
|
|
case "USERNAME_INVALID":
|
|
|
|
builder.setMessage(LocaleController.getString("LinkInvalid", R.string.LinkInvalid));
|
|
|
|
break;
|
|
|
|
case "USERNAME_OCCUPIED":
|
|
|
|
builder.setMessage(LocaleController.getString("LinkInUse", R.string.LinkInUse));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
builder.setMessage(LocaleController.getString("ErrorOccurred", R.string.ErrorOccurred));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), null);
|
|
|
|
showDialog(builder.create());
|
|
|
|
}
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
@Override
|
2020-04-24 11:21:58 +02:00
|
|
|
public ArrayList<ThemeDescription> getThemeDescriptions() {
|
|
|
|
ArrayList<ThemeDescription> themeDescriptions = new ArrayList<>();
|
|
|
|
|
2019-01-23 18:03:33 +01:00
|
|
|
ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
|
|
|
|
if (adminnedChannelsLayout != null) {
|
|
|
|
int count = adminnedChannelsLayout.getChildCount();
|
|
|
|
for (int a = 0; a < count; a++) {
|
|
|
|
View child = adminnedChannelsLayout.getChildAt(a);
|
|
|
|
if (child instanceof AdminedChannelCell) {
|
|
|
|
((AdminedChannelCell) child).update();
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
}
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
};
|
2015-09-24 22:52:02 +02:00
|
|
|
|
2020-04-24 11:21:58 +02:00
|
|
|
themeDescriptions.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundWhite));
|
|
|
|
themeDescriptions.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundGray));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
|
|
|
|
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(nameTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(nameTextView, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(nameTextView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
|
|
|
|
themeDescriptions.add(new ThemeDescription(nameTextView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
|
|
|
|
themeDescriptions.add(new ThemeDescription(descriptionTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(descriptionTextView, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(descriptionTextView, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundWhiteInputField));
|
|
|
|
themeDescriptions.add(new ThemeDescription(descriptionTextView, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_windowBackgroundWhiteInputFieldActivated));
|
|
|
|
themeDescriptions.add(new ThemeDescription(helpTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText8));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(linearLayout2, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
|
|
|
|
themeDescriptions.add(new ThemeDescription(linkContainer, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
|
|
|
|
themeDescriptions.add(new ThemeDescription(sectionCell, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_windowBackgroundGrayShadow));
|
|
|
|
themeDescriptions.add(new ThemeDescription(headerCell, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader));
|
|
|
|
themeDescriptions.add(new ThemeDescription(headerCell2, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader));
|
|
|
|
themeDescriptions.add(new ThemeDescription(editText, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(editText, ThemeDescription.FLAG_HINTTEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteHintText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(checkTextView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundWhiteRedText4));
|
|
|
|
themeDescriptions.add(new ThemeDescription(checkTextView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText8));
|
|
|
|
themeDescriptions.add(new ThemeDescription(checkTextView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, null, null, null, null, Theme.key_windowBackgroundWhiteGreenText));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(typeInfoCell, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow));
|
|
|
|
themeDescriptions.add(new ThemeDescription(typeInfoCell, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText4));
|
|
|
|
themeDescriptions.add(new ThemeDescription(typeInfoCell, ThemeDescription.FLAG_CHECKTAG, new Class[]{TextInfoPrivacyCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteRedText4));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(adminedInfoCell, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{TextInfoPrivacyCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow));
|
|
|
|
themeDescriptions.add(new ThemeDescription(adminnedChannelsLayout, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
|
|
|
|
themeDescriptions.add(new ThemeDescription(privateContainer, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
|
|
|
|
themeDescriptions.add(new ThemeDescription(privateContainer, 0, new Class[]{TextBlockCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(loadingAdminedCell, 0, new Class[]{LoadingCell.class}, new String[]{"progressBar"}, null, null, null, Theme.key_progressCircle));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell1, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell1, ThemeDescription.FLAG_CHECKBOX, new Class[]{RadioButtonCell.class}, new String[]{"radioButton"}, null, null, null, Theme.key_radioBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell1, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[]{RadioButtonCell.class}, new String[]{"radioButton"}, null, null, null, Theme.key_radioBackgroundChecked));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell1, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{RadioButtonCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell1, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{RadioButtonCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell2, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell2, ThemeDescription.FLAG_CHECKBOX, new Class[]{RadioButtonCell.class}, new String[]{"radioButton"}, null, null, null, Theme.key_radioBackground));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell2, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[]{RadioButtonCell.class}, new String[]{"radioButton"}, null, null, null, Theme.key_radioBackgroundChecked));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell2, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{RadioButtonCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(radioButtonCell2, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{RadioButtonCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
|
|
|
|
|
|
|
|
themeDescriptions.add(new ThemeDescription(adminnedChannelsLayout, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{AdminedChannelCell.class}, new String[]{"nameTextView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(adminnedChannelsLayout, ThemeDescription.FLAG_TEXTCOLOR, new Class[]{AdminedChannelCell.class}, new String[]{"statusTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(adminnedChannelsLayout, ThemeDescription.FLAG_LINKCOLOR, new Class[]{AdminedChannelCell.class}, new String[]{"statusTextView"}, null, null, null, Theme.key_windowBackgroundWhiteLinkText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(adminnedChannelsLayout, ThemeDescription.FLAG_IMAGECOLOR, new Class[]{AdminedChannelCell.class}, new String[]{"deleteButton"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText));
|
|
|
|
themeDescriptions.add(new ThemeDescription(null, 0, null, null, Theme.avatarDrawables, cellDelegate, Theme.key_avatar_text));
|
|
|
|
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed));
|
|
|
|
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange));
|
|
|
|
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet));
|
|
|
|
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen));
|
|
|
|
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan));
|
|
|
|
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue));
|
|
|
|
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink));
|
|
|
|
|
|
|
|
return themeDescriptions;
|
2015-09-24 22:52:02 +02:00
|
|
|
}
|
|
|
|
}
|