虽然图片能发送了,本质问题还没解决,文件没有存到本地。
这个问题始终要解决,否则语音也没法做。
考虑不加路径,直接写看看吧。既然会路径了,问题也就方便多了。现在socket在接收图片的时候,会写到文件里面去,然后。
现在实现了,发的时候,从本地取,然后传给Adapter的是一个路径值,然后socket线程接收到是图片时,先存在本地,然后广播的是路径值。
下一步,点击一下,显示全景。
首先实现了点击一下显示图片,方法是,在Adapter中设置listener,然后点击,生成新的Activity。可参考http://blog.csdn.net/xinyetonghua/article/details/6692767这个链接。
然后全屏的第一步是去掉标题栏,可以参考这个里面的第二个办法http://blog.csdn.net/ttjjttjj1101/article/details/8720235。第一个办法随着版本更新会报错,我实现的方式本质和链接一致,只是在styles中设置了不同的theme,然后分配给不同的Activity。
贴下xml和mainfest的
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppThemeNot" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
Mainfest(局部):
<activity
android:name=".ChatActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:windowSoftInputMode="stateHidden"
android:theme="@style/AppTheme"/>
<activity
android:name=".PicActivity"
android:theme="@style/AppThemeNot"
>
这样可以达到效果。
下一步是,全屏显示,最好还带透明。OK,这个搞定了。透明的处理,参考了http://blog.csdn.net/hjj0212/article/details/7065050
放图:
下一步是,对图片进行压缩,任何图片,假如宽小于屏幕1/2,长也小于,那就不处理,否则则交大的那个元素压缩成1/2,其次,在本地保存一个原图,一个small图,一个界面显示,一个放大显示。comeon。完成了!
贴效果图:
原谅我放大的图迷惑性很强:
下一步,开摄像头捕捉图像然后传输,但是再做就是下周二了,有点事。
对了,一个没处理的bug先说一下,之前也作,A在主界面,B和A聊,然后A显示,现在图片发过去是不显示的,要稍微改一下。