Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.07 KB | None | 0 0
  1. public class customSwipeAdapter extends PagerAdapter {
  2.  
  3. @Override
  4. public Object instantiateItem(ViewGroup container, int position) {
  5. layoutInflator = (LayoutInflater)
  6.  
  7. ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  8. final View item_view = layoutInflator.inflate(R.layout.swipe_layout, container, false);
  9.  
  10. final EasyFlipView mYourFlipView = (EasyFlipView) item_view.findViewById(R.id.flipView);
  11.  
  12. ImageView imageView_Front = (ImageView) item_view.findViewById(R.id.imageView_Front);
  13. imageView_Front.setImageResource(frontImages[position]);
  14.  
  15. ImageView imageView_Back = (ImageView) item_view.findViewById(R.id.imageView_Back);
  16.  
  17. container.addView(item_view);
  18.  
  19. return item_view;
  20. }
  21.  
  22. public class savedImagesViewController extends AppCompatActivity {
  23.  
  24. ViewPager viewPager;
  25. customSwipeAdapter adapter;
  26.  
  27. @Override
  28. protected void onCreate(Bundle savedInstanceState) {
  29. super.onCreate(savedInstanceState);
  30. setContentView(R.layout.activity_saved_Images_view_controller);
  31.  
  32. viewPager = (ViewPager) findViewById(R.id.view_pager);
  33. adapter = new customSwipeAdapter(this);
  34. viewPager.setAdapter(adapter);
  35. viewPager.setPageTransformer(false, new DefaultTransformer());
  36. }
  37.  
  38. <?xml version="1.0" encoding="utf-8"?>
  39. <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
  40. android:id="@+id/rootView"
  41. xmlns:app="http://schemas.android.com/apk/res-auto"
  42. xmlns:tools="http://schemas.android.com/tools"
  43. android:layout_width="match_parent"
  44. android:layout_height="match_parent"
  45. tools:context="com.project_bc.project_bc.savedImagesViewController">
  46.  
  47. <com.project_bc.project_bc.CustomViewPager xmlns:android="http://schemas.android.com/apk/res/android"
  48. xmlns:app="http://schemas.android.com/apk/res-auto"
  49. android:id="@+id/view_pager"
  50. android:layout_width="match_parent"
  51. android:layout_height="match_parent"
  52. app:swipe_orientation="vertical" >
  53.  
  54.  
  55. </com.project_bc.project_bc.CustomViewPager>
  56.  
  57. <android.support.design.widget.NavigationView
  58. android:id="@+id/startNav"
  59. android:background="@color/QRCodeBg"
  60. android:layout_width="wrap_content"
  61. android:layout_height="match_parent"
  62. android:layout_gravity="start" >
  63.  
  64. <RelativeLayout
  65. android:layout_width="match_parent"
  66. android:layout_height="match_parent">
  67.  
  68. <TextView
  69. android:id="@+id/textView4"
  70. android:layout_width="match_parent"
  71. android:layout_height="wrap_content"
  72. android:layout_alignParentLeft="true"
  73. android:layout_alignParentStart="true"
  74. android:layout_alignParentTop="true"
  75. android:layout_marginTop="5dp"
  76. android:text="@string/currentImageText"
  77. android:textAlignment="center"
  78. android:textColor="#41C8FF"
  79. android:textSize="36sp" />
  80.  
  81. <TextView
  82. android:id="@+id/currentImageName"
  83. android:layout_width="match_parent"
  84. android:layout_height="wrap_content"
  85. android:layout_alignParentLeft="true"
  86. android:layout_alignParentStart="true"
  87. android:layout_below="@+id/textView4"
  88. android:layout_marginTop="10dp"
  89. android:textAlignment="center"
  90. android:textColor="#ffffff"
  91. android:textSize="24sp" />
  92.  
  93. <Button
  94. android:id="@+id/favorite"
  95. android:layout_width="match_parent"
  96. android:layout_height="40dp"
  97. android:layout_below="@+id/share"
  98. android:layout_centerHorizontal="true"
  99. android:layout_marginLeft="20dp"
  100. android:layout_marginRight="20dp"
  101. android:layout_marginTop="20dp"
  102. android:background="@drawable/deletecurrentImageborder"
  103. android:onClick="onClick_FavoriteImage"
  104. android:text="@string/favCurrentImageText"
  105. android:textAllCaps="false"
  106. android:textColor="#FF69B4"
  107. android:textSize="24sp" />
  108.  
  109. <Button
  110. android:id="@+id/share"
  111. android:layout_width="match_parent"
  112. android:layout_height="40dp"
  113. android:layout_alignParentLeft="true"
  114. android:layout_alignParentStart="true"
  115. android:layout_centerVertical="true"
  116. android:layout_marginLeft="20dp"
  117. android:layout_marginRight="20dp"
  118. android:background="@drawable/deletecurrentImageborder"
  119. android:onClick="onClick_ShareImage"
  120. android:text="@string/shareCurrentCardText"
  121. android:textAllCaps="false"
  122. android:textColor="#41C8FF"
  123. android:textSize="24sp" />
  124.  
  125. <Button
  126. android:id="@+id/delete"
  127. android:layout_width="match_parent"
  128. android:layout_height="40dp"
  129. android:layout_alignParentEnd="true"
  130. android:layout_alignParentRight="true"
  131. android:layout_below="@+id/favorite"
  132. android:layout_marginLeft="20dp"
  133. android:layout_marginRight="20dp"
  134. android:layout_marginTop="20dp"
  135. android:background="@drawable/deletecurrentImageborder"
  136. android:onClick="onClick_DeleteCurrentImageBtn"
  137. android:text="normal"
  138. android:textAllCaps="false"
  139. android:textColor="#ff0000"
  140. android:textSize="24sp" />
  141.  
  142. <EditText
  143. android:id="@+id/shareCurrentImageWith"
  144. android:layout_width="match_parent"
  145. android:layout_height="wrap_content"
  146. android:layout_centerHorizontal="true"
  147. android:layout_centerVertical="true"
  148. android:layout_marginLeft="20dp"
  149. android:layout_marginRight="20dp"
  150. android:backgroundTint="#ffffff"
  151. android:ems="10"
  152. android:hint="@string/shareImageWIth_Hint"
  153. android:imeOptions="flagNoExtractUi"
  154. android:inputType="textPersonName"
  155. android:paddingLeft="10dp"
  156. android:textColor="#ffffff"
  157. android:textColorHint="#1441C8FF"
  158. android:textStyle="italic" />
  159.  
  160. </RelativeLayout>
  161.  
  162. </android.support.design.widget.NavigationView>
  163.  
  164. <android.support.design.widget.NavigationView
  165. android:id="@+id/endNav"
  166. android:background="@color/QRCodeBg"
  167. android:layout_width="wrap_content"
  168. android:layout_height="match_parent"
  169. android:layout_gravity="end" >
  170.  
  171. <RelativeLayout
  172. android:layout_width="match_parent"
  173. android:layout_height="match_parent">
  174.  
  175. <Button
  176. android:id="@+id/goToMyImageButton"
  177. android:layout_width="match_parent"
  178. android:layout_height="35dp"
  179. android:layout_alignParentTop="true"
  180. android:layout_centerHorizontal="true"
  181. android:layout_marginLeft="30dp"
  182. android:layout_marginRight="30dp"
  183. android:layout_marginTop="28dp"
  184. android:background="@drawable/myImagebtnborder"
  185. android:onClick="onClick_GoToMyImage"
  186. android:text="@string/myImageBtn"
  187. android:textAlignment="center"
  188. android:textAllCaps="false"
  189. android:textSize="14sp" />
  190.  
  191. <!--<ImageView-->
  192. <!--android:id="@+id/previewSearchUser"-->
  193. <!--android:layout_width="180dp"-->
  194. <!--android:layout_height="80dp"-->
  195. <!--android:layout_above="@+id/editText"-->
  196. <!--android:layout_centerHorizontal="true"-->
  197. <!--android:background="@drawable/previewImageborder"-->
  198. <!--android:scaleType="fitXY"-->
  199. <!--android:visibility="invisible" />-->
  200.  
  201. <TextView
  202. android:id="@+id/troubleScanningText"
  203. android:layout_width="match_parent"
  204. android:layout_height="wrap_content"
  205. android:layout_above="@+id/editText"
  206. android:layout_alignParentEnd="true"
  207. android:layout_alignParentRight="true"
  208. android:layout_marginBottom="3dp"
  209. android:layout_marginLeft="25dp"
  210. android:layout_marginRight="25dp"
  211. android:text="@string/trouble"
  212. android:textColor="#ffffff"
  213. android:textSize="18sp"
  214. tools:text="@string/trouble" />
  215.  
  216. <EditText
  217. android:id="@+id/editText"
  218. style="@android:style/Widget.AutoCompleteTextView"
  219. android:layout_width="wrap_content"
  220. android:layout_height="45dp"
  221. android:layout_alignParentBottom="true"
  222. android:layout_alignParentEnd="true"
  223. android:layout_alignParentLeft="true"
  224. android:layout_alignParentRight="true"
  225. android:layout_alignParentStart="true"
  226. android:layout_marginBottom="15dp"
  227. android:layout_marginLeft="25dp"
  228. android:layout_marginRight="25dp"
  229. android:ems="10"
  230. android:hint="@string/EditTxtPlaceHolder"
  231. android:imeOptions="flagNoExtractUi"
  232. android:inputType="text"
  233. android:onClick="showKeyBoard"
  234. android:paddingLeft="7dp"
  235. android:backgroundTint="#ffffff"
  236. android:textColor="#ffffff"
  237. android:textColorHint="#1441C8FF"
  238. android:textSize="18sp" />
  239.  
  240. <ImageView
  241. android:id="@+id/cameraButtonImage"
  242. android:layout_width="110dp"
  243. android:layout_height="110dp"
  244. android:layout_below="@+id/goToMyImageButton"
  245. android:layout_centerHorizontal="true"
  246. android:layout_marginTop="21dp"
  247. android:background="@drawable/camerabtnborder"
  248. app:srcCompat="@drawable/qrcodebtn" />
  249.  
  250. <Button
  251. android:id="@+id/cameraButton"
  252. android:layout_width="110dp"
  253. android:layout_height="110dp"
  254. android:layout_alignTop="@+id/cameraButtonImage"
  255. android:layout_centerHorizontal="true"
  256. android:background="@null"
  257. android:onClick="onClick_GoToCamera"
  258. android:text="@null" />
  259.  
  260. </RelativeLayout>
  261.  
  262. </android.support.design.widget.NavigationView>
  263.  
  264.  
  265. </android.support.v4.widget.DrawerLayout>
  266.  
  267. <?xml version="1.0" encoding="utf-8"?>
  268. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  269. android:layout_width="match_parent"
  270. android:layout_height="match_parent"
  271. xmlns:app="http://schemas.android.com/apk/res-auto">
  272.  
  273. <com.wajahatkarim3.easyflipview.EasyFlipView
  274. android:id="@+id/flipView"
  275. android:layout_width="wrap_content"
  276. android:layout_height="wrap_content"
  277.  
  278. android:foregroundGravity="center"
  279. android:gravity="center"
  280.  
  281. app:flipOnTouch="true"
  282. app:flipEnabled="true"
  283. app:flipDuration="500" >
  284.  
  285. <!-- Back Layout Goes Here -->
  286. <include layout="@layout/flash_card_layout_back"/>
  287.  
  288. <!-- Front Layout Goes Here -->
  289. <include layout="@layout/flash_card_layout_front" />
  290.  
  291. </com.wajahatkarim3.easyflipview.EasyFlipView>
  292.  
  293. </RelativeLayout>
  294.  
  295. <?xml version="1.0" encoding="utf-8"?>
  296. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  297. xmlns:app="http://schemas.android.com/apk/res-auto"
  298. android:orientation="vertical"
  299. android:layout_width="match_parent"
  300. android:layout_height="match_parent">
  301.  
  302. <ImageView
  303. android:id="@+id/imageView_Back"
  304. android:layout_width="match_parent"
  305. android:layout_height="match_parent"
  306. android:layout_margin="15dp"
  307. android:background="@drawable/cardborder"
  308. android:scaleType="fitXY"
  309. app:srcCompat="@drawable/backimage" />
  310.  
  311. </RelativeLayout>
  312.  
  313. <?xml version="1.0" encoding="utf-8"?>
  314. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  315. android:layout_width="match_parent"
  316. android:layout_height="match_parent"
  317. xmlns:app="http://schemas.android.com/apk/res-auto">
  318.  
  319. <com.wajahatkarim3.easyflipview.EasyFlipView
  320. android:id="@+id/flipView"
  321. android:layout_width="wrap_content"
  322. android:layout_height="wrap_content"
  323.  
  324. android:foregroundGravity="center"
  325. android:gravity="center"
  326.  
  327. app:flipOnTouch="true"
  328. app:flipEnabled="true"
  329. app:flipDuration="500" >
  330.  
  331. <!-- Back Layout Goes Here -->
  332. <include layout="@layout/flash_card_layout_back"/>
  333.  
  334. <!-- Front Layout Goes Here -->
  335. <include layout="@layout/flash_card_layout_front" />
  336.  
  337. </com.wajahatkarim3.easyflipview.EasyFlipView>
  338.  
  339. </RelativeLayout>
  340.  
  341. <?xml version="1.0" encoding="utf-8"?>
  342. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  343. android:layout_width="match_parent"
  344. android:layout_height="match_parent"
  345. xmlns:app="http://schemas.android.com/apk/res-auto">
  346.  
  347. <com.wajahatkarim3.easyflipview.EasyFlipView
  348. android:id="@+id/flipView"
  349. android:layout_width="wrap_content"
  350. android:layout_height="wrap_content"
  351. app:flipOnTouch="true"
  352. app:flipEnabled="true"
  353. app:flipDuration="500"
  354.  
  355. android:layout_marginRight="100dp"
  356. android:layout_marginLeft="100dp" >
  357.  
  358. <!-- Back Layout Goes Here -->
  359. <include layout="@layout/flash_card_layout_back"/>
  360.  
  361. <!-- Front Layout Goes Here -->
  362. <include
  363. layout="@layout/flash_card_layout_front" />
  364.  
  365. </com.wajahatkarim3.easyflipview.EasyFlipView>
  366.  
  367. </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement