Commit 01e0b7ae authored by DrKLO's avatar DrKLO

More bug fixes, new locales

parent 1cda12c7
...@@ -81,7 +81,7 @@ android { ...@@ -81,7 +81,7 @@ android {
defaultConfig { defaultConfig {
minSdkVersion 8 minSdkVersion 8
targetSdkVersion 19 targetSdkVersion 19
versionCode 248 versionCode 250
versionName "1.5.0" versionName "1.5.0"
} }
} }
...@@ -160,6 +160,22 @@ public class LocaleController { ...@@ -160,6 +160,22 @@ public class LocaleController {
sortedLanguages.add(localeInfo); sortedLanguages.add(localeInfo);
languagesDict.put(localeInfo.shortName, localeInfo); languagesDict.put(localeInfo.shortName, localeInfo);
localeInfo = new LocaleInfo();
localeInfo.name = "Português (Brasil)";
localeInfo.nameEnglish = "Portuguese (Brazil)";
localeInfo.shortName = "pt_BR";
localeInfo.pathToFile = null;
sortedLanguages.add(localeInfo);
languagesDict.put(localeInfo.shortName, localeInfo);
localeInfo = new LocaleInfo();
localeInfo.name = "Português (Portugal)";
localeInfo.nameEnglish = "Portuguese (Portugal)";
localeInfo.shortName = "pt_PT";
localeInfo.pathToFile = null;
sortedLanguages.add(localeInfo);
languagesDict.put(localeInfo.shortName, localeInfo);
loadOtherLanguages(); loadOtherLanguages();
for (LocaleInfo locale : otherLanguages) { for (LocaleInfo locale : otherLanguages) {
...@@ -382,7 +398,12 @@ public class LocaleController { ...@@ -382,7 +398,12 @@ public class LocaleController {
try { try {
Locale newLocale = null; Locale newLocale = null;
if (localeInfo.shortName != null) { if (localeInfo.shortName != null) {
newLocale = new Locale(localeInfo.shortName); String[] args = localeInfo.shortName.split("_");
if (args.length == 1) {
newLocale = new Locale(localeInfo.shortName);
} else {
newLocale = new Locale(args[0], args[1]);
}
if (newLocale != null) { if (newLocale != null) {
if (override) { if (override) {
languageOverride = localeInfo.shortName; languageOverride = localeInfo.shortName;
......
...@@ -949,6 +949,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel ...@@ -949,6 +949,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
currentTotalPcmDuration = getTotalPcmDuration(); currentTotalPcmDuration = getTotalPcmDuration();
audioTrackPlayer = new AudioTrack(AudioManager.STREAM_MUSIC, 48000, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, playerBufferSize, AudioTrack.MODE_STREAM); audioTrackPlayer = new AudioTrack(AudioManager.STREAM_MUSIC, 48000, AudioFormat.CHANNEL_OUT_MONO, AudioFormat.ENCODING_PCM_16BIT, playerBufferSize, AudioTrack.MODE_STREAM);
audioTrackPlayer.setStereoVolume(1.0f, 1.0f);
//audioTrackPlayer.setNotificationMarkerPosition((int)currentTotalPcmDuration); //audioTrackPlayer.setNotificationMarkerPosition((int)currentTotalPcmDuration);
audioTrackPlayer.setPlaybackPositionUpdateListener(new AudioTrack.OnPlaybackPositionUpdateListener() { audioTrackPlayer.setPlaybackPositionUpdateListener(new AudioTrack.OnPlaybackPositionUpdateListener() {
@Override @Override
...@@ -1606,7 +1607,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel ...@@ -1606,7 +1607,7 @@ public class MediaController implements NotificationCenter.NotificationCenterDel
long dateTaken = cursor.getLong(dateColumn); long dateTaken = cursor.getLong(dateColumn);
int orientation = cursor.getInt(orientationColumn); int orientation = cursor.getInt(orientationColumn);
if (path == null || path.isEmpty()) { if (path == null || path.length() == 0) {
continue; continue;
} }
......
...@@ -102,6 +102,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -102,6 +102,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
private int animationInProgress = 0; private int animationInProgress = 0;
private boolean disableShowCheck = false; private boolean disableShowCheck = false;
private Animation.AnimationListener animationListener;
private ImageReceiver leftImage = new ImageReceiver(); private ImageReceiver leftImage = new ImageReceiver();
private ImageReceiver centerImage = new ImageReceiver(); private ImageReceiver centerImage = new ImageReceiver();
...@@ -245,6 +246,14 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -245,6 +246,14 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
setWillNotDraw(false); setWillNotDraw(false);
} }
@Override
protected void onAnimationEnd() {
super.onAnimationEnd();
if (getInstance().animationListener != null) {
getInstance().animationListener.onAnimationEnd(null);
}
}
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
getInstance().onDraw(canvas); getInstance().onDraw(canvas);
...@@ -725,19 +734,21 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -725,19 +734,21 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
if (overlayViewVisible == show) { if (overlayViewVisible == show) {
return; return;
} }
overlayViewVisible = show; if (currentOverlay.getVisibility() == View.VISIBLE) {
if (android.os.Build.VERSION.SDK_INT >= 11) { overlayViewVisible = show;
AnimatorSet animatorSet = new AnimatorSet(); if (android.os.Build.VERSION.SDK_INT >= 11) {
animatorSet.playTogether( AnimatorSet animatorSet = new AnimatorSet();
ObjectAnimator.ofFloat(currentOverlay, "alpha", show ? 1.0f : 0.0f) animatorSet.playTogether(
); ObjectAnimator.ofFloat(currentOverlay, "alpha", show ? 1.0f : 0.0f)
animatorSet.setDuration(200); );
animatorSet.start(); animatorSet.setDuration(200);
} else { animatorSet.start();
AlphaAnimation animation = new AlphaAnimation(show ? 0.0f : 1.0f, show ? 1.0f : 0.0f); } else {
animation.setDuration(200); AlphaAnimation animation = new AlphaAnimation(show ? 0.0f : 1.0f, show ? 1.0f : 0.0f);
animation.setFillAfter(true); animation.setDuration(200);
currentOverlay.startAnimation(animation); animation.setFillAfter(true);
currentOverlay.startAnimation(animation);
}
} }
} }
...@@ -1122,7 +1133,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1122,7 +1133,6 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
} }
actionBarLayer.setTitle(LocaleController.formatString("Of", R.string.Of, (totalImagesCount - imagesArr.size()) + currentIndex + 1, totalImagesCount)); actionBarLayer.setTitle(LocaleController.formatString("Of", R.string.Of, (totalImagesCount - imagesArr.size()) + currentIndex + 1, totalImagesCount));
} }
updateActionOverlays();
} else if (!imagesArrLocations.isEmpty()) { } else if (!imagesArrLocations.isEmpty()) {
currentFileLocation = imagesArrLocations.get(index); currentFileLocation = imagesArrLocations.get(index);
actionBarLayer.setTitle(LocaleController.formatString("Of", R.string.Of, currentIndex + 1, imagesArrLocations.size())); actionBarLayer.setTitle(LocaleController.formatString("Of", R.string.Of, currentIndex + 1, imagesArrLocations.size()));
...@@ -1563,7 +1573,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1563,7 +1573,7 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
animationSet.addAnimation(scaleAnimation); animationSet.addAnimation(scaleAnimation);
animationSet.setDuration(150); animationSet.setDuration(150);
animationInProgress = 2; animationInProgress = 2;
animationSet.setAnimationListener(new Animation.AnimationListener() { animationSet.setAnimationListener(animationListener = new Animation.AnimationListener() {
@Override @Override
public void onAnimationStart(Animation animation) { public void onAnimationStart(Animation animation) {
...@@ -1571,8 +1581,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat ...@@ -1571,8 +1581,11 @@ public class PhotoViewer implements NotificationCenter.NotificationCenterDelegat
@Override @Override
public void onAnimationEnd(Animation animation) { public void onAnimationEnd(Animation animation) {
animationInProgress = 0; if (animationListener != null) {
onPhotoClosed(object); animationInProgress = 0;
onPhotoClosed(object);
animationListener = null;
}
} }
@Override @Override
......
...@@ -17,6 +17,7 @@ import android.content.Intent; ...@@ -17,6 +17,7 @@ import android.content.Intent;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.Gravity; import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
...@@ -442,7 +443,7 @@ public class ActionBarActivity extends Activity { ...@@ -442,7 +443,7 @@ public class ActionBarActivity extends Activity {
return actionBar; return actionBar;
} }
private void presentFragmentInternalRemoveOld(boolean removeLast, BaseFragment fragment) { private void presentFragmentInternalRemoveOld(boolean removeLast, final BaseFragment fragment) {
if (fragment == null) { if (fragment == null) {
return; return;
} }
...@@ -513,7 +514,12 @@ public class ActionBarActivity extends Activity { ...@@ -513,7 +514,12 @@ public class ActionBarActivity extends Activity {
transitionAnimationInProgress = false; transitionAnimationInProgress = false;
transitionAnimationStartTime = 0; transitionAnimationStartTime = 0;
fragment.onOpenAnimationEnd(); fragment.onOpenAnimationEnd();
presentFragmentInternalRemoveOld(removeLast, currentFragment); new Handler().post(new Runnable() {
@Override
public void run() {
presentFragmentInternalRemoveOld(removeLast, currentFragment);
}
});
listener = null; listener = null;
} }
} }
...@@ -577,6 +583,7 @@ public class ActionBarActivity extends Activity { ...@@ -577,6 +583,7 @@ public class ActionBarActivity extends Activity {
transitionAnimationStartTime = System.currentTimeMillis(); transitionAnimationStartTime = System.currentTimeMillis();
transitionAnimationInProgress = true; transitionAnimationInProgress = true;
closeAnimation.reset(); closeAnimation.reset();
closeAnimation.setFillAfter(true);
closeAnimation.setAnimationListener(listener = new Animation.AnimationListener() { closeAnimation.setAnimationListener(listener = new Animation.AnimationListener() {
@Override @Override
public void onAnimationStart(Animation animation) { public void onAnimationStart(Animation animation) {
...@@ -588,7 +595,11 @@ public class ActionBarActivity extends Activity { ...@@ -588,7 +595,11 @@ public class ActionBarActivity extends Activity {
if (transitionAnimationInProgress) { if (transitionAnimationInProgress) {
transitionAnimationInProgress = false; transitionAnimationInProgress = false;
transitionAnimationStartTime = 0; transitionAnimationStartTime = 0;
closeLastFragmentInternalRemoveOld(currentFragment); new Handler().post(new Runnable() {
public void run() {
closeLastFragmentInternalRemoveOld(currentFragment);
}
});
listener = null; listener = null;
} }
} }
......
...@@ -127,6 +127,7 @@ public class ActionBarMenuItem extends ImageView { ...@@ -127,6 +127,7 @@ public class ActionBarMenuItem extends ImageView {
popupWindow.setClippingEnabled(true); popupWindow.setClippingEnabled(true);
popupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED); popupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED); popupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
popupLayout.measure(MeasureSpec.makeMeasureSpec(Utilities.dp(1000), MeasureSpec.AT_MOST), MeasureSpec.makeMeasureSpec(Utilities.dp(1000), MeasureSpec.AT_MOST));
} }
if (popupLayout.getMeasuredWidth() == 0) { if (popupLayout.getMeasuredWidth() == 0) {
popupWindow.showAsDropDown(this, parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), 0); popupWindow.showAsDropDown(this, parentActionBar.getMeasuredWidth() - popupLayout.getMeasuredWidth() - getLeft() - parentMenu.getLeft(), 0);
......
...@@ -294,7 +294,6 @@ ...@@ -294,7 +294,6 @@
<string name="Gallery">الألبوم</string> <string name="Gallery">الألبوم</string>
<string name="AllPhotos">All Photos</string> <string name="AllPhotos">All Photos</string>
<string name="NoPhotos">No photos yet</string> <string name="NoPhotos">No photos yet</string>
<string name="SendingPhotos">Sending photos... %1$d of %2$d</string>
<!--button titles--> <!--button titles-->
<string name="Next">التالي</string> <string name="Next">التالي</string>
......
...@@ -294,7 +294,6 @@ ...@@ -294,7 +294,6 @@
<string name="Gallery">Galerie</string> <string name="Gallery">Galerie</string>
<string name="AllPhotos">All Photos</string> <string name="AllPhotos">All Photos</string>
<string name="NoPhotos">No photos yet</string> <string name="NoPhotos">No photos yet</string>
<string name="SendingPhotos">Sending photos... %1$d of %2$d</string>
<!--button titles--> <!--button titles-->
<string name="Next">Weiter</string> <string name="Next">Weiter</string>
......
...@@ -294,7 +294,6 @@ ...@@ -294,7 +294,6 @@
<string name="Gallery">Galería</string> <string name="Gallery">Galería</string>
<string name="AllPhotos">All Photos</string> <string name="AllPhotos">All Photos</string>
<string name="NoPhotos">No photos yet</string> <string name="NoPhotos">No photos yet</string>
<string name="SendingPhotos">Sending photos... %1$d of %2$d</string>
<!--button titles--> <!--button titles-->
<string name="Next">Siguiente</string> <string name="Next">Siguiente</string>
......
...@@ -294,7 +294,6 @@ ...@@ -294,7 +294,6 @@
<string name="Gallery">Galleria</string> <string name="Gallery">Galleria</string>
<string name="AllPhotos">All Photos</string> <string name="AllPhotos">All Photos</string>
<string name="NoPhotos">No photos yet</string> <string name="NoPhotos">No photos yet</string>
<string name="SendingPhotos">Sending photos... %1$d of %2$d</string>
<!--button titles--> <!--button titles-->
<string name="Next">Avanti</string> <string name="Next">Avanti</string>
......
...@@ -294,7 +294,6 @@ ...@@ -294,7 +294,6 @@
<string name="Gallery">Galerij</string> <string name="Gallery">Galerij</string>
<string name="AllPhotos">All Photos</string> <string name="AllPhotos">All Photos</string>
<string name="NoPhotos">No photos yet</string> <string name="NoPhotos">No photos yet</string>
<string name="SendingPhotos">Sending photos... %1$d of %2$d</string>
<!--button titles--> <!--button titles-->
<string name="Next">Volgende</string> <string name="Next">Volgende</string>
......
This diff is collapsed.
This diff is collapsed.
...@@ -294,7 +294,6 @@ ...@@ -294,7 +294,6 @@
<string name="Gallery">Gallery</string> <string name="Gallery">Gallery</string>
<string name="AllPhotos">All Photos</string> <string name="AllPhotos">All Photos</string>
<string name="NoPhotos">No photos yet</string> <string name="NoPhotos">No photos yet</string>
<string name="SendingPhotos">Sending photos... %1$d of %2$d</string>
<!--button titles--> <!--button titles-->
<string name="Next">Next</string> <string name="Next">Next</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment