|
|
@@ -13,6 +13,7 @@ import android.view.inputmethod.InputMethodManager;
|
|
|
import android.widget.CheckBox;
|
|
|
import android.widget.CompoundButton;
|
|
|
import android.widget.EditText;
|
|
|
+import android.widget.GridLayout;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
@@ -24,6 +25,7 @@ import com.netease.nim.uikit.common.media.picker.model.PhotoInfo;
|
|
|
import com.netease.nim.uikit.common.ui.dialog.DialogMaker;
|
|
|
import com.netease.nim.uikit.common.ui.dialog.EasyAlertDialog;
|
|
|
import com.netease.nim.uikit.common.ui.dialog.EasyAlertDialogHelper;
|
|
|
+import com.netease.nim.uikit.common.util.sys.ScreenUtil;
|
|
|
import com.netease.nim.uikit.session.activity.WatchPictureActivity;
|
|
|
import com.netease.nim.uikit.session.constant.Extras;
|
|
|
import com.sheishuo.app.R;
|
|
|
@@ -53,7 +55,7 @@ public class NewTweetingActivity extends SheishuoUI {
|
|
|
private BaseToolbar toolbar;
|
|
|
private EditText tweetContent;
|
|
|
private TextView locationTV;
|
|
|
- private LinearLayout imgsLayout;
|
|
|
+ private GridLayout imgsLayout;
|
|
|
private ImageView addImg;
|
|
|
private NewTweetPresenter presenter;
|
|
|
private List<String> selectedPhotoPathList;
|
|
|
@@ -64,6 +66,7 @@ public class NewTweetingActivity extends SheishuoUI {
|
|
|
// private static MainActivity activity;
|
|
|
|
|
|
private int maxNumImages = 9;
|
|
|
+ private int imgSize;
|
|
|
|
|
|
public static void start(Context context) {
|
|
|
start(context, null);
|
|
|
@@ -106,13 +109,15 @@ public class NewTweetingActivity extends SheishuoUI {
|
|
|
toolbar = (BaseToolbar) findViewById(R.id.new_tweet_toolbar);
|
|
|
tweetContent = (EditText) findViewById(R.id.new_tweet_content);
|
|
|
locationTV = (TextView) findViewById(R.id.new_tweet_location_tv);
|
|
|
- imgsLayout = (LinearLayout) findViewById(R.id.new_tweet_img_layout);
|
|
|
+ imgsLayout = (GridLayout) findViewById(R.id.new_tweet_img_layout);
|
|
|
addImg = (ImageView) findViewById(R.id.new_tweet_add_imgs);
|
|
|
checkBoxShowLoc = (CheckBox) findViewById(R.id.check_show_loc);
|
|
|
}
|
|
|
|
|
|
private void init() {
|
|
|
|
|
|
+ imgSize = (ImgUtil.getScreenWidth(context) - ScreenUtil.dip2px(16)) / 5;
|
|
|
+
|
|
|
presenter = new NewTweetPresenter(this);
|
|
|
|
|
|
toolbar.setTitle("发布");
|
|
|
@@ -153,11 +158,17 @@ public class NewTweetingActivity extends SheishuoUI {
|
|
|
//初始化照片添加监听事件
|
|
|
selectedPhotoPathList = new ArrayList<>();
|
|
|
photoIds = new ArrayList<>();
|
|
|
+
|
|
|
+ GridLayout.LayoutParams layoutParams = (GridLayout.LayoutParams)addImg.getLayoutParams();
|
|
|
+ layoutParams.width = imgSize;
|
|
|
+ layoutParams.height = imgSize;
|
|
|
+ addImg.setLayoutParams(layoutParams);
|
|
|
addImg.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
PickImageHelper.PickImageOption option = new PickImageHelper.PickImageOption();
|
|
|
+ option.multiSelectMaxCount = 10 - imgsLayout.getChildCount();
|
|
|
PickImageHelper.pickImage(context, 0, option);
|
|
|
|
|
|
}
|
|
|
@@ -216,7 +227,6 @@ public class NewTweetingActivity extends SheishuoUI {
|
|
|
|
|
|
private ImageView createImageView(final String filePath)
|
|
|
{
|
|
|
- int imgSize = (int) ImgUtil.convertDpToPixel(60, context);
|
|
|
selectedPhotoPathList.add(filePath);
|
|
|
|
|
|
final ImageView imageView = new ImageView(this);
|
|
|
@@ -269,10 +279,10 @@ public class NewTweetingActivity extends SheishuoUI {
|
|
|
|
|
|
private void checkAddImg()
|
|
|
{
|
|
|
- if(imgsLayout.getChildCount() >= maxNumImages + 1)
|
|
|
- addImg.setVisibility(View.GONE);
|
|
|
- else
|
|
|
- addImg.setVisibility(View.VISIBLE);
|
|
|
+// if(imgsLayout.getChildCount() >= maxNumImages + 1)
|
|
|
+// addImg.setVisibility(View.GONE);
|
|
|
+// else
|
|
|
+// addImg.setVisibility(View.VISIBLE);
|
|
|
}
|
|
|
|
|
|
public void publish()
|