@@ -5,6 +5,7 @@ |
||
| 5 | 5 |
<module fileurl="file://$PROJECT_DIR$/Lensman.iml" filepath="$PROJECT_DIR$/Lensman.iml" /> |
| 6 | 6 |
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" /> |
| 7 | 7 |
<module fileurl="file://$PROJECT_DIR$/common/common.iml" filepath="$PROJECT_DIR$/common/common.iml" /> |
| 8 |
+ <module fileurl="file://$PROJECT_DIR$/lensman_ssh.iml" filepath="$PROJECT_DIR$/lensman_ssh.iml" /> |
|
| 8 | 9 |
<module fileurl="file://$PROJECT_DIR$/views/views.iml" filepath="$PROJECT_DIR$/views/views.iml" /> |
| 9 | 10 |
</modules> |
| 10 | 11 |
</component> |
@@ -30,6 +30,6 @@ dependencies {
|
||
| 30 | 30 |
apt 'com.jakewharton:butterknife-compiler:8.2.1' |
| 31 | 31 |
|
| 32 | 32 |
compile project(path: ':common') |
| 33 |
- compile project(path: ':common') |
|
| 34 | 33 |
compile files('libs/zxing.jar')
|
| 34 |
+ compile project(path: ':views') |
|
| 35 | 35 |
} |
@@ -22,7 +22,7 @@ public class SessionActivity extends AppCompatActivity implements SessionContrac |
||
| 22 | 22 |
@BindView(R.id.title_bar_middle_txt) TextView titleTextView; |
| 23 | 23 |
@BindView(R.id.recycler_view_photos) RecyclerView photosRecyclerView; |
| 24 | 24 |
private PhotoRecyclerAdapter adapter; |
| 25 |
- |
|
| 25 |
+ private SessionBean sessionBean; |
|
| 26 | 26 |
private SessionContract.SessionPresenter presenter; |
| 27 | 27 |
|
| 28 | 28 |
private static final int JOIN_REQUEST_CODE = 3002; |
@@ -34,7 +34,7 @@ public class SessionActivity extends AppCompatActivity implements SessionContrac |
||
| 34 | 34 |
ButterKnife.bind(this); |
| 35 | 35 |
presenter = new SessionPresenterImpl(this,this); |
| 36 | 36 |
|
| 37 |
- SessionBean sessionBean =(SessionBean)getIntent().getSerializableExtra("session");
|
|
| 37 |
+ sessionBean =(SessionBean)getIntent().getSerializableExtra("session");
|
|
| 38 | 38 |
titleTextView.setText(getString(R.string.scene)+sessionBean.sessionSeq); |
| 39 | 39 |
adapter = new PhotoRecyclerAdapter(this); |
| 40 | 40 |
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); |
@@ -62,7 +62,7 @@ public class SessionActivity extends AppCompatActivity implements SessionContrac |
||
| 62 | 62 |
|
| 63 | 63 |
@OnClick(R.id.iv_qrcode) |
| 64 | 64 |
void showQRCodeForSession(){
|
| 65 |
- |
|
| 65 |
+ new SessionQRPopup(this, String.valueOf(sessionBean.sessionSeq)).showPopupWindow(); |
|
| 66 | 66 |
} |
| 67 | 67 |
|
| 68 | 68 |
@OnClick(R.id.title_bar_back_layout) |
@@ -0,0 +1,71 @@ |
||
| 1 |
+package ai.pai.lensman.session; |
|
| 2 |
+ |
|
| 3 |
+import android.app.Activity; |
|
| 4 |
+import android.content.Context; |
|
| 5 |
+import android.view.LayoutInflater; |
|
| 6 |
+import android.view.View; |
|
| 7 |
+import android.view.animation.Animation; |
|
| 8 |
+import android.widget.ImageView; |
|
| 9 |
+import android.widget.LinearLayout; |
|
| 10 |
+ |
|
| 11 |
+import com.android.common.utils.DeviceUtils; |
|
| 12 |
+import com.android.views.popup.BasePopupWindow; |
|
| 13 |
+ |
|
| 14 |
+import ai.pai.lensman.R; |
|
| 15 |
+import ai.pai.lensman.qrcode.QRCreateUtils; |
|
| 16 |
+import ai.pai.lensman.utils.UrlContainer; |
|
| 17 |
+ |
|
| 18 |
+public class SessionQRPopup extends BasePopupWindow {
|
|
| 19 |
+ |
|
| 20 |
+ private View popupView; |
|
| 21 |
+ private ImageView groupQRImg; |
|
| 22 |
+ private String groupId; |
|
| 23 |
+ private Context context; |
|
| 24 |
+ |
|
| 25 |
+ |
|
| 26 |
+ public SessionQRPopup(Activity context, String groupId) {
|
|
| 27 |
+ super(context); |
|
| 28 |
+ this.groupId = groupId; |
|
| 29 |
+ this.context = context; |
|
| 30 |
+ init(); |
|
| 31 |
+ } |
|
| 32 |
+ |
|
| 33 |
+ @Override |
|
| 34 |
+ protected Animation getShowAnimation() {
|
|
| 35 |
+ return getDefaultScaleAnimation(); |
|
| 36 |
+ } |
|
| 37 |
+ |
|
| 38 |
+ @Override |
|
| 39 |
+ protected View getClickToDismissView() {
|
|
| 40 |
+ return popupView.findViewById(R.id.click_to_dismiss); |
|
| 41 |
+ } |
|
| 42 |
+ |
|
| 43 |
+ @Override |
|
| 44 |
+ public View getPopupView() {
|
|
| 45 |
+ popupView = LayoutInflater.from(mContext).inflate(R.layout.pop_session_qr, null); |
|
| 46 |
+ groupQRImg = (ImageView) popupView.findViewById(R.id.iv_group_qrcode); |
|
| 47 |
+ return popupView; |
|
| 48 |
+ } |
|
| 49 |
+ |
|
| 50 |
+ private void init(){
|
|
| 51 |
+ try{
|
|
| 52 |
+ initQRImageSize(); |
|
| 53 |
+ groupQRImg.setImageBitmap(QRCreateUtils.Create2DCode(UrlContainer.HOST_URL+groupId, DeviceUtils.dip2px(context,200))); |
|
| 54 |
+ groupQRImg.setVisibility(View.VISIBLE); |
|
| 55 |
+ }catch (Exception e){
|
|
| 56 |
+ e.printStackTrace(); |
|
| 57 |
+ } |
|
| 58 |
+ } |
|
| 59 |
+ |
|
| 60 |
+ @Override |
|
| 61 |
+ public View getAnimaView() {
|
|
| 62 |
+ return popupView.findViewById(R.id.popup_anima); |
|
| 63 |
+ } |
|
| 64 |
+ |
|
| 65 |
+ private void initQRImageSize() {
|
|
| 66 |
+ LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) groupQRImg.getLayoutParams(); |
|
| 67 |
+ params.width = DeviceUtils.dip2px(context,200); |
|
| 68 |
+ params.height = DeviceUtils.dip2px(context,200); |
|
| 69 |
+ groupQRImg.setLayoutParams(params); |
|
| 70 |
+ } |
|
| 71 |
+} |
@@ -0,0 +1,40 @@ |
||
| 1 |
+<?xml version="1.0" encoding="utf-8"?> |
|
| 2 |
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
|
| 3 |
+ android:layout_width="match_parent" |
|
| 4 |
+ android:layout_height="match_parent"> |
|
| 5 |
+ |
|
| 6 |
+ <RelativeLayout |
|
| 7 |
+ android:id="@+id/click_to_dismiss" |
|
| 8 |
+ android:layout_width="match_parent" |
|
| 9 |
+ android:layout_height="match_parent" |
|
| 10 |
+ android:background="@color/popup_bg"> |
|
| 11 |
+ |
|
| 12 |
+ <LinearLayout |
|
| 13 |
+ android:id="@+id/popup_anima" |
|
| 14 |
+ android:layout_width="270dp" |
|
| 15 |
+ android:layout_height="270dp" |
|
| 16 |
+ android:layout_centerInParent="true" |
|
| 17 |
+ android:gravity="center" |
|
| 18 |
+ android:background="@color/pop_bg_color" |
|
| 19 |
+ android:orientation="vertical"> |
|
| 20 |
+ |
|
| 21 |
+ |
|
| 22 |
+ <ImageView |
|
| 23 |
+ android:layout_marginTop="16dp" |
|
| 24 |
+ android:id="@+id/iv_group_qrcode" |
|
| 25 |
+ android:layout_width="200dp" |
|
| 26 |
+ android:layout_height="200dp" |
|
| 27 |
+ /> |
|
| 28 |
+ |
|
| 29 |
+ <TextView |
|
| 30 |
+ android:layout_marginTop="16dp" |
|
| 31 |
+ android:layout_width="wrap_content" |
|
| 32 |
+ android:layout_height="wrap_content" |
|
| 33 |
+ android:text="@string/scan_qr_join_group" |
|
| 34 |
+ android:textColor="@color/grey" |
|
| 35 |
+ android:textSize="12sp" /> |
|
| 36 |
+ |
|
| 37 |
+ </LinearLayout> |
|
| 38 |
+ |
|
| 39 |
+ </RelativeLayout> |
|
| 40 |
+</RelativeLayout> |
@@ -11,4 +11,7 @@ |
||
| 11 | 11 |
<color name="text_white">#FFFFFF</color> |
| 12 | 12 |
<color name="background_white">#FFFFFF</color> |
| 13 | 13 |
<color name="background_light_grey_color">#F0F0F0</color> |
| 14 |
+ |
|
| 15 |
+ <color name="pop_bg_color">#F7F7F7</color> |
|
| 16 |
+ <color name="dark_grey">#333333</color> |
|
| 14 | 17 |
</resources> |
@@ -15,4 +15,6 @@ |
||
| 15 | 15 |
<string name="qr_scan_flash_on">开灯</string> |
| 16 | 16 |
<string name="qr_scan_flash_off">关灯</string> |
| 17 | 17 |
|
| 18 |
+ <string name="scan_qr_join_group">扫描二维码加入群</string> |
|
| 19 |
+ |
|
| 18 | 20 |
</resources> |