1
0
mirror of https://github.com/MGislv/NekoX.git synced 2024-06-30 10:14:04 +00:00

Bug fixes, locales update

https://github.com/DrKLO/Telegram/issues/451
This commit is contained in:
DrKLO 2014-06-12 19:53:20 +04:00
parent 55ccb7c9e2
commit 69f8bb4f40
47 changed files with 382 additions and 269 deletions

View File

@ -81,7 +81,7 @@ android {
defaultConfig {
minSdkVersion 8
targetSdkVersion 19
versionCode 245
versionCode 247
versionName "1.5.0"
}
}

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.telegram.messenger">
package="org.telegram.messenger"
android:installLocation="auto">
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.telegram.messenger">
package="org.telegram.messenger"
android:installLocation="auto">
<application
android:allowBackup="false"

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.telegram.messenger">
package="org.telegram.messenger"
android:installLocation="auto">
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />

View File

@ -148,15 +148,33 @@ public class ConnectionsManager implements Action.ActionDelegate, TcpConnection.
if (datacenters != null) {
MessagesController.getInstance().updateTimerProc();
Datacenter datacenter = datacenterWithId(currentDatacenterId);
if (datacenter != null && datacenter.authKey != null) {
if (lastPingTime < System.currentTimeMillis() - 19000) {
lastPingTime = System.currentTimeMillis();
generatePing();
if (datacenter != null) {
if (datacenter.authKey != null) {
if (lastPingTime < System.currentTimeMillis() - 19000) {
lastPingTime = System.currentTimeMillis();
generatePing();
}
if (!updatingDcSettings && lastDcUpdateTime < (int) (System.currentTimeMillis() / 1000) - DC_UPDATE_TIME) {
updateDcSettings(0);
}
processRequestQueue(0, 0);
} else {
boolean notFound = true;
for (Action actor : actionQueue) {
if (actor instanceof HandshakeAction) {
HandshakeAction eactor = (HandshakeAction)actor;
if (eactor.datacenter.datacenterId == datacenter.datacenterId) {
notFound = false;
break;
}
}
}
if (notFound) {
HandshakeAction actor = new HandshakeAction(datacenter);
actor.delegate = ConnectionsManager.this;
dequeueActor(actor, true);
}
}
if (!updatingDcSettings && lastDcUpdateTime < (int)(System.currentTimeMillis() / 1000) - DC_UPDATE_TIME) {
updateDcSettings(0);
}
processRequestQueue(0, 0);
}
}

View File

@ -11,6 +11,9 @@ package org.telegram.messenger;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.provider.MediaStore;
import org.telegram.ui.ApplicationLoader;
import java.io.RandomAccessFile;
import java.net.URL;
@ -158,14 +161,24 @@ public class FileLoadOperation {
boolean ignoreCache = false;
boolean onlyCache = false;
boolean isLocalFile = false;
Long mediaId = null;
String fileNameFinal = null;
String fileNameTemp = null;
String fileNameIv = null;
if (httpUrl != null) {
if (!httpUrl.startsWith("http")) {
if (httpUrl.startsWith("thumb://")) {
int idx = httpUrl.indexOf(":", 8);
if (idx >= 0) {
String media = httpUrl.substring(8, idx);
mediaId = Long.parseLong(media);
fileNameFinal = httpUrl.substring(idx + 1);
}
} else {
fileNameFinal = httpUrl;
}
onlyCache = true;
isLocalFile = true;
fileNameFinal = httpUrl;
} else {
fileNameFinal = Utilities.MD5(httpUrl);
fileNameTemp = fileNameFinal + "_temp.jpg";
@ -197,6 +210,7 @@ public class FileLoadOperation {
cacheFileFinal = new File(Utilities.getCacheDir(), fileNameFinal);
}
final boolean dontDelete = isLocalFile;
final Long mediaIdFinal = mediaId;
if ((exist = cacheFileFinal.exists()) && !ignoreCache) {
FileLoader.cacheOutQueue.postRunnable(new Runnable() {
@Override
@ -206,15 +220,18 @@ public class FileLoadOperation {
if (FileLoader.getInstance().runtimeHack != null) {
delay = 60;
}
if (FileLoader.lastCacheOutTime != 0 && FileLoader.lastCacheOutTime > System.currentTimeMillis() - delay) {
if (mediaIdFinal != null) {
delay = 0;
}
if (delay != 0 && FileLoader.lastCacheOutTime != 0 && FileLoader.lastCacheOutTime > System.currentTimeMillis() - delay) {
Thread.sleep(delay);
}
FileLoader.lastCacheOutTime = System.currentTimeMillis();
if (state != 1) {
return;
}
if (needBitmapCreate) {
FileInputStream is = new FileInputStream(cacheFileFinal);
BitmapFactory.Options opts = new BitmapFactory.Options();
float w_filter = 0;
@ -223,9 +240,14 @@ public class FileLoadOperation {
String args[] = filter.split("_");
w_filter = Float.parseFloat(args[0]) * Utilities.density;
h_filter = Float.parseFloat(args[1]) * Utilities.density;
opts.inJustDecodeBounds = true;
BitmapFactory.decodeFile(cacheFileFinal.getAbsolutePath(), opts);
if (mediaIdFinal != null) {
MediaStore.Images.Thumbnails.getThumbnail(ApplicationLoader.applicationContext.getContentResolver(), mediaIdFinal, MediaStore.Images.Thumbnails.MINI_KIND, opts);
} else {
BitmapFactory.decodeFile(cacheFileFinal.getAbsolutePath(), opts);
}
float photoW = opts.outWidth;
float photoH = opts.outHeight;
float scaleFactor = Math.max(photoW / w_filter, photoH / h_filter);
@ -242,8 +264,14 @@ public class FileLoadOperation {
opts.inPreferredConfig = Bitmap.Config.RGB_565;
}
opts.inDither = false;
image = BitmapFactory.decodeStream(is, null, opts);
is.close();
if (mediaIdFinal != null) {
image = MediaStore.Images.Thumbnails.getThumbnail(ApplicationLoader.applicationContext.getContentResolver(), mediaIdFinal, MediaStore.Images.Thumbnails.MINI_KIND, opts);
}
if (image == null) {
FileInputStream is = new FileInputStream(cacheFileFinal);
image = BitmapFactory.decodeStream(is, null, opts);
is.close();
}
if (image == null) {
if (!dontDelete && (cacheFileFinal.length() == 0 || filter == null)) {
cacheFileFinal.delete();

View File

@ -81,30 +81,6 @@ public class TcpConnection extends ConnectionContext {
public void connect() {
if (!ConnectionsManager.isNetworkOnline()) {
synchronized (timerSync) {
reconnectTimer = new Timer();
reconnectTimer.schedule(new TimerTask() {
@Override
public void run() {
selector.scheduleTask(new Runnable() {
@Override
public void run() {
try {
synchronized (timerSync) {
if (reconnectTimer != null) {
reconnectTimer.cancel();
reconnectTimer = null;
}
}
} catch (Exception e2) {
FileLog.e("tmessages", e2);
}
connect();
}
});
}
}, 500);
}
if (delegate != null) {
final TcpConnectionDelegate finalDelegate = delegate;
Utilities.stageQueue.postRunnable(new Runnable() {

View File

@ -418,6 +418,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
@ -551,6 +552,7 @@ public class ChatActivity extends BaseFragment implements SizeNotifierRelativeLa
}
}
});
updateSubtitle();
if (currentEncryptedChat != null) {

View File

@ -145,6 +145,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("GroupInfo", R.string.GroupInfo));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@Override
@ -331,6 +332,7 @@ public class ChatProfileActivity extends BaseFragment implements NotificationCen
@Override
public void restoreSelfArgs(Bundle args) {
MessagesController.getInstance().loadChatInfo(chat_id);
if (avatarUpdater != null) {
avatarUpdater.currentPicturePath = args.getString("path");
}

View File

@ -67,9 +67,9 @@ public class ChatProfileChangeNameActivity extends BaseFragment {
}
});
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel));
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
TextView textView = (TextView)doneButton.findViewById(R.id.done_button_text);
textView.setText(LocaleController.getString("Done", R.string.Done));
textView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
fragmentView = inflater.inflate(R.layout.chat_profile_change_name_layout, container, false);

View File

@ -87,9 +87,9 @@ public class ContactAddActivity extends BaseFragment implements NotificationCent
}
});
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel));
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
TextView textView = (TextView)doneButton.findViewById(R.id.done_button_text);
textView.setText(LocaleController.getString("Done", R.string.Done));
textView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
fragmentView = inflater.inflate(R.layout.contact_add_layout, container, false);

View File

@ -116,6 +116,7 @@ public class ContactsActivity extends BaseFragment implements NotificationCenter
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
if (destroyAfterSelect) {
actionBarLayer.setTitle(LocaleController.getString("SelectContact", R.string.SelectContact));
} else {

View File

@ -119,6 +119,7 @@ public class CountrySelectActivity extends BaseFragment {
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("ChooseCountry", R.string.ChooseCountry));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {

View File

@ -127,6 +127,7 @@ public class DocumentSelectActivity extends BaseFragment {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("SelectFile", R.string.SelectFile));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@Override

View File

@ -124,6 +124,7 @@ public class GroupCreateActivity extends BaseFragment implements NotificationCen
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup));
actionBarLayer.setSubtitle(String.format("%d/200 %s", selectedContacts.size(), LocaleController.getString("Members", R.string.Members)));

View File

@ -119,6 +119,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("NewGroup", R.string.NewGroup));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@ -167,7 +168,7 @@ public class GroupCreateFinalActivity extends BaseFragment implements Notificati
View doneItem = menu.addItemResource(done_button, R.layout.group_create_done_layout);
TextView doneTextView = (TextView)doneItem.findViewById(R.id.done_button);
doneTextView.setText(LocaleController.getString("Done", R.string.Done));
doneTextView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
fragmentView = inflater.inflate(R.layout.group_create_final_layout, container, false);

View File

@ -46,6 +46,7 @@ public class IdenticonActivity extends BaseFragment {
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("EncryptionKey", R.string.EncryptionKey));
actionBarLayer.setTitleIcon(R.drawable.ic_lock_white, Utilities.dp(4));

View File

@ -17,6 +17,7 @@ import android.support.v4.view.ViewPager;
import android.text.Html;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
@ -42,6 +43,7 @@ public class IntroActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
setTheme(R.style.Theme_TMessages);
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.intro_layout);

View File

@ -49,6 +49,7 @@ public class LanguageSelectActivity extends BaseFragment {
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("Language", R.string.Language));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {

View File

@ -59,10 +59,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
private ArrayList<String> documentsPathArray = null;
private ArrayList<TLRPC.User> contactsToSend = null;
private int currentConnectionState;
private View statusView;
private View backStatusButton;
private View statusBackground;
private TextView statusText;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -104,19 +100,6 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
NotificationCenter.getInstance().addObserver(this, 702);
NotificationCenter.getInstance().addObserver(this, 703);
statusView = getLayoutInflater().inflate(R.layout.updating_state_layout, null);
statusBackground = statusView.findViewById(R.id.back_button_background);
backStatusButton = statusView.findViewById(R.id.back_button);
statusText = (TextView)statusView.findViewById(R.id.status_text);
statusBackground.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (fragmentsStack.size() > 1) {
onBackPressed();
}
}
});
if (fragmentsStack.isEmpty()) {
if (!UserConfig.clientActivated) {
addFragmentToStack(new LoginActivity());
@ -186,7 +169,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
imagesPathArray = null;
documentsPathArray = null;
if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
if ((intent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
if (intent != null && intent.getAction() != null && !restore) {
if (Intent.ACTION_SEND.equals(intent.getAction())) {
@ -407,10 +390,10 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
}
}
if (getIntent().getAction() != null && getIntent().getAction().startsWith("com.tmessages.openchat") && !restore) {
int chatId = getIntent().getIntExtra("chatId", 0);
int userId = getIntent().getIntExtra("userId", 0);
int encId = getIntent().getIntExtra("encId", 0);
if (intent.getAction() != null && intent.getAction().startsWith("com.tmessages.openchat") && !restore) {
int chatId = intent.getIntExtra("chatId", 0);
int userId = intent.getIntExtra("userId", 0);
int encId = intent.getIntExtra("encId", 0);
if (chatId != 0) {
TLRPC.Chat chat = MessagesController.getInstance().chats.get(chatId);
if (chat != null) {
@ -477,7 +460,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
showLastFragment();
}
getIntent().setAction(null);
intent.setAction(null);
}
@Override
@ -579,7 +562,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
Utilities.checkForCrashes(this);
Utilities.checkForUpdates(this);
ApplicationLoader.resetLastPauseTime();
updateActionBar();
actionBar.setBackOverlayVisible(currentConnectionState != 0);
try {
NotificationManager mNotificationManager = (NotificationManager)this.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.cancel(1);
@ -678,39 +661,26 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
if (currentConnectionState != state) {
FileLog.e("tmessages", "switch to state " + state);
currentConnectionState = state;
updateActionBar();
actionBar.setBackOverlayVisible(currentConnectionState != 0);
}
}
}
public void updateActionBar() {
if (currentConnectionState != 0 && statusView != null) {
onShowFragment();
if (currentConnectionState == 1) {
statusText.setText(getString(R.string.WaitingForNetwork));
} else if (currentConnectionState == 2) {
statusText.setText(getString(R.string.Connecting));
} else if (currentConnectionState == 3) {
statusText.setText(getString(R.string.Updating));
}
statusText.measure(View.MeasureSpec.makeMeasureSpec(800, View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.AT_MOST));
actionBar.setBackOverlay(statusView, (statusText.getMeasuredWidth() + Utilities.dp(54)));
} else {
actionBar.setBackOverlay(null, 0);
}
}
@Override
protected void onShowFragment() {
if (statusView != null) {
if (fragmentsStack.size() > 1) {
backStatusButton.setVisibility(View.VISIBLE);
statusBackground.setEnabled(true);
} else {
backStatusButton.setVisibility(View.GONE);
statusBackground.setEnabled(false);
}
public void onOverlayShow(View view, BaseFragment fragment) {
if (view == null || fragment == null || fragmentsStack.isEmpty()) {
return;
}
View backStatusButton = view.findViewById(R.id.back_button);
TextView statusText = (TextView)view.findViewById(R.id.status_text);
backStatusButton.setVisibility(fragmentsStack.get(0) == fragment ? View.GONE : View.VISIBLE);
view.setEnabled(fragmentsStack.get(0) != fragment);
if (currentConnectionState == 1) {
statusText.setText(LocaleController.getString("WaitingForNetwork", R.string.WaitingForNetwork));
} else if (currentConnectionState == 2) {
statusText.setText(LocaleController.getString("Connecting", R.string.Connecting));
} else if (currentConnectionState == 3) {
statusText.setText(LocaleController.getString("Updating", R.string.Updating));
}
}
@ -732,6 +702,7 @@ public class LaunchActivity extends ActionBarActivity implements NotificationCen
} else if (lastFragment instanceof SettingsWallpapersActivity) {
outState.putString("fragment", "wallpapers");
} else if (lastFragment instanceof ChatProfileActivity && args != null) {
outState.putBundle("args", args);
outState.putString("fragment", "chat_profile");
}
lastFragment.saveSelfArgs(outState);

View File

@ -81,6 +81,7 @@ public class LocationActivity extends BaseFragment implements NotificationCenter
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
if (messageObject != null) {
actionBarLayer.setTitle(LocaleController.getString("ChatLocation", R.string.ChatLocation));
} else {

View File

@ -56,7 +56,7 @@ public class LoginActivity extends BaseFragment implements SlideView.SlideViewDe
@Override
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayUseLogoEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setDisplayUseLogoEnabled(true, R.drawable.ic_ab_logo);
actionBarLayer.setTitle(LocaleController.getString("AppName", R.string.AppName));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@ -71,7 +71,7 @@ public class LoginActivity extends BaseFragment implements SlideView.SlideViewDe
ActionBarMenu menu = actionBarLayer.createMenu();
View doneItem = menu.addItemResource(done_button, R.layout.group_create_done_layout);
TextView doneTextView = (TextView)doneItem.findViewById(R.id.done_button);
doneTextView.setText(LocaleController.getString("Done", R.string.Done));
doneTextView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
fragmentView = inflater.inflate(R.layout.login_layout, container, false);

View File

@ -87,6 +87,7 @@ public class MediaActivity extends BaseFragment implements NotificationCenter.No
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("SharedMedia", R.string.SharedMedia));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@Override

View File

@ -176,6 +176,7 @@ public class MessagesActivity extends BaseFragment implements NotificationCenter
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

View File

@ -353,9 +353,9 @@ public class PhotoCropActivity extends BaseFragment {
}
});
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel));
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
TextView textView = (TextView)doneButton.findViewById(R.id.done_button_text);
textView.setText(LocaleController.getString("Done", R.string.Done));
textView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
fragmentView = view = new PhotoCropView(getParentActivity());
fragmentView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));

View File

@ -492,7 +492,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
MediaController.AlbumEntry albumEntry = albumsSorted.get(i);
BackupImageView imageView = (BackupImageView)view.findViewById(R.id.media_photo_image);
if (albumEntry.coverPhoto != null && albumEntry.coverPhoto.path != null) {
imageView.setImage(albumEntry.coverPhoto.path, "150_150", R.drawable.nophotos);
imageView.setImage("thumb://" + albumEntry.coverPhoto.imageId + ":" + albumEntry.coverPhoto.path, "150_150", R.drawable.nophotos);
} else {
imageView.setImageResource(R.drawable.nophotos);
}
@ -534,7 +534,7 @@ public class PhotoPickerActivity extends BaseFragment implements NotificationCen
imageView.setTag(i);
view.setTag(i);
if (photoEntry.path != null) {
imageView.setImage(photoEntry.path, "100_100", R.drawable.nophotos);
imageView.setImage("thumb://" + photoEntry.imageId + ":" + photoEntry.path, "100_100", R.drawable.nophotos);
} else {
imageView.setImageResource(R.drawable.nophotos);
}

View File

@ -34,7 +34,10 @@ import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.ScaleAnimation;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
@ -81,7 +84,8 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private boolean isActionBarVisible = true;
private WindowManager.LayoutParams windowLayoutParams;
private FrameLayoutTouchListener containerView;
private FrameLayoutDrawer containerView;
private FrameLayoutTouchListener windowView;
private ClippingImageView animatingImageView;
private FrameLayout bottomLayout;
private TextView nameTextView;
@ -97,7 +101,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private boolean canShowBottom = true;
private boolean overlayViewVisible = true;
private boolean animationInProgress = false;
private int animationInProgress = 0;
private boolean disableShowCheck = false;
private ImageReceiver leftImage = new ImageReceiver();
@ -229,11 +233,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
return getInstance().onTouchEvent(event);
}
@Override
protected void onDraw(Canvas canvas) {
getInstance().onDraw(canvas);
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
@ -241,6 +240,18 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
}
private static class FrameLayoutDrawer extends FrameLayout {
public FrameLayoutDrawer(Context context) {
super(context);
setWillNotDraw(false);
}
@Override
protected void onDraw(Canvas canvas) {
getInstance().onDraw(canvas);
}
}
private static volatile PhotoViewer Instance = null;
public static PhotoViewer getInstance() {
PhotoViewer localInstance = Instance;
@ -404,9 +415,21 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
public void setParentActivity(Activity activity) {
parentActivity = activity;
containerView = new FrameLayoutTouchListener(activity);
containerView.setBackgroundDrawable(backgroundDrawable);
windowView = new FrameLayoutTouchListener(activity);
windowView.setBackgroundDrawable(backgroundDrawable);
windowView.setFocusable(false);
animatingImageView = new ClippingImageView(windowView.getContext());
windowView.addView(animatingImageView);
containerView = new FrameLayoutDrawer(activity);
containerView.setFocusable(false);
windowView.addView(containerView);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)containerView.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
containerView.setLayoutParams(layoutParams);
windowLayoutParams = new WindowManager.LayoutParams();
windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
@ -416,13 +439,10 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
windowLayoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION;
windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
animatingImageView = new ClippingImageView(containerView.getContext());
containerView.addView(animatingImageView);
actionBar = new ActionBar(activity);
containerView.addView(actionBar);
actionBar.setBackgroundColor(0xdd000000);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)actionBar.getLayoutParams();
actionBar.setBackgroundColor(0x7F000000);
layoutParams = (FrameLayout.LayoutParams)actionBar.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
actionBar.setLayoutParams(layoutParams);
actionBarLayer = actionBar.createLayer();
@ -510,7 +530,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
layoutParams.height = Utilities.dp(48);
layoutParams.gravity = Gravity.BOTTOM | Gravity.LEFT;
bottomLayout.setLayoutParams(layoutParams);
bottomLayout.setBackgroundColor(0xdd000000);
bottomLayout.setBackgroundColor(0x7F000000);
ImageView shareButton = new ImageView(containerView.getContext());
shareButton.setImageResource(R.drawable.ic_ab_share_white);
@ -1111,13 +1131,13 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
if (!init) {
if (currentPlaceObject != null) {
if (android.os.Build.VERSION.SDK_INT >= 11 && currentPlaceObject != null) {
currentPlaceObject.imageReceiver.setVisible(true, true);
}
}
currentPlaceObject = placeProvider.getPlaceForPhoto(currentMessageObject, currentFileLocation, currentIndex);
if (!init) {
if (currentPlaceObject != null) {
if (android.os.Build.VERSION.SDK_INT >= 11 && currentPlaceObject != null) {
currentPlaceObject.imageReceiver.setVisible(false, true);
}
}
@ -1253,15 +1273,15 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
public boolean isShowingImage(MessageObject object) {
return !disableShowCheck && object != null && currentMessageObject != null && currentMessageObject.messageOwner.id == object.messageOwner.id;
return android.os.Build.VERSION.SDK_INT >= 11 && isVisible && !disableShowCheck && object != null && currentMessageObject != null && currentMessageObject.messageOwner.id == object.messageOwner.id;
}
public boolean isShowingImage(TLRPC.FileLocation object) {
return !disableShowCheck && object != null && currentFileLocation != null && object.local_id == currentFileLocation.local_id && object.volume_id == currentFileLocation.volume_id && object.dc_id == currentFileLocation.dc_id;
return android.os.Build.VERSION.SDK_INT >= 11 && isVisible && !disableShowCheck && object != null && currentFileLocation != null && object.local_id == currentFileLocation.local_id && object.volume_id == currentFileLocation.volume_id && object.dc_id == currentFileLocation.dc_id;
}
public boolean isShowingImage(String object) {
return !disableShowCheck && object != null && currentPathObject != null && object.equals(currentPathObject);
return android.os.Build.VERSION.SDK_INT >= 11 && isVisible && !disableShowCheck && object != null && currentPathObject != null && object.equals(currentPathObject);
}
public void openPhoto(final MessageObject messageObject, final PhotoViewerProvider provider) {
@ -1281,7 +1301,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
public void openPhoto(final MessageObject messageObject, final TLRPC.FileLocation fileLocation, final ArrayList<MessageObject> messages, final ArrayList<MediaController.PhotoEntry> photos, final int index, final PhotoViewerProvider provider) {
if (parentActivity == null || isVisible || provider == null || animationInProgress || messageObject == null && fileLocation == null && messages == null && photos == null) {
if (parentActivity == null || isVisible || provider == null || animationInProgress != 0 || messageObject == null && fileLocation == null && messages == null && photos == null) {
return;
}
final PlaceProviderObject object = provider.getPlaceForPhoto(messageObject, fileLocation, index);
@ -1299,7 +1319,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
placeProvider = provider;
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
wm.addView(containerView, windowLayoutParams);
wm.addView(windowView, windowLayoutParams);
if (velocityTracker == null) {
velocityTracker = VelocityTracker.obtain();
@ -1315,7 +1335,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if(android.os.Build.VERSION.SDK_INT >= 11) {
Utilities.lockOrientation(parentActivity);
animationInProgress = true;
animationInProgress = 1;
animatingImageView.setVisibility(View.VISIBLE);
animatingImageView.setImageBitmap(object.thumb);
@ -1370,18 +1390,16 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
ObjectAnimator.ofInt(animatingImageView, "clipHorizontal", clipHorizontal, 0),
ObjectAnimator.ofInt(animatingImageView, "clipTop", clipTop, 0),
ObjectAnimator.ofInt(animatingImageView, "clipBottom", clipBottom, 0),
ObjectAnimator.ofFloat(actionBar, "alpha", 0.0f, 1.0f),
ObjectAnimator.ofFloat(bottomLayout, "alpha", 0.0f, 1.0f),
ObjectAnimator.ofFloat(progressBar, "alpha", 0.0f, 1.0f),
ObjectAnimator.ofFloat(currentOverlay, "alpha", 0.0f, 1.0f),
ObjectAnimator.ofFloat(checkImageView, "alpha", 0.0f, 1.0f)
ObjectAnimator.ofFloat(containerView, "alpha", 0.0f, 1.0f),
ObjectAnimator.ofFloat(currentOverlay, "alpha", 1.0f)
);
animatorSet.setDuration(250);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
animationInProgress = false;
animationInProgress = 0;
containerView.invalidate();
animatingImageView.setVisibility(View.GONE);
Utilities.unlockOrientation(parentActivity);
}
@ -1393,19 +1411,33 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
public void onDraw() {
disableShowCheck = false;
animatingImageView.setOnDrawListener(null);
object.imageReceiver.setVisible(false, true);
if (android.os.Build.VERSION.SDK_INT >= 11) {
object.imageReceiver.setVisible(false, true);
}
}
});
return true;
}
});
} else {
containerView.invalidate();
AnimationSet animationSet = new AnimationSet(true);
AlphaAnimation animation = new AlphaAnimation(0.0f, 1.0f);
animation.setDuration(150);
animation.setFillAfter(false);
animationSet.addAnimation(animation);
ScaleAnimation scaleAnimation = new ScaleAnimation(0.9f, 1.0f, 0.9f, 1.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(150);
scaleAnimation.setFillAfter(false);
animationSet.addAnimation(scaleAnimation);
animationSet.setDuration(150);
containerView.startAnimation(animationSet);
disableShowCheck = false;
}
}
public void closePhoto(boolean animated) {
if (parentActivity == null || !isVisible || animationInProgress) {
if (parentActivity == null || !isVisible || animationInProgress != 0) {
return;
}
@ -1430,7 +1462,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if(android.os.Build.VERSION.SDK_INT >= 11 && animated) {
Utilities.lockOrientation(parentActivity);
animationInProgress = true;
animationInProgress = 1;
animatingImageView.setVisibility(View.VISIBLE);
AnimatorSet animatorSet = new AnimatorSet();
@ -1460,7 +1492,9 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animatingImageView.setScaleY(scale * scale2);
if (object != null) {
object.imageReceiver.setVisible(false, true);
if (android.os.Build.VERSION.SDK_INT >= 11) {
object.imageReceiver.setVisible(false, true);
}
int clipHorizontal = Math.abs(object.imageReceiver.drawRegion.left - object.imageReceiver.imageX);
int clipVertical = Math.abs(object.imageReceiver.drawRegion.top - object.imageReceiver.imageY);
@ -1487,22 +1521,14 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
ObjectAnimator.ofInt(animatingImageView, "clipHorizontal", clipHorizontal),
ObjectAnimator.ofInt(animatingImageView, "clipTop", clipTop),
ObjectAnimator.ofInt(animatingImageView, "clipBottom", clipBottom),
ObjectAnimator.ofFloat(actionBar, "alpha", 0.0f),
ObjectAnimator.ofFloat(bottomLayout, "alpha", 0.0f),
ObjectAnimator.ofFloat(progressBar, "alpha", 0.0f),
ObjectAnimator.ofFloat(currentOverlay, "alpha", 0.0f),
ObjectAnimator.ofFloat(checkImageView, "alpha", 0.0f)
ObjectAnimator.ofFloat(containerView, "alpha", 0.0f)
);
} else {
animatorSet.playTogether(
ObjectAnimator.ofInt(backgroundDrawable, "alpha", 0),
ObjectAnimator.ofFloat(actionBar, "alpha", 0.0f),
ObjectAnimator.ofFloat(animatingImageView, "alpha", 0.0f),
ObjectAnimator.ofFloat(bottomLayout, "alpha", 0.0f),
ObjectAnimator.ofFloat(progressBar, "alpha", 0.0f),
ObjectAnimator.ofFloat(animatingImageView, "translationY", translationY >= 0 ? Utilities.displaySize.y : -Utilities.displaySize.y),
ObjectAnimator.ofFloat(currentOverlay, "alpha", 0.0f),
ObjectAnimator.ofFloat(checkImageView, "alpha", 0.0f)
ObjectAnimator.ofFloat(containerView, "alpha", 0.0f)
);
}
@ -1511,13 +1537,41 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
@Override
public void onAnimationEnd(Animator animation) {
Utilities.unlockOrientation(parentActivity);
animationInProgress = false;
animationInProgress = 0;
onPhotoClosed(object);
}
});
animatorSet.start();
} else {
onPhotoClosed(object);
AnimationSet animationSet = new AnimationSet(true);
AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f);
animation.setDuration(150);
animation.setFillAfter(false);
animationSet.addAnimation(animation);
ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.9f, 1.0f, 0.9f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
scaleAnimation.setDuration(150);
scaleAnimation.setFillAfter(false);
animationSet.addAnimation(scaleAnimation);
animationSet.setDuration(150);
animationInProgress = 2;
animationSet.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
animationInProgress = 0;
onPhotoClosed(object);
}
@Override
public void onAnimationRepeat(Animation animation) {
}
});
containerView.startAnimation(animationSet);
}
}
@ -1530,15 +1584,21 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
centerImage.setImageBitmap((Bitmap)null);
leftImage.setImageBitmap((Bitmap) null);
rightImage.setImageBitmap((Bitmap)null);
if (object != null) {
if (android.os.Build.VERSION.SDK_INT >= 11 && object != null) {
object.imageReceiver.setVisible(true, true);
}
containerView.post(new Runnable() {
@Override
public void run() {
animatingImageView.setImageBitmap(null);
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
wm.removeView(containerView);
try {
WindowManager wm = (WindowManager) parentActivity.getSystemService(Context.WINDOW_SERVICE);
if (windowView.getParent() != null) {
wm.removeView(windowView);
}
} catch (Exception e) {
FileLog.e("tmessages", e);
}
}
});
if (placeProvider != null) {
@ -1570,7 +1630,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
private boolean onTouchEvent(MotionEvent ev) {
if (animationInProgress || animationStartTime != 0) {
if (animationInProgress != 0 || animationStartTime != 0) {
if (animationStartTime == 0) {
Utilities.unlockOrientation(parentActivity);
}
@ -1798,7 +1858,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
}
private void onDraw(Canvas canvas) {
if (animationInProgress || !isVisible) {
if (animationInProgress == 1 || !isVisible && animationInProgress != 2) {
return;
}

View File

@ -221,6 +221,7 @@ public class SettingsActivity extends BaseFragment implements NotificationCenter
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("Settings", R.string.Settings));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@Override

View File

@ -68,6 +68,7 @@ public class SettingsBlockedUsers extends BaseFragment implements NotificationCe
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("BlockedUsers", R.string.BlockedUsers));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@Override

View File

@ -59,9 +59,9 @@ public class SettingsChangeNameActivity extends BaseFragment {
}
});
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel));
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
TextView textView = (TextView)doneButton.findViewById(R.id.done_button_text);
textView.setText(LocaleController.getString("Done", R.string.Done));
textView.setText(LocaleController.getString("Done", R.string.Done).toUpperCase());
fragmentView = inflater.inflate(R.layout.settings_change_name_layout, container, false);

View File

@ -98,6 +98,7 @@ public class SettingsNotificationsActivity extends BaseFragment {
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
actionBarLayer.setTitle(LocaleController.getString("NotificationsAndSounds", R.string.NotificationsAndSounds));
actionBarLayer.setActionBarMenuOnItemClick(new ActionBarLayer.ActionBarMenuOnItemClick() {
@Override

View File

@ -143,9 +143,9 @@ public class SettingsWallpapersActivity extends BaseFragment implements Notifica
}
});
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel));
cancelButton.setText(LocaleController.getString("Cancel", R.string.Cancel).toUpperCase());
TextView textView = (TextView)doneButton.findViewById(R.id.done_button_text);
textView.setText(LocaleController.getString("Set", R.string.Set));
textView.setText(LocaleController.getString("Set", R.string.Set).toUpperCase());
fragmentView = inflater.inflate(R.layout.settings_wallpapers_layout, container, false);
listAdapter = new ListAdapter(getParentActivity());

View File

@ -135,6 +135,7 @@ public class UserProfileActivity extends BaseFragment implements NotificationCen
public View createView(LayoutInflater inflater, ViewGroup container) {
if (fragmentView == null) {
actionBarLayer.setDisplayHomeAsUpEnabled(true, R.drawable.ic_ab_back);
actionBarLayer.setBackOverlay(R.layout.updating_state_layout);
if (dialog_id != 0) {
actionBarLayer.setTitle(LocaleController.getString("SecretTitle", R.string.SecretTitle));
actionBarLayer.setTitleIcon(R.drawable.ic_lock_white, Utilities.dp(4));

View File

@ -29,9 +29,8 @@ public class ActionBar extends FrameLayout {
private static Drawable logoDrawable;
protected ActionBarLayer currentLayer = null;
private ActionBarLayer previousLayer = null;
private View currentBackOverlay;
private View shadowView = null;
private int currentBackOverlayWidth;
private boolean isBackOverlayVisible;
public ActionBar(Context context) {
super(context);
@ -87,42 +86,19 @@ public class ActionBar extends FrameLayout {
layoutParams.height = LayoutParams.MATCH_PARENT;
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
layer.setLayoutParams(layoutParams);
updateBackOverlay(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
currentLayer.setBackOverlayVisible(isBackOverlayVisible);
if(android.os.Build.VERSION.SDK_INT >= 11) {
layer.setAlpha(1);
}
}
public void setBackOverlay(View view, int width) {
if (currentBackOverlay != null) {
removeView(currentBackOverlay);
}
if (view != null) {
addView(view);
}
currentBackOverlayWidth = width;
currentBackOverlay = view;
updateBackOverlay(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY));
}
private void updateBackOverlay(int widthMeasureSpec, int heightMeasureSpec) {
public void setBackOverlayVisible(boolean visible) {
isBackOverlayVisible = visible;
if (currentLayer != null) {
currentLayer.setBackLayoutVisible(currentLayer.isSearchFieldVisible || currentBackOverlay == null ? VISIBLE : INVISIBLE);
currentLayer.setBackOverlayVisible(visible);
}
if (currentBackOverlay != null) {
ViewGroup.LayoutParams layoutParams = currentBackOverlay.getLayoutParams();
if (currentLayer != null) {
currentBackOverlay.setVisibility(currentLayer.isSearchFieldVisible ? GONE : VISIBLE);
currentLayer.measure(widthMeasureSpec, heightMeasureSpec);
layoutParams.width = Math.min(currentBackOverlayWidth, currentLayer.getBackLayoutWidth());
} else {
currentBackOverlay.setVisibility(VISIBLE);
layoutParams.width = LayoutParams.WRAP_CONTENT;
}
if (layoutParams.width != 0) {
layoutParams.height = LayoutParams.MATCH_PARENT;
currentBackOverlay.setLayoutParams(layoutParams);
}
if (previousLayer != null) {
previousLayer.setBackOverlayVisible(visible);
}
}
@ -142,6 +118,7 @@ public class ActionBar extends FrameLayout {
layer.setLayoutParams(layoutParams);
shadowView.setX(-Utilities.dp(2));
shadowView.setVisibility(VISIBLE);
previousLayer.setBackOverlayVisible(isBackOverlayVisible);
}
public void stopMoving(boolean backAnimation) {
@ -153,6 +130,7 @@ public class ActionBar extends FrameLayout {
removeView(currentLayer);
currentLayer = previousLayer;
currentLayer.setAlpha(1);
previousLayer = null;
} else {
removeView(previousLayer);
previousLayer = null;
@ -192,7 +170,6 @@ public class ActionBar extends FrameLayout {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
updateBackOverlay(widthMeasureSpec, heightMeasureSpec);
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(Utilities.dp(40), MeasureSpec.EXACTLY));
} else {

View File

@ -13,6 +13,7 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
@ -24,6 +25,7 @@ import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
@ -97,6 +99,7 @@ public class ActionBarActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
try {
openAnimation = AnimationUtils.loadAnimation(this, R.anim.scale_in);
@ -511,6 +514,7 @@ public class ActionBarActivity extends Activity {
transitionAnimationStartTime = 0;
fragment.onOpenAnimationEnd();
presentFragmentInternalRemoveOld(removeLast, currentFragment);
listener = null;
}
}
@ -585,6 +589,7 @@ public class ActionBarActivity extends Activity {
transitionAnimationInProgress = false;
transitionAnimationStartTime = 0;
closeLastFragmentInternalRemoveOld(currentFragment);
listener = null;
}
}
@ -653,6 +658,10 @@ public class ActionBarActivity extends Activity {
return super.onKeyUp(keyCode, event);
}
public void onOverlayShow(View view, BaseFragment fragment) {
}
@Override
public void onActionModeStarted(ActionMode mode) {
super.onActionModeStarted(mode);
@ -670,4 +679,14 @@ public class ActionBarActivity extends Activity {
public boolean onPreIme() {
return false;
}
@Override
public void startActivityForResult(Intent intent, int requestCode) {
if (transitionAnimationInProgress && listener != null) {
openAnimation.cancel();
closeAnimation.cancel();
listener.onAnimationEnd(null);
}
super.startActivityForResult(intent, requestCode);
}
}

View File

@ -48,9 +48,11 @@ public class ActionBarLayer extends FrameLayout {
protected ActionBar parentActionBar;
private boolean oldUseLogo;
private boolean oldUseBack;
private boolean isBackLayoutHidden = false;
private View actionOverlay;
protected boolean isSearchFieldVisible;
protected int itemsBackgroundResourceId;
private boolean isBackOverlayVisible;
protected BaseFragment parentFragment;
public ActionBarMenuOnItemClick actionBarMenuOnItemClick;
public ActionBarLayer(Context context, ActionBar actionBar) {
@ -340,18 +342,6 @@ public class ActionBarLayer extends FrameLayout {
addView(view);
}
public void setBackLayoutVisible(int visibility) {
isBackLayoutHidden = visibility != VISIBLE;
backButtonFrameLayout.setVisibility(isSearchFieldVisible ? VISIBLE : visibility);
}
public int getBackLayoutWidth() {
if (menu != null) {
return getMeasuredWidth() - menu.getMeasuredWidth();
}
return getMeasuredWidth();
}
public ActionBarMenu createActionMode() {
if (actionMode != null) {
return actionMode;
@ -419,11 +409,7 @@ public class ActionBarLayer extends FrameLayout {
} else {
setDisplayHomeAsUpEnabled(oldUseBack, backResourceId);
}
if (visible) {
backButtonFrameLayout.setVisibility(VISIBLE);
} else {
backButtonFrameLayout.setVisibility(isBackLayoutHidden ? INVISIBLE : VISIBLE);
}
positionBackOverlay(getMeasuredWidth(), getMeasuredHeight());
}
public void closeSearchField() {
@ -439,6 +425,7 @@ public class ActionBarLayer extends FrameLayout {
positionBackImage(MeasureSpec.getSize(heightMeasureSpec));
positionMenu(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
positionTitle(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
positionBackOverlay(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.getSize(heightMeasureSpec));
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@ -464,6 +451,45 @@ public class ActionBarLayer extends FrameLayout {
}
}
public void setBackOverlay(int resourceId) {
LayoutInflater li = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
actionOverlay = li.inflate(resourceId, null);
addView(actionOverlay);
actionOverlay.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (actionBarMenuOnItemClick != null) {
actionBarMenuOnItemClick.onItemClick(-1);
}
}
});
}
public void setBackOverlayVisible(boolean visible) {
if (actionOverlay == null) {
return;
}
isBackOverlayVisible = visible;
positionBackOverlay(getMeasuredWidth(), getMeasuredHeight());
if (visible) {
((ActionBarActivity)getContext()).onOverlayShow(actionOverlay, parentFragment);
}
}
private void positionBackOverlay(int widthMeasureSpec, int heightMeasureSpec) {
if (actionOverlay == null) {
return;
}
backButtonFrameLayout.setVisibility(isSearchFieldVisible || actionOverlay == null || actionOverlay.getVisibility() == GONE ? VISIBLE : INVISIBLE);
actionOverlay.setVisibility(!isSearchFieldVisible && isBackOverlayVisible ? VISIBLE : GONE);
if (actionOverlay.getVisibility() == VISIBLE) {
ViewGroup.LayoutParams layoutParams = actionOverlay.getLayoutParams();
layoutParams.width = widthMeasureSpec - (menu != null ? menu.getMeasuredWidth() : 0);
layoutParams.height = LayoutParams.MATCH_PARENT;
actionOverlay.setLayoutParams(layoutParams);
}
}
public void setItemsBackground(int resourceId) {
itemsBackgroundResourceId = resourceId;
backButtonFrameLayout.setBackgroundResource(itemsBackgroundResourceId);

View File

@ -61,6 +61,7 @@ public class BaseFragment {
actionBarLayer.onDestroy();
}
actionBarLayer = parentActivity.getInternalActionBar().createLayer();
actionBarLayer.parentFragment = this;
actionBarLayer.setBackgroundResource(R.color.header);
actionBarLayer.setItemsBackground(R.drawable.bar_selector);
}

View File

@ -16,6 +16,7 @@
android:numColumns="auto_fit"
android:stretchMode="columnWidth"
android:gravity="center"
android:listSelector="@drawable/list_selector"
android:layout_gravity="top"/>
<TextView android:layout_width="match_parent"

View File

@ -25,6 +25,7 @@
android:textColor="#ffffffff"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="end"
android:maxLines="1"
android:layout_marginLeft="8dp"/>

View File

@ -22,7 +22,8 @@
android:stretchMode="columnWidth"
android:gravity="center"
android:layout_gravity="top"
android:scrollbars="none"/>
android:scrollbars="none"
android:listSelector="@drawable/list_selector"/>
<TextView
android:layout_width="match_parent"

View File

@ -16,15 +16,17 @@
android:layout_gravity="center_vertical|left"
android:layout_marginLeft="12dp"/>
<ImageView android:layout_height="wrap_content"
<ImageView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:src="@drawable/ic_ab_back"
android:layout_gravity="center_vertical|left"
android:layout_marginLeft="3dp"
android:id="@+id/back_button"/>
<TextView android:layout_height="wrap_content"
android:layout_width="wrap_content"
<TextView
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginLeft="52dp"
android:textColor="#ffffff"
android:textSize="17dp"

View File

@ -109,7 +109,7 @@
<string name="YouWereKicked">لقد تم إخراجك من هذه المجموعة</string>
<string name="YouLeft">لقد قمت بمغادرة المجموعة</string>
<string name="DeleteThisGroup">حذف المجموعة</string>
<string name="DeleteThisChat">Delete this chat</string>
<string name="DeleteThisChat">حذف هذه الدردشة</string>
<string name="SlideToCancel">قم بالسحب للإلغاء</string>
<string name="SaveToDownloads">حفظ في الجهاز</string>
<string name="ApplyLocalizationFile">تطبيق ملف التعريب</string>
@ -258,18 +258,20 @@
<string name="Pebble">PEBBLE</string>
<string name="Language">اللغة</string>
<string name="AskAQuestionInfo">نرجو الأخذ بالعلم أن الدعم الفني في تيليجرام يقوم به مجموعة من المتطوعين. نحاول الرد بسرعة قدر المستطاع، لكن ربما نستغرق القليل من الوقت.<![CDATA[<br><br>]]>يرجى الإطلاع على <![CDATA[<a href="http://telegram.org/faq/ar">صفحة الأسئلة الأكثر شيوعًا</a>]]>: يوجد بها حلول للمشاكل وإجابات لمعظم الأسئلة.</string>
<string name="AskButton">اسأل متطوع</string>
<string name="TelegramFaq">Telegram FAQ</string>
<string name="AskButton">اسأل أحد المتطوعين</string>
<string name="TelegramFaq">الأسئلة الشائعة عن تيليجرام</string>
<string name="TelegramFaqUrl">https://telegram.org/faq/ar</string>
<string name="DeleteLocalization">Delete localization?</string>
<string name="IncorrectLocalization">Incorrect localization file</string>
<string name="Enabled">Enabled</string>
<string name="Disabled">Disabled</string>
<string name="NotificationsService">Notifications Service</string>
<string name="NotificationsServiceDisableInfo">If google play services are enough for you to receive notifications, you can disable Notifications Service. However we recommend you to leave it enabled to keep app running in background and receive instant notifications.</string>
<string name="SortBy">Sort By</string>
<string name="ImportContacts">Import Contacts</string>
<string name="WiFiOnly">via WiFi only</string>
<string name="DeleteLocalization">حذف التعريب؟</string>
<string name="IncorrectLocalization">ملف التعريب غير صحيح</string>
<string name="Enabled">تمكين</string>
<string name="Disabled">تعطيل</string>
<string name="NotificationsService">خدمة الإشعارات</string>
<string name="NotificationsServiceDisableInfo">إذا كانت خدمات Google play كافية بالنسبة لك لتلقي الإشعارات ، يمكنك تعطيل " خدمة الإشعارات " . ومع ذلك نحن نوصي بترك هذه الخدمة مفعلة للحفاظ على تشغيل التطبيق في الخلفية ، ولتلقي إشعارات الدردشة .</string>
<string name="SortBy">فرز حسب</string>
<string name="ImportContacts">استيراد جهات الاتصال</string>
<string name="WiFiOnly">بواسطة WiFi فقط</string>
<string name="SortFirstName">الاسم الأول</string>
<string name="SortLastName">اسم العائلة</string>
<!--media view-->
<string name="NoMedia">لا توجد وسائط بعد</string>
@ -339,8 +341,8 @@
<string name="AttachDocument">مستند</string>
<string name="AttachAudio">مقطع صوتي</string>
<string name="FromYou">أنت</string>
<string name="ActionTakeScreenshootYou">You took a screenshot!</string>
<string name="ActionTakeScreenshoot">un1 took a screenshot!</string>
<string name="ActionTakeScreenshootYou">أنت أخذت لقطة للشاشة !</string>
<string name="ActionTakeScreenshoot">un1 أخذ لقطة للشاشة !</string>
<!--Alert messages-->
<string name="InvalidPhoneNumber">رقم الهاتف غير صحيح</string>

View File

@ -109,7 +109,7 @@
<string name="YouWereKicked">Du wurdest aus der Gruppe entfernt</string>
<string name="YouLeft">Du hast die Gruppe verlassen</string>
<string name="DeleteThisGroup">Diese Gruppe löschen</string>
<string name="DeleteThisChat">Delete this chat</string>
<string name="DeleteThisChat">Diesen Chat löschen</string>
<string name="SlideToCancel">WISCHEN UM ABZUBRECHEN</string>
<string name="SaveToDownloads">In Ordner Downloads speichern</string>
<string name="ApplyLocalizationFile">Sprachdatei benutzen</string>
@ -263,13 +263,15 @@
<string name="TelegramFaqUrl">https://telegram.org/faq</string>
<string name="DeleteLocalization">Lokalisierung löschen?</string>
<string name="IncorrectLocalization">Falsche Sprachdatei</string>
<string name="Enabled">Enabled</string>
<string name="Disabled">Disabled</string>
<string name="NotificationsService">Notifications Service</string>
<string name="NotificationsServiceDisableInfo">If google play services are enough for you to receive notifications, you can disable Notifications Service. However we recommend you to leave it enabled to keep app running in background and receive instant notifications.</string>
<string name="SortBy">Sort By</string>
<string name="ImportContacts">Import Contacts</string>
<string name="WiFiOnly">via WiFi only</string>
<string name="Enabled">Aktiviert</string>
<string name="Disabled">Deaktiviert</string>
<string name="NotificationsService">Benachrichtigungsdienst</string>
<string name="NotificationsServiceDisableInfo">Sofern Google Play Dienste ausreichend für deine Benachrichtigungen sind, kannst du unseren Benachrichtigungsdienst abschalten. Wir empfehlen allerdings, unseren Dienst dauerhaft aktiviert zu lassen um über neue Nachrichten in Echtzeit informiert zu werden.</string>
<string name="SortBy">sortiert nach</string>
<string name="ImportContacts">Kontakte importieren</string>
<string name="WiFiOnly">nur über WLAN</string>
<string name="SortFirstName">Vorname</string>
<string name="SortLastName">Nachname</string>
<!--media view-->
<string name="NoMedia">Noch keine geteilten Medien vorhanden</string>
@ -339,8 +341,8 @@
<string name="AttachDocument">Dokument</string>
<string name="AttachAudio">Audio</string>
<string name="FromYou">Du</string>
<string name="ActionTakeScreenshootYou">You took a screenshot!</string>
<string name="ActionTakeScreenshoot">un1 took a screenshot!</string>
<string name="ActionTakeScreenshootYou">Du hast ein Bildschirmfoto gemacht!</string>
<string name="ActionTakeScreenshoot">un1 hat ein Bildschirmfoto gemacht!</string>
<!--Alert messages-->
<string name="InvalidPhoneNumber">Ungültige Telefonnummer</string>

View File

@ -109,7 +109,7 @@
<string name="YouWereKicked">Has sido expulsado de este grupo</string>
<string name="YouLeft">Has abandonado este grupo</string>
<string name="DeleteThisGroup">Eliminar este grupo</string>
<string name="DeleteThisChat">Delete this chat</string>
<string name="DeleteThisChat">Eliminar esta conversación</string>
<string name="SlideToCancel">DESLIZA PARA CANCELAR</string>
<string name="SaveToDownloads">Guardar en descargas</string>
<string name="ApplyLocalizationFile">Aplicar fichero de localización</string>
@ -263,13 +263,15 @@
<string name="TelegramFaqUrl">https://telegram.org/faq/es</string>
<string name="DeleteLocalization">¿Eliminar localización?</string>
<string name="IncorrectLocalization">Fichero de localización incorrecto</string>
<string name="Enabled">Enabled</string>
<string name="Disabled">Disabled</string>
<string name="NotificationsService">Notifications Service</string>
<string name="NotificationsServiceDisableInfo">If google play services are enough for you to receive notifications, you can disable Notifications Service. However we recommend you to leave it enabled to keep app running in background and receive instant notifications.</string>
<string name="SortBy">Sort By</string>
<string name="ImportContacts">Import Contacts</string>
<string name="WiFiOnly">via WiFi only</string>
<string name="Enabled">Activado</string>
<string name="Disabled">Desactivado</string>
<string name="NotificationsService">Servicio de notificaciones</string>
<string name="NotificationsServiceDisableInfo">Si los servicios de google play son suficientes para recibir notificaciones, puedes desactivar el \'Servicio de notificaciones\'. Sin embargo, te recomendamos activarlos para mantener la aplicación funcionando en segundo plano y recibir notificaciones de forma instantánea.</string>
<string name="SortBy">Ordenar por</string>
<string name="ImportContacts">Importar contactos</string>
<string name="WiFiOnly">Sólo vía WiFi</string>
<string name="SortFirstName">Nombre</string>
<string name="SortLastName">Apellido</string>
<!--media view-->
<string name="NoMedia">No hay fotos ni vídeos compartidos aún</string>
@ -339,8 +341,8 @@
<string name="AttachDocument">Archivo</string>
<string name="AttachAudio">Audio</string>
<string name="FromYou"></string>
<string name="ActionTakeScreenshootYou">You took a screenshot!</string>
<string name="ActionTakeScreenshoot">un1 took a screenshot!</string>
<string name="ActionTakeScreenshootYou">¡Hiciste una captura de pantalla!</string>
<string name="ActionTakeScreenshoot">¡un1 hizo una captura de pantalla!</string>
<!--Alert messages-->
<string name="InvalidPhoneNumber">Número de teléfono inválido</string>

View File

@ -109,7 +109,7 @@
<string name="YouWereKicked">Sei stato espulso da questo gruppo</string>
<string name="YouLeft">Hai lasciato il gruppo</string>
<string name="DeleteThisGroup">Elimina questo gruppo</string>
<string name="DeleteThisChat">Delete this chat</string>
<string name="DeleteThisChat">Elimina questa chat</string>
<string name="SlideToCancel">TRASCINA PER ANNULLARE</string>
<string name="SaveToDownloads">Salva in download</string>
<string name="ApplyLocalizationFile">Applica file di localizzazione</string>
@ -263,13 +263,15 @@
<string name="TelegramFaqUrl">https://telegram.org/faq</string>
<string name="DeleteLocalization">Eliminare la localizzazione?</string>
<string name="IncorrectLocalization">File della localizzazione non valido</string>
<string name="Enabled">Enabled</string>
<string name="Disabled">Disabled</string>
<string name="NotificationsService">Notifications Service</string>
<string name="NotificationsServiceDisableInfo">If google play services are enough for you to receive notifications, you can disable Notifications Service. However we recommend you to leave it enabled to keep app running in background and receive instant notifications.</string>
<string name="SortBy">Sort By</string>
<string name="ImportContacts">Import Contacts</string>
<string name="WiFiOnly">via WiFi only</string>
<string name="Enabled">Abilitato</string>
<string name="Disabled">Disabilitato</string>
<string name="NotificationsService">Servizio notifiche</string>
<string name="NotificationsServiceDisableInfo">Se i servizi di Google Play ti bastano per ricevere le notifiche, puoi disabilitare il Servizio notifiche. Tuttavia sarebbe meglio lasciarlo abilitato al fine di mantenere l\'applicazione attiva in background e ricevere notifiche istantanee.</string>
<string name="SortBy">Ordina per</string>
<string name="ImportContacts">Importa contatti</string>
<string name="WiFiOnly">solo tramite WiFi</string>
<string name="SortFirstName">Nome</string>
<string name="SortLastName">Cognome</string>
<!--media view-->
<string name="NoMedia">Nessun media condiviso</string>
@ -339,8 +341,8 @@
<string name="AttachDocument">Documento</string>
<string name="AttachAudio">Audio</string>
<string name="FromYou">Tu</string>
<string name="ActionTakeScreenshootYou">You took a screenshot!</string>
<string name="ActionTakeScreenshoot">un1 took a screenshot!</string>
<string name="ActionTakeScreenshootYou">Hai catturato la schermata!</string>
<string name="ActionTakeScreenshoot">un1 ha catturato la schermata!</string>
<!--Alert messages-->
<string name="InvalidPhoneNumber">Numero di telefono non valido</string>

View File

@ -109,7 +109,7 @@
<string name="YouWereKicked">U bent verwijderd uit deze groep</string>
<string name="YouLeft">U hebt deze groep verlaten</string>
<string name="DeleteThisGroup">Deze groep verwijderen</string>
<string name="DeleteThisChat">Delete this chat</string>
<string name="DeleteThisChat">Verwijder dit gesprek</string>
<string name="SlideToCancel">SLEEP OM TE ANNULEREN</string>
<string name="SaveToDownloads">Opslaan in Downloads</string>
<string name="ApplyLocalizationFile">Vertaling toepassen</string>
@ -263,13 +263,15 @@
<string name="TelegramFaqUrl">https://telegram.org/faq</string>
<string name="DeleteLocalization">Verwijder vertaling?</string>
<string name="IncorrectLocalization">Ongeldig vertalingsbestand</string>
<string name="Enabled">Enabled</string>
<string name="Disabled">Disabled</string>
<string name="NotificationsService">Notifications Service</string>
<string name="NotificationsServiceDisableInfo">If google play services are enough for you to receive notifications, you can disable Notifications Service. However we recommend you to leave it enabled to keep app running in background and receive instant notifications.</string>
<string name="SortBy">Sort By</string>
<string name="ImportContacts">Import Contacts</string>
<string name="WiFiOnly">via WiFi only</string>
<string name="Enabled">Inschakelen</string>
<string name="Disabled">Uitschakelen</string>
<string name="NotificationsService">Meldingen service</string>
<string name="NotificationsServiceDisableInfo">Als Google Play services genoeg is om notificaties te ontvang, kan de meldingen service worden uitgeschakeld. Echter, we adviseren de service ingeschakeld te laten zodat de app in de achtergrond blijft draaien en meldingen direct worden ontvangen.</string>
<string name="SortBy">Sorteren op</string>
<string name="ImportContacts">Importeer contacten</string>
<string name="WiFiOnly">alleen via WIFI</string>
<string name="SortFirstName">Voornaam</string>
<string name="SortLastName">Achternaam</string>
<!--media view-->
<string name="NoMedia">Nog geen media gedeeld</string>
@ -339,8 +341,8 @@
<string name="AttachDocument">Document</string>
<string name="AttachAudio">Geluidsbestand</string>
<string name="FromYou">U</string>
<string name="ActionTakeScreenshootYou">You took a screenshot!</string>
<string name="ActionTakeScreenshoot">un1 took a screenshot!</string>
<string name="ActionTakeScreenshootYou">U heeft een schermafbeelding gemaakt!</string>
<string name="ActionTakeScreenshoot">un1 maakte een schermafbeeling!</string>
<!--Alert messages-->
<string name="InvalidPhoneNumber">Ongeldig telefoonnummer</string>

View File

@ -8,7 +8,6 @@
<item name="android:colorBackground">@android:color/white</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:windowContentOverlay">@drawable/shadow</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="Theme.TMessages" parent="@android:style/Theme.Holo.Light">