More Android L design (still not usable)
|
@ -457,6 +457,7 @@ public class AndroidUtilities {
|
|||
Method mGetRawH = Display.class.getMethod("getRawHeight");
|
||||
size.set((Integer) mGetRawW.invoke(windowManager.getDefaultDisplay()), (Integer) mGetRawH.invoke(windowManager.getDefaultDisplay()));
|
||||
} catch (Exception e) {
|
||||
size.set(windowManager.getDefaultDisplay().getWidth(), windowManager.getDefaultDisplay().getHeight());
|
||||
FileLog.e("tmessages", e);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
* This is the source code of Telegram for Android v. 1.7.x.
|
||||
* It is licensed under GNU GPL v. 2 or later.
|
||||
* You should have received a copy of the license in this archive (see LICENSE).
|
||||
*
|
||||
* Copyright Nikolai Kudashov, 2013-2014.
|
||||
*/
|
||||
|
||||
package org.telegram.ui.Adapters;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.BaseAdapter;
|
||||
|
||||
import org.telegram.android.LocaleController;
|
||||
import org.telegram.android.MessagesController;
|
||||
import org.telegram.messenger.R;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.ui.Cells.DrawerActionCell;
|
||||
import org.telegram.ui.Cells.DrawerDividerCell;
|
||||
import org.telegram.ui.Cells.DrawerEmptyCell;
|
||||
import org.telegram.ui.Cells.DrawerProfileCell;
|
||||
|
||||
public class DrawerLayoutAdapter extends BaseAdapter {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public DrawerLayoutAdapter(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areAllItemsEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int i) {
|
||||
return !(i == 0 || i == 1 || i == 5 || i == 6 || i == 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return UserConfig.isClientActivated() ? 12 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int i) {
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStableIds() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int i, View view, ViewGroup viewGroup) {
|
||||
int type = getItemViewType(i);
|
||||
if (type == 0) {
|
||||
if (view == null) {
|
||||
view = new DrawerProfileCell(mContext);
|
||||
}
|
||||
((DrawerProfileCell) view).setUser(MessagesController.getInstance().getUser(UserConfig.getClientUserId()));
|
||||
} else if (type == 1) {
|
||||
if (view == null) {
|
||||
view = new DrawerEmptyCell(mContext);
|
||||
}
|
||||
} else if (type == 2) {
|
||||
if (view == null) {
|
||||
view = new DrawerDividerCell(mContext);
|
||||
}
|
||||
} else if (type == 3) {
|
||||
if (view == null) {
|
||||
view = new DrawerActionCell(mContext);
|
||||
}
|
||||
DrawerActionCell actionCell = (DrawerActionCell) view;
|
||||
if (i == 2) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("NewGroup", R.string.NewGroup), R.drawable.menu_newgroup);
|
||||
} else if (i == 3) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("NewSecretChat", R.string.NewSecretChat), R.drawable.menu_secret);
|
||||
} else if (i == 4) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("NewBroadcastList", R.string.NewBroadcastList), R.drawable.menu_broadcast);
|
||||
} else if (i == 8) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("Contacts", R.string.Contacts), R.drawable.menu_contacts);
|
||||
} else if (i == 9) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("InviteFriends", R.string.InviteFriends), R.drawable.menu_invite);
|
||||
} else if (i == 10) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("Settings", R.string.Settings), R.drawable.menu_settings);
|
||||
} else if (i == 11) {
|
||||
actionCell.setTextAndIcon(LocaleController.getString("TelegramFaq", R.string.TelegramFaq), R.drawable.menu_help);
|
||||
}
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int i) {
|
||||
if (i == 0) {
|
||||
return 0;
|
||||
} else if (i == 1 || i == 5 || i == 7) {
|
||||
return 1;
|
||||
} else if (i == 6) {
|
||||
return 2;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getViewTypeCount() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return !UserConfig.isClientActivated();
|
||||
}
|
||||
}
|
|
@ -11,11 +11,11 @@ package org.telegram.ui.AnimationCompat;
|
|||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import org.telegram.ui.Animation.Animator10;
|
||||
import org.telegram.ui.Animation.AnimatorListenerAdapter10;
|
||||
import org.telegram.ui.Animation.AnimatorSet10;
|
||||
import org.telegram.ui.Animation.ObjectAnimator10;
|
||||
import org.telegram.ui.Animation.View10;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -58,11 +58,27 @@ public class AnimatorSetProxy {
|
|||
}
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
if (View10.NEED_PROXY) {
|
||||
((AnimatorSet10) animatorSet).cancel();
|
||||
} else {
|
||||
((AnimatorSet) animatorSet).cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public void addListener(AnimatorListenerAdapterProxy listener) {
|
||||
if (View10.NEED_PROXY) {
|
||||
((AnimatorSet10) animatorSet).addListener((AnimatorListenerAdapter10)listener.animatorListenerAdapter);
|
||||
((AnimatorSet10) animatorSet).addListener((AnimatorListenerAdapter10) listener.animatorListenerAdapter);
|
||||
} else {
|
||||
((AnimatorSet) animatorSet).addListener((AnimatorListenerAdapter) listener.animatorListenerAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInterpolator(Interpolator interpolator) {
|
||||
if (View10.NEED_PROXY) {
|
||||
((AnimatorSet10) animatorSet).setInterpolator(interpolator);
|
||||
} else {
|
||||
((AnimatorSet) animatorSet).setInterpolator(interpolator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* This is the source code of Telegram for Android v. 1.7.x.
|
||||
* It is licensed under GNU GPL v. 2 or later.
|
||||
* You should have received a copy of the license in this archive (see LICENSE).
|
||||
*
|
||||
* Copyright Nikolai Kudashov, 2013-2014.
|
||||
*/
|
||||
|
||||
package org.telegram.ui.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.telegram.android.AndroidUtilities;
|
||||
|
||||
public class DrawerActionCell extends FrameLayout {
|
||||
|
||||
private TextView textView;
|
||||
|
||||
public DrawerActionCell(Context context) {
|
||||
super(context);
|
||||
|
||||
textView = new TextView(context);
|
||||
textView.setTextColor(0xff444444);
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
textView.setLines(1);
|
||||
textView.setMaxLines(1);
|
||||
textView.setSingleLine(true);
|
||||
textView.setGravity(Gravity.LEFT | Gravity.CENTER);
|
||||
textView.setCompoundDrawablePadding(AndroidUtilities.dp(34));
|
||||
addView(textView);
|
||||
LayoutParams layoutParams = (LayoutParams) textView.getLayoutParams();
|
||||
layoutParams.width = LayoutParams.MATCH_PARENT;
|
||||
layoutParams.height = LayoutParams.MATCH_PARENT;
|
||||
layoutParams.gravity = Gravity.LEFT | Gravity.BOTTOM;
|
||||
layoutParams.leftMargin = AndroidUtilities.dp(14);
|
||||
layoutParams.rightMargin = AndroidUtilities.dp(16);
|
||||
textView.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY));
|
||||
}
|
||||
|
||||
public void setTextAndIcon(String text, int resId) {
|
||||
textView.setText(text);
|
||||
textView.setCompoundDrawablesWithIntrinsicBounds(resId, 0, 0, 0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* This is the source code of Telegram for Android v. 1.7.x.
|
||||
* It is licensed under GNU GPL v. 2 or later.
|
||||
* You should have received a copy of the license in this archive (see LICENSE).
|
||||
*
|
||||
* Copyright Nikolai Kudashov, 2013-2014.
|
||||
*/
|
||||
|
||||
package org.telegram.ui.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
public class DrawerDividerCell extends FrameLayout {
|
||||
|
||||
public DrawerDividerCell(Context context) {
|
||||
super(context);
|
||||
setBackgroundColor(0xffd9d9d9);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(1, MeasureSpec.EXACTLY));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* This is the source code of Telegram for Android v. 1.7.x.
|
||||
* It is licensed under GNU GPL v. 2 or later.
|
||||
* You should have received a copy of the license in this archive (see LICENSE).
|
||||
*
|
||||
* Copyright Nikolai Kudashov, 2013-2014.
|
||||
*/
|
||||
|
||||
package org.telegram.ui.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import org.telegram.android.AndroidUtilities;
|
||||
|
||||
public class DrawerEmptyCell extends FrameLayout {
|
||||
|
||||
public DrawerEmptyCell(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(8), MeasureSpec.EXACTLY));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* This is the source code of Telegram for Android v. 1.7.x.
|
||||
* It is licensed under GNU GPL v. 2 or later.
|
||||
* You should have received a copy of the license in this archive (see LICENSE).
|
||||
*
|
||||
* Copyright Nikolai Kudashov, 2013-2014.
|
||||
*/
|
||||
|
||||
package org.telegram.ui.Cells;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.telegram.PhoneFormat.PhoneFormat;
|
||||
import org.telegram.android.AndroidUtilities;
|
||||
import org.telegram.android.ContactsController;
|
||||
import org.telegram.messenger.TLRPC;
|
||||
import org.telegram.ui.Views.AvatarDrawable;
|
||||
import org.telegram.ui.Views.BackupImageView;
|
||||
|
||||
public class DrawerProfileCell extends FrameLayout {
|
||||
|
||||
private BackupImageView avatarImageView;
|
||||
private TextView nameTextView;
|
||||
private TextView phoneTextView;
|
||||
|
||||
public DrawerProfileCell(Context context) {
|
||||
super(context);
|
||||
setBackgroundColor(0xff4c84b5);
|
||||
|
||||
avatarImageView = new BackupImageView(context);
|
||||
avatarImageView.imageReceiver.setRoundRadius(AndroidUtilities.dp(32));
|
||||
addView(avatarImageView);
|
||||
LayoutParams layoutParams = (LayoutParams) avatarImageView.getLayoutParams();
|
||||
layoutParams.width = AndroidUtilities.dp(64);
|
||||
layoutParams.height = AndroidUtilities.dp(64);
|
||||
layoutParams.gravity = Gravity.LEFT | Gravity.BOTTOM;
|
||||
layoutParams.leftMargin = AndroidUtilities.dp(16);
|
||||
layoutParams.bottomMargin = AndroidUtilities.dp(67);
|
||||
avatarImageView.setLayoutParams(layoutParams);
|
||||
|
||||
nameTextView = new TextView(context);
|
||||
nameTextView.setTextColor(0xffffffff);
|
||||
nameTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
|
||||
nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
|
||||
nameTextView.setLines(1);
|
||||
nameTextView.setMaxLines(1);
|
||||
nameTextView.setSingleLine(true);
|
||||
nameTextView.setGravity(Gravity.LEFT);
|
||||
addView(nameTextView);
|
||||
layoutParams = (FrameLayout.LayoutParams) nameTextView.getLayoutParams();
|
||||
layoutParams.width = LayoutParams.MATCH_PARENT;
|
||||
layoutParams.height = LayoutParams.WRAP_CONTENT;
|
||||
layoutParams.gravity = Gravity.LEFT | Gravity.BOTTOM;
|
||||
layoutParams.leftMargin = AndroidUtilities.dp(16);
|
||||
layoutParams.bottomMargin = AndroidUtilities.dp(28);
|
||||
layoutParams.rightMargin = AndroidUtilities.dp(16);
|
||||
nameTextView.setLayoutParams(layoutParams);
|
||||
|
||||
phoneTextView = new TextView(context);
|
||||
phoneTextView.setTextColor(0xffc2e5ff);
|
||||
phoneTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
|
||||
phoneTextView.setLines(1);
|
||||
phoneTextView.setMaxLines(1);
|
||||
phoneTextView.setSingleLine(true);
|
||||
phoneTextView.setGravity(Gravity.LEFT);
|
||||
addView(phoneTextView);
|
||||
layoutParams = (FrameLayout.LayoutParams) phoneTextView.getLayoutParams();
|
||||
layoutParams.width = LayoutParams.MATCH_PARENT;
|
||||
layoutParams.height = LayoutParams.WRAP_CONTENT;
|
||||
layoutParams.gravity = Gravity.LEFT | Gravity.BOTTOM;
|
||||
layoutParams.leftMargin = AndroidUtilities.dp(16);
|
||||
layoutParams.bottomMargin = AndroidUtilities.dp(9);
|
||||
layoutParams.rightMargin = AndroidUtilities.dp(16);
|
||||
phoneTextView.setLayoutParams(layoutParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
if (Build.VERSION.SDK_INT >= 21) {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(148) + AndroidUtilities.statusBarHeight, MeasureSpec.EXACTLY));
|
||||
} else {
|
||||
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(148), MeasureSpec.EXACTLY));
|
||||
}
|
||||
}
|
||||
|
||||
public void setUser(TLRPC.User user) {
|
||||
if (user == null) {
|
||||
return;
|
||||
}
|
||||
TLRPC.FileLocation photo = null;
|
||||
if (user.photo != null) {
|
||||
photo = user.photo.photo_small;
|
||||
}
|
||||
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
|
||||
phoneTextView.setText(PhoneFormat.getInstance().format("+" + user.phone));
|
||||
AvatarDrawable avatarDrawable = new AvatarDrawable(user);
|
||||
avatarDrawable.setColor(0xff5c98cd);
|
||||
avatarImageView.setImage(photo, "50_50", avatarDrawable);
|
||||
}
|
||||
}
|
|
@ -2852,8 +2852,8 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
|||
} else if (lower_part < 0) {
|
||||
args.putInt("chat_id", -lower_part);
|
||||
}
|
||||
presentFragment(new ChatActivity(args), true);
|
||||
forwardSelectedMessages(did, param);
|
||||
presentFragment(new ChatActivity(args), true);
|
||||
if (!AndroidUtilities.isTablet()) {
|
||||
removeSelfFromStack();
|
||||
}
|
||||
|
|
|
@ -27,9 +27,12 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.Window;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
@ -45,6 +48,7 @@ import org.telegram.messenger.R;
|
|||
import org.telegram.messenger.TLRPC;
|
||||
import org.telegram.messenger.UserConfig;
|
||||
import org.telegram.messenger.Utilities;
|
||||
import org.telegram.ui.Adapters.DrawerLayoutAdapter;
|
||||
import org.telegram.ui.Views.ActionBar.ActionBarLayout;
|
||||
import org.telegram.ui.Views.ActionBar.BaseFragment;
|
||||
import org.telegram.ui.Views.ActionBar.DrawerLayoutContainer;
|
||||
|
@ -75,6 +79,8 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||
private LinearLayout buttonLayoutTablet = null;
|
||||
private FrameLayout shadowTabletSide = null;
|
||||
private ImageView backgroundTablet = null;
|
||||
private DrawerLayoutContainer drawerLayoutContainer = null;
|
||||
|
||||
private boolean tabletFullSize = false;
|
||||
|
||||
@Override
|
||||
|
@ -233,21 +239,62 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||
}
|
||||
});
|
||||
} else {
|
||||
DrawerLayoutContainer drawerLayoutContainer = new DrawerLayoutContainer(this);
|
||||
drawerLayoutContainer = new DrawerLayoutContainer(this);
|
||||
drawerLayoutContainer.setStatusBarColor(0xff54759e);
|
||||
drawerLayoutContainer.addView(actionBarLayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
|
||||
FrameLayout frameLayout = new FrameLayout(this);
|
||||
drawerLayoutContainer.setDrawerLayout(frameLayout);
|
||||
frameLayout.setBackgroundColor(0xffff0000);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)frameLayout.getLayoutParams();
|
||||
ListView listView = new ListView(this);
|
||||
listView.setAdapter(new DrawerLayoutAdapter(this));
|
||||
drawerLayoutContainer.setDrawerLayout(listView);
|
||||
listView.setBackgroundColor(0xffffffff);
|
||||
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)listView.getLayoutParams();
|
||||
Point screenSize = AndroidUtilities.getRealScreenSize();
|
||||
layoutParams.width = Math.min(screenSize.x, screenSize.y) - AndroidUtilities.dp(56);
|
||||
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
|
||||
frameLayout.setLayoutParams(layoutParams);
|
||||
listView.setPadding(0, 0, 0, 0);
|
||||
listView.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
|
||||
listView.setDivider(null);
|
||||
listView.setDividerHeight(0);
|
||||
listView.setLayoutParams(layoutParams);
|
||||
listView.setVerticalScrollBarEnabled(false);
|
||||
|
||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
if (position == 2) {
|
||||
presentFragment(new GroupCreateActivity());
|
||||
drawerLayoutContainer.closeDrawer(false);
|
||||
} else if (position == 3) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("onlyUsers", true);
|
||||
args.putBoolean("destroyAfterSelect", true);
|
||||
args.putBoolean("usersAsSections", true);
|
||||
args.putBoolean("createSecretChat", true);
|
||||
presentFragment(new ContactsActivity(args));
|
||||
drawerLayoutContainer.closeDrawer(false);
|
||||
} else if (position == 4) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("broadcast", true);
|
||||
presentFragment(new GroupCreateActivity(args));
|
||||
drawerLayoutContainer.closeDrawer(false);
|
||||
} else if (position == 8) {
|
||||
presentFragment(new ContactsActivity(null));
|
||||
drawerLayoutContainer.closeDrawer(false);
|
||||
} else if (position == 9) {
|
||||
drawerLayoutContainer.closeDrawer(false);
|
||||
} else if (position == 10) {
|
||||
presentFragment(new SettingsActivity());
|
||||
drawerLayoutContainer.closeDrawer(false);
|
||||
} else if (position == 11) {
|
||||
drawerLayoutContainer.closeDrawer(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setContentView(drawerLayoutContainer, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
actionBarLayout.setDrawerLayout(drawerLayoutContainer);
|
||||
actionBarLayout.setAllowOpenDrawer(true);
|
||||
drawerLayoutContainer.setParentActionBarLayout(actionBarLayout);
|
||||
drawerLayoutContainer.setAllowOpenDrawer(true);
|
||||
actionBarLayout.setDrawerLayoutContainer(drawerLayoutContainer);
|
||||
}
|
||||
actionBarLayout.init(mainFragmentsStack);
|
||||
actionBarLayout.setDelegate(this);
|
||||
|
@ -965,23 +1012,23 @@ public class LaunchActivity extends Activity implements ActionBarLayout.ActionBa
|
|||
public void onBackPressed() {
|
||||
if (PhotoViewer.getInstance().isVisible()) {
|
||||
PhotoViewer.getInstance().closePhoto(true);
|
||||
} else {
|
||||
if (AndroidUtilities.isTablet()) {
|
||||
if (layersActionBarLayout.getVisibility() == View.VISIBLE) {
|
||||
layersActionBarLayout.onBackPressed();
|
||||
} else {
|
||||
boolean cancel = false;
|
||||
if (rightActionBarLayout.getVisibility() == View.VISIBLE && !rightActionBarLayout.fragmentsStack.isEmpty()) {
|
||||
BaseFragment lastFragment = rightActionBarLayout.fragmentsStack.get(rightActionBarLayout.fragmentsStack.size() - 1);
|
||||
cancel = !lastFragment.onBackPressed();
|
||||
}
|
||||
if (!cancel) {
|
||||
actionBarLayout.onBackPressed();
|
||||
}
|
||||
}
|
||||
} else if (drawerLayoutContainer.isDrawerOpened()) {
|
||||
drawerLayoutContainer.closeDrawer(false);
|
||||
} else if (AndroidUtilities.isTablet()) {
|
||||
if (layersActionBarLayout.getVisibility() == View.VISIBLE) {
|
||||
layersActionBarLayout.onBackPressed();
|
||||
} else {
|
||||
actionBarLayout.onBackPressed();
|
||||
boolean cancel = false;
|
||||
if (rightActionBarLayout.getVisibility() == View.VISIBLE && !rightActionBarLayout.fragmentsStack.isEmpty()) {
|
||||
BaseFragment lastFragment = rightActionBarLayout.fragmentsStack.get(rightActionBarLayout.fragmentsStack.size() - 1);
|
||||
cancel = !lastFragment.onBackPressed();
|
||||
}
|
||||
if (!cancel) {
|
||||
actionBarLayout.onBackPressed();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
actionBarLayout.onBackPressed();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -82,13 +82,6 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
|||
|
||||
private long openedDialogId = 0;
|
||||
|
||||
private final static int messages_list_menu_other = 1;
|
||||
private final static int messages_list_menu_new_chat = 2;
|
||||
private final static int messages_list_menu_new_secret_chat = 3;
|
||||
private final static int messages_list_menu_contacts = 4;
|
||||
private final static int messages_list_menu_settings = 5;
|
||||
private final static int messages_list_menu_new_broadcast = 6;
|
||||
|
||||
public static interface MessagesActivityDelegate {
|
||||
public abstract void didSelectDialog(MessagesActivity fragment, long dialog_id, boolean param);
|
||||
}
|
||||
|
@ -201,39 +194,18 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
|
|||
} else {
|
||||
actionBarLayer.setBackButtonDrawable(new MenuDrawable());
|
||||
actionBarLayer.setTitle(LocaleController.getString("AppName", R.string.AppName));
|
||||
ActionBarMenuItem item = menu.addItem(0, R.drawable.ic_ab_other);
|
||||
item.addSubItem(messages_list_menu_new_chat, LocaleController.getString("NewGroup", R.string.NewGroup), 0);
|
||||
item.addSubItem(messages_list_menu_new_secret_chat, LocaleController.getString("NewSecretChat", R.string.NewSecretChat), 0);
|
||||
item.addSubItem(messages_list_menu_new_broadcast, LocaleController.getString("NewBroadcastList", R.string.NewBroadcastList), 0);
|
||||
item.addSubItem(messages_list_menu_contacts, LocaleController.getString("Contacts", R.string.Contacts), 0);
|
||||
item.addSubItem(messages_list_menu_settings, LocaleController.getString("Settings", R.string.Settings), 0);
|
||||
}
|
||||
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
|
||||
|
||||
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
|
||||
@Override
|
||||
public void onItemClick(int id) {
|
||||
if (id == messages_list_menu_settings) {
|
||||
presentFragment(new SettingsActivity());
|
||||
} else if (id == messages_list_menu_contacts) {
|
||||
presentFragment(new ContactsActivity(null));
|
||||
} else if (id == messages_list_menu_new_secret_chat) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("onlyUsers", true);
|
||||
args.putBoolean("destroyAfterSelect", true);
|
||||
args.putBoolean("usersAsSections", true);
|
||||
args.putBoolean("createSecretChat", true);
|
||||
presentFragment(new ContactsActivity(args));
|
||||
} else if (id == messages_list_menu_new_chat) {
|
||||
presentFragment(new GroupCreateActivity());
|
||||
} else if (id == -1) {
|
||||
if (id == -1) {
|
||||
if (onlySelect) {
|
||||
finishFragment();
|
||||
} else if (parentLayout != null) {
|
||||
parentLayout.getDrawerLayoutContainer().openDrawer(false);
|
||||
}
|
||||
} else if (id == messages_list_menu_new_broadcast) {
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean("broadcast", true);
|
||||
presentFragment(new GroupCreateActivity(args));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -66,8 +66,6 @@ public class ActionBarLayout extends FrameLayout {
|
|||
private View shadowView;
|
||||
private DrawerLayoutContainer drawerLayoutContainer;
|
||||
|
||||
private boolean allowOpenDrawer;
|
||||
|
||||
private Animation openAnimation;
|
||||
private Animation closeAnimation;
|
||||
private Animation alphaOpenAnimation;
|
||||
|
@ -243,14 +241,6 @@ public class ActionBarLayout extends FrameLayout {
|
|||
ViewProxy.setTranslationX(shadowView, -AndroidUtilities.dp(2));
|
||||
}
|
||||
|
||||
private void prepareForDrawerOpen(MotionEvent ev) {
|
||||
maybeStartTracking = false;
|
||||
startedTracking = true;
|
||||
startedTrackingX = (int) ev.getX();
|
||||
beginTrackingSent = false;
|
||||
AndroidUtilities.lockOrientation(parentActivity);
|
||||
}
|
||||
|
||||
private void prepareForMoving(MotionEvent ev) {
|
||||
maybeStartTracking = false;
|
||||
startedTracking = true;
|
||||
|
@ -327,6 +317,12 @@ public class ActionBarLayout extends FrameLayout {
|
|||
float velY = velocityTracker.getYVelocity();
|
||||
if (velX >= 3500 && velX > velY) {
|
||||
prepareForMoving(ev);
|
||||
if (!beginTrackingSent) {
|
||||
if (((Activity)getContext()).getCurrentFocus() != null) {
|
||||
AndroidUtilities.hideKeyboard(((Activity)getContext()).getCurrentFocus());
|
||||
}
|
||||
beginTrackingSent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (startedTracking) {
|
||||
|
@ -386,77 +382,6 @@ public class ActionBarLayout extends FrameLayout {
|
|||
velocityTracker = null;
|
||||
}
|
||||
}
|
||||
} else if (drawerLayoutContainer != null && allowOpenDrawer && fragmentsStack.size() == 1) {
|
||||
if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && !startedTracking && !maybeStartTracking) {
|
||||
startedTrackingPointerId = ev.getPointerId(0);
|
||||
maybeStartTracking = true;
|
||||
startedTrackingX = (int) ev.getX();
|
||||
startedTrackingY = (int) ev.getY();
|
||||
if (velocityTracker != null) {
|
||||
velocityTracker.clear();
|
||||
}
|
||||
} else if (ev != null && ev.getAction() == MotionEvent.ACTION_MOVE && ev.getPointerId(0) == startedTrackingPointerId) {
|
||||
if (velocityTracker == null) {
|
||||
velocityTracker = VelocityTracker.obtain();
|
||||
}
|
||||
int dx = (int) (ev.getX() - startedTrackingX);
|
||||
int dy = Math.abs((int) ev.getY() - startedTrackingY);
|
||||
velocityTracker.addMovement(ev);
|
||||
if (maybeStartTracking && !startedTracking && Math.abs(dx) >= AndroidUtilities.dp(10) && Math.abs(dx) / 3 > dy) {
|
||||
prepareForDrawerOpen(ev);
|
||||
} else if (startedTracking) {
|
||||
if (!beginTrackingSent) {
|
||||
if (parentActivity.getCurrentFocus() != null) {
|
||||
AndroidUtilities.hideKeyboard(parentActivity.getCurrentFocus());
|
||||
}
|
||||
BaseFragment currentFragment = fragmentsStack.get(fragmentsStack.size() - 1);
|
||||
currentFragment.onBeginSlide();
|
||||
beginTrackingSent = true;
|
||||
}
|
||||
drawerLayoutContainer.moveDrawerByX(dx);
|
||||
}
|
||||
} else if (ev != null && ev.getPointerId(0) == startedTrackingPointerId && (ev.getAction() == MotionEvent.ACTION_CANCEL || ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_POINTER_UP)) {
|
||||
if (velocityTracker == null) {
|
||||
velocityTracker = VelocityTracker.obtain();
|
||||
}
|
||||
velocityTracker.computeCurrentVelocity(1000);
|
||||
if (!startedTracking) {
|
||||
float velX = velocityTracker.getXVelocity();
|
||||
float velY = velocityTracker.getYVelocity();
|
||||
if (Math.abs(velX) >= 3500 && velX > velY) {
|
||||
prepareForDrawerOpen(ev);
|
||||
}
|
||||
}
|
||||
if (startedTracking) {
|
||||
float x = ViewProxy.getX(containerView);
|
||||
float velX = velocityTracker.getXVelocity();
|
||||
float velY = velocityTracker.getYVelocity();
|
||||
final boolean backAnimation = x < containerView.getMeasuredWidth() / 3.0f && (velX < 3500 || velX < velY);
|
||||
float distToMove = 0;
|
||||
if (!backAnimation) {
|
||||
drawerLayoutContainer.openDrawer();
|
||||
} else {
|
||||
drawerLayoutContainer.closeDrawer();
|
||||
}
|
||||
AndroidUtilities.unlockOrientation(parentActivity);
|
||||
startedTracking = false;
|
||||
animationInProgress = false; //TODO animation check
|
||||
} else {
|
||||
maybeStartTracking = false;
|
||||
startedTracking = false;
|
||||
}
|
||||
if (velocityTracker != null) {
|
||||
velocityTracker.recycle();
|
||||
velocityTracker = null;
|
||||
}
|
||||
} else if (ev == null) {
|
||||
maybeStartTracking = false;
|
||||
startedTracking = false;
|
||||
if (velocityTracker != null) {
|
||||
velocityTracker.recycle();
|
||||
velocityTracker = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return startedTracking;
|
||||
}
|
||||
|
@ -909,11 +834,11 @@ public class ActionBarLayout extends FrameLayout {
|
|||
backgroundView = view;
|
||||
}
|
||||
|
||||
public void setDrawerLayout(DrawerLayoutContainer layout) {
|
||||
public void setDrawerLayoutContainer(DrawerLayoutContainer layout) {
|
||||
drawerLayoutContainer = layout;
|
||||
}
|
||||
|
||||
public void setAllowOpenDrawer(boolean value) {
|
||||
allowOpenDrawer = value;
|
||||
public DrawerLayoutContainer getDrawerLayoutContainer() {
|
||||
return drawerLayoutContainer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -382,7 +382,7 @@ public class ActionBarMenuItem extends ImageView {
|
|||
layoutParams.width = 0;
|
||||
layoutParams.gravity = Gravity.CENTER_VERTICAL;
|
||||
layoutParams.height = AndroidUtilities.dp(36);
|
||||
layoutParams.rightMargin = AndroidUtilities.dp(4);
|
||||
layoutParams.rightMargin = AndroidUtilities.dp(16);
|
||||
searchField.setLayoutParams(layoutParams);
|
||||
searchField.setVisibility(GONE);
|
||||
}
|
||||
|
|
|
@ -72,6 +72,10 @@ public class AvatarDrawable extends Drawable {
|
|||
}
|
||||
}
|
||||
|
||||
public void setColor(int value) {
|
||||
color = value;
|
||||
}
|
||||
|
||||
public void setInfo(int id, String firstName, String lastName, boolean isBroadcast) {
|
||||
color = arrColors[Math.abs(id) % arrColors.length];
|
||||
|
||||
|
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/menu_broadcast.png
Executable file
After Width: | Height: | Size: 1.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/menu_contacts.png
Executable file
After Width: | Height: | Size: 1.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/menu_help.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/menu_invite.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/menu_newgroup.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/menu_secret.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/menu_settings.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
TMessagesProj/src/main/res/drawable-hdpi/menu_shadow.png
Executable file
After Width: | Height: | Size: 942 B |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/menu_broadcast.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/menu_contacts.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/menu_help.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/menu_invite.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/menu_newgroup.png
Executable file
After Width: | Height: | Size: 1.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/menu_secret.png
Executable file
After Width: | Height: | Size: 1.1 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/menu_settings.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
TMessagesProj/src/main/res/drawable-mdpi/menu_shadow.png
Executable file
After Width: | Height: | Size: 935 B |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/menu_broadcast.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/menu_contacts.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/menu_help.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/menu_invite.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/menu_newgroup.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/menu_secret.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/menu_settings.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
TMessagesProj/src/main/res/drawable-xhdpi/menu_shadow.png
Executable file
After Width: | Height: | Size: 944 B |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/menu_broadcast.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/menu_contacts.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/menu_help.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/menu_invite.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/menu_newgroup.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/menu_secret.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/menu_settings.png
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
TMessagesProj/src/main/res/drawable-xxhdpi/menu_shadow.png
Executable file
After Width: | Height: | Size: 955 B |