mirror of
https://github.com/DrKLO/Telegram.git
synced 2024-12-22 22:45:18 +01:00
Bug fixes
This commit is contained in:
parent
fdaf4555c5
commit
95de265e1a
19 changed files with 251 additions and 21 deletions
|
@ -80,7 +80,7 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 8
|
minSdkVersion 8
|
||||||
targetSdkVersion 21
|
targetSdkVersion 21
|
||||||
versionCode 395
|
versionCode 397
|
||||||
versionName "2.0.4"
|
versionName "2.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -425,7 +425,9 @@ public class NotificationsController {
|
||||||
}
|
}
|
||||||
|
|
||||||
mBuilder.setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
mBuilder.setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
||||||
mBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
|
if (chat == null && user != null && user.phone != null && user.phone.length() > 0) {
|
||||||
|
mBuilder.addPerson("tel:+" + user.phone);
|
||||||
|
}
|
||||||
/*Bundle bundle = new Bundle();
|
/*Bundle bundle = new Bundle();
|
||||||
bundle.putString(NotificationCompat.EXTRA_PEOPLE, );
|
bundle.putString(NotificationCompat.EXTRA_PEOPLE, );
|
||||||
mBuilder.setExtras()*/
|
mBuilder.setExtras()*/
|
||||||
|
@ -636,6 +638,10 @@ public class NotificationsController {
|
||||||
.extend(new NotificationCompat.WearableExtender().addAction(action))
|
.extend(new NotificationCompat.WearableExtender().addAction(action))
|
||||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
.setCategory(NotificationCompat.CATEGORY_MESSAGE);
|
||||||
|
|
||||||
|
if (chat == null && user != null && user.phone != null && user.phone.length() > 0) {
|
||||||
|
builder.addPerson("tel:+" + user.phone);
|
||||||
|
}
|
||||||
|
|
||||||
notificationManager.notify(notificationId, builder.build());
|
notificationManager.notify(notificationId, builder.build());
|
||||||
wearNoticationsIds.put(dialog_id, notificationId);
|
wearNoticationsIds.put(dialog_id, notificationId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@ public class ActionBar extends FrameLayout {
|
||||||
private ImageView backButtonImageView;
|
private ImageView backButtonImageView;
|
||||||
private TextView titleTextView;
|
private TextView titleTextView;
|
||||||
private TextView subTitleTextView;
|
private TextView subTitleTextView;
|
||||||
|
private View actionModeTop;
|
||||||
private ActionBarMenu menu;
|
private ActionBarMenu menu;
|
||||||
private ActionBarMenu actionMode;
|
private ActionBarMenu actionMode;
|
||||||
private boolean occupyStatusBar = Build.VERSION.SDK_INT >= 21;
|
private boolean occupyStatusBar = Build.VERSION.SDK_INT >= 21;
|
||||||
|
@ -343,6 +344,19 @@ public class ActionBar extends FrameLayout {
|
||||||
layoutParams.gravity = Gravity.RIGHT;
|
layoutParams.gravity = Gravity.RIGHT;
|
||||||
actionMode.setLayoutParams(layoutParams);
|
actionMode.setLayoutParams(layoutParams);
|
||||||
actionMode.setVisibility(GONE);
|
actionMode.setVisibility(GONE);
|
||||||
|
|
||||||
|
if (occupyStatusBar) {
|
||||||
|
actionModeTop = new View(getContext());
|
||||||
|
actionModeTop.setBackgroundColor(0x99000000);
|
||||||
|
addView(actionModeTop);
|
||||||
|
layoutParams = (FrameLayout.LayoutParams)actionModeTop.getLayoutParams();
|
||||||
|
layoutParams.height = AndroidUtilities.statusBarHeight;
|
||||||
|
layoutParams.width = LayoutParams.FILL_PARENT;
|
||||||
|
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
|
||||||
|
actionModeTop.setLayoutParams(layoutParams);
|
||||||
|
actionModeTop.setVisibility(GONE);
|
||||||
|
}
|
||||||
|
|
||||||
return actionMode;
|
return actionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,6 +365,9 @@ public class ActionBar extends FrameLayout {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
actionMode.setVisibility(VISIBLE);
|
actionMode.setVisibility(VISIBLE);
|
||||||
|
if (actionModeTop != null) {
|
||||||
|
actionModeTop.setVisibility(VISIBLE);
|
||||||
|
}
|
||||||
if (titleFrameLayout != null) {
|
if (titleFrameLayout != null) {
|
||||||
titleFrameLayout.setVisibility(INVISIBLE);
|
titleFrameLayout.setVisibility(INVISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -364,6 +381,9 @@ public class ActionBar extends FrameLayout {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
actionMode.setVisibility(GONE);
|
actionMode.setVisibility(GONE);
|
||||||
|
if (actionModeTop != null) {
|
||||||
|
actionModeTop.setVisibility(GONE);
|
||||||
|
}
|
||||||
if (titleFrameLayout != null) {
|
if (titleFrameLayout != null) {
|
||||||
titleFrameLayout.setVisibility(VISIBLE);
|
titleFrameLayout.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,6 @@ public class BaseFragment {
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
if (actionBar != null) {
|
if (actionBar != null) {
|
||||||
actionBar.onPause();
|
actionBar.onPause();
|
||||||
actionBar.closeSearchField();
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (visibleDialog != null && visibleDialog.isShowing()) {
|
if (visibleDialog != null && visibleDialog.isShowing()) {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
package org.telegram.ui.Adapters;
|
package org.telegram.ui.Adapters;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
@ -35,6 +36,7 @@ public class ContactsAdapter extends BaseSectionsAdapter {
|
||||||
private boolean needPhonebook;
|
private boolean needPhonebook;
|
||||||
private HashMap<Integer, TLRPC.User> ignoreUsers;
|
private HashMap<Integer, TLRPC.User> ignoreUsers;
|
||||||
private HashMap<Integer, ?> checkedMap;
|
private HashMap<Integer, ?> checkedMap;
|
||||||
|
private boolean scrolling;
|
||||||
|
|
||||||
public ContactsAdapter(Context context, boolean arg1, boolean arg2, HashMap<Integer, TLRPC.User> arg3) {
|
public ContactsAdapter(Context context, boolean arg1, boolean arg2, HashMap<Integer, TLRPC.User> arg3) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
@ -47,6 +49,10 @@ public class ContactsAdapter extends BaseSectionsAdapter {
|
||||||
checkedMap = map;
|
checkedMap = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIsScrolling(boolean value) {
|
||||||
|
scrolling = value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object getItem(int section, int position) {
|
public Object getItem(int section, int position) {
|
||||||
if (onlyUsers) {
|
if (onlyUsers) {
|
||||||
|
@ -175,7 +181,7 @@ public class ContactsAdapter extends BaseSectionsAdapter {
|
||||||
if (type == 4) {
|
if (type == 4) {
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
convertView = new DividerCell(mContext);
|
convertView = new DividerCell(mContext);
|
||||||
convertView.setPadding(AndroidUtilities.dp(LocaleController.isRTL ? 24 : 72), 0, AndroidUtilities.dp(LocaleController.isRTL ? 72 : 24), 0);
|
convertView.setPadding(AndroidUtilities.dp(LocaleController.isRTL ? 28 : 72), 0, AndroidUtilities.dp(LocaleController.isRTL ? 72 : 28), 0);
|
||||||
}
|
}
|
||||||
} else if (type == 3) {
|
} else if (type == 3) {
|
||||||
if (convertView == null) {
|
if (convertView == null) {
|
||||||
|
@ -220,7 +226,7 @@ public class ContactsAdapter extends BaseSectionsAdapter {
|
||||||
TLRPC.User user = MessagesController.getInstance().getUser(arr.get(position).user_id);
|
TLRPC.User user = MessagesController.getInstance().getUser(arr.get(position).user_id);
|
||||||
((UserCell)convertView).setData(user, null, null, 0);
|
((UserCell)convertView).setData(user, null, null, 0);
|
||||||
if (checkedMap != null) {
|
if (checkedMap != null) {
|
||||||
((UserCell) convertView).setChecked(checkedMap.containsKey(user.id), false);
|
((UserCell) convertView).setChecked(checkedMap.containsKey(user.id), !scrolling && Build.VERSION.SDK_INT > 10);
|
||||||
}
|
}
|
||||||
if (ignoreUsers != null) {
|
if (ignoreUsers != null) {
|
||||||
if (ignoreUsers.containsKey(user.id)) {
|
if (ignoreUsers.containsKey(user.id)) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import android.widget.TextView;
|
||||||
import org.telegram.android.AndroidUtilities;
|
import org.telegram.android.AndroidUtilities;
|
||||||
import org.telegram.android.LocaleController;
|
import org.telegram.android.LocaleController;
|
||||||
import org.telegram.ui.Views.BackupImageView;
|
import org.telegram.ui.Views.BackupImageView;
|
||||||
|
import org.telegram.ui.Views.CheckBox;
|
||||||
|
|
||||||
public class TextDetailDocumentsCell extends FrameLayout {
|
public class TextDetailDocumentsCell extends FrameLayout {
|
||||||
|
|
||||||
|
@ -26,6 +27,7 @@ public class TextDetailDocumentsCell extends FrameLayout {
|
||||||
private TextView valueTextView;
|
private TextView valueTextView;
|
||||||
private TextView typeTextView;
|
private TextView typeTextView;
|
||||||
private BackupImageView imageView;
|
private BackupImageView imageView;
|
||||||
|
private CheckBox checkBox;
|
||||||
|
|
||||||
public TextDetailDocumentsCell(Context context) {
|
public TextDetailDocumentsCell(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
|
@ -90,6 +92,18 @@ public class TextDetailDocumentsCell extends FrameLayout {
|
||||||
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
|
layoutParams.rightMargin = AndroidUtilities.dp(LocaleController.isRTL ? 16 : 0);
|
||||||
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
|
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL;
|
||||||
imageView.setLayoutParams(layoutParams);
|
imageView.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
|
checkBox = new CheckBox(context);
|
||||||
|
checkBox.setVisibility(GONE);
|
||||||
|
addView(checkBox);
|
||||||
|
layoutParams = (LayoutParams) checkBox.getLayoutParams();
|
||||||
|
layoutParams.width = AndroidUtilities.dp(22);
|
||||||
|
layoutParams.height = AndroidUtilities.dp(22);
|
||||||
|
layoutParams.topMargin = AndroidUtilities.dp(34);
|
||||||
|
layoutParams.leftMargin = LocaleController.isRTL ? 0 : AndroidUtilities.dp(38);
|
||||||
|
layoutParams.rightMargin = LocaleController.isRTL ? AndroidUtilities.dp(38) : 0;
|
||||||
|
layoutParams.gravity = (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
|
||||||
|
checkBox.setLayoutParams(layoutParams);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -117,4 +131,11 @@ public class TextDetailDocumentsCell extends FrameLayout {
|
||||||
imageView.setVisibility(GONE);
|
imageView.setVisibility(GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setChecked(boolean checked, boolean animated) {
|
||||||
|
if (checkBox.getVisibility() != VISIBLE) {
|
||||||
|
checkBox.setVisibility(VISIBLE);
|
||||||
|
}
|
||||||
|
checkBox.setChecked(checked, animated);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -572,9 +572,9 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||||
DocumentSelectActivity fragment = new DocumentSelectActivity();
|
DocumentSelectActivity fragment = new DocumentSelectActivity();
|
||||||
fragment.setDelegate(new DocumentSelectActivity.DocumentSelectActivityDelegate() {
|
fragment.setDelegate(new DocumentSelectActivity.DocumentSelectActivityDelegate() {
|
||||||
@Override
|
@Override
|
||||||
public void didSelectFile(DocumentSelectActivity activity, String path) {
|
public void didSelectFiles(DocumentSelectActivity activity, ArrayList<String> files) {
|
||||||
activity.finishFragment();
|
activity.finishFragment();
|
||||||
SendMessagesHelper.prepareSendingDocument(path, path, null, null, dialog_id);
|
SendMessagesHelper.prepareSendingDocuments(files, files, null, null, dialog_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -440,6 +440,14 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.closeSearchField();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void didReceivedNotification(int id, Object... args) {
|
public void didReceivedNotification(int id, Object... args) {
|
||||||
if (id == NotificationCenter.contactsDidLoaded) {
|
if (id == NotificationCenter.contactsDidLoaded) {
|
||||||
|
|
|
@ -16,11 +16,15 @@ import android.content.IntentFilter;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.StatFs;
|
import android.os.StatFs;
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AbsListView;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -33,6 +37,8 @@ import org.telegram.ui.Adapters.BaseFragmentAdapter;
|
||||||
import org.telegram.ui.ActionBar.ActionBar;
|
import org.telegram.ui.ActionBar.ActionBar;
|
||||||
import org.telegram.ui.ActionBar.ActionBarMenu;
|
import org.telegram.ui.ActionBar.ActionBarMenu;
|
||||||
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
import org.telegram.ui.ActionBar.ActionBarMenuItem;
|
||||||
|
import org.telegram.ui.AnimationCompat.AnimatorSetProxy;
|
||||||
|
import org.telegram.ui.AnimationCompat.ObjectAnimatorProxy;
|
||||||
import org.telegram.ui.Cells.TextDetailDocumentsCell;
|
import org.telegram.ui.Cells.TextDetailDocumentsCell;
|
||||||
import org.telegram.ui.ActionBar.BaseFragment;
|
import org.telegram.ui.ActionBar.BaseFragment;
|
||||||
|
|
||||||
|
@ -47,19 +53,26 @@ import java.util.HashMap;
|
||||||
public class DocumentSelectActivity extends BaseFragment {
|
public class DocumentSelectActivity extends BaseFragment {
|
||||||
|
|
||||||
public static abstract interface DocumentSelectActivityDelegate {
|
public static abstract interface DocumentSelectActivityDelegate {
|
||||||
public void didSelectFile(DocumentSelectActivity activity, String path);
|
public void didSelectFiles(DocumentSelectActivity activity, ArrayList<String> files);
|
||||||
public void startDocumentSelectActivity();
|
public void startDocumentSelectActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ListView listView;
|
private ListView listView;
|
||||||
private ListAdapter listAdapter;
|
private ListAdapter listAdapter;
|
||||||
private File currentDir;
|
private TextView selectedMessagesCountTextView;
|
||||||
private TextView emptyView;
|
private TextView emptyView;
|
||||||
|
|
||||||
|
private File currentDir;
|
||||||
private ArrayList<ListItem> items = new ArrayList<ListItem>();
|
private ArrayList<ListItem> items = new ArrayList<ListItem>();
|
||||||
private boolean receiverRegistered = false;
|
private boolean receiverRegistered = false;
|
||||||
private ArrayList<HistoryEntry> history = new ArrayList<HistoryEntry>();
|
private ArrayList<HistoryEntry> history = new ArrayList<HistoryEntry>();
|
||||||
private long sizeLimit = 1024 * 1024 * 1024;
|
private long sizeLimit = 1024 * 1024 * 1024;
|
||||||
private DocumentSelectActivityDelegate delegate;
|
private DocumentSelectActivityDelegate delegate;
|
||||||
|
private HashMap<String, ListItem> selectedFiles = new HashMap<String, ListItem>();
|
||||||
|
private ArrayList<View> actionModeViews = new ArrayList<View>();
|
||||||
|
private boolean scrolling;
|
||||||
|
|
||||||
|
private final static int done = 3;
|
||||||
|
|
||||||
private class ListItem {
|
private class ListItem {
|
||||||
int icon;
|
int icon;
|
||||||
|
@ -144,11 +157,51 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||||
delegate.startDocumentSelectActivity();
|
delegate.startDocumentSelectActivity();
|
||||||
}
|
}
|
||||||
finishFragment(false);
|
finishFragment(false);
|
||||||
|
} else if (id == -2) {
|
||||||
|
selectedFiles.clear();
|
||||||
|
actionBar.hideActionMode();
|
||||||
|
listView.invalidateViews();
|
||||||
|
} else if (id == done) {
|
||||||
|
if (delegate != null) {
|
||||||
|
ArrayList<String> files = new ArrayList<String>();
|
||||||
|
files.addAll(selectedFiles.keySet());
|
||||||
|
delegate.didSelectFiles(DocumentSelectActivity.this, files);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ActionBarMenu menu = actionBar.createMenu();
|
ActionBarMenu menu = actionBar.createMenu();
|
||||||
ActionBarMenuItem item = menu.addItem(1, R.drawable.ic_ab_other);
|
final ActionBarMenuItem item = menu.addItem(1, R.drawable.ic_ab_other);
|
||||||
|
|
||||||
|
selectedFiles.clear();
|
||||||
|
actionModeViews.clear();
|
||||||
|
|
||||||
|
final ActionBarMenu actionMode = actionBar.createActionMode();
|
||||||
|
actionModeViews.add(actionMode.addItem(-2, R.drawable.ic_ab_back_grey, R.drawable.bar_selector_mode, null, AndroidUtilities.dp(54)));
|
||||||
|
|
||||||
|
selectedMessagesCountTextView = new TextView(actionMode.getContext());
|
||||||
|
selectedMessagesCountTextView.setTextSize(18);
|
||||||
|
selectedMessagesCountTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||||
|
selectedMessagesCountTextView.setTextColor(0xff737373);
|
||||||
|
selectedMessagesCountTextView.setSingleLine(true);
|
||||||
|
selectedMessagesCountTextView.setLines(1);
|
||||||
|
selectedMessagesCountTextView.setEllipsize(TextUtils.TruncateAt.END);
|
||||||
|
selectedMessagesCountTextView.setPadding(AndroidUtilities.dp(11), 0, 0, AndroidUtilities.dp(2));
|
||||||
|
selectedMessagesCountTextView.setGravity(Gravity.CENTER_VERTICAL);
|
||||||
|
selectedMessagesCountTextView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
actionMode.addView(selectedMessagesCountTextView);
|
||||||
|
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams)selectedMessagesCountTextView.getLayoutParams();
|
||||||
|
layoutParams.weight = 1;
|
||||||
|
layoutParams.width = 0;
|
||||||
|
layoutParams.height = LinearLayout.LayoutParams.MATCH_PARENT;
|
||||||
|
selectedMessagesCountTextView.setLayoutParams(layoutParams);
|
||||||
|
|
||||||
|
actionModeViews.add(actionMode.addItem(done, R.drawable.ic_ab_done_gray, R.drawable.bar_selector_mode, null, AndroidUtilities.dp(54)));
|
||||||
|
|
||||||
fragmentView = inflater.inflate(R.layout.document_select_layout, container, false);
|
fragmentView = inflater.inflate(R.layout.document_select_layout, container, false);
|
||||||
listAdapter = new ListAdapter(getParentActivity());
|
listAdapter = new ListAdapter(getParentActivity());
|
||||||
|
@ -162,9 +215,75 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||||
listView = (ListView)fragmentView.findViewById(R.id.listView);
|
listView = (ListView)fragmentView.findViewById(R.id.listView);
|
||||||
listView.setEmptyView(emptyView);
|
listView.setEmptyView(emptyView);
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter(listAdapter);
|
||||||
|
|
||||||
|
listView.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||||
|
scrolling = scrollState != SCROLL_STATE_IDLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onItemLongClick(AdapterView<?> parent, View view, int i, long id) {
|
||||||
|
if (actionBar.isActionModeShowed() || i < 0 || i >= items.size()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ListItem item = items.get(i);
|
||||||
|
File file = item.file;
|
||||||
|
if (file != null && !file.isDirectory()) {
|
||||||
|
if (!file.canRead()) {
|
||||||
|
showErrorBox(LocaleController.getString("AccessError", R.string.AccessError));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (sizeLimit != 0) {
|
||||||
|
if (file.length() > sizeLimit) {
|
||||||
|
showErrorBox(LocaleController.formatString("FileUploadLimit", R.string.FileUploadLimit, Utilities.formatFileSize(sizeLimit)));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (file.length() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
selectedFiles.put(file.toString(), item);
|
||||||
|
selectedMessagesCountTextView.setText(String.format("%d", selectedFiles.size()));
|
||||||
|
if (Build.VERSION.SDK_INT >= 11) {
|
||||||
|
AnimatorSetProxy animatorSet = new AnimatorSetProxy();
|
||||||
|
ArrayList<Object> animators = new ArrayList<Object>();
|
||||||
|
for (int a = 0; a < actionModeViews.size(); a++) {
|
||||||
|
View view2 = actionModeViews.get(a);
|
||||||
|
AndroidUtilities.clearDrawableAnimation(view2);
|
||||||
|
if (a < 1) {
|
||||||
|
animators.add(ObjectAnimatorProxy.ofFloat(view2, "translationX", -AndroidUtilities.dp(56), 0));
|
||||||
|
} else {
|
||||||
|
animators.add(ObjectAnimatorProxy.ofFloat(view2, "scaleY", 0.1f, 1.0f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
animatorSet.playTogether(animators);
|
||||||
|
animatorSet.setDuration(250);
|
||||||
|
animatorSet.start();
|
||||||
|
}
|
||||||
|
scrolling = false;
|
||||||
|
if (view instanceof TextDetailDocumentsCell) {
|
||||||
|
((TextDetailDocumentsCell) view).setChecked(true, true);
|
||||||
|
}
|
||||||
|
actionBar.showActionMode();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
|
||||||
|
if (i < 0 || i >= items.size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
ListItem item = items.get(i);
|
ListItem item = items.get(i);
|
||||||
File file = item.file;
|
File file = item.file;
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
|
@ -202,8 +321,27 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||||
if (file.length() == 0) {
|
if (file.length() == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (actionBar.isActionModeShowed()) {
|
||||||
|
if (selectedFiles.containsKey(file.toString())) {
|
||||||
|
selectedFiles.remove(file.toString());
|
||||||
|
} else {
|
||||||
|
selectedFiles.put(file.toString(), item);
|
||||||
|
}
|
||||||
|
if (selectedFiles.isEmpty()) {
|
||||||
|
actionBar.hideActionMode();
|
||||||
|
} else {
|
||||||
|
selectedMessagesCountTextView.setText(String.format("%d", selectedFiles.size()));
|
||||||
|
}
|
||||||
|
scrolling = false;
|
||||||
|
if (view instanceof TextDetailDocumentsCell) {
|
||||||
|
((TextDetailDocumentsCell) view).setChecked(selectedFiles.containsKey(item.file.toString()), true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (delegate != null) {
|
if (delegate != null) {
|
||||||
delegate.didSelectFile(DocumentSelectActivity.this, file.getAbsolutePath());
|
ArrayList<String> files = new ArrayList<String>();
|
||||||
|
files.add(file.getAbsolutePath());
|
||||||
|
delegate.didSelectFiles(DocumentSelectActivity.this, files);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,6 +401,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||||
emptyView.setText(LocaleController.getString("NotMounted", R.string.NotMounted));
|
emptyView.setText(LocaleController.getString("NotMounted", R.string.NotMounted));
|
||||||
}
|
}
|
||||||
AndroidUtilities.clearDrawableAnimation(listView);
|
AndroidUtilities.clearDrawableAnimation(listView);
|
||||||
|
scrolling = true;
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -331,6 +470,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||||
item.file = null;
|
item.file = null;
|
||||||
items.add(0, item);
|
items.add(0, item);
|
||||||
AndroidUtilities.clearDrawableAnimation(listView);
|
AndroidUtilities.clearDrawableAnimation(listView);
|
||||||
|
scrolling = true;
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -421,6 +561,7 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidUtilities.clearDrawableAnimation(listView);
|
AndroidUtilities.clearDrawableAnimation(listView);
|
||||||
|
scrolling = true;
|
||||||
listAdapter.notifyDataSetChanged();
|
listAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,6 +618,11 @@ public class DocumentSelectActivity extends BaseFragment {
|
||||||
String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4));
|
String type = item.ext.toUpperCase().substring(0, Math.min(item.ext.length(), 4));
|
||||||
((TextDetailDocumentsCell) convertView).setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0);
|
((TextDetailDocumentsCell) convertView).setTextAndValueAndTypeAndThumb(item.title, item.subtitle, type, item.thumb, 0);
|
||||||
}
|
}
|
||||||
|
if (item.file != null && actionBar.isActionModeShowed()) {
|
||||||
|
textDetailCell.setChecked(selectedFiles.containsKey(item.file.toString()), !scrolling);
|
||||||
|
} else {
|
||||||
|
textDetailCell.setChecked(false, !scrolling);
|
||||||
|
}
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,6 +455,9 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
|
||||||
if (i == SCROLL_STATE_TOUCH_SCROLL) {
|
if (i == SCROLL_STATE_TOUCH_SCROLL) {
|
||||||
AndroidUtilities.hideKeyboard(userSelectEditText);
|
AndroidUtilities.hideKeyboard(userSelectEditText);
|
||||||
}
|
}
|
||||||
|
if (listViewAdapter != null) {
|
||||||
|
listViewAdapter.setIsScrolling(i != SCROLL_STATE_IDLE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -362,6 +362,10 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
||||||
}
|
}
|
||||||
if (message_id != 0) {
|
if (message_id != 0) {
|
||||||
args.putInt("message_id", message_id);
|
args.putInt("message_id", message_id);
|
||||||
|
} else {
|
||||||
|
if (actionBar != null) {
|
||||||
|
actionBar.closeSearchField();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (AndroidUtilities.isTablet()) {
|
if (AndroidUtilities.isTablet()) {
|
||||||
if (openedDialogId == dialog_id) {
|
if (openedDialogId == dialog_id) {
|
||||||
|
|
|
@ -485,10 +485,10 @@ public class ProfileActivity extends BaseFragment implements NotificationCenter.
|
||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
if(Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
|
if(Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||||
android.text.ClipboardManager clipboard = (android.text.ClipboardManager)ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
android.text.ClipboardManager clipboard = (android.text.ClipboardManager)ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
clipboard.setText(user.phone);
|
clipboard.setText("+" + user.phone);
|
||||||
} else {
|
} else {
|
||||||
android.content.ClipboardManager clipboard = (android.content.ClipboardManager)ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
android.content.ClipboardManager clipboard = (android.content.ClipboardManager)ApplicationLoader.applicationContext.getSystemService(Context.CLIPBOARD_SERVICE);
|
||||||
android.content.ClipData clip = android.content.ClipData.newPlainText("label", user.phone);
|
android.content.ClipData clip = android.content.ClipData.newPlainText("label", "+" + user.phone);
|
||||||
clipboard.setPrimaryClip(clip);
|
clipboard.setPrimaryClip(clip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,7 @@ public class ChatActivityEnterView implements NotificationCenter.NotificationCen
|
||||||
ViewProxy.setScaleX(sendButton, 0.1f);
|
ViewProxy.setScaleX(sendButton, 0.1f);
|
||||||
ViewProxy.setScaleY(sendButton, 0.1f);
|
ViewProxy.setScaleY(sendButton, 0.1f);
|
||||||
ViewProxy.setAlpha(sendButton, 0.0f);
|
ViewProxy.setAlpha(sendButton, 0.0f);
|
||||||
|
sendButton.clearAnimation();
|
||||||
emojiButton = (ImageView) containerView.findViewById(R.id.chat_smile_button);
|
emojiButton = (ImageView) containerView.findViewById(R.id.chat_smile_button);
|
||||||
audioSendButton = (ImageButton) containerView.findViewById(R.id.chat_audio_send_button);
|
audioSendButton = (ImageButton) containerView.findViewById(R.id.chat_audio_send_button);
|
||||||
recordPanel = containerView.findViewById(R.id.record_panel);
|
recordPanel = containerView.findViewById(R.id.record_panel);
|
||||||
|
|
|
@ -58,13 +58,23 @@ public class CheckBox extends View {
|
||||||
eraser2.setStrokeWidth(AndroidUtilities.dp(28));
|
eraser2.setStrokeWidth(AndroidUtilities.dp(28));
|
||||||
eraser2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
eraser2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setVisibility(int visibility) {
|
||||||
|
super.setVisibility(visibility);
|
||||||
|
if (visibility == VISIBLE && drawBitmap == null) {
|
||||||
drawBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444);
|
drawBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444);
|
||||||
bitmapCanvas = new Canvas(drawBitmap);
|
bitmapCanvas = new Canvas(drawBitmap);
|
||||||
checkBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444);
|
checkBitmap = Bitmap.createBitmap(AndroidUtilities.dp(22), AndroidUtilities.dp(22), Bitmap.Config.ARGB_4444);
|
||||||
checkCanvas = new Canvas(checkBitmap);
|
checkCanvas = new Canvas(checkBitmap);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setProgress(float value) {
|
public void setProgress(float value) {
|
||||||
|
if (progress == value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
progress = value;
|
progress = value;
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
@ -104,8 +114,10 @@ public class CheckBox extends View {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setChecked(boolean checked, boolean animated) {
|
public void setChecked(boolean checked, boolean animated) {
|
||||||
|
if (checked == isChecked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
isChecked = checked;
|
isChecked = checked;
|
||||||
invalidate();
|
|
||||||
|
|
||||||
if (attachedToWindow && animated) {
|
if (attachedToWindow && animated) {
|
||||||
animateToCheckedState(checked);
|
animateToCheckedState(checked);
|
||||||
|
@ -121,6 +133,9 @@ public class CheckBox extends View {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw(Canvas canvas) {
|
protected void onDraw(Canvas canvas) {
|
||||||
|
if (getVisibility() != VISIBLE) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (progress != 0) {
|
if (progress != 0) {
|
||||||
drawBitmap.eraseColor(0);
|
drawBitmap.eraseColor(0);
|
||||||
float rad = getMeasuredWidth() / 2;
|
float rad = getMeasuredWidth() / 2;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.graphics.PorterDuffColorFilter;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.Region;
|
import android.graphics.Region;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Build;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.VelocityTracker;
|
import android.view.VelocityTracker;
|
||||||
|
@ -532,7 +533,7 @@ public class Switch extends CompoundButton {
|
||||||
mThumbDrawable.setBounds(thumbLeft, switchTop + offset, thumbRight, switchBottom + offset);
|
mThumbDrawable.setBounds(thumbLeft, switchTop + offset, thumbRight, switchBottom + offset);
|
||||||
|
|
||||||
final Drawable background = getBackground();
|
final Drawable background = getBackground();
|
||||||
if (background != null) {
|
if (background != null && Build.VERSION.SDK_INT >= 21) {
|
||||||
background.setHotspotBounds(thumbLeft, switchTop, thumbRight, switchBottom);
|
background.setHotspotBounds(thumbLeft, switchTop, thumbRight, switchBottom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
TMessagesProj/src/main/res/drawable-hdpi/ic_ab_done_gray.png
Executable file
BIN
TMessagesProj/src/main/res/drawable-hdpi/ic_ab_done_gray.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/ic_ab_done_gray.png
Executable file
BIN
TMessagesProj/src/main/res/drawable-mdpi/ic_ab_done_gray.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/ic_ab_done_gray.png
Executable file
BIN
TMessagesProj/src/main/res/drawable-xhdpi/ic_ab_done_gray.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/ic_ab_done_gray.png
Executable file
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/ic_ab_done_gray.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Reference in a new issue