2013-10-25 17:19:00 +02:00
|
|
|
/*
|
2015-10-29 18:10:07 +01:00
|
|
|
* This is the source code of Telegram for Android v. 3.x.x.
|
2013-10-25 17:19:00 +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).
|
|
|
|
*
|
2017-03-31 01:58:05 +02:00
|
|
|
* Copyright Nikolai Kudashov, 2013-2017.
|
2013-10-25 17:19:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
package org.telegram.ui;
|
|
|
|
|
2016-06-24 12:27:15 +02:00
|
|
|
import android.animation.Animator;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.animation.AnimatorListenerAdapter;
|
2016-06-24 12:27:15 +02:00
|
|
|
import android.animation.AnimatorSet;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.animation.ObjectAnimator;
|
|
|
|
import android.animation.StateListAnimator;
|
2015-05-21 23:27:27 +02:00
|
|
|
import android.annotation.SuppressLint;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.content.Context;
|
|
|
|
import android.content.DialogInterface;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.SharedPreferences;
|
2014-05-17 01:05:49 +02:00
|
|
|
import android.content.pm.PackageInfo;
|
2014-11-11 23:16:17 +01:00
|
|
|
import android.content.res.Configuration;
|
2015-06-29 19:12:11 +02:00
|
|
|
import android.graphics.Canvas;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.graphics.Outline;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.graphics.PorterDuff;
|
|
|
|
import android.graphics.PorterDuffColorFilter;
|
|
|
|
import android.graphics.drawable.Drawable;
|
2013-12-20 20:25:49 +01:00
|
|
|
import android.net.Uri;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.os.Build;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.os.Bundle;
|
2015-09-24 22:52:02 +02:00
|
|
|
import android.support.annotation.NonNull;
|
2017-12-08 18:35:59 +01:00
|
|
|
import android.support.v4.content.FileProvider;
|
2014-04-02 19:36:57 +02:00
|
|
|
import android.text.Html;
|
2014-04-03 23:18:54 +02:00
|
|
|
import android.text.Spannable;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.text.SpannableString;
|
2014-11-12 23:16:59 +01:00
|
|
|
import android.text.TextUtils;
|
2014-04-02 19:36:57 +02:00
|
|
|
import android.text.method.LinkMovementMethod;
|
2017-03-31 01:58:05 +02:00
|
|
|
import android.text.style.URLSpan;
|
2014-02-28 23:28:25 +01:00
|
|
|
import android.util.Base64;
|
2014-11-11 23:16:17 +01:00
|
|
|
import android.util.TypedValue;
|
|
|
|
import android.view.Gravity;
|
2014-04-03 23:18:54 +02:00
|
|
|
import android.view.MotionEvent;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.view.View;
|
|
|
|
import android.view.ViewGroup;
|
2015-02-01 19:51:02 +01:00
|
|
|
import android.view.ViewOutlineProvider;
|
2014-11-11 23:16:17 +01:00
|
|
|
import android.view.ViewTreeObserver;
|
2015-06-29 19:12:11 +02:00
|
|
|
import android.view.animation.AccelerateInterpolator;
|
|
|
|
import android.view.animation.DecelerateInterpolator;
|
2014-11-11 23:16:17 +01:00
|
|
|
import android.widget.FrameLayout;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.widget.ImageView;
|
2016-01-11 18:19:48 +01:00
|
|
|
import android.widget.LinearLayout;
|
2013-10-25 17:19:00 +02:00
|
|
|
import android.widget.TextView;
|
2016-06-24 12:27:15 +02:00
|
|
|
import android.widget.Toast;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.AndroidUtilities;
|
2013-10-25 17:19:00 +02:00
|
|
|
import org.telegram.PhoneFormat.PhoneFormat;
|
2017-12-08 18:35:59 +01:00
|
|
|
import org.telegram.messenger.BuildConfig;
|
2016-06-24 12:27:15 +02:00
|
|
|
import org.telegram.messenger.ContactsController;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.messenger.DataQuery;
|
|
|
|
import org.telegram.messenger.SharedConfig;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.UserObject;
|
2014-12-01 18:56:31 +01:00
|
|
|
import org.telegram.messenger.ApplicationLoader;
|
2014-03-23 00:20:13 +01:00
|
|
|
import org.telegram.messenger.BuildVars;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.LocaleController;
|
2014-09-25 05:54:35 +02:00
|
|
|
import org.telegram.messenger.FileLoader;
|
2016-04-22 15:49:00 +02:00
|
|
|
import org.telegram.messenger.browser.Browser;
|
2016-10-11 13:57:01 +02:00
|
|
|
import org.telegram.messenger.support.widget.LinearLayoutManager;
|
|
|
|
import org.telegram.messenger.support.widget.RecyclerView;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.tgnet.ConnectionsManager;
|
|
|
|
import org.telegram.tgnet.RequestDelegate;
|
|
|
|
import org.telegram.tgnet.SerializedData;
|
|
|
|
import org.telegram.tgnet.TLObject;
|
|
|
|
import org.telegram.tgnet.TLRPC;
|
2013-12-20 20:25:49 +01:00
|
|
|
import org.telegram.messenger.FileLog;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.MessagesController;
|
|
|
|
import org.telegram.messenger.MessagesStorage;
|
|
|
|
import org.telegram.messenger.NotificationCenter;
|
2013-10-25 17:19:00 +02:00
|
|
|
import org.telegram.messenger.R;
|
|
|
|
import org.telegram.messenger.UserConfig;
|
2015-09-24 22:52:02 +02:00
|
|
|
import org.telegram.messenger.MessageObject;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.AlertDialog;
|
2016-01-11 18:19:48 +01:00
|
|
|
import org.telegram.ui.ActionBar.BottomSheet;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.ActionBar.ThemeDescription;
|
2016-01-11 18:19:48 +01:00
|
|
|
import org.telegram.ui.Cells.CheckBoxCell;
|
2014-11-12 11:41:46 +01:00
|
|
|
import org.telegram.ui.Cells.TextInfoCell;
|
2014-11-11 23:16:17 +01:00
|
|
|
import org.telegram.ui.Cells.EmptyCell;
|
|
|
|
import org.telegram.ui.Cells.HeaderCell;
|
|
|
|
import org.telegram.ui.Cells.ShadowSectionCell;
|
|
|
|
import org.telegram.ui.Cells.TextCheckCell;
|
|
|
|
import org.telegram.ui.Cells.TextDetailSettingsCell;
|
|
|
|
import org.telegram.ui.Cells.TextSettingsCell;
|
2014-11-13 21:10:14 +01:00
|
|
|
import org.telegram.ui.ActionBar.ActionBar;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
|
|
|
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
2014-12-01 18:56:31 +01:00
|
|
|
import org.telegram.ui.Components.AvatarDrawable;
|
2018-07-30 04:07:02 +02:00
|
|
|
import org.telegram.ui.Components.ImageUpdater;
|
2014-12-01 18:56:31 +01:00
|
|
|
import org.telegram.ui.Components.BackupImageView;
|
2014-11-13 21:10:14 +01:00
|
|
|
import org.telegram.ui.ActionBar.BaseFragment;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Components.CombinedDrawable;
|
2015-05-03 13:48:36 +02:00
|
|
|
import org.telegram.ui.Components.LayoutHelper;
|
2014-12-01 18:56:31 +01:00
|
|
|
import org.telegram.ui.Components.NumberPicker;
|
2016-04-22 15:49:00 +02:00
|
|
|
import org.telegram.ui.ActionBar.Theme;
|
2016-10-11 13:57:01 +02:00
|
|
|
import org.telegram.ui.Components.RecyclerListView;
|
2017-03-31 01:58:05 +02:00
|
|
|
import org.telegram.ui.Components.URLSpanNoUnderline;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2013-12-20 20:25:49 +01:00
|
|
|
import java.io.File;
|
|
|
|
import java.util.ArrayList;
|
2014-05-17 01:05:49 +02:00
|
|
|
import java.util.Locale;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
public class SettingsActivity extends BaseFragment implements NotificationCenter.NotificationCenterDelegate {
|
2014-11-11 23:16:17 +01:00
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
private RecyclerListView listView;
|
2013-10-25 17:19:00 +02:00
|
|
|
private ListAdapter listAdapter;
|
2016-10-11 13:57:01 +02:00
|
|
|
private LinearLayoutManager layoutManager;
|
2014-11-11 23:16:17 +01:00
|
|
|
private BackupImageView avatarImage;
|
|
|
|
private TextView nameTextView;
|
|
|
|
private TextView onlineTextView;
|
|
|
|
private ImageView writeButton;
|
2016-06-24 12:27:15 +02:00
|
|
|
private AnimatorSet writeButtonAnimation;
|
2018-07-30 04:07:02 +02:00
|
|
|
private ImageUpdater imageUpdater = new ImageUpdater();
|
2015-10-29 18:10:07 +01:00
|
|
|
private View extraHeightView;
|
|
|
|
private View shadowView;
|
2017-03-31 01:58:05 +02:00
|
|
|
private AvatarDrawable avatarDrawable;
|
2015-10-29 18:10:07 +01:00
|
|
|
|
|
|
|
private int extraHeight;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2014-11-12 23:16:59 +01:00
|
|
|
private int overscrollRow;
|
2014-11-11 23:16:17 +01:00
|
|
|
private int emptyRow;
|
2014-03-22 23:31:55 +01:00
|
|
|
private int numberSectionRow;
|
|
|
|
private int numberRow;
|
2014-10-17 20:29:13 +02:00
|
|
|
private int usernameRow;
|
2017-07-23 14:56:38 +02:00
|
|
|
private int bioRow;
|
2014-03-22 23:31:55 +01:00
|
|
|
private int settingsSectionRow;
|
2014-11-11 23:16:17 +01:00
|
|
|
private int settingsSectionRow2;
|
2014-03-22 23:31:55 +01:00
|
|
|
private int enableAnimationsRow;
|
|
|
|
private int notificationRow;
|
|
|
|
private int backgroundRow;
|
2017-03-31 01:58:05 +02:00
|
|
|
private int themeRow;
|
2014-11-11 23:16:17 +01:00
|
|
|
private int languageRow;
|
2014-11-17 03:44:57 +01:00
|
|
|
private int privacyRow;
|
2017-03-31 01:58:05 +02:00
|
|
|
private int dataRow;
|
2014-10-01 00:36:18 +02:00
|
|
|
private int saveToGalleryRow;
|
2014-11-11 23:16:17 +01:00
|
|
|
private int messagesSectionRow;
|
|
|
|
private int messagesSectionRow2;
|
2016-03-16 13:26:32 +01:00
|
|
|
private int customTabsRow;
|
|
|
|
private int directShareRow;
|
2014-11-11 23:16:17 +01:00
|
|
|
private int textSizeRow;
|
2015-05-21 23:27:27 +02:00
|
|
|
private int stickersRow;
|
2016-10-11 13:57:01 +02:00
|
|
|
private int emojiRow;
|
2016-03-06 02:49:31 +01:00
|
|
|
private int raiseToSpeakRow;
|
2014-11-11 23:16:17 +01:00
|
|
|
private int sendByEnterRow;
|
|
|
|
private int supportSectionRow;
|
|
|
|
private int supportSectionRow2;
|
|
|
|
private int askQuestionRow;
|
2014-04-02 19:36:57 +02:00
|
|
|
private int telegramFaqRow;
|
2016-03-16 13:26:32 +01:00
|
|
|
private int privacyPolicyRow;
|
2014-11-11 23:16:17 +01:00
|
|
|
private int sendLogsRow;
|
|
|
|
private int clearLogsRow;
|
|
|
|
private int switchBackendButtonRow;
|
2017-07-08 18:32:04 +02:00
|
|
|
private int dumpCallStatsRow;
|
2018-07-30 04:07:02 +02:00
|
|
|
private int forceTcpInCallsRow;
|
2014-05-17 01:05:49 +02:00
|
|
|
private int versionRow;
|
2014-05-25 00:47:05 +02:00
|
|
|
private int contactsSectionRow;
|
|
|
|
private int contactsReimportRow;
|
|
|
|
private int contactsSortRow;
|
2016-01-11 18:19:48 +01:00
|
|
|
private int autoplayGifsRow;
|
2014-05-17 01:05:49 +02:00
|
|
|
private int rowCount;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2014-11-11 23:16:17 +01:00
|
|
|
private final static int edit_name = 1;
|
|
|
|
private final static int logout = 2;
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
private PhotoViewer.PhotoViewerProvider provider = new PhotoViewer.EmptyPhotoViewerProvider() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public PhotoViewer.PlaceProviderObject getPlaceForPhoto(MessageObject messageObject, TLRPC.FileLocation fileLocation, int index) {
|
|
|
|
if (fileLocation == null) {
|
|
|
|
return null;
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
|
2017-12-08 18:35:59 +01:00
|
|
|
if (user != null && user.photo != null && user.photo.photo_big != null) {
|
|
|
|
TLRPC.FileLocation photoBig = user.photo.photo_big;
|
|
|
|
if (photoBig.local_id == fileLocation.local_id && photoBig.volume_id == fileLocation.volume_id && photoBig.dc_id == fileLocation.dc_id) {
|
|
|
|
int coords[] = new int[2];
|
|
|
|
avatarImage.getLocationInWindow(coords);
|
|
|
|
PhotoViewer.PlaceProviderObject object = new PhotoViewer.PlaceProviderObject();
|
|
|
|
object.viewX = coords[0];
|
|
|
|
object.viewY = coords[1] - (Build.VERSION.SDK_INT >= 21 ? 0 : AndroidUtilities.statusBarHeight);
|
|
|
|
object.parentView = avatarImage;
|
|
|
|
object.imageReceiver = avatarImage.getImageReceiver();
|
2018-07-30 04:07:02 +02:00
|
|
|
object.dialogId = UserConfig.getInstance(currentAccount).getClientUserId();
|
|
|
|
object.thumb = object.imageReceiver.getBitmapSafe();
|
2017-12-08 18:35:59 +01:00
|
|
|
object.size = -1;
|
|
|
|
object.radius = avatarImage.getImageReceiver().getRoundRadius();
|
|
|
|
object.scale = avatarImage.getScaleX();
|
|
|
|
return object;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void willHidePhotoViewer() {
|
|
|
|
avatarImage.getImageReceiver().setVisible(true, true);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-04-03 23:18:54 +02:00
|
|
|
private static class LinkMovementMethodMy extends LinkMovementMethod {
|
|
|
|
@Override
|
2015-09-24 22:52:02 +02:00
|
|
|
public boolean onTouchEvent(@NonNull TextView widget, @NonNull Spannable buffer, @NonNull MotionEvent event) {
|
2014-04-03 23:18:54 +02:00
|
|
|
try {
|
|
|
|
return super.onTouchEvent(widget, buffer, event);
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2014-04-03 23:18:54 +02:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
|
|
|
public boolean onFragmentCreate() {
|
|
|
|
super.onFragmentCreate();
|
2018-07-30 04:07:02 +02:00
|
|
|
|
|
|
|
imageUpdater.parentFragment = this;
|
|
|
|
imageUpdater.delegate = new ImageUpdater.ImageUpdaterDelegate() {
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
2018-07-30 04:07:02 +02:00
|
|
|
public void didUploadedPhoto(TLRPC.InputFile file, TLRPC.PhotoSize small, TLRPC.PhotoSize big, TLRPC.TL_secureFile secureFile) {
|
2013-10-25 17:19:00 +02:00
|
|
|
TLRPC.TL_photos_uploadProfilePhoto req = new TLRPC.TL_photos_uploadProfilePhoto();
|
|
|
|
req.file = file;
|
2018-07-30 04:07:02 +02:00
|
|
|
ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() {
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
|
|
|
public void run(TLObject response, TLRPC.TL_error error) {
|
2014-02-04 19:36:55 +01:00
|
|
|
if (error == null) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
|
2014-02-04 19:36:55 +01:00
|
|
|
if (user == null) {
|
2018-07-30 04:07:02 +02:00
|
|
|
user = UserConfig.getInstance(currentAccount).getCurrentUser();
|
2014-02-04 19:36:55 +01:00
|
|
|
if (user == null) {
|
|
|
|
return;
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).putUser(user, false);
|
2014-02-04 19:36:55 +01:00
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
UserConfig.getInstance(currentAccount).setCurrentUser(user);
|
2014-02-04 19:36:55 +01:00
|
|
|
}
|
2015-05-21 23:27:27 +02:00
|
|
|
TLRPC.TL_photos_photo photo = (TLRPC.TL_photos_photo) response;
|
2014-02-04 19:36:55 +01:00
|
|
|
ArrayList<TLRPC.PhotoSize> sizes = photo.photo.sizes;
|
2014-10-01 21:55:24 +02:00
|
|
|
TLRPC.PhotoSize smallSize = FileLoader.getClosestPhotoSizeWithSize(sizes, 100);
|
|
|
|
TLRPC.PhotoSize bigSize = FileLoader.getClosestPhotoSizeWithSize(sizes, 1000);
|
2014-02-04 19:36:55 +01:00
|
|
|
user.photo = new TLRPC.TL_userProfilePhoto();
|
|
|
|
user.photo.photo_id = photo.photo.id;
|
|
|
|
if (smallSize != null) {
|
|
|
|
user.photo.photo_small = smallSize.location;
|
|
|
|
}
|
|
|
|
if (bigSize != null) {
|
|
|
|
user.photo.photo_big = bigSize.location;
|
|
|
|
} else if (smallSize != null) {
|
|
|
|
user.photo.photo_small = smallSize.location;
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesStorage.getInstance(currentAccount).clearUserPhotos(user.id);
|
2015-01-02 23:15:07 +01:00
|
|
|
ArrayList<TLRPC.User> users = new ArrayList<>();
|
2014-02-04 19:36:55 +01:00
|
|
|
users.add(user);
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesStorage.getInstance(currentAccount).putUsersAndChats(users, null, false, true);
|
2014-11-06 22:34:47 +01:00
|
|
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
2014-02-04 19:36:55 +01:00
|
|
|
@Override
|
|
|
|
public void run() {
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.updateInterfaces, MessagesController.UPDATE_MASK_ALL);
|
|
|
|
NotificationCenter.getInstance(currentAccount).postNotificationName(NotificationCenter.mainUserInfoChanged);
|
|
|
|
UserConfig.getInstance(currentAccount).saveConfig(true);
|
2014-02-04 19:36:55 +01:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2014-07-03 00:39:05 +02:00
|
|
|
});
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
};
|
2018-07-30 04:07:02 +02:00
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.updateInterfaces);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.featuredStickersDidLoaded);
|
|
|
|
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.userInfoDidLoaded);
|
|
|
|
NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoaded);
|
2013-10-25 17:19:00 +02:00
|
|
|
|
|
|
|
rowCount = 0;
|
2014-11-12 23:16:59 +01:00
|
|
|
overscrollRow = rowCount++;
|
2014-11-11 23:16:17 +01:00
|
|
|
emptyRow = rowCount++;
|
2013-10-25 17:19:00 +02:00
|
|
|
numberSectionRow = rowCount++;
|
|
|
|
numberRow = rowCount++;
|
2014-10-17 20:29:13 +02:00
|
|
|
usernameRow = rowCount++;
|
2017-07-23 14:56:38 +02:00
|
|
|
bioRow = rowCount++;
|
2013-10-25 17:19:00 +02:00
|
|
|
settingsSectionRow = rowCount++;
|
2014-11-11 23:16:17 +01:00
|
|
|
settingsSectionRow2 = rowCount++;
|
2013-10-25 17:19:00 +02:00
|
|
|
notificationRow = rowCount++;
|
2014-11-17 03:44:57 +01:00
|
|
|
privacyRow = rowCount++;
|
2017-03-31 01:58:05 +02:00
|
|
|
dataRow = rowCount++;
|
2013-10-25 17:19:00 +02:00
|
|
|
backgroundRow = rowCount++;
|
2017-03-31 01:58:05 +02:00
|
|
|
themeRow = rowCount++;
|
2014-11-11 23:16:17 +01:00
|
|
|
languageRow = rowCount++;
|
2014-11-17 23:04:31 +01:00
|
|
|
enableAnimationsRow = rowCount++;
|
2014-02-04 19:36:55 +01:00
|
|
|
messagesSectionRow = rowCount++;
|
2014-11-11 23:16:17 +01:00
|
|
|
messagesSectionRow2 = rowCount++;
|
2016-03-16 13:26:32 +01:00
|
|
|
customTabsRow = rowCount++;
|
|
|
|
if (Build.VERSION.SDK_INT >= 23) {
|
|
|
|
directShareRow = rowCount++;
|
|
|
|
}
|
2015-05-21 23:27:27 +02:00
|
|
|
stickersRow = rowCount++;
|
2016-10-11 13:57:01 +02:00
|
|
|
//emojiRow = rowCount++;
|
|
|
|
textSizeRow = rowCount++;
|
2016-03-06 02:49:31 +01:00
|
|
|
raiseToSpeakRow = rowCount++;
|
2014-02-04 19:36:55 +01:00
|
|
|
sendByEnterRow = rowCount++;
|
2017-03-31 01:58:05 +02:00
|
|
|
autoplayGifsRow = rowCount++;
|
|
|
|
saveToGalleryRow = rowCount++;
|
2013-10-25 17:19:00 +02:00
|
|
|
supportSectionRow = rowCount++;
|
2014-11-11 23:16:17 +01:00
|
|
|
supportSectionRow2 = rowCount++;
|
|
|
|
askQuestionRow = rowCount++;
|
|
|
|
telegramFaqRow = rowCount++;
|
2016-03-16 13:26:32 +01:00
|
|
|
privacyPolicyRow = rowCount++;
|
2018-07-30 04:07:02 +02:00
|
|
|
if (BuildVars.LOGS_ENABLED) {
|
2013-12-20 20:25:49 +01:00
|
|
|
sendLogsRow = rowCount++;
|
2014-02-28 23:28:25 +01:00
|
|
|
clearLogsRow = rowCount++;
|
2017-07-08 18:32:04 +02:00
|
|
|
dumpCallStatsRow = rowCount++;
|
2018-07-30 04:07:02 +02:00
|
|
|
} else {
|
|
|
|
sendLogsRow = -1;
|
|
|
|
clearLogsRow = -1;
|
|
|
|
dumpCallStatsRow = -1;
|
|
|
|
}
|
|
|
|
if (BuildVars.DEBUG_VERSION) {
|
|
|
|
forceTcpInCallsRow = rowCount++;
|
2014-03-26 00:38:23 +01:00
|
|
|
switchBackendButtonRow = rowCount++;
|
2018-07-30 04:07:02 +02:00
|
|
|
} else {
|
|
|
|
switchBackendButtonRow = -1;
|
2013-12-20 20:25:49 +01:00
|
|
|
}
|
2014-05-17 01:05:49 +02:00
|
|
|
versionRow = rowCount++;
|
2014-11-11 23:16:17 +01:00
|
|
|
//contactsSectionRow = rowCount++;
|
|
|
|
//contactsReimportRow = rowCount++;
|
|
|
|
//contactsSortRow = rowCount++;
|
2013-10-25 17:19:00 +02:00
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
DataQuery.getInstance(currentAccount).checkFeaturedStickers();
|
|
|
|
MessagesController.getInstance(currentAccount).loadFullUser(UserConfig.getInstance(currentAccount).getCurrentUser(), classGuid, true);
|
2014-10-17 20:29:13 +02:00
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFragmentDestroy() {
|
|
|
|
super.onFragmentDestroy();
|
2015-03-19 00:09:45 +01:00
|
|
|
if (avatarImage != null) {
|
|
|
|
avatarImage.setImageDrawable(null);
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).cancelLoadFullUser(UserConfig.getInstance(currentAccount).getClientUserId());
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.updateInterfaces);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.featuredStickersDidLoaded);
|
|
|
|
NotificationCenter.getInstance(currentAccount).removeObserver(this, NotificationCenter.userInfoDidLoaded);
|
|
|
|
NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.emojiDidLoaded);
|
|
|
|
imageUpdater.clear();
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-07-22 20:56:37 +02:00
|
|
|
public View createView(Context context) {
|
2017-03-31 01:58:05 +02:00
|
|
|
actionBar.setBackgroundColor(Theme.getColor(Theme.key_avatar_backgroundActionBarBlue));
|
|
|
|
actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_avatar_actionBarSelectorBlue), false);
|
|
|
|
actionBar.setItemsColor(Theme.getColor(Theme.key_avatar_actionBarIconBlue), false);
|
2015-04-09 20:00:14 +02:00
|
|
|
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
|
2015-10-29 18:10:07 +01:00
|
|
|
actionBar.setAddToContainer(false);
|
|
|
|
extraHeight = 88;
|
2015-04-09 20:00:14 +02:00
|
|
|
if (AndroidUtilities.isTablet()) {
|
|
|
|
actionBar.setOccupyStatusBar(false);
|
|
|
|
}
|
|
|
|
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
|
|
|
|
@Override
|
|
|
|
public void onItemClick(int id) {
|
|
|
|
if (id == -1) {
|
|
|
|
finishFragment();
|
|
|
|
} else if (id == edit_name) {
|
|
|
|
presentFragment(new ChangeNameActivity());
|
|
|
|
} else if (id == logout) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
2014-06-04 01:31:48 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setMessage(LocaleController.getString("AreYouSureLogout", R.string.AreYouSureLogout));
|
|
|
|
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).performLogout(1);
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
2015-05-21 23:27:27 +02:00
|
|
|
showDialog(builder.create());
|
2014-06-04 01:31:48 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
ActionBarMenu menu = actionBar.createMenu();
|
|
|
|
ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_other);
|
2017-03-31 01:58:05 +02:00
|
|
|
item.addSubItem(edit_name, LocaleController.getString("EditName", R.string.EditName));
|
|
|
|
item.addSubItem(logout, LocaleController.getString("LogOut", R.string.LogOut));
|
2015-04-09 20:00:14 +02:00
|
|
|
|
|
|
|
listAdapter = new ListAdapter(context);
|
|
|
|
|
2015-06-29 19:12:11 +02:00
|
|
|
fragmentView = new FrameLayout(context) {
|
|
|
|
@Override
|
2015-09-24 22:52:02 +02:00
|
|
|
protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
|
2015-06-29 19:12:11 +02:00
|
|
|
if (child == listView) {
|
|
|
|
boolean result = super.drawChild(canvas, child, drawingTime);
|
|
|
|
if (parentLayout != null) {
|
|
|
|
int actionBarHeight = 0;
|
|
|
|
int childCount = getChildCount();
|
|
|
|
for (int a = 0; a < childCount; a++) {
|
|
|
|
View view = getChildAt(a);
|
|
|
|
if (view == child) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (view instanceof ActionBar && view.getVisibility() == VISIBLE) {
|
|
|
|
if (((ActionBar) view).getCastShadows()) {
|
|
|
|
actionBarHeight = view.getMeasuredHeight();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
parentLayout.drawHeaderShadow(canvas, actionBarHeight);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
} else {
|
|
|
|
return super.drawChild(canvas, child, drawingTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2017-03-31 01:58:05 +02:00
|
|
|
fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
|
2015-04-09 20:00:14 +02:00
|
|
|
FrameLayout frameLayout = (FrameLayout) fragmentView;
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
listView = new RecyclerListView(context);
|
2015-04-09 20:00:14 +02:00
|
|
|
listView.setVerticalScrollBarEnabled(false);
|
2017-07-23 14:56:38 +02:00
|
|
|
listView.setLayoutManager(layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false) {
|
|
|
|
@Override
|
|
|
|
public boolean supportsPredictiveItemAnimations() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
2017-03-31 01:58:05 +02:00
|
|
|
listView.setGlowColor(Theme.getColor(Theme.key_avatar_backgroundActionBarBlue));
|
2015-05-21 23:27:27 +02:00
|
|
|
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
|
2015-04-09 20:00:14 +02:00
|
|
|
listView.setAdapter(listAdapter);
|
2017-07-23 14:56:38 +02:00
|
|
|
listView.setItemAnimator(null);
|
|
|
|
listView.setLayoutAnimation(null);
|
2016-10-11 13:57:01 +02:00
|
|
|
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
2016-10-11 13:57:01 +02:00
|
|
|
public void onItemClick(View view, final int position) {
|
|
|
|
if (position == textSizeRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("TextSize", R.string.TextSize));
|
|
|
|
final NumberPicker numberPicker = new NumberPicker(getParentActivity());
|
|
|
|
numberPicker.setMinValue(12);
|
|
|
|
numberPicker.setMaxValue(30);
|
2018-07-30 04:07:02 +02:00
|
|
|
numberPicker.setValue(SharedConfig.fontSize);
|
2015-04-09 20:00:14 +02:00
|
|
|
builder.setView(numberPicker);
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Done", R.string.Done), new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2015-04-09 20:00:14 +02:00
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putInt("fons_size", numberPicker.getValue());
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedConfig.fontSize = numberPicker.getValue();
|
2015-04-09 20:00:14 +02:00
|
|
|
editor.commit();
|
2016-10-11 13:57:01 +02:00
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyItemChanged(position);
|
2014-03-26 00:38:23 +01:00
|
|
|
}
|
2014-04-02 19:36:57 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
});
|
2015-05-21 23:27:27 +02:00
|
|
|
showDialog(builder.create());
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == enableAnimationsRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2015-04-09 20:00:14 +02:00
|
|
|
boolean animations = preferences.getBoolean("view_animations", true);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("view_animations", !animations);
|
|
|
|
editor.commit();
|
|
|
|
if (view instanceof TextCheckCell) {
|
|
|
|
((TextCheckCell) view).setChecked(!animations);
|
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == notificationRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
presentFragment(new NotificationsSettingsActivity());
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == backgroundRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
presentFragment(new WallpapersActivity());
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == askQuestionRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
final TextView message = new TextView(getParentActivity());
|
2017-07-08 18:32:04 +02:00
|
|
|
Spannable spanned = new SpannableString(Html.fromHtml(LocaleController.getString("AskAQuestionInfo", R.string.AskAQuestionInfo).replace("\n", "<br>")));
|
2017-03-31 01:58:05 +02:00
|
|
|
URLSpan[] spans = spanned.getSpans(0, spanned.length(), URLSpan.class);
|
|
|
|
for (int a = 0; a < spans.length; a++) {
|
|
|
|
URLSpan span = spans[a];
|
|
|
|
int start = spanned.getSpanStart(span);
|
|
|
|
int end = spanned.getSpanEnd(span);
|
|
|
|
spanned.removeSpan(span);
|
2018-07-30 04:07:02 +02:00
|
|
|
span = new URLSpanNoUnderline(span.getURL()) {
|
|
|
|
@Override
|
|
|
|
public void onClick(View widget) {
|
|
|
|
dismissCurrentDialig();
|
|
|
|
super.onClick(widget);
|
|
|
|
}
|
|
|
|
};
|
2017-03-31 01:58:05 +02:00
|
|
|
spanned.setSpan(span, start, end, 0);
|
|
|
|
}
|
|
|
|
message.setText(spanned);
|
|
|
|
message.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
|
|
|
|
message.setLinkTextColor(Theme.getColor(Theme.key_dialogTextLink));
|
|
|
|
message.setHighlightColor(Theme.getColor(Theme.key_dialogLinkSelection));
|
|
|
|
message.setPadding(AndroidUtilities.dp(23), 0, AndroidUtilities.dp(23), 0);
|
2015-04-09 20:00:14 +02:00
|
|
|
message.setMovementMethod(new LinkMovementMethodMy());
|
2017-03-31 01:58:05 +02:00
|
|
|
message.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
|
2014-05-25 00:47:05 +02:00
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setView(message);
|
2017-03-31 01:58:05 +02:00
|
|
|
builder.setTitle(LocaleController.getString("AskAQuestion", R.string.AskAQuestion));
|
2015-04-09 20:00:14 +02:00
|
|
|
builder.setPositiveButton(LocaleController.getString("AskButton", R.string.AskButton), new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
|
performAskAQuestion();
|
2014-08-22 16:24:33 +02:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
});
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
2015-05-21 23:27:27 +02:00
|
|
|
showDialog(builder.create());
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == sendLogsRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
sendLogs();
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == clearLogsRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
FileLog.cleanupLogs();
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == sendByEnterRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2015-04-09 20:00:14 +02:00
|
|
|
boolean send = preferences.getBoolean("send_by_enter", false);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("send_by_enter", !send);
|
|
|
|
editor.commit();
|
|
|
|
if (view instanceof TextCheckCell) {
|
|
|
|
((TextCheckCell) view).setChecked(!send);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == raiseToSpeakRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedConfig.toogleRaiseToSpeak();
|
2016-03-06 02:49:31 +01:00
|
|
|
if (view instanceof TextCheckCell) {
|
2018-07-30 04:07:02 +02:00
|
|
|
((TextCheckCell) view).setChecked(SharedConfig.raiseToSpeak);
|
2016-03-06 02:49:31 +01:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == autoplayGifsRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedConfig.toggleAutoplayGifs();
|
2016-01-11 18:19:48 +01:00
|
|
|
if (view instanceof TextCheckCell) {
|
2018-07-30 04:07:02 +02:00
|
|
|
((TextCheckCell) view).setChecked(SharedConfig.autoplayGifs);
|
2016-01-11 18:19:48 +01:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == saveToGalleryRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedConfig.toggleSaveToGallery();
|
2015-04-09 20:00:14 +02:00
|
|
|
if (view instanceof TextCheckCell) {
|
2018-07-30 04:07:02 +02:00
|
|
|
((TextCheckCell) view).setChecked(SharedConfig.saveToGallery);
|
2015-02-01 19:51:02 +01:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == customTabsRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedConfig.toggleCustomTabs();
|
2016-03-16 13:26:32 +01:00
|
|
|
if (view instanceof TextCheckCell) {
|
2018-07-30 04:07:02 +02:00
|
|
|
((TextCheckCell) view).setChecked(SharedConfig.customTabs);
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if(position == directShareRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedConfig.toggleDirectShare();
|
2016-03-16 13:26:32 +01:00
|
|
|
if (view instanceof TextCheckCell) {
|
2018-07-30 04:07:02 +02:00
|
|
|
((TextCheckCell) view).setChecked(SharedConfig.directShare);
|
2016-03-16 13:26:32 +01:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == privacyRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
presentFragment(new PrivacySettingsActivity());
|
2017-03-31 01:58:05 +02:00
|
|
|
} else if (position == dataRow) {
|
|
|
|
presentFragment(new DataSettingsActivity());
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == languageRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
presentFragment(new LanguageSelectActivity());
|
2017-03-31 01:58:05 +02:00
|
|
|
} else if (position == themeRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
presentFragment(new ThemeActivity(ThemeActivity.THEME_TYPE_BASIC));
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == switchBackendButtonRow) {
|
2014-11-11 23:16:17 +01:00
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2015-04-09 20:00:14 +02:00
|
|
|
builder.setMessage(LocaleController.getString("AreYouSure", R.string.AreYouSure));
|
|
|
|
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
|
|
|
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedConfig.pushAuthKey = null;
|
|
|
|
SharedConfig.pushAuthKeyId = null;
|
|
|
|
SharedConfig.saveConfig();
|
|
|
|
ConnectionsManager.getInstance(currentAccount).switchBackend();
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
2015-05-21 23:27:27 +02:00
|
|
|
showDialog(builder.create());
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == telegramFaqRow) {
|
2016-04-22 15:49:00 +02:00
|
|
|
Browser.openUrl(getParentActivity(), LocaleController.getString("TelegramFaqUrl", R.string.TelegramFaqUrl));
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == privacyPolicyRow) {
|
2016-04-22 15:49:00 +02:00
|
|
|
Browser.openUrl(getParentActivity(), LocaleController.getString("PrivacyPolicyUrl", R.string.PrivacyPolicyUrl));
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == contactsReimportRow) {
|
2015-09-24 22:52:02 +02:00
|
|
|
//not implemented
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == contactsSortRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
if (getParentActivity() == null) {
|
2014-11-11 23:16:17 +01:00
|
|
|
return;
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
|
|
|
builder.setTitle(LocaleController.getString("SortBy", R.string.SortBy));
|
|
|
|
builder.setItems(new CharSequence[]{
|
|
|
|
LocaleController.getString("Default", R.string.Default),
|
|
|
|
LocaleController.getString("SortFirstName", R.string.SortFirstName),
|
|
|
|
LocaleController.getString("SortLastName", R.string.SortLastName)
|
|
|
|
}, new DialogInterface.OnClickListener() {
|
2014-11-11 23:16:17 +01:00
|
|
|
@Override
|
2015-04-09 20:00:14 +02:00
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2015-04-09 20:00:14 +02:00
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putInt("sortContactsBy", which);
|
|
|
|
editor.commit();
|
2016-10-11 13:57:01 +02:00
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyItemChanged(position);
|
2014-11-11 23:16:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2015-04-09 20:00:14 +02:00
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
2015-05-21 23:27:27 +02:00
|
|
|
showDialog(builder.create());
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == usernameRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
presentFragment(new ChangeUsernameActivity());
|
2017-07-23 14:56:38 +02:00
|
|
|
} else if (position == bioRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.TL_userFull userFull = MessagesController.getInstance(currentAccount).getUserFull(UserConfig.getInstance(currentAccount).getClientUserId());
|
2017-07-23 14:56:38 +02:00
|
|
|
if (userFull != null) {
|
|
|
|
presentFragment(new ChangeBioActivity());
|
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == numberRow) {
|
2015-04-09 20:00:14 +02:00
|
|
|
presentFragment(new ChangePhoneHelpActivity());
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == stickersRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
presentFragment(new StickersActivity(DataQuery.TYPE_IMAGE));
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == emojiRow) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
final boolean maskValues[] = new boolean[2];
|
|
|
|
BottomSheet.Builder builder = new BottomSheet.Builder(getParentActivity());
|
|
|
|
|
|
|
|
builder.setApplyTopPadding(false);
|
|
|
|
builder.setApplyBottomPadding(false);
|
|
|
|
LinearLayout linearLayout = new LinearLayout(getParentActivity());
|
|
|
|
linearLayout.setOrientation(LinearLayout.VERTICAL);
|
|
|
|
for (int a = 0; a < (Build.VERSION.SDK_INT >= 19 ? 2 : 1); a++) {
|
|
|
|
String name = null;
|
|
|
|
if (a == 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
maskValues[a] = SharedConfig.allowBigEmoji;
|
2016-10-11 13:57:01 +02:00
|
|
|
name = LocaleController.getString("EmojiBigSize", R.string.EmojiBigSize);
|
|
|
|
} else if (a == 1) {
|
2018-07-30 04:07:02 +02:00
|
|
|
maskValues[a] = SharedConfig.useSystemEmoji;
|
2016-10-11 13:57:01 +02:00
|
|
|
name = LocaleController.getString("EmojiUseDefault", R.string.EmojiUseDefault);
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
CheckBoxCell checkBoxCell = new CheckBoxCell(getParentActivity(), 1);
|
2016-10-11 13:57:01 +02:00
|
|
|
checkBoxCell.setTag(a);
|
2017-03-31 01:58:05 +02:00
|
|
|
checkBoxCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
2016-10-11 13:57:01 +02:00
|
|
|
linearLayout.addView(checkBoxCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
|
|
|
|
checkBoxCell.setText(name, "", maskValues[a], true);
|
2017-03-31 01:58:05 +02:00
|
|
|
checkBoxCell.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
|
2016-10-11 13:57:01 +02:00
|
|
|
checkBoxCell.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
CheckBoxCell cell = (CheckBoxCell) v;
|
|
|
|
int num = (Integer) cell.getTag();
|
|
|
|
maskValues[num] = !maskValues[num];
|
|
|
|
cell.setChecked(maskValues[num], true);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
BottomSheet.BottomSheetCell cell = new BottomSheet.BottomSheetCell(getParentActivity(), 1);
|
2017-03-31 01:58:05 +02:00
|
|
|
cell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
|
2016-10-11 13:57:01 +02:00
|
|
|
cell.setTextAndIcon(LocaleController.getString("Save", R.string.Save).toUpperCase(), 0);
|
2017-03-31 01:58:05 +02:00
|
|
|
cell.setTextColor(Theme.getColor(Theme.key_dialogTextBlue2));
|
2016-10-11 13:57:01 +02:00
|
|
|
cell.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
try {
|
|
|
|
if (visibleDialog != null) {
|
|
|
|
visibleDialog.dismiss();
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences.Editor editor = MessagesController.getGlobalMainSettings().edit();
|
|
|
|
editor.putBoolean("allowBigEmoji", SharedConfig.allowBigEmoji = maskValues[0]);
|
|
|
|
editor.putBoolean("useSystemEmoji", SharedConfig.useSystemEmoji = maskValues[1]);
|
2016-10-11 13:57:01 +02:00
|
|
|
editor.commit();
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyItemChanged(position);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
linearLayout.addView(cell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
|
|
|
|
builder.setCustomView(linearLayout);
|
|
|
|
showDialog(builder.create());
|
2017-07-08 18:32:04 +02:00
|
|
|
} else if (position == dumpCallStatsRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2017-07-08 18:32:04 +02:00
|
|
|
boolean dump = preferences.getBoolean("dbg_dump_call_stats", false);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("dbg_dump_call_stats", !dump);
|
|
|
|
editor.commit();
|
|
|
|
if (view instanceof TextCheckCell) {
|
|
|
|
((TextCheckCell) view).setChecked(!dump);
|
|
|
|
}
|
2018-07-30 04:07:02 +02:00
|
|
|
}else if (position == forceTcpInCallsRow) {
|
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
|
|
|
boolean dump = preferences.getBoolean("dbg_force_tcp_in_calls", false);
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putBoolean("dbg_force_tcp_in_calls", !dump);
|
|
|
|
editor.commit();
|
|
|
|
if (view instanceof TextCheckCell) {
|
|
|
|
((TextCheckCell) view).setChecked(!dump);
|
|
|
|
}
|
2014-11-11 23:16:17 +01:00
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
|
|
|
});
|
2014-11-11 23:16:17 +01:00
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
listView.setOnItemLongClickListener(new RecyclerListView.OnItemLongClickListener() {
|
2016-06-24 12:27:15 +02:00
|
|
|
|
|
|
|
private int pressCount = 0;
|
|
|
|
|
|
|
|
@Override
|
2016-10-11 13:57:01 +02:00
|
|
|
public boolean onItemClick(View view, int position) {
|
2016-06-24 12:27:15 +02:00
|
|
|
if (position == versionRow) {
|
|
|
|
pressCount++;
|
2017-12-08 18:35:59 +01:00
|
|
|
if (pressCount >= 2 || BuildVars.DEBUG_PRIVATE_VERSION) {
|
2016-06-24 12:27:15 +02:00
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2017-03-31 01:58:05 +02:00
|
|
|
builder.setTitle(LocaleController.getString("DebugMenu", R.string.DebugMenu));
|
2017-12-08 18:35:59 +01:00
|
|
|
CharSequence[] items;
|
2018-07-30 04:07:02 +02:00
|
|
|
items = new CharSequence[]{
|
|
|
|
LocaleController.getString("DebugMenuImportContacts", R.string.DebugMenuImportContacts),
|
|
|
|
LocaleController.getString("DebugMenuReloadContacts", R.string.DebugMenuReloadContacts),
|
|
|
|
LocaleController.getString("DebugMenuResetContacts", R.string.DebugMenuResetContacts),
|
|
|
|
LocaleController.getString("DebugMenuResetDialogs", R.string.DebugMenuResetDialogs),
|
|
|
|
BuildVars.LOGS_ENABLED ? LocaleController.getString("DebugMenuDisableLogs", R.string.DebugMenuDisableLogs) : LocaleController.getString("DebugMenuEnableLogs", R.string.DebugMenuEnableLogs),
|
|
|
|
SharedConfig.inappCamera ? LocaleController.getString("DebugMenuDisableCamera", R.string.DebugMenuDisableCamera) : LocaleController.getString("DebugMenuEnableCamera", R.string.DebugMenuEnableCamera),
|
|
|
|
LocaleController.getString("DebugMenuClearMediaCache", R.string.DebugMenuClearMediaCache),
|
|
|
|
null,
|
|
|
|
BuildVars.DEBUG_PRIVATE_VERSION ? "Check for app updates" : null
|
|
|
|
};
|
2017-12-08 18:35:59 +01:00
|
|
|
builder.setItems(items, new DialogInterface.OnClickListener() {
|
2016-06-24 12:27:15 +02:00
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
if (which == 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
UserConfig.getInstance(currentAccount).syncContacts = true;
|
|
|
|
UserConfig.getInstance(currentAccount).saveConfig(false);
|
|
|
|
ContactsController.getInstance(currentAccount).forceImportContacts();
|
2016-06-24 12:27:15 +02:00
|
|
|
} else if (which == 1) {
|
2018-07-30 04:07:02 +02:00
|
|
|
ContactsController.getInstance(currentAccount).loadContacts(false, 0);
|
2017-12-08 18:35:59 +01:00
|
|
|
} else if (which == 2) {
|
2018-07-30 04:07:02 +02:00
|
|
|
ContactsController.getInstance(currentAccount).resetImportedContacts();
|
2017-12-08 18:35:59 +01:00
|
|
|
} else if (which == 3) {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).forceResetDialogs();
|
2017-12-08 18:35:59 +01:00
|
|
|
} else if (which == 4) {
|
2018-07-30 04:07:02 +02:00
|
|
|
BuildVars.LOGS_ENABLED = !BuildVars.LOGS_ENABLED;
|
|
|
|
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("systemConfig", Context.MODE_PRIVATE);
|
|
|
|
sharedPreferences.edit().putBoolean("logsEnabled", BuildVars.LOGS_ENABLED).commit();
|
2017-12-08 18:35:59 +01:00
|
|
|
} else if (which == 5) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedConfig.toggleInappCamera();
|
|
|
|
} else if (which == 6) {
|
|
|
|
MessagesStorage.getInstance(currentAccount).clearSentMedia();
|
|
|
|
} else if (which == 7) {
|
|
|
|
SharedConfig.toggleRoundCamera16to9();
|
|
|
|
} else if (which == 8) {
|
|
|
|
((LaunchActivity) getParentActivity()).checkAppUpdate(true);
|
2016-06-24 12:27:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
|
|
|
|
showDialog(builder.create());
|
|
|
|
} else {
|
|
|
|
try {
|
|
|
|
Toast.makeText(getParentActivity(), "¯\\_(ツ)_/¯", Toast.LENGTH_SHORT).show();
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2016-06-24 12:27:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
frameLayout.addView(actionBar);
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
extraHeightView = new View(context);
|
2016-06-24 12:27:15 +02:00
|
|
|
extraHeightView.setPivotY(0);
|
2017-03-31 01:58:05 +02:00
|
|
|
extraHeightView.setBackgroundColor(Theme.getColor(Theme.key_avatar_backgroundActionBarBlue));
|
2015-10-29 18:10:07 +01:00
|
|
|
frameLayout.addView(extraHeightView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 88));
|
|
|
|
|
|
|
|
shadowView = new View(context);
|
|
|
|
shadowView.setBackgroundResource(R.drawable.header_shadow);
|
|
|
|
frameLayout.addView(shadowView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 3));
|
|
|
|
|
|
|
|
avatarImage = new BackupImageView(context);
|
|
|
|
avatarImage.setRoundRadius(AndroidUtilities.dp(21));
|
2016-06-24 12:27:15 +02:00
|
|
|
avatarImage.setPivotX(0);
|
|
|
|
avatarImage.setPivotY(0);
|
2015-10-29 18:10:07 +01:00
|
|
|
frameLayout.addView(avatarImage, LayoutHelper.createFrame(42, 42, Gravity.TOP | Gravity.LEFT, 64, 0, 0, 0));
|
|
|
|
avatarImage.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
|
2016-03-16 13:26:32 +01:00
|
|
|
if (user != null && user.photo != null && user.photo.photo_big != null) {
|
2015-10-29 18:10:07 +01:00
|
|
|
PhotoViewer.getInstance().setParentActivity(getParentActivity());
|
2017-12-08 18:35:59 +01:00
|
|
|
PhotoViewer.getInstance().openPhoto(user.photo.photo_big, provider);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
nameTextView = new TextView(context);
|
2017-03-31 01:58:05 +02:00
|
|
|
nameTextView.setTextColor(Theme.getColor(Theme.key_profile_title));
|
2015-10-29 18:10:07 +01:00
|
|
|
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
|
|
|
nameTextView.setLines(1);
|
|
|
|
nameTextView.setMaxLines(1);
|
|
|
|
nameTextView.setSingleLine(true);
|
|
|
|
nameTextView.setEllipsize(TextUtils.TruncateAt.END);
|
|
|
|
nameTextView.setGravity(Gravity.LEFT);
|
|
|
|
nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
2016-06-24 12:27:15 +02:00
|
|
|
nameTextView.setPivotX(0);
|
|
|
|
nameTextView.setPivotY(0);
|
2015-10-29 18:10:07 +01:00
|
|
|
frameLayout.addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 48, 0));
|
|
|
|
|
|
|
|
onlineTextView = new TextView(context);
|
2017-03-31 01:58:05 +02:00
|
|
|
onlineTextView.setTextColor(Theme.getColor(Theme.key_avatar_subtitleInProfileBlue));
|
2015-10-29 18:10:07 +01:00
|
|
|
onlineTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
|
|
|
|
onlineTextView.setLines(1);
|
|
|
|
onlineTextView.setMaxLines(1);
|
|
|
|
onlineTextView.setSingleLine(true);
|
|
|
|
onlineTextView.setEllipsize(TextUtils.TruncateAt.END);
|
|
|
|
onlineTextView.setGravity(Gravity.LEFT);
|
|
|
|
frameLayout.addView(onlineTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 48, 0));
|
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
writeButton = new ImageView(context);
|
2017-03-31 01:58:05 +02:00
|
|
|
Drawable drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_profile_actionBackground), Theme.getColor(Theme.key_profile_actionPressedBackground));
|
|
|
|
if (Build.VERSION.SDK_INT < 21) {
|
|
|
|
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
|
|
|
|
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
|
|
|
|
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
|
|
|
|
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
|
|
|
drawable = combinedDrawable;
|
|
|
|
}
|
|
|
|
writeButton.setBackgroundDrawable(drawable);
|
2015-04-09 20:00:14 +02:00
|
|
|
writeButton.setImageResource(R.drawable.floating_camera);
|
2017-03-31 01:58:05 +02:00
|
|
|
writeButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_profile_actionIcon), PorterDuff.Mode.MULTIPLY));
|
2015-04-09 20:00:14 +02:00
|
|
|
writeButton.setScaleType(ImageView.ScaleType.CENTER);
|
|
|
|
if (Build.VERSION.SDK_INT >= 21) {
|
|
|
|
StateListAnimator animator = new StateListAnimator();
|
|
|
|
animator.addState(new int[]{android.R.attr.state_pressed}, ObjectAnimator.ofFloat(writeButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200));
|
|
|
|
animator.addState(new int[]{}, ObjectAnimator.ofFloat(writeButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200));
|
|
|
|
writeButton.setStateListAnimator(animator);
|
|
|
|
writeButton.setOutlineProvider(new ViewOutlineProvider() {
|
2015-05-21 23:27:27 +02:00
|
|
|
@SuppressLint("NewApi")
|
2014-11-12 23:16:59 +01:00
|
|
|
@Override
|
2015-04-09 20:00:14 +02:00
|
|
|
public void getOutline(View view, Outline outline) {
|
|
|
|
outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
frameLayout.addView(writeButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, Gravity.RIGHT | Gravity.TOP, 0, 0, 16, 0));
|
2015-04-09 20:00:14 +02:00
|
|
|
writeButton.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
if (getParentActivity() == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
|
2014-11-12 23:16:59 +01:00
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
CharSequence[] items;
|
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
|
2015-04-09 20:00:14 +02:00
|
|
|
if (user == null) {
|
2018-07-30 04:07:02 +02:00
|
|
|
user = UserConfig.getInstance(currentAccount).getCurrentUser();
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
|
|
|
if (user == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
boolean fullMenu = false;
|
|
|
|
if (user.photo != null && user.photo.photo_big != null && !(user.photo instanceof TLRPC.TL_userProfilePhotoEmpty)) {
|
|
|
|
items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley), LocaleController.getString("DeletePhoto", R.string.DeletePhoto)};
|
|
|
|
fullMenu = true;
|
|
|
|
} else {
|
|
|
|
items = new CharSequence[]{LocaleController.getString("FromCamera", R.string.FromCamera), LocaleController.getString("FromGalley", R.string.FromGalley)};
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
|
2015-04-09 20:00:14 +02:00
|
|
|
final boolean full = fullMenu;
|
|
|
|
builder.setItems(items, new DialogInterface.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
public void onClick(DialogInterface dialogInterface, int i) {
|
|
|
|
if (i == 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
imageUpdater.openCamera();
|
2015-04-09 20:00:14 +02:00
|
|
|
} else if (i == 1) {
|
2018-07-30 04:07:02 +02:00
|
|
|
imageUpdater.openGallery();
|
2015-04-09 20:00:14 +02:00
|
|
|
} else if (i == 2) {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).deleteUserPhoto(null);
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
});
|
2015-05-21 23:27:27 +02:00
|
|
|
showDialog(builder.create());
|
2015-04-09 20:00:14 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-10-29 18:10:07 +01:00
|
|
|
needLayout();
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
2015-04-09 20:00:14 +02:00
|
|
|
@Override
|
2016-10-11 13:57:01 +02:00
|
|
|
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
|
|
|
if (layoutManager.getItemCount() == 0) {
|
2015-04-09 20:00:14 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
int height = 0;
|
2016-10-11 13:57:01 +02:00
|
|
|
View child = recyclerView.getChildAt(0);
|
2015-04-09 20:00:14 +02:00
|
|
|
if (child != null) {
|
2016-10-11 13:57:01 +02:00
|
|
|
if (layoutManager.findFirstVisibleItemPosition() == 0) {
|
2015-04-09 20:00:14 +02:00
|
|
|
height = AndroidUtilities.dp(88) + (child.getTop() < 0 ? child.getTop() : 0);
|
|
|
|
}
|
2015-10-29 18:10:07 +01:00
|
|
|
if (extraHeight != height) {
|
|
|
|
extraHeight = height;
|
2015-04-09 20:00:14 +02:00
|
|
|
needLayout();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
return fragmentView;
|
|
|
|
}
|
|
|
|
|
2016-06-24 12:27:15 +02:00
|
|
|
private void performAskAQuestion() {
|
2018-07-30 04:07:02 +02:00
|
|
|
final SharedPreferences preferences = MessagesController.getMainSettings(currentAccount);
|
2014-04-02 19:36:57 +02:00
|
|
|
int uid = preferences.getInt("support_id", 0);
|
|
|
|
TLRPC.User supportUser = null;
|
|
|
|
if (uid != 0) {
|
2018-07-30 04:07:02 +02:00
|
|
|
supportUser = MessagesController.getInstance(currentAccount).getUser(uid);
|
2014-04-02 19:36:57 +02:00
|
|
|
if (supportUser == null) {
|
|
|
|
String userString = preferences.getString("support_user", null);
|
|
|
|
if (userString != null) {
|
|
|
|
try {
|
|
|
|
byte[] datacentersBytes = Base64.decode(userString, Base64.DEFAULT);
|
|
|
|
if (datacentersBytes != null) {
|
|
|
|
SerializedData data = new SerializedData(datacentersBytes);
|
2015-05-03 13:48:36 +02:00
|
|
|
supportUser = TLRPC.User.TLdeserialize(data, data.readInt32(false), false);
|
2014-07-03 00:39:05 +02:00
|
|
|
if (supportUser != null && supportUser.id == 333000) {
|
|
|
|
supportUser = null;
|
|
|
|
}
|
2015-02-27 20:57:58 +01:00
|
|
|
data.cleanup();
|
2014-04-02 19:36:57 +02:00
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2014-04-02 19:36:57 +02:00
|
|
|
supportUser = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (supportUser == null) {
|
2017-03-31 01:58:05 +02:00
|
|
|
final AlertDialog progressDialog = new AlertDialog(getParentActivity(), 1);
|
2014-06-04 01:31:48 +02:00
|
|
|
progressDialog.setMessage(LocaleController.getString("Loading", R.string.Loading));
|
2014-04-02 19:36:57 +02:00
|
|
|
progressDialog.setCanceledOnTouchOutside(false);
|
|
|
|
progressDialog.setCancelable(false);
|
|
|
|
progressDialog.show();
|
|
|
|
TLRPC.TL_help_getSupport req = new TLRPC.TL_help_getSupport();
|
2018-07-30 04:07:02 +02:00
|
|
|
ConnectionsManager.getInstance(currentAccount).sendRequest(req, new RequestDelegate() {
|
2014-04-02 19:36:57 +02:00
|
|
|
@Override
|
|
|
|
public void run(TLObject response, TLRPC.TL_error error) {
|
|
|
|
if (error == null) {
|
|
|
|
|
2015-05-21 23:27:27 +02:00
|
|
|
final TLRPC.TL_help_support res = (TLRPC.TL_help_support) response;
|
2014-11-06 22:34:47 +01:00
|
|
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
2014-04-02 19:36:57 +02:00
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
SharedPreferences.Editor editor = preferences.edit();
|
|
|
|
editor.putInt("support_id", res.user.id);
|
|
|
|
SerializedData data = new SerializedData();
|
|
|
|
res.user.serializeToStream(data);
|
|
|
|
editor.putString("support_user", Base64.encodeToString(data.toByteArray(), Base64.DEFAULT));
|
|
|
|
editor.commit();
|
2015-02-27 20:57:58 +01:00
|
|
|
data.cleanup();
|
2014-04-02 19:36:57 +02:00
|
|
|
try {
|
|
|
|
progressDialog.dismiss();
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2014-04-02 19:36:57 +02:00
|
|
|
}
|
2015-01-02 23:15:07 +01:00
|
|
|
ArrayList<TLRPC.User> users = new ArrayList<>();
|
2014-07-27 00:28:33 +02:00
|
|
|
users.add(res.user);
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesStorage.getInstance(currentAccount).putUsersAndChats(users, null, true, true);
|
|
|
|
MessagesController.getInstance(currentAccount).putUser(res.user, false);
|
2014-06-04 01:31:48 +02:00
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", res.user.id);
|
|
|
|
presentFragment(new ChatActivity(args));
|
2014-04-02 19:36:57 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
2014-11-06 22:34:47 +01:00
|
|
|
AndroidUtilities.runOnUIThread(new Runnable() {
|
2014-04-02 19:36:57 +02:00
|
|
|
@Override
|
|
|
|
public void run() {
|
|
|
|
try {
|
|
|
|
progressDialog.dismiss();
|
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2014-04-02 19:36:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2014-07-03 00:39:05 +02:00
|
|
|
});
|
2014-04-02 19:36:57 +02:00
|
|
|
} else {
|
2018-07-30 04:07:02 +02:00
|
|
|
MessagesController.getInstance(currentAccount).putUser(supportUser, true);
|
2014-06-04 01:31:48 +02:00
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putInt("user_id", supportUser.id);
|
|
|
|
presentFragment(new ChatActivity(args));
|
2014-04-02 19:36:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
2014-03-26 21:16:28 +01:00
|
|
|
public void onActivityResultFragment(int requestCode, int resultCode, Intent data) {
|
2018-07-30 04:07:02 +02:00
|
|
|
imageUpdater.onActivityResult(requestCode, resultCode, data);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2014-03-26 21:16:28 +01:00
|
|
|
@Override
|
|
|
|
public void saveSelfArgs(Bundle args) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (imageUpdater != null && imageUpdater.currentPicturePath != null) {
|
|
|
|
args.putString("path", imageUpdater.currentPicturePath);
|
2014-03-26 21:16:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void restoreSelfArgs(Bundle args) {
|
2018-07-30 04:07:02 +02:00
|
|
|
if (imageUpdater != null) {
|
|
|
|
imageUpdater.currentPicturePath = args.getString("path");
|
2014-03-26 21:16:28 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
@Override
|
2018-07-30 04:07:02 +02:00
|
|
|
public void didReceivedNotification(int id, int account, Object... args) {
|
2014-08-22 16:24:33 +02:00
|
|
|
if (id == NotificationCenter.updateInterfaces) {
|
2015-05-21 23:27:27 +02:00
|
|
|
int mask = (Integer) args[0];
|
2014-02-04 19:36:55 +01:00
|
|
|
if ((mask & MessagesController.UPDATE_MASK_AVATAR) != 0 || (mask & MessagesController.UPDATE_MASK_NAME) != 0) {
|
2014-11-11 23:16:17 +01:00
|
|
|
updateUserData();
|
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (id == NotificationCenter.featuredStickersDidLoaded) {
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyItemChanged(stickersRow);
|
|
|
|
}
|
2017-07-23 14:56:38 +02:00
|
|
|
} else if (id == NotificationCenter.userInfoDidLoaded) {
|
|
|
|
Integer uid = (Integer) args[0];
|
2018-07-30 04:07:02 +02:00
|
|
|
if (uid == UserConfig.getInstance(currentAccount).getClientUserId() && listAdapter != null) {
|
2017-07-23 14:56:38 +02:00
|
|
|
listAdapter.notifyItemChanged(bioRow);
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
} else if (id == NotificationCenter.emojiDidLoaded) {
|
|
|
|
if (listView != null) {
|
|
|
|
listView.invalidateViews();
|
|
|
|
}
|
2014-11-11 23:16:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResume() {
|
|
|
|
super.onResume();
|
|
|
|
if (listAdapter != null) {
|
|
|
|
listAdapter.notifyDataSetChanged();
|
|
|
|
}
|
2015-04-09 20:00:14 +02:00
|
|
|
updateUserData();
|
2014-11-11 23:16:17 +01:00
|
|
|
fixLayout();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
|
|
super.onConfigurationChanged(newConfig);
|
|
|
|
fixLayout();
|
|
|
|
}
|
|
|
|
|
2014-11-12 23:16:59 +01:00
|
|
|
private void needLayout() {
|
|
|
|
FrameLayout.LayoutParams layoutParams;
|
2015-10-29 18:10:07 +01:00
|
|
|
int newTop = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight();
|
2014-11-12 23:16:59 +01:00
|
|
|
if (listView != null) {
|
|
|
|
layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams();
|
2015-10-29 18:10:07 +01:00
|
|
|
if (layoutParams.topMargin != newTop) {
|
|
|
|
layoutParams.topMargin = newTop;
|
|
|
|
listView.setLayoutParams(layoutParams);
|
2016-06-24 12:27:15 +02:00
|
|
|
extraHeightView.setTranslationY(newTop);
|
2015-10-29 18:10:07 +01:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (avatarImage != null) {
|
2015-10-29 18:10:07 +01:00
|
|
|
float diff = extraHeight / (float) AndroidUtilities.dp(88);
|
2016-06-24 12:27:15 +02:00
|
|
|
extraHeightView.setScaleY(diff);
|
|
|
|
shadowView.setTranslationY(newTop + extraHeight);
|
|
|
|
|
|
|
|
|
|
|
|
writeButton.setTranslationY((actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight() + extraHeight - AndroidUtilities.dp(29.5f));
|
2015-10-29 18:10:07 +01:00
|
|
|
|
2015-06-29 19:12:11 +02:00
|
|
|
final boolean setVisible = diff > 0.2f;
|
|
|
|
boolean currentVisible = writeButton.getTag() == null;
|
|
|
|
if (setVisible != currentVisible) {
|
|
|
|
if (setVisible) {
|
|
|
|
writeButton.setTag(null);
|
|
|
|
writeButton.setVisibility(View.VISIBLE);
|
|
|
|
} else {
|
|
|
|
writeButton.setTag(0);
|
|
|
|
}
|
|
|
|
if (writeButtonAnimation != null) {
|
2016-06-24 12:27:15 +02:00
|
|
|
AnimatorSet old = writeButtonAnimation;
|
2015-06-29 19:12:11 +02:00
|
|
|
writeButtonAnimation = null;
|
|
|
|
old.cancel();
|
|
|
|
}
|
2016-06-24 12:27:15 +02:00
|
|
|
writeButtonAnimation = new AnimatorSet();
|
2015-06-29 19:12:11 +02:00
|
|
|
if (setVisible) {
|
|
|
|
writeButtonAnimation.setInterpolator(new DecelerateInterpolator());
|
|
|
|
writeButtonAnimation.playTogether(
|
2016-06-24 12:27:15 +02:00
|
|
|
ObjectAnimator.ofFloat(writeButton, "scaleX", 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(writeButton, "scaleY", 1.0f),
|
|
|
|
ObjectAnimator.ofFloat(writeButton, "alpha", 1.0f)
|
2015-06-29 19:12:11 +02:00
|
|
|
);
|
|
|
|
} else {
|
|
|
|
writeButtonAnimation.setInterpolator(new AccelerateInterpolator());
|
|
|
|
writeButtonAnimation.playTogether(
|
2016-06-24 12:27:15 +02:00
|
|
|
ObjectAnimator.ofFloat(writeButton, "scaleX", 0.2f),
|
|
|
|
ObjectAnimator.ofFloat(writeButton, "scaleY", 0.2f),
|
|
|
|
ObjectAnimator.ofFloat(writeButton, "alpha", 0.0f)
|
2015-06-29 19:12:11 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
writeButtonAnimation.setDuration(150);
|
2017-03-31 01:58:05 +02:00
|
|
|
writeButtonAnimation.addListener(new AnimatorListenerAdapter() {
|
2015-06-29 19:12:11 +02:00
|
|
|
@Override
|
2016-06-24 12:27:15 +02:00
|
|
|
public void onAnimationEnd(Animator animation) {
|
2015-06-29 19:12:11 +02:00
|
|
|
if (writeButtonAnimation != null && writeButtonAnimation.equals(animation)) {
|
|
|
|
writeButton.setVisibility(setVisible ? View.VISIBLE : View.GONE);
|
|
|
|
writeButtonAnimation = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
writeButtonAnimation.start();
|
2014-11-19 02:23:46 +01:00
|
|
|
}
|
2014-11-12 23:16:59 +01:00
|
|
|
|
2016-06-24 12:27:15 +02:00
|
|
|
avatarImage.setScaleX((42 + 18 * diff) / 42.0f);
|
|
|
|
avatarImage.setScaleY((42 + 18 * diff) / 42.0f);
|
2015-10-29 18:10:07 +01:00
|
|
|
float avatarY = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight() / 2.0f * (1.0f + diff) - 21 * AndroidUtilities.density + 27 * AndroidUtilities.density * diff;
|
2016-06-24 12:27:15 +02:00
|
|
|
avatarImage.setTranslationX(-AndroidUtilities.dp(47) * diff);
|
|
|
|
avatarImage.setTranslationY((float) Math.ceil(avatarY));
|
|
|
|
nameTextView.setTranslationX(-21 * AndroidUtilities.density * diff);
|
|
|
|
nameTextView.setTranslationY((float) Math.floor(avatarY) - (float) Math.ceil(AndroidUtilities.density) + (float) Math.floor(7 * AndroidUtilities.density * diff));
|
|
|
|
onlineTextView.setTranslationX(-21 * AndroidUtilities.density * diff);
|
|
|
|
onlineTextView.setTranslationY((float) Math.floor(avatarY) + AndroidUtilities.dp(22) + (float )Math.floor(11 * AndroidUtilities.density) * diff);
|
|
|
|
nameTextView.setScaleX(1.0f + 0.12f * diff);
|
|
|
|
nameTextView.setScaleY(1.0f + 0.12f * diff);
|
2014-11-12 23:16:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-11 23:16:17 +01:00
|
|
|
private void fixLayout() {
|
|
|
|
if (fragmentView == null) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
fragmentView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
|
|
|
|
@Override
|
|
|
|
public boolean onPreDraw() {
|
|
|
|
if (fragmentView != null) {
|
2014-11-12 23:16:59 +01:00
|
|
|
needLayout();
|
2014-11-11 23:16:17 +01:00
|
|
|
fragmentView.getViewTreeObserver().removeOnPreDrawListener(this);
|
2014-02-04 19:36:55 +01:00
|
|
|
}
|
2015-06-29 19:12:11 +02:00
|
|
|
return true;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2014-11-11 23:16:17 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateUserData() {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(UserConfig.getInstance(currentAccount).getClientUserId());
|
2014-11-11 23:16:17 +01:00
|
|
|
TLRPC.FileLocation photo = null;
|
|
|
|
TLRPC.FileLocation photoBig = null;
|
|
|
|
if (user.photo != null) {
|
|
|
|
photo = user.photo.photo_small;
|
|
|
|
photoBig = user.photo.photo_big;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
avatarDrawable = new AvatarDrawable(user, true);
|
2016-04-22 15:49:00 +02:00
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
avatarDrawable.setColor(Theme.getColor(Theme.key_avatar_backgroundInProfileBlue));
|
2015-02-26 15:36:15 +01:00
|
|
|
if (avatarImage != null) {
|
|
|
|
avatarImage.setImage(photo, "50_50", avatarDrawable);
|
2018-07-30 04:07:02 +02:00
|
|
|
avatarImage.getImageReceiver().setVisible(!PhotoViewer.isShowingImage(photoBig), false);
|
2014-11-11 23:16:17 +01:00
|
|
|
|
2015-06-29 19:12:11 +02:00
|
|
|
nameTextView.setText(UserObject.getUserName(user));
|
2015-02-26 15:36:15 +01:00
|
|
|
onlineTextView.setText(LocaleController.getString("Online", R.string.Online));
|
2014-11-11 23:16:17 +01:00
|
|
|
|
2018-07-30 04:07:02 +02:00
|
|
|
avatarImage.getImageReceiver().setVisible(!PhotoViewer.isShowingImage(photoBig), false);
|
2015-02-26 15:36:15 +01:00
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
2013-12-20 20:25:49 +01:00
|
|
|
private void sendLogs() {
|
|
|
|
try {
|
2015-01-02 23:15:07 +01:00
|
|
|
ArrayList<Uri> uris = new ArrayList<>();
|
2013-12-20 20:25:49 +01:00
|
|
|
File sdCard = ApplicationLoader.applicationContext.getExternalFilesDir(null);
|
2015-05-21 23:27:27 +02:00
|
|
|
File dir = new File(sdCard.getAbsolutePath() + "/logs");
|
2013-12-20 20:25:49 +01:00
|
|
|
File[] files = dir.listFiles();
|
2017-12-08 18:35:59 +01:00
|
|
|
|
2013-12-20 20:25:49 +01:00
|
|
|
for (File file : files) {
|
2017-12-08 18:35:59 +01:00
|
|
|
if (Build.VERSION.SDK_INT >= 24) {
|
|
|
|
uris.add(FileProvider.getUriForFile(getParentActivity(), BuildConfig.APPLICATION_ID + ".provider", file));
|
|
|
|
} else {
|
|
|
|
uris.add(Uri.fromFile(file));
|
|
|
|
}
|
2013-12-20 20:25:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (uris.isEmpty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Intent i = new Intent(Intent.ACTION_SEND_MULTIPLE);
|
2017-12-08 18:35:59 +01:00
|
|
|
if (Build.VERSION.SDK_INT >= 24) {
|
|
|
|
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
|
|
|
}
|
2015-05-21 23:27:27 +02:00
|
|
|
i.setType("message/rfc822");
|
2017-03-31 01:58:05 +02:00
|
|
|
i.putExtra(Intent.EXTRA_EMAIL, "");
|
2013-12-20 20:25:49 +01:00
|
|
|
i.putExtra(Intent.EXTRA_SUBJECT, "last logs");
|
|
|
|
i.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
|
2015-02-26 02:32:51 +01:00
|
|
|
getParentActivity().startActivityForResult(Intent.createChooser(i, "Select email application."), 500);
|
2013-12-20 20:25:49 +01:00
|
|
|
} catch (Exception e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
private class ListAdapter extends RecyclerListView.SelectionAdapter {
|
2016-10-11 13:57:01 +02:00
|
|
|
|
2013-10-25 17:19:00 +02:00
|
|
|
private Context mContext;
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
public ListAdapter(Context context) {
|
|
|
|
mContext = context;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-10-11 13:57:01 +02:00
|
|
|
public int getItemCount() {
|
2013-10-25 17:19:00 +02:00
|
|
|
return rowCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-10-11 13:57:01 +02:00
|
|
|
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
|
|
|
switch (holder.getItemViewType()) {
|
|
|
|
case 0: {
|
|
|
|
if (position == overscrollRow) {
|
|
|
|
((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(88));
|
|
|
|
} else {
|
|
|
|
((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(16));
|
|
|
|
}
|
|
|
|
break;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
case 2: {
|
|
|
|
TextSettingsCell textCell = (TextSettingsCell) holder.itemView;
|
|
|
|
if (position == textSizeRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2016-10-11 13:57:01 +02:00
|
|
|
int size = preferences.getInt("fons_size", AndroidUtilities.isTablet() ? 18 : 16);
|
|
|
|
textCell.setTextAndValue(LocaleController.getString("TextSize", R.string.TextSize), String.format("%d", size), true);
|
|
|
|
} else if (position == languageRow) {
|
|
|
|
textCell.setTextAndValue(LocaleController.getString("Language", R.string.Language), LocaleController.getCurrentLanguageName(), true);
|
2017-03-31 01:58:05 +02:00
|
|
|
} else if (position == themeRow) {
|
|
|
|
textCell.setTextAndValue(LocaleController.getString("Theme", R.string.Theme), Theme.getCurrentThemeName(), true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == contactsSortRow) {
|
|
|
|
String value;
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2016-10-11 13:57:01 +02:00
|
|
|
int sort = preferences.getInt("sortContactsBy", 0);
|
|
|
|
if (sort == 0) {
|
|
|
|
value = LocaleController.getString("Default", R.string.Default);
|
|
|
|
} else if (sort == 1) {
|
|
|
|
value = LocaleController.getString("FirstName", R.string.SortFirstName);
|
|
|
|
} else {
|
|
|
|
value = LocaleController.getString("LastName", R.string.SortLastName);
|
|
|
|
}
|
|
|
|
textCell.setTextAndValue(LocaleController.getString("SortBy", R.string.SortBy), value, true);
|
|
|
|
} else if (position == notificationRow) {
|
|
|
|
textCell.setText(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds), true);
|
|
|
|
} else if (position == backgroundRow) {
|
|
|
|
textCell.setText(LocaleController.getString("ChatBackground", R.string.ChatBackground), true);
|
|
|
|
} else if (position == sendLogsRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
textCell.setText(LocaleController.getString("DebugSendLogs", R.string.DebugSendLogs), true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == clearLogsRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
textCell.setText(LocaleController.getString("DebugClearLogs", R.string.DebugClearLogs), true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == askQuestionRow) {
|
|
|
|
textCell.setText(LocaleController.getString("AskAQuestion", R.string.AskAQuestion), true);
|
|
|
|
} else if (position == privacyRow) {
|
|
|
|
textCell.setText(LocaleController.getString("PrivacySettings", R.string.PrivacySettings), true);
|
2017-03-31 01:58:05 +02:00
|
|
|
} else if (position == dataRow) {
|
|
|
|
textCell.setText(LocaleController.getString("DataSettings", R.string.DataSettings), true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == switchBackendButtonRow) {
|
|
|
|
textCell.setText("Switch Backend", true);
|
|
|
|
} else if (position == telegramFaqRow) {
|
2017-12-08 18:35:59 +01:00
|
|
|
textCell.setText(LocaleController.getString("TelegramFAQ", R.string.TelegramFAQ), true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == contactsReimportRow) {
|
|
|
|
textCell.setText(LocaleController.getString("ImportContacts", R.string.ImportContacts), true);
|
|
|
|
} else if (position == stickersRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
int count = DataQuery.getInstance(currentAccount).getUnreadStickerSets().size();
|
2017-07-08 18:32:04 +02:00
|
|
|
textCell.setTextAndValue(LocaleController.getString("StickersName", R.string.StickersName), count != 0 ? String.format("%d", count) : "", true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == privacyPolicyRow) {
|
|
|
|
textCell.setText(LocaleController.getString("PrivacyPolicy", R.string.PrivacyPolicy), true);
|
|
|
|
} else if (position == emojiRow) {
|
|
|
|
textCell.setText(LocaleController.getString("Emoji", R.string.Emoji), true);
|
|
|
|
}
|
|
|
|
break;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
case 3: {
|
|
|
|
TextCheckCell textCell = (TextCheckCell) holder.itemView;
|
2018-07-30 04:07:02 +02:00
|
|
|
SharedPreferences preferences = MessagesController.getGlobalMainSettings();
|
2016-10-11 13:57:01 +02:00
|
|
|
if (position == enableAnimationsRow) {
|
|
|
|
textCell.setTextAndCheck(LocaleController.getString("EnableAnimations", R.string.EnableAnimations), preferences.getBoolean("view_animations", true), false);
|
|
|
|
} else if (position == sendByEnterRow) {
|
2017-03-31 01:58:05 +02:00
|
|
|
textCell.setTextAndCheck(LocaleController.getString("SendByEnter", R.string.SendByEnter), preferences.getBoolean("send_by_enter", false), true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == saveToGalleryRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
textCell.setTextAndCheck(LocaleController.getString("SaveToGallerySettings", R.string.SaveToGallerySettings), SharedConfig.saveToGallery, false);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == autoplayGifsRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
textCell.setTextAndCheck(LocaleController.getString("AutoplayGifs", R.string.AutoplayGifs), SharedConfig.autoplayGifs, true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == raiseToSpeakRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
textCell.setTextAndCheck(LocaleController.getString("RaiseToSpeak", R.string.RaiseToSpeak), SharedConfig.raiseToSpeak, true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == customTabsRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
textCell.setTextAndValueAndCheck(LocaleController.getString("ChromeCustomTabs", R.string.ChromeCustomTabs), LocaleController.getString("ChromeCustomTabsInfo", R.string.ChromeCustomTabsInfo), SharedConfig.customTabs, false, true);
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == directShareRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
textCell.setTextAndValueAndCheck(LocaleController.getString("DirectShare", R.string.DirectShare), LocaleController.getString("DirectShareInfo", R.string.DirectShareInfo), SharedConfig.directShare, false, true);
|
2017-07-08 18:32:04 +02:00
|
|
|
} else if (position == dumpCallStatsRow) {
|
|
|
|
textCell.setTextAndCheck("Dump detailed call stats", preferences.getBoolean("dbg_dump_call_stats", false), true);
|
2018-07-30 04:07:02 +02:00
|
|
|
} else if (position == forceTcpInCallsRow) {
|
|
|
|
textCell.setTextAndValueAndCheck("Force TCP in calls", "This disables UDP", preferences.getBoolean("dbg_force_tcp_in_calls", false), false, true);
|
2014-11-11 23:16:17 +01:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
break;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
case 4: {
|
|
|
|
if (position == settingsSectionRow2) {
|
|
|
|
((HeaderCell) holder.itemView).setText(LocaleController.getString("SETTINGS", R.string.SETTINGS));
|
|
|
|
} else if (position == supportSectionRow2) {
|
|
|
|
((HeaderCell) holder.itemView).setText(LocaleController.getString("Support", R.string.Support));
|
|
|
|
} else if (position == messagesSectionRow2) {
|
|
|
|
((HeaderCell) holder.itemView).setText(LocaleController.getString("MessagesSettings", R.string.MessagesSettings));
|
|
|
|
} else if (position == numberSectionRow) {
|
|
|
|
((HeaderCell) holder.itemView).setText(LocaleController.getString("Info", R.string.Info));
|
|
|
|
}
|
|
|
|
break;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
case 6: {
|
|
|
|
TextDetailSettingsCell textCell = (TextDetailSettingsCell) holder.itemView;
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
if (position == numberRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = UserConfig.getInstance(currentAccount).getCurrentUser();
|
2016-10-11 13:57:01 +02:00
|
|
|
String value;
|
|
|
|
if (user != null && user.phone != null && user.phone.length() != 0) {
|
|
|
|
value = PhoneFormat.getInstance().format("+" + user.phone);
|
|
|
|
} else {
|
|
|
|
value = LocaleController.getString("NumberUnknown", R.string.NumberUnknown);
|
|
|
|
}
|
|
|
|
textCell.setTextAndValue(value, LocaleController.getString("Phone", R.string.Phone), true);
|
|
|
|
} else if (position == usernameRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.User user = UserConfig.getInstance(currentAccount).getCurrentUser();
|
2016-10-11 13:57:01 +02:00
|
|
|
String value;
|
2017-07-23 14:56:38 +02:00
|
|
|
if (user != null && !TextUtils.isEmpty(user.username)) {
|
2016-10-11 13:57:01 +02:00
|
|
|
value = "@" + user.username;
|
|
|
|
} else {
|
|
|
|
value = LocaleController.getString("UsernameEmpty", R.string.UsernameEmpty);
|
|
|
|
}
|
2017-07-23 14:56:38 +02:00
|
|
|
textCell.setTextAndValue(value, LocaleController.getString("Username", R.string.Username), true);
|
|
|
|
} else if (position == bioRow) {
|
2018-07-30 04:07:02 +02:00
|
|
|
TLRPC.TL_userFull userFull = MessagesController.getInstance(currentAccount).getUserFull(UserConfig.getInstance(currentAccount).getClientUserId());
|
2017-07-23 14:56:38 +02:00
|
|
|
String value;
|
|
|
|
if (userFull == null) {
|
|
|
|
value = LocaleController.getString("Loading", R.string.Loading);
|
2017-12-08 18:35:59 +01:00
|
|
|
} else if (!TextUtils.isEmpty(userFull.about)) {
|
2017-07-23 14:56:38 +02:00
|
|
|
value = userFull.about;
|
|
|
|
} else {
|
|
|
|
value = LocaleController.getString("UserBioEmpty", R.string.UserBioEmpty);
|
|
|
|
}
|
2017-12-08 18:35:59 +01:00
|
|
|
textCell.setTextWithEmojiAndValue(value, LocaleController.getString("UserBio", R.string.UserBio), false);
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
|
|
|
break;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-31 01:58:05 +02:00
|
|
|
@Override
|
|
|
|
public boolean isEnabled(RecyclerView.ViewHolder holder) {
|
|
|
|
int position = holder.getAdapterPosition();
|
|
|
|
return position == textSizeRow || position == enableAnimationsRow || position == notificationRow || position == backgroundRow || position == numberRow ||
|
|
|
|
position == askQuestionRow || position == sendLogsRow || position == sendByEnterRow || position == autoplayGifsRow || position == privacyRow ||
|
2017-07-23 14:56:38 +02:00
|
|
|
position == clearLogsRow || position == languageRow || position == usernameRow || position == bioRow ||
|
2017-03-31 01:58:05 +02:00
|
|
|
position == switchBackendButtonRow || position == telegramFaqRow || position == contactsSortRow || position == contactsReimportRow || position == saveToGalleryRow ||
|
|
|
|
position == stickersRow || position == raiseToSpeakRow || position == privacyPolicyRow || position == customTabsRow || position == directShareRow || position == versionRow ||
|
2018-07-30 04:07:02 +02:00
|
|
|
position == emojiRow || position == dataRow || position == themeRow || position == dumpCallStatsRow || position == forceTcpInCallsRow;
|
2017-03-31 01:58:05 +02:00
|
|
|
}
|
|
|
|
|
2016-10-11 13:57:01 +02:00
|
|
|
@Override
|
|
|
|
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
|
|
|
View view = null;
|
|
|
|
switch (viewType) {
|
|
|
|
case 0:
|
|
|
|
view = new EmptyCell(mContext);
|
2017-03-31 01:58:05 +02:00
|
|
|
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
2016-10-11 13:57:01 +02:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
view = new ShadowSectionCell(mContext);
|
|
|
|
break;
|
|
|
|
case 2:
|
2017-03-31 01:58:05 +02:00
|
|
|
view = new TextSettingsCell(mContext);
|
|
|
|
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
2016-10-11 13:57:01 +02:00
|
|
|
break;
|
|
|
|
case 3:
|
2017-03-31 01:58:05 +02:00
|
|
|
view = new TextCheckCell(mContext);
|
|
|
|
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
2016-10-11 13:57:01 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
view = new HeaderCell(mContext);
|
2017-03-31 01:58:05 +02:00
|
|
|
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
2016-10-11 13:57:01 +02:00
|
|
|
break;
|
|
|
|
case 5:
|
2017-03-31 01:58:05 +02:00
|
|
|
view = new TextInfoCell(mContext);
|
|
|
|
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
2014-05-17 01:05:49 +02:00
|
|
|
try {
|
|
|
|
PackageInfo pInfo = ApplicationLoader.applicationContext.getPackageManager().getPackageInfo(ApplicationLoader.applicationContext.getPackageName(), 0);
|
2016-03-16 13:26:32 +01:00
|
|
|
int code = pInfo.versionCode / 10;
|
|
|
|
String abi = "";
|
|
|
|
switch (pInfo.versionCode % 10) {
|
|
|
|
case 1:
|
2017-03-31 01:58:05 +02:00
|
|
|
case 3:
|
2016-03-16 13:26:32 +01:00
|
|
|
abi = "arm-v7a";
|
|
|
|
break;
|
|
|
|
case 2:
|
2017-03-31 01:58:05 +02:00
|
|
|
case 4:
|
2016-03-16 13:26:32 +01:00
|
|
|
abi = "x86";
|
|
|
|
break;
|
2017-03-31 01:58:05 +02:00
|
|
|
case 5:
|
2018-07-30 04:07:02 +02:00
|
|
|
case 7:
|
|
|
|
abi = "arm64-v8a";
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
case 8:
|
|
|
|
abi = "x86_64";
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
case 9:
|
|
|
|
abi = "universal " + Build.CPU_ABI + " " + Build.CPU_ABI2;
|
2016-03-16 13:26:32 +01:00
|
|
|
break;
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
((TextInfoCell) view).setText(LocaleController.formatString("TelegramVersion", R.string.TelegramVersion, String.format(Locale.US, "v%s (%d) %s", pInfo.versionName, code, abi)));
|
2014-05-17 01:05:49 +02:00
|
|
|
} catch (Exception e) {
|
2017-03-31 01:58:05 +02:00
|
|
|
FileLog.e(e);
|
2014-05-17 01:05:49 +02:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
break;
|
|
|
|
case 6:
|
2017-03-31 01:58:05 +02:00
|
|
|
view = new TextDetailSettingsCell(mContext);
|
|
|
|
view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
|
2016-10-11 13:57:01 +02:00
|
|
|
break;
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
2016-10-11 13:57:01 +02:00
|
|
|
view.setLayoutParams(new RecyclerView.LayoutParams(RecyclerView.LayoutParams.MATCH_PARENT, RecyclerView.LayoutParams.WRAP_CONTENT));
|
2017-03-31 01:58:05 +02:00
|
|
|
return new RecyclerListView.Holder(view);
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-10-11 13:57:01 +02:00
|
|
|
public int getItemViewType(int position) {
|
|
|
|
if (position == emptyRow || position == overscrollRow) {
|
2013-10-25 17:19:00 +02:00
|
|
|
return 0;
|
2015-05-21 23:27:27 +02:00
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
if (position == settingsSectionRow || position == supportSectionRow || position == messagesSectionRow || position == contactsSectionRow) {
|
2013-10-25 17:19:00 +02:00
|
|
|
return 1;
|
2018-07-30 04:07:02 +02:00
|
|
|
} else if (position == enableAnimationsRow || position == sendByEnterRow || position == saveToGalleryRow || position == autoplayGifsRow || position == raiseToSpeakRow || position == customTabsRow || position == directShareRow || position == dumpCallStatsRow || position == forceTcpInCallsRow) {
|
2013-10-25 17:19:00 +02:00
|
|
|
return 3;
|
2017-03-31 01:58:05 +02:00
|
|
|
} else if (position == notificationRow || position == themeRow || position == backgroundRow || position == askQuestionRow || position == sendLogsRow || position == privacyRow || position == clearLogsRow || position == switchBackendButtonRow || position == telegramFaqRow || position == contactsReimportRow || position == textSizeRow || position == languageRow || position == contactsSortRow || position == stickersRow || position == privacyPolicyRow || position == emojiRow || position == dataRow) {
|
2013-10-25 17:19:00 +02:00
|
|
|
return 2;
|
2016-10-11 13:57:01 +02:00
|
|
|
} else if (position == versionRow) {
|
2014-11-11 23:16:17 +01:00
|
|
|
return 5;
|
2017-07-23 14:56:38 +02:00
|
|
|
} else if (position == numberRow || position == usernameRow || position == bioRow) {
|
2014-05-17 01:05:49 +02:00
|
|
|
return 6;
|
2017-03-31 01:58:05 +02:00
|
|
|
} else if (position == settingsSectionRow2 || position == messagesSectionRow2 || position == supportSectionRow2 || position == numberSectionRow) {
|
2014-11-11 23:16:17 +01:00
|
|
|
return 4;
|
2013-10-25 17:19:00 +02:00
|
|
|
} else {
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-03-31 01:58:05 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public ThemeDescription[] getThemeDescriptions() {
|
|
|
|
return new ThemeDescription[]{
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[]{EmptyCell.class, TextSettingsCell.class, TextCheckCell.class, HeaderCell.class, TextInfoCell.class, TextDetailSettingsCell.class}, null, null, null, Theme.key_windowBackgroundWhite),
|
|
|
|
new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray),
|
|
|
|
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
|
|
|
|
new ThemeDescription(extraHeightView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_avatar_backgroundActionBarBlue),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_avatar_actionBarIconBlue),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_avatar_actionBarSelectorBlue),
|
|
|
|
new ThemeDescription(nameTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_profile_title),
|
|
|
|
new ThemeDescription(onlineTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_avatar_subtitleInProfileBlue),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUBACKGROUND, null, null, null, null, Theme.key_actionBarDefaultSubmenuBackground),
|
|
|
|
new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SUBMENUITEM, null, null, null, null, Theme.key_actionBarDefaultSubmenuItem),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{View.class}, Theme.dividerPaint, null, null, Theme.key_divider),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[]{ShadowSectionCell.class}, null, null, null, Theme.key_windowBackgroundGrayShadow),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextSettingsCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextSettingsCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteValueText),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchThumb),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrack),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchThumbChecked),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextCheckCell.class}, new String[]{"checkBox"}, null, null, null, Theme.key_switchTrackChecked),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{HeaderCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteBlackText),
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextDetailSettingsCell.class}, new String[]{"valueTextView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText2),
|
|
|
|
|
|
|
|
new ThemeDescription(listView, 0, new Class[]{TextInfoCell.class}, new String[]{"textView"}, null, null, null, Theme.key_windowBackgroundWhiteGrayText5),
|
|
|
|
|
2017-12-08 18:35:59 +01:00
|
|
|
new ThemeDescription(avatarImage, 0, null, null, new Drawable[]{Theme.avatar_photoDrawable, Theme.avatar_broadcastDrawable, Theme.avatar_savedDrawable}, null, Theme.key_avatar_text),
|
2017-03-31 01:58:05 +02:00
|
|
|
new ThemeDescription(avatarImage, 0, null, null, new Drawable[]{avatarDrawable}, null, Theme.key_avatar_backgroundInProfileBlue),
|
|
|
|
|
|
|
|
new ThemeDescription(writeButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_profile_actionIcon),
|
|
|
|
new ThemeDescription(writeButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_profile_actionBackground),
|
|
|
|
new ThemeDescription(writeButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_profile_actionPressedBackground),
|
|
|
|
};
|
|
|
|
}
|
2013-10-25 17:19:00 +02:00
|
|
|
}
|