diff options
| -rw-r--r-- | res/values-zh-rCN/filtershow_strings.xml | 3 | ||||
| -rwxr-xr-x | res/values-zh-rCN/strings.xml | 13 | ||||
| -rw-r--r-- | res/values-zh-rTW/filtershow_strings.xml | 3 | ||||
| -rwxr-xr-x | res/values-zh-rTW/strings.xml | 13 | ||||
| -rwxr-xr-x | res/values/strings.xml | 8 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/AbstractGalleryActivity.java | 18 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/AlbumPage.java | 20 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/AlbumSetPage.java | 7 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/PhotoPage.java | 24 | ||||
| -rw-r--r-- | src/com/android/gallery3d/ui/SlotView.java | 37 | ||||
| -rw-r--r-- | src/com/android/gallery3d/ui/TimeLineSlotView.java | 4 | ||||
| -rwxr-xr-x | src/com/android/gallery3d/ui/TimeLineTitleMaker.java | 21 |
12 files changed, 105 insertions, 66 deletions
diff --git a/res/values-zh-rCN/filtershow_strings.xml b/res/values-zh-rCN/filtershow_strings.xml index 6eff89776..ccde8d3f8 100644 --- a/res/values-zh-rCN/filtershow_strings.xml +++ b/res/values-zh-rCN/filtershow_strings.xml @@ -153,4 +153,7 @@ <string name="filtershow_exif_f_stop" msgid="6081797865604483139">"光圈值"</string> <string name="filtershow_exif_exposure_time" msgid="4099067062781294115">"曝光时间"</string> <string name="filtershow_exif_copyright" msgid="8801875918803737581">"版权"</string> + + <string name="color">滤镜</string> + <string name="frames">相框</string> </resources> diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index 49ca20c5a..1a218ad8b 100755 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -443,6 +443,11 @@ <item quantity="other" msgid="3813306834113858135">"%1$d张照片"</item> </plurals> + <plurals name="number_of_videos"> + <item quantity="one">%1$d个视频</item> + <item quantity="other">%1$d个视频</item> + </plurals> + <string name="bass_boost_strength" msgid="882301530007752270">"低音增强"</string> <string name="virtualizer_strength" msgid="5035111173763913313">"3D 音效"</string> <string name="audio_effects" msgid="612896145300512593">"音效"</string> @@ -454,4 +459,12 @@ <!-- The tips of trimming video --> <string name="fail_trim">抱歉,不能修剪该视频文件</string> <string name="can_not_trim">只有MP4和3GP文件才能修剪</string> + + <!-- Timeline screen title --> + <string name="timeline_title">时间轴</string> + <!-- Videos screen title --> + <string name="videos_title">视频</string> + <string name="action_viewtype_list">列表视图</string> + <string name="tvEmptyAlbum">没有图片</string> + <string name="tvEmptyVideos">没有视频</string> </resources> diff --git a/res/values-zh-rTW/filtershow_strings.xml b/res/values-zh-rTW/filtershow_strings.xml index f689a0fe6..004f7a4bf 100644 --- a/res/values-zh-rTW/filtershow_strings.xml +++ b/res/values-zh-rTW/filtershow_strings.xml @@ -153,4 +153,7 @@ <string name="filtershow_exif_f_stop" msgid="6081797865604483139">"光圈孔徑"</string> <string name="filtershow_exif_exposure_time" msgid="4099067062781294115">"曝光時間"</string> <string name="filtershow_exif_copyright" msgid="8801875918803737581">"版權"</string> + + <string name="color">濾鏡</string> + <string name="frames">相框</string> </resources> diff --git a/res/values-zh-rTW/strings.xml b/res/values-zh-rTW/strings.xml index de49fb45e..7d2cb2158 100755 --- a/res/values-zh-rTW/strings.xml +++ b/res/values-zh-rTW/strings.xml @@ -438,7 +438,20 @@ <item quantity="other" msgid="3813306834113858135">"%1$d 張相片"</item> </plurals> + <plurals name="number_of_videos"> + <item quantity="one">%1$d个影片</item> + <item quantity="other">%1$d个影片</item> + </plurals> + <string name="bass_boost_strength">"低音加強"</string> <string name="virtualizer_strength">"3D 效果"</string> <string name="audio_effects">"音效"</string> + + <!-- Timeline screen title --> + <string name="timeline_title">時間軸</string> + <!-- Videos screen title --> + <string name="videos_title">影片</string> + <string name="action_viewtype_list">列表视图</string> + <string name="tvEmptyAlbum">O 個可用的圖片</string> + <string name="tvEmptyVideos">O 個可用的影片</string> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index 7e4c50310..1fe30b3fe 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1172,18 +1172,18 @@ CHAR LIMIT = NONE] --> <item>Videos</item> </string-array> - <string name="navigation_drawer_title">Gallery</string> + <string name="navigation_drawer_title" translatable="false">@string/app_name</string> <!-- Timeline screen title --> <string name="timeline_title">Timeline</string> <!-- Albums screen title --> - <string name="albums_title">Albums</string> + <string name="albums_title" translatable="false">@string/tab_albums</string> <!-- Videos screen title --> <string name="videos_title">Videos</string> <string name="action_viewtype_list">List view</string> - <string name="action_viewtype_grid">Grid view</string> + <string name="action_viewtype_grid" translatable="false">@string/switch_photo_grid</string> <string name="tvEmptyAlbum">No photos found</string> <string name="tvEmptyVideos">No videos found</string> <string name="text_makeup_trimface">Trimface</string> <string name="text_makeup_bigeye">Bigeye</string> - <string name="drawer_desc">drawer</string> + <string name="drawer_desc" translatable="false">drawer</string> </resources> diff --git a/src/com/android/gallery3d/app/AbstractGalleryActivity.java b/src/com/android/gallery3d/app/AbstractGalleryActivity.java index 915fc948a..b9007d57e 100644 --- a/src/com/android/gallery3d/app/AbstractGalleryActivity.java +++ b/src/com/android/gallery3d/app/AbstractGalleryActivity.java @@ -368,8 +368,7 @@ public class AbstractGalleryActivity extends Activity implements GalleryContext } String path = ImageLoader.getLocalPathFromUri(this, uri); if (path != null) { - Uri localUri = Uri.parse(path); - path = localUri.getLastPathSegment(); + path = getLastPathSegment(path); } else { path = uri.getLastPathSegment(); } @@ -381,6 +380,21 @@ public class AbstractGalleryActivity extends Activity implements GalleryContext } } + private String getLastPathSegment(String path) { + if (path == null) return null; + Uri localUri = Uri.parse(path); + String lastPathSegment = localUri.getLastPathSegment(); + + // uri.getLastPathSegment will return null if localUri contains + // spacial characters such as ':', so use other way to get it. + if (lastPathSegment == null) { + // use substring to get last path segment. + int indexOfLastPathSegment = path.lastIndexOf("/") + 1; + lastPathSegment = path.substring(indexOfLastPathSegment, path.length()); + } + return lastPathSegment; + } + public Toolbar getToolbar() { return mToolbar; } diff --git a/src/com/android/gallery3d/app/AlbumPage.java b/src/com/android/gallery3d/app/AlbumPage.java index 3181d2daf..e730c070c 100644 --- a/src/com/android/gallery3d/app/AlbumPage.java +++ b/src/com/android/gallery3d/app/AlbumPage.java @@ -38,6 +38,7 @@ import android.view.View; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; +import android.widget.Toolbar; import com.android.gallery3d.R; import com.android.gallery3d.common.Utils; @@ -331,17 +332,6 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster } private void pickPhoto(int slotIndex) { - if ((View.LAYOUT_DIRECTION_RTL == TextUtils - .getLayoutDirectionFromLocale(Locale.getDefault())) - && !mGetContent) { - // Fetch corresponding slotIndex from another side, (RTL) - if (slotIndex > DATA_CACHE_SIZE / 2 - && slotIndex < mAlbumDataAdapter.size() - DATA_CACHE_SIZE / 2) { - slotIndex = mAlbumDataAdapter.size() - slotIndex - 2; - } else { - slotIndex = mAlbumDataAdapter.size() - slotIndex - 1; - } - } pickPhoto(slotIndex, false); } @@ -512,9 +502,11 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster mParentMediaSetString != null; //GalleryActionBar actionBar = mActivity.getGalleryActionBar(); mActionBar.setDisplayOptions(enableHomeButton, true); - if (enableHomeButton) { - mActivity.getToolbar().setNavigationContentDescription("back"); - mActivity.getToolbar().setNavigationIcon(R.drawable.back); + + Toolbar toolBar = mActivity.getToolbar(); + if (enableHomeButton && toolBar != null) { + toolBar.setNavigationContentDescription("back"); + toolBar.setNavigationIcon(R.drawable.back); } // Set the reload bit here to prevent it exit this page in clearLoadingBit(). setLoadingBit(BIT_LOADING_RELOAD); diff --git a/src/com/android/gallery3d/app/AlbumSetPage.java b/src/com/android/gallery3d/app/AlbumSetPage.java index d2cc0ca57..c8916fe16 100644 --- a/src/com/android/gallery3d/app/AlbumSetPage.java +++ b/src/com/android/gallery3d/app/AlbumSetPage.java @@ -244,13 +244,16 @@ public class AlbumSetPage extends ActivityState implements WeakReference<Toast> mEmptyAlbumToast = null; private void showEmptyAlbumToast(int toastLength) { + //CRs-Fixed:951767 java.lang.NullPointerException: Attempt to invoke virtual method + // 'void android.widget.RelativeLayout.addView(android.view.View + RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity) + .findViewById(R.id.gallery_root); + if (galleryRoot == null) return ; tvEmptyAlbum = new TextView(mActivity); tvEmptyAlbum.setText(R.string.tvEmptyAlbum); tvEmptyAlbum.setTextColor(Color.parseColor("#8A000000")); tvEmptyAlbum.setGravity(Gravity.CENTER); tvEmptyAlbum.setTextSize(TypedValue.COMPLEX_UNIT_SP,20); - RelativeLayout galleryRoot = (RelativeLayout) ((Activity) mActivity) - .findViewById(R.id.gallery_root); RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java index 233e36999..1b2a68245 100644 --- a/src/com/android/gallery3d/app/PhotoPage.java +++ b/src/com/android/gallery3d/app/PhotoPage.java @@ -496,30 +496,6 @@ public abstract class PhotoPage extends ActivityState implements return; } } - - // If it is from widget, need to re-calcuate index and range - if (View.LAYOUT_DIRECTION_RTL == TextUtils - .getLayoutDirectionFromLocale(Locale.getDefault()) - && mIsFromWidget) { - int nMediaItemCount = mMediaSet.getMediaItemCount(); - ArrayList<MediaItem> mediaItemList = mMediaSet.getMediaItem(0, nMediaItemCount); - int nItemIndex; - for (nItemIndex = 0; nItemIndex < nMediaItemCount; nItemIndex++) { - if (mediaItemList.get(nItemIndex).getPath().toString() - .equals(itemPath.toString())) { - int nIndex; - if (nItemIndex > DATA_CACHE_SIZE / 2 - && nItemIndex < (mMediaSet.getMediaItemCount() - - DATA_CACHE_SIZE / 2)) { - nIndex = mMediaSet.getMediaItemCount() - nItemIndex - 2; - } else { - nIndex = mMediaSet.getMediaItemCount() - nItemIndex - 1; - } - itemPath = mMediaSet.getMediaItem(nIndex, 1).get(0).getPath(); - break; - } - } - } PhotoDataAdapter pda = new PhotoDataAdapter( mActivity, mPhotoView, mMediaSet, itemPath, mCurrentIndex, mAppBridge == null ? -1 : 0, diff --git a/src/com/android/gallery3d/ui/SlotView.java b/src/com/android/gallery3d/ui/SlotView.java index b5fa2bf6c..90080ff9e 100644 --- a/src/com/android/gallery3d/ui/SlotView.java +++ b/src/com/android/gallery3d/ui/SlotView.java @@ -154,12 +154,6 @@ public class SlotView extends GLView { } public void setScrollPosition(int position) { - if (View.LAYOUT_DIRECTION_RTL == TextUtils - .getLayoutDirectionFromLocale(Locale.getDefault()) - && position == 0 && !isFromPhotoPage) { - // If RTL and not from Photo Page, set position to max. - position = mLayout.getScrollLimit(); - } position = Utils.clamp(position, 0, mLayout.getScrollLimit()); mScroller.setPosition(position); updateScrollPosition(position, false); @@ -462,19 +456,21 @@ public class SlotView extends GLView { public Rect getSlotRect(int index, Rect rect) { int col, row; if (WIDE) { + col = index / mUnitCount; + row = index - col * mUnitCount; if (View.LAYOUT_DIRECTION_RTL == TextUtils .getLayoutDirectionFromLocale(Locale.getDefault())) { - // If RTL, recalculate the columns and rows. - int count = ((mSlotCount + mUnitCount - 1) / mUnitCount); - col = count - index / mUnitCount - 1; - row = index % mUnitCount; - } else { - col = index / mUnitCount; - row = index - col * mUnitCount; + // If RTL, recalculate the columns. + col = mUnitCount - (index - row * mUnitCount) - 1; } } else { row = index / mUnitCount; col = index - row * mUnitCount; + if (View.LAYOUT_DIRECTION_RTL == TextUtils + .getLayoutDirectionFromLocale(Locale.getDefault())) { + // If RTL, recalculate the columns. + col = mUnitCount - (index - row * mUnitCount) - 1; + } } int x = mHorizontalPadding.get() + col * (mSlotWidth + mSlotGap); @@ -619,12 +615,6 @@ public class SlotView extends GLView { public int getSlotIndexByPosition(float x, float y) { int absoluteX = Math.round(x) + (WIDE ? mScrollPosition : 0); int absoluteY = Math.round(y) + (WIDE ? 0 : mScrollPosition); - if (View.LAYOUT_DIRECTION_RTL == TextUtils - .getLayoutDirectionFromLocale(Locale.getDefault())) { - // If RTL, recalculate the absoluteX. - absoluteX = mContentLength > mWidth ? (mContentLength - absoluteX) : mWidth - - absoluteX; - } absoluteX -= mHorizontalPadding.get(); absoluteY -= mVerticalPadding.get(); @@ -634,6 +624,15 @@ public class SlotView extends GLView { int columnIdx = absoluteX / (mSlotWidth + mSlotGap); int rowIdx = absoluteY / (mSlotHeight + mSlotGap); + if (View.LAYOUT_DIRECTION_RTL == TextUtils + .getLayoutDirectionFromLocale(Locale.getDefault())) { + // If RTL, recalculate the columnIdx/rowIdx. + if (WIDE) { + rowIdx = mUnitCount - rowIdx - 1; + } else { + columnIdx = mUnitCount - columnIdx - 1; + } + } if (!WIDE && columnIdx >= mUnitCount) { return INDEX_NONE; diff --git a/src/com/android/gallery3d/ui/TimeLineSlotView.java b/src/com/android/gallery3d/ui/TimeLineSlotView.java index dbb8a6a76..2bce76865 100644 --- a/src/com/android/gallery3d/ui/TimeLineSlotView.java +++ b/src/com/android/gallery3d/ui/TimeLineSlotView.java @@ -759,6 +759,10 @@ public class TimeLineSlotView extends GLView { } mHeightList.add(totalHieght); + if (View.LAYOUT_DIRECTION_RTL == TextUtils + .getLayoutDirectionFromLocale(Locale.getDefault())) { + col = mUnitCount - col -1; + } RectSlot rectslot = new RectSlot(info.getMediaType(), i, col, totalHieght); mMediaSlotMap.put(rectslot.slotIndex, rectslot); } diff --git a/src/com/android/gallery3d/ui/TimeLineTitleMaker.java b/src/com/android/gallery3d/ui/TimeLineTitleMaker.java index a0464147e..c154f369d 100755 --- a/src/com/android/gallery3d/ui/TimeLineTitleMaker.java +++ b/src/com/android/gallery3d/ui/TimeLineTitleMaker.java @@ -28,12 +28,15 @@ import android.graphics.Rect; import android.graphics.Typeface; import android.text.TextPaint; import android.text.TextUtils; +import android.view.View; import com.android.gallery3d.util.ThreadPool; import com.android.gallery3d.util.ThreadPool.JobContext; import com.android.photos.data.GalleryBitmapPool; import com.android.gallery3d.R; +import java.util.Locale; + public class TimeLineTitleMaker { private final String TAG = "TimelineTitleMaker"; @@ -45,6 +48,8 @@ public class TimeLineTitleMaker { private final Context mContext; private final TimeLineSlotView mTimeLineSlotView; + private final int TIMELINETITLE_START_X = 16; + public TimeLineTitleMaker(Context context, TimeLineSlotRenderer.LabelSpec spec, TimeLineSlotView slotView) { mContext = context; mSpec = spec; @@ -140,8 +145,17 @@ public class TimeLineTitleMaker { int y = 0; if (mTitle != null) { mTitle = mTitle.toUpperCase(); - x = 16; + x = TIMELINETITLE_START_X; y = (height - spec.timeLineTitleFontSize)/2; + // re-calculate x for RTL + if (View.LAYOUT_DIRECTION_RTL == TextUtils + .getLayoutDirectionFromLocale(Locale.getDefault())) { + Rect titleBounds = new Rect(); + mTitlePaint.getTextBounds( + mTitle, 0, mTitle.length(), titleBounds); + int w = titleBounds.width(); + x = width - mTitle.length() - w; + } drawText(canvas, x, y, mTitle, width-x, mTitlePaint); } @@ -153,6 +167,11 @@ public class TimeLineTitleMaker { int w = mediaCountBounds.width(); y = (height - spec.timeLineTitleFontSize)/2; x = width - countString.length() -w; + // re-calculate x for RTL + if (View.LAYOUT_DIRECTION_RTL == TextUtils + .getLayoutDirectionFromLocale(Locale.getDefault())) { + x = TIMELINETITLE_START_X; + } drawText(canvas, x, y, countString, width - x, mCountPaint); } |
