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