370
阿裏雲
技術社區[雲棲]
鎵嬫満鍗+07-璁劇疆鍚戝-鍗氬-浜戞爾紺懼尯-闃塊噷浜?
浠婂ぉ锛屾垜浠鍋氱殑灝辨槸緇欐垜浠殑鎵嬫満闃茬洍榪欎釜鍔熻兘娣誨姞涓€涓緗悜瀵肩殑鍔熻兘鍟︼紝鎸囧鐢ㄦ埛榪涜涓€浜涜緗紝搴熻瘽涓嶅璿達紝鐩存帴涓婂浘锛岀湅鐪嬫垜浠鍋氱殑鏁堟灉

聽 聽聽
UI涓嶆槸寰堝ソ鐪嬶紝鍚勪綅鍙互鑷繁淇敼涓€涓嬪搱
濂藉暒锛屾垜浠粖澶╀富瑕佹槸鎶婅繖涓や釜鐣岄潰鍐欏嚭鏉ワ紝榪樻湁鎶婁竴浜溳€昏緫浠g爜鍐欎竴涓?/span>
鍏跺疄榪欎富瑕佸氨鏄袱涓獂ml鏂囦歡鍟?/span>
setup_guide1.xml
-
<?xml version="1.0" encoding="utf-8"?>
-
<LinearLayout xmlns:andro
-
聽 聽 android:layout_width="match_parent"
-
聽 聽 android:layout_height="match_parent"
-
聽 聽 android:background="@drawable/title_background"
-
聽 聽 android:orientation="vertical" >
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_content"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_item1"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_item2"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_item3"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_item4"/>
-
聽 聽聽
-
聽 聽 <LinearLayout聽
-
聽 聽聽 聽聽聽android:layout_width="match_parent"
-
聽 聽聽 聽聽聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽聽android:layout_marginTop="8dip"
-
聽 聽聽 聽聽聽android:gravity="center_horizontal"
-
聽 聽聽 聽聽聽android:orientation="horizontal">
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_online"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_invisible"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_invisible"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_invisible"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽 </LinearLayout>
-
聽 聽聽
-
聽 聽 <RelativeLayout聽
-
聽 聽聽 聽聽聽android:layout_width="match_parent"
-
聽 聽聽 聽聽聽android:layout_height="match_parent"
-
聽 聽聽 聽聽聽android:gravity="center_horizontal|center_vertical">
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<LinearLayout聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="match_parent"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽android:layout_height="match_parent"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽android:gravity="center_horizontal|center_vertical">
-
聽 聽 聽 聽聽 聽聽 聽聽 聽
-
聽 聽 聽 聽聽 聽聽 聽聽 聽<ImageView聽
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:layout_width="150dip"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:layout_height="150dip"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:src="@drawable/widget01"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽</LinearLayout>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<Button聽
-
聽 聽聽 聽聽 聽聽 聽android:
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:text="@string/next"
-
聽 聽聽 聽聽 聽聽 聽android:drawableRight="@drawable/next"
-
聽 聽聽 聽聽 聽聽 聽android:layout_alignParentBottom="true"
-
聽 聽聽 聽聽 聽聽 聽android:layout_alignParentRight="true"/>
-
聽 聽聽 聽聽聽
-
聽 聽 </RelativeLayout>
-
聽 聽聽 聽聽聽
-
</LinearLayout>
-
澶嶅埗浠g爜
setup_guide2.xml
setup_guide3.xml
-
<?xml version="1.0" encoding="utf-8"?>
-
<LinearLayout xmlns:andro
-
聽 聽 android:layout_width="match_parent"
-
聽 聽 android:layout_height="match_parent"
-
聽 聽 android:background="@drawable/title_background"
-
聽 聽 android:orientation="vertical" >
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_content"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_item1"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_item2"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_item3"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide1_item4"/>
-
聽 聽聽
-
聽 聽 <LinearLayout聽
-
聽 聽聽 聽聽聽android:layout_width="match_parent"
-
聽 聽聽 聽聽聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽聽android:layout_marginTop="8dip"
-
聽 聽聽 聽聽聽android:gravity="center_horizontal"
-
聽 聽聽 聽聽聽android:orientation="horizontal">
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_online"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_invisible"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_invisible"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_invisible"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽 </LinearLayout>
-
聽 聽聽
-
聽 聽 <RelativeLayout聽
-
聽 聽聽 聽聽聽android:layout_width="match_parent"
-
聽 聽聽 聽聽聽android:layout_height="match_parent"
-
聽 聽聽 聽聽聽android:gravity="center_horizontal|center_vertical">
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<LinearLayout聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="match_parent"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽android:layout_height="match_parent"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽android:gravity="center_horizontal|center_vertical">
-
聽 聽 聽 聽聽 聽聽 聽聽 聽
-
聽 聽 聽 聽聽 聽聽 聽聽 聽<ImageView聽
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:layout_width="150dip"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:layout_height="150dip"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:src="@drawable/widget01"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽</LinearLayout>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<Button聽
-
聽 聽聽 聽聽 聽聽 聽android:
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:text="@string/next"
-
聽 聽聽 聽聽 聽聽 聽android:drawableRight="@drawable/next"
-
聽 聽聽 聽聽 聽聽 聽android:layout_alignParentBottom="true"
-
聽 聽聽 聽聽 聽聽 聽android:layout_alignParentRight="true"/>
-
聽 聽聽 聽聽聽
-
聽 聽 </RelativeLayout>
-
聽 聽聽 聽聽聽
-
</LinearLayout>
-
澶嶅埗浠g爜
setup_guide4.xml
-
<?xml version="1.0" encoding="utf-8"?>
-
<LinearLayout xmlns:andro
-
聽 聽 android:layout_width="match_parent"
-
聽 聽 android:layout_height="match_parent"
-
聽 聽 android:background="@drawable/title_background"
-
聽 聽 android:orientation="vertical" >
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide4"/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽/>
-
聽 聽聽
-
聽 聽 <TextView聽
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽android:text="@string/guide4_content"/>
-
聽 聽聽
-
聽 聽 <CheckBox聽
-
聽 聽聽 聽聽聽android:
-
聽 聽聽 聽聽聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽聽android:textColor="@android:color/white"
-
聽 聽聽 聽聽聽android:text="@string/guide4_item1"/>
-
聽 聽聽
-
聽 聽 <LinearLayout聽
-
聽 聽聽 聽聽聽android:layout_width="match_parent"
-
聽 聽聽 聽聽聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽聽android:layout_marginTop="8dip"
-
聽 聽聽 聽聽聽android:gravity="center_horizontal"
-
聽 聽聽 聽聽聽android:orientation="horizontal">
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_invisible"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_invisible"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_invisible"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<ImageView聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:src="@android:drawable/presence_online"
-
聽 聽聽 聽聽 聽聽 聽android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽 </LinearLayout>
-
聽 聽聽
-
聽 聽 <RelativeLayout聽
-
聽 聽聽 聽聽聽android:layout_width="match_parent"
-
聽 聽聽 聽聽聽android:layout_height="match_parent"
-
聽 聽聽 聽聽聽android:gravity="center_horizontal|center_vertical">
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<LinearLayout聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="match_parent"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽android:layout_height="match_parent"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽android:gravity="center_horizontal|center_vertical">
-
聽 聽 聽 聽聽 聽聽 聽聽 聽
-
聽 聽 聽 聽聽 聽聽 聽聽 聽<ImageView聽
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:layout_width="150dip"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:layout_height="150dip"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:src="@drawable/guide4"
-
聽 聽 聽 聽聽 聽聽 聽聽 聽聽 聽 android:contentDescription="@string/hello_world"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽</LinearLayout>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<Button聽
-
聽 聽聽 聽聽 聽聽 聽android:
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:text="@string/perviout"
-
聽 聽聽 聽聽 聽聽 聽android:drawableRight="@drawable/previous"
-
聽 聽聽 聽聽 聽聽 聽android:layout_alignParentBottom="true"
-
聽 聽聽 聽聽 聽聽 聽android:layout_alignParentLeft="true"/>
-
聽 聽聽 聽聽聽
-
聽 聽聽 聽聽聽<Button聽
-
聽 聽聽 聽聽 聽聽 聽android:layout_width="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:layout_height="wrap_content"
-
聽 聽聽 聽聽 聽聽 聽android:text="@string/finish"
-
聽 聽聽 聽聽 聽聽 聽android:drawableRight="@drawable/next"
-
聽 聽聽 聽聽 聽聽 聽android:layout_alignParentBottom="true"
-
聽 聽聽 聽聽 聽聽 聽android:layout_alignParentRight="true"/>
-
聽 聽聽 聽聽聽
-
聽 聽 </RelativeLayout>
-
聽 聽聽 聽聽聽
-
</LinearLayout>
-
澶嶅埗浠g爜
涓婇潰鍥涗釜xml鏂囦歡锛屽氨鏄垜浠鍋氱殑鍚戝鐨勭晫闈㈠暒锛屽叾涓兘鐢ㄥ埌浜嗘牱寮忕殑瀹氫箟锛屽悇浣嶅鏋滄湁浠€涔堜笉鏄庣櫧鐨勶紝鍙互鍥炲ご鍐嶇湅涓€涓嬫垜浠箣鍓嶅啓鐨勶紝姣曠珶鏄竴姝ユ帴涓€姝ョ殑锛岃偗瀹氳鍏堟妸鍓嶉潰鐨勫紕娓呮鐨勶紝鍥犱負鍚庨潰榪樹細鐢ㄥ埌閭d簺鐭ヨ瘑鐐圭殑銆傛垜浠粖澶╀富瑕佹槸鎶婂墠涓や釜欏甸潰鐨勯€昏緫鍔犱笂锛屽悗闈袱涓〉闈㈢殑閫昏緫鍦ㄦ槑澶╁啀鍔狅紝鍥犱負絎笁涓〉闈紝瑕佹秹鍙婂埌璿誨彇鐢ㄦ埛鐨勮仈緋諱漢榪欎竴闈炲父甯哥敤鐨勬搷浣滐紝鎵€浠ュ崟鐙潵璁蹭竴涓嬫垜浠殑璁劇疆鍚戝鏄湪鐢ㄦ埛絎竴嬈℃墦寮€鎴戜滑鐨勬墜鏈洪槻鐩楄繖涓姛鑳芥椂鎵嶅惎鍔ㄧ殑锛屾墍浠ユ垜浠繕瑕佸湪鎵嬫満闃茬洍榪欎釜鍔熻兘鐨勭晫闈㈤噷闈㈠姞涓€浜溳€昏緫锛屽ソ锛屽簾璿濅笉澶氳锛? 鐩存帴涓婁唬鐮乧om.xiaobin.security.ui.LostProtectedActivity
-
package com.xiaobin.security.ui;
-
-
import android.app.Activity;
-
import android.app.Dialog;
-
import android.content.Context;
-
import android.content.Intent;
-
import android.content.SharedPreferences;
-
import android.content.SharedPreferences.Editor;
-
import android.os.Bundle;
-
import android.view.View;
-
import android.view.View.OnClickListener;
-
import android.widget.Button;
-
import android.widget.EditText;
-
import android.widget.Toast;
-
-
import com.xiaobin.security.R;
-
import com.xiaobin.security.utils.MD5Encoder;
-
-
public class LostProtectedActivity extends Activity implements OnClickListener
-
{
-
聽 聽 聽 聽 private SharedPreferences sp;
-
聽 聽 聽 聽 private Dialog dialog;
-
聽 聽 聽 聽 private EditText password;
-
聽 聽 聽 聽 private EditText confirmPassword;
-
聽 聽 聽 聽聽
-
聽 聽 聽 聽 @Override
-
聽 聽 聽 聽 protected void onCreate(Bundle savedInstanceState)
-
聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 super.onCreate(savedInstanceState);
-
聽 聽 聽 聽 聽 聽 聽 聽聽
-
聽 聽 聽 聽 聽 聽 聽 聽 sp = getSharedPreferences("cofig", Context.MODE_PRIVATE);
-
聽 聽 聽 聽 聽 聽 聽 聽聽
-
聽 聽 聽 聽 聽 聽 聽 聽 if(isSetPassword())
-
聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 showLoginDialog();
-
聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 else
-
聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 showFirstDialog();
-
聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 }
-
聽 聽 聽 聽聽
-
聽 聽 聽 聽 private void showLoginDialog()
-
聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 dialog = new Dialog(this, R.style.MyDialog);
-
聽 聽 聽 聽 聽 聽 聽 聽 View view = View.inflate(this, R.layout.login_dialog, null);
-
聽 聽 聽 聽 聽 聽 聽 聽 password = (EditText) view.findViewById(R.id.et_protected_password);
-
聽 聽 聽 聽 聽 聽 聽 聽 Button yes = (Button) view.findViewById(R.id.bt_protected_login_yes);
-
聽 聽 聽 聽 聽 聽 聽 聽 Button cancel = (Button) view.findViewById(R.id.bt_protected_login_no);
-
聽 聽 聽 聽 聽 聽 聽 聽 yes.setOnClickListener(this);
-
聽 聽 聽 聽 聽 聽 聽 聽 cancel.setOnClickListener(this);
-
聽 聽 聽 聽 聽 聽 聽 聽 dialog.setContentView(view);
-
聽 聽 聽 聽 聽 聽 聽 聽 dialog.setCancelable(false);
-
聽 聽 聽 聽 聽 聽 聽 聽 dialog.show();
-
聽 聽 聽 聽 }
-
-
聽 聽 聽 聽 private void showFirstDialog()
-
聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 dialog = new Dialog(this, R.style.MyDialog);
-
聽 聽 聽 聽 聽 聽 聽 聽 //dialog.setContentView(R.layout.first_dialog);
-
聽 聽 聽 聽 聽 聽 聽 聽 View view = View.inflate(this, R.layout.first_dialog, null);//榪欑濉厖甯冨矓鐨勬柟寮忔瘮杈冩柟渚匡紝宄敤鎷垮埌涓€涓狶ayoutInflate瀵矽薄
-
聽 聽 聽 聽 聽 聽 聽 聽 password = (EditText) view.findViewById(R.id.et_protected_first_password);
-
聽 聽 聽 聽 聽 聽 聽 聽 confirmPassword = (EditText) view.findViewById(R.id.et_protected_confirm_password);
-
聽 聽 聽 聽 聽 聽 聽 聽 Button yes = (Button) view.findViewById(R.id.bt_protected_first_yes);
-
聽 聽 聽 聽 聽 聽 聽 聽 Button cancel = (Button) view.findViewById(R.id.bt_protected_first_no);
-
聽 聽 聽 聽 聽 聽 聽 聽 yes.setOnClickListener(this);
-
聽 聽 聽 聽 聽 聽 聽 聽 cancel.setOnClickListener(this);
-
聽 聽 聽 聽 聽 聽 聽 聽 dialog.setContentView(view);
-
聽 聽 聽 聽 聽 聽 聽 聽 dialog.setCancelable(false);
-
聽 聽 聽 聽 聽 聽 聽 聽 dialog.show();
-
聽 聽 聽 聽 }
-
-
聽 聽 聽 聽 private boolean isSetPassword()
-
聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 String pwd = sp.getString("password", "");
-
聽 聽 聽 聽 聽 聽 聽 聽 if(pwd.equals("") || pwd == null)
-
聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 return false;
-
聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 return true;
-
聽 聽 聽 聽 }
-
聽 聽 聽 聽聽
-
聽 聽 聽 聽 private boolean isSetupGuide()
-
聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 return sp.getBoolean("setupGuide", false);
-
聽 聽 聽 聽 }
-
-
聽 聽 聽 聽 @Override
-
聽 聽 聽 聽 public void onClick(View v)
-
聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 switch(v.getId())
-
聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 case R.id.bt_protected_first_yes :聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 String fp = password.getText().toString().trim();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 String cp = confirmPassword.getText().toString().trim();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 if(fp.equals("") || cp.equals(""))
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Toast.makeText(this, "瀵嗙爜涓嶈兘涓虹┖", Toast.LENGTH_SHORT).show();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 return;
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 else聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 if(fp.equals(cp))
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Editor editor = sp.edit();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 editor.putString("password", MD5Encoder.encode(fp));
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 editor.commit();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 dialog.dismiss();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 if(!isSetupGuide())
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 finish();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Intent intent = new Intent(this, SetupGuide1Activity.class);
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 startActivity(intent);
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 else
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Toast.makeText(this, "涓ゆ瀵嗙爜涓嶇溮鍚?, Toast.LENGTH_SHORT).show();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 return;
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 dialog.dismiss();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 break;
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 case R.id.bt_protected_first_no :聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 dialog.dismiss();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 finish();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 break;
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 case R.id.bt_protected_login_yes :聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 String pwd = password.getText().toString().toString();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 if(pwd.equals(""))
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Toast.makeText(this, "璿瘋緭鍏ュ瘑鐮?, Toast.LENGTH_SHORT).show();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 else
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 String str = sp.getString("password", "");
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 if(MD5Encoder.encode(pwd).equals(str))
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 if(!isSetupGuide())
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 finish();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Intent intent = new Intent(this, SetupGuide1Activity.class);
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 startActivity(intent);
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 dialog.dismiss();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 else
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Toast.makeText(this, "瀵嗙爜閿欒", Toast.LENGTH_SHORT).show();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 break;
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 case R.id.bt_protected_login_no :聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 dialog.dismiss();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 finish();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 break;
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 default :聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 break;
-
聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 }
-
-
}
-
澶嶅埗浠g爜
com.xiaobin.security.ui.SetupGuide1
-
package com.xiaobin.security.ui;
-
-
import android.app.Activity;
-
import android.content.Intent;
-
import android.os.Bundle;
-
import android.view.View;
-
import android.view.View.OnClickListener;
-
import android.widget.Button;
-
-
import com.xiaobin.security.R;
-
-
public class SetupGuide1Activity extends Activity implements OnClickListener
-
{
-
聽 聽 聽 聽 private Button next;
-
聽 聽 聽 聽聽
-
聽 聽 聽 聽 @Override
-
聽 聽 聽 聽 protected void onCreate(Bundle savedInstanceState)
-
聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 super.onCreate(savedInstanceState);
-
聽 聽 聽 聽 聽 聽 聽 聽 setContentView(R.layout.setup_guide1);
-
聽 聽 聽 聽 聽 聽 聽 聽聽
-
聽 聽 聽 聽 聽 聽 聽 聽 next = (Button) findViewById(R.id.bt_guide_next);
-
聽 聽 聽 聽 聽 聽 聽 聽 next.setOnClickListener(this);
-
聽 聽 聽 聽 }
-
-
聽 聽 聽 聽 @Override
-
聽 聽 聽 聽 public void onClick(View v)
-
聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 switch(v.getId())
-
聽 聽 聽 聽 聽 聽 聽 聽 {
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 case R.id.bt_guide_next :聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 Intent intent = new Intent(this, SetupGuide2Activity.class);
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 finish();
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 startActivity(intent);
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 //榪欎釜鏄畾涔塧ctivity鍒囨崲鏃剁殑鍔ㄧ敾鏁堟灉鐨?br>
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 overridePendingTransition(R.anim.alpha_in, R.anim.alpha_out);
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 break;
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 default :聽
-
聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 聽 break;
-
聽 聽 聽 聽 聽 聽 聽 聽 }
-
聽 聽 聽 聽 }
-
-
}
-
澶嶅埗浠g爜
澶у鍙互鐪嬪埌锛屾垜浠湪涓婇潰鍒囨崲activity鏃訛紝鍔犱簡涓€浜涙晥鏋滐紝鍏跺疄灝辨槸閫氳繃overridePendingTransition榪欎釜鏂規硶鏉ュ疄鐜扮殑锛屾墍浠ュぇ瀹朵互鍚庢兂璁╄嚜宸辯殑activity涔嬮棿鍒囨崲锛屽涓€浜涘姩鎬佺殑鏁堟灉锛屽氨鍙互鐢ㄨ繖涓柟娉曞暒銆備笂闈㈠彧鏄垜鑷繁瀹氫箟鐨勪竴涓畝鍗曠殑鍔ㄧ敾鏂囦歡锛岃瀹氫箟涓€涓姩鐢繪枃浠朵篃寰堢畝鍗曪紝鍙鍦╮es涓嬮潰鏂板緩涓€涓猘nim鐩綍锛岀劧鍚庡湪閲岄潰鏂板緩涓€浜涘姩鐢葷殑xml灝辮鍟︿笅闈㈡槸鎴戜滑涓婇潰鐨勯偅涓や釜xml鍔ㄧ敾alpha_in.xml
-
<?xml version="1.0" encoding="utf-8"?>
-
<alpha xmlns:andro
-
聽 聽 android:fromAlpha="0.0"
-
聽 聽 android:toAlpha="1.0"
-
聽 聽 android:duration="300" >
-
聽 聽聽
-
-
</alpha>
-
澶嶅埗浠g爜
alpha_out.xml鏈変竴涓湴鏂矽娉ㄦ剰鐨勶紝鎴戜滑鏂板緩鍔ㄧ敾鐨剎ml鏃訛紝涓€瀹氳鎶婇偅涓懡鍚嶇┖闂?a target="_blank" href="https://schemas.android.com/apk/res/android" >https://schemas.android.com/apk/res/android鎸囧畾濂斤紝涓嶇劧灝變笉琛岀殑 濂藉暒锛岀幇鍦ㄦ垜浠妸絎簩涓猤uide鐨勯€昏緫浠g爜涔熷啓涓€涓媍om.xiaobin.security.ui.SetupGuide2