Skip to content

Commit

Permalink
update to 1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
TangXiaoLv committed Aug 1, 2017
1 parent f87e8f2 commit f95abde
Show file tree
Hide file tree
Showing 188 changed files with 74,601 additions and 91 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Fast,efficiently,low memory selector of album,extract from [Telegram](https:
### Gradle
```
dependencies {
compile 'com.library.tangxiaolv:telegramgallery:1.0.3'
compile 'com.library.tangxiaolv:telegramgallery:1.0.4'
}
```

Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
### Gradle
```
dependencies {
compile 'com.library.tangxiaolv:telegramgallery:1.0.3'
compile 'com.library.tangxiaolv:telegramgallery:1.0.4'
}
```

Expand Down

This file was deleted.

23 changes: 17 additions & 6 deletions telegramgallery/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ext {
siteUrl = 'https://github.com/TangXiaoLv/TelegramGallery'
gitUrl = 'https://github.com/TangXiaoLv/TelegramGallery.git'

libraryVersion = '1.0.3'
libraryVersion = '1.0.4'

developerId = 'tangxiaolv'
developerName = 'Tang XiaoLv'
Expand All @@ -43,7 +43,7 @@ android {

externalNativeBuild {
cmake {
cFlags "-std=c99"
cFlags "-std=c11"
cppFlags "-std=c++11 -frtti -fexceptions"
arguments "-DANDROID_STL=gnustl_static"
}
Expand All @@ -59,12 +59,23 @@ android {
publishNonDefault true
externalNativeBuild {
cmake {
path 'src/main/cpp/CMakeLists.txt'
//path 'src/main/cpp/CMakeLists.txt'
}

ndkBuild {
//path 'src/main/jni/Android.mk'
}
}

sourceSets.main {
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
}

dependencies {
}

// Place it at the end of the file
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
dependencies {
}
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
12 changes: 10 additions & 2 deletions telegramgallery/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ INCLUDE_DIRECTORIES(${LIBAVFORMAT}/include)
aux_source_directory(. SOURCE)

add_definitions("-fPIC")
#set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup")

#link_directories(${LIB_STATIC})
#LOCAL_CFLAGS :=
#LOCAL_CFLAGS +=
#LOCAL_CFLAGS +=
#LOCAL_CPPFLAGS :=
#LOCAL_LDLIBS := -ljnigraphics -llog -lz -latomic

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w -Os -DNULL=0 -DSOCKLEN_T=socklen_t -DLOCALE_NOT_USED -D_LARGEFILE_SOURCE=1 -D_FILE_OFFSET_BITS=64")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Drestrict='' -D__EMX__ -DOPUS_BUILD -DFIXED_POINT -DUSE_ALLOCA -DHAVE_LRINT -DHAVE_LRINTF -fno-math-errno")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DANDROID_NDK -DDISABLE_IMPORTGL -fno-strict-aliasing -fprefetch-loop-arrays -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE -DANDROID_ARMV6_IDCT -ffast-math -D__STDC_CONSTANT_MACROS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBSD=1 -ffast-math -Os -funroll-loops")

find_library(LIB_JNIGRAPHICS jnigraphics)
set(LIB_AVCODEC ${LIB_STATIC}/libavcodec.a)
Expand Down
2 changes: 1 addition & 1 deletion telegramgallery/src/main/cpp/gifvideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,4 @@ jint Java_com_tangxiaolv_telegramgallery_AnimatedFileDrawable_getVideoFrame(JNIE
}
return 0;
}
}
} //END "C"
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int actionBarHeight = getCurrentActionBarHeight();
int actionBarHeightSpec = MeasureSpec.makeMeasureSpec(actionBarHeight, MeasureSpec.EXACTLY);

setMeasuredDimension(width, actionBarHeight
+ (occupyStatusBar ? AndroidUtilities.statusBarHeight : 0) + extraHeight);
setMeasuredDimension(width, actionBarHeight/*
+ (occupyStatusBar ? AndroidUtilities.statusBarHeight : 0)*/ + extraHeight);

int textLeft;
if (backContainer != null && backContainer.getVisibility() != GONE) {
Expand Down Expand Up @@ -504,7 +504,8 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
int additionalTop = occupyStatusBar ? AndroidUtilities.statusBarHeight : 0;
// int additionalTop = occupyStatusBar ? AndroidUtilities.statusBarHeight : 0;
int additionalTop= 0 ;

int textLeft;
if (backContainer != null && backContainer.getVisibility() != GONE) {
Expand Down Expand Up @@ -693,7 +694,7 @@ public static int getCurrentActionBarHeight() {
.getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
return AndroidUtilities.dp(48);
} else {
return AndroidUtilities.dp(56);
return AndroidUtilities.dp(48);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,10 +558,10 @@ private void updateOrShowPopup(boolean show, boolean update) {
}
} else {
if (show) {
popupWindow.showAsDropDown(this, -AndroidUtilities.dp(8), offsetY);
popupWindow.showAsDropDown(this, -AndroidUtilities.dp(10), offsetY);
}
if (update) {
popupWindow.update(this, -AndroidUtilities.dp(8), offsetY, -1, -1);
popupWindow.update(this, -AndroidUtilities.dp(10), offsetY, -1, -1);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,13 @@ public PickerBottomLayout(Context context, boolean darkTheme) {

doneButtonBadgeTextView = new TextView(context);
// doneButtonBadgeTextView.getPaint().setFakeBoldText(true);
doneButtonBadgeTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
doneButtonBadgeTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12);
doneButtonBadgeTextView.setTextColor(0xffffffff);
doneButtonBadgeTextView.setGravity(Gravity.CENTER);
doneButtonBadgeTextView.setBackgroundResource(
isDarkTheme ? R.drawable.photobadge_new : R.drawable.photobadge_new);
doneButtonBadgeTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8),
AndroidUtilities.dp(1));
doneButton.addView(doneButtonBadgeTextView,
LayoutHelper.createLinear(26, 26, Gravity.CENTER_VERTICAL, 0, 0, 10, 0));
doneButtonBadgeTextView.setPadding(AndroidUtilities.dp(8), 0, AndroidUtilities.dp(8), AndroidUtilities.dp(1));
doneButton.addView(doneButtonBadgeTextView, LayoutHelper.createLinear(24, 24, Gravity.CENTER_VERTICAL, 0, 0, 8, 0));

doneButtonTextView = new TextView(context);
doneButtonTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public void onFragmentDestroy() {
public View createView(Context context) {
actionBar.setBackgroundColor(Theme.ACTION_BAR_MEDIA_PICKER_COLOR);
actionBar.setItemsBackgroundColor(Theme.ACTION_BAR_PICKER_SELECTOR_COLOR);
// actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setBackText(context.getString(R.string.Cancel));
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
//actionBar.setBackText(context.getString(R.string.Cancel));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
Expand Down Expand Up @@ -158,17 +158,15 @@ public void onItemClick(int id) {
ActionBarMenu menu = actionBar.createMenu();
dropDownContainer = new ActionBarMenuItem(context, menu, 0);
dropDownContainer.setSubMenuOpenSide(1);
dropDownContainer.addSubItem(item_photos,context.getString(
R.string.PickerPhotos), 0);
dropDownContainer.addSubItem(item_video,context.getString(
R.string.PickerVideo), 0);
dropDownContainer.addSubItem(item_photos, context.getString(R.string.PickerPhotos), 0);
dropDownContainer.addSubItem(item_video, context.getString(R.string.PickerVideo), 0);
actionBar.addView(dropDownContainer);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) dropDownContainer
.getLayoutParams();
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) dropDownContainer.getLayoutParams();
layoutParams.height = LayoutHelper.MATCH_PARENT;
layoutParams.width = LayoutHelper.WRAP_CONTENT;
// layoutParams.rightMargin = AndroidUtilities.dp(40);
// layoutParams.leftMargin = AndroidUtilities.getRealScreenSize().x / 2;
layoutParams.rightMargin = AndroidUtilities.dp(40);
// layoutParams.leftMargin = AndroidUtilities.getRealScreenSize().x / 2;
layoutParams.leftMargin = AndroidUtilities.dp(56);
layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
dropDownContainer.setLayoutParams(layoutParams);
dropDownContainer.setOnClickListener(new View.OnClickListener() {
Expand All @@ -186,8 +184,7 @@ public void onClick(View view) {
dropDown.setEllipsize(TextUtils.TruncateAt.END);
dropDown.setTextColor(0xffffffff);
// dropDown.getPaint().setFakeBoldText(true);
dropDown.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down,
0);
dropDown.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ic_arrow_drop_down, 0);
dropDown.setCompoundDrawablePadding(AndroidUtilities.dp(4));
// dropDown.setPadding(0, 0, AndroidUtilities.dp(10), 0);
dropDown.setText(R.string.PickerPhotos);
Expand Down Expand Up @@ -535,8 +532,8 @@ private void fixLayoutInternal() {
if (!AndroidUtilities.isTablet()) {
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) dropDownContainer
.getLayoutParams();
layoutParams.topMargin = (Build.VERSION.SDK_INT >= 21
? AndroidUtilities.statusBarHeight : 0);
/*layoutParams.topMargin = (Build.VERSION.SDK_INT >= 21
? AndroidUtilities.statusBarHeight : 0);*/
dropDownContainer.setLayoutParams(layoutParams);
}

Expand All @@ -550,7 +547,7 @@ private void fixLayoutInternal() {
}

private void openPhotoPicker(MediaController.AlbumEntry albumEntry, int type,
boolean withAnim) {
boolean withAnim) {
currentPhotoPickerActivity = new PhotoPickerActivity(type, limitPickPhoto, albumEntry,
selectedPhotos, null, singlePhoto);
currentPhotoPickerActivity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ public class AndroidUtilities {
+ "(?:" + DOMAIN_NAME + ")"
+ "(?:\\:\\d{1,5})?)" // plus option port number
+ "(\\/(?:(?:[" + GOOD_IRI_CHAR + "\\;\\/\\?\\:\\@\\&\\=\\#\\~" // plus
// option
// query
// params
// option
// query
// params
+ "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?"
+ "(?:\\b|$)");
} catch (Exception e) {
Expand All @@ -96,27 +96,18 @@ public class AndroidUtilities {
checkDisplaySize();
}

public static Typeface getTypeface(String assetPath) {
synchronized (typefaceCache) {
if (!typefaceCache.containsKey(assetPath)) {
try {
Typeface t = Typeface.createFromAsset(
Gallery.applicationContext.getAssets(), assetPath);
typefaceCache.put(assetPath, t);
} catch (Exception e) {
Log.e("Typefaces",
"Could not get typeface '" + assetPath + "' because " + e.getMessage());
return null;
}
}
return typefaceCache.get(assetPath);
public static int statusBarHeights;
static {
int resourceId = Gallery.applicationContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = Gallery.applicationContext.getResources().getDimensionPixelSize(resourceId);
}
}

public static void showToast(String text){
if (toast == null){
toast = Toast.makeText(Gallery.applicationContext,text,Toast.LENGTH_SHORT);
}else{
public static void showToast(String text) {
if (toast == null) {
toast = Toast.makeText(Gallery.applicationContext, text, Toast.LENGTH_SHORT);
} else {
toast.setText(text);
}
toast.show();
Expand All @@ -135,20 +126,6 @@ public static void showKeyboard(View view) {
}
}

public static boolean isKeyboardShowed(View view) {
if (view == null) {
return false;
}
try {
InputMethodManager inputManager = (InputMethodManager) view.getContext()
.getSystemService(Context.INPUT_METHOD_SERVICE);
return inputManager.isActive(view);
} catch (Exception e) {
e.printStackTrace();
}
return false;
}

public static void hideKeyboard(View view) {
if (view == null) {
return;
Expand Down Expand Up @@ -549,7 +526,7 @@ public static String getPath(final Uri uri) {
}

final String selection = "_id=?";
final String[] selectionArgs = new String[] {
final String[] selectionArgs = new String[]{
split[1]
};

Expand All @@ -568,7 +545,7 @@ public static String getPath(final Uri uri) {
}

public static String getDataColumn(Context context, Uri uri, String selection,
String[] selectionArgs) {
String[] selectionArgs) {

Cursor cursor = null;
final String column = "_data";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,8 @@ public void run() {
.getAbsolutePath() + "/" + "Camera/";

// 相当于我们常用sql where 后面的写法
StringBuilder selectionBuilder = null;
StringBuilder selectionBuilder = new StringBuilder();
if (filterMimiType != null && filterMimiType.length > 0) {
selectionBuilder = new StringBuilder();
int length = filterMimiType.length;
for (int i = 0; i < length; i++) {
String mimeType = MediaStore.Files.FileColumns.MIME_TYPE;
Expand Down
Loading

0 comments on commit f95abde

Please sign in to comment.