Commit b7d052339e8844dfbf9b84f67074f4d58a54f1af

Authored by transpine
1 parent 60414fa7

- add loginActivity ui

app/src/main/AndroidManifest.xml
... ... @@ -2,6 +2,7 @@
2 2 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 3 package="net.devfac.userstory" >
4 4  
  5 +
5 6 <uses-permission android:name="android.permission.INTERNET"/>
6 7 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
7 8 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
... ... @@ -23,7 +24,10 @@
23 24 <category android:name="android.intent.category.LAUNCHER" />
24 25 </intent-filter>
25 26 </activity>
26   - <activity android:name=".IndexActivitiy"/>
  27 +
  28 + <activity android:name=".IndexActivitiy"
  29 + android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
  30 +
27 31 <activity android:name=".ActivityLogin"
28 32 android:label="LOGIN"
29 33 android:theme="@style/AppTheme.UserstoryNoActionBar" />
... ...
app/src/main/java/net/devfac/userstory/ActivityLogin.java
1 1 package net.devfac.userstory;
2 2  
  3 +import android.content.Intent;
  4 +import android.net.Uri;
3 5 import android.os.Bundle;
4 6 import android.support.v7.app.AppCompatActivity;
5 7 import android.support.v7.widget.Toolbar;
... ... @@ -9,6 +11,8 @@ import android.view.MenuItem;
9 11 import android.view.View;
10 12 import android.widget.Button;
11 13 import android.widget.EditText;
  14 +import android.widget.ImageButton;
  15 +import android.widget.TextView;
12 16 import android.widget.Toast;
13 17  
14 18 import net.devfac.userstory.FSM.Action;
... ... @@ -18,6 +22,8 @@ import net.devfac.userstory.FSM.state.StateLoginRequested;
18 22 import net.devfac.userstory.Utils.Logger;
19 23 import net.devfac.userstory.Utils.PreferenceUtil;
20 24  
  25 +import org.w3c.dom.Text;
  26 +
21 27 /**
22 28 * Created by Onether on 15. 11. 10..
23 29 */
... ... @@ -25,7 +31,8 @@ public class ActivityLogin extends AppCompatActivity implements View.OnClickList
25 31 private Toolbar mToolbarLogin;
26 32 private EditText mEditId;
27 33 private EditText mEditPassword;
28   - private Button mBtnLogin;
  34 + private ImageButton mImgBtnLogin;
  35 + private TextView mTextHomepageLink;
29 36  
30 37 @Override
31 38 protected void onCreate(Bundle savedInstanceState) {
... ... @@ -37,19 +44,22 @@ public class ActivityLogin extends AppCompatActivity implements View.OnClickList
37 44  
38 45 mEditId = (EditText)findViewById(R.id.editId);
39 46 mEditPassword = (EditText)findViewById(R.id.editPassword);
40   - mBtnLogin = (Button)findViewById(R.id.btn_login);
  47 + mImgBtnLogin = (ImageButton)findViewById(R.id.imgbtn_login);
41 48  
42 49 mEditId.setText(PreferenceUtil.getInstance(this).getUserId());
43 50 mEditPassword.setText(PreferenceUtil.getInstance(this).getUserPwd());
44 51  
45 52 if( PreferenceUtil.getInstance(this).getIsLoggedInState() ){
46   - mBtnLogin.setText("LOGOFF");
  53 + mImgBtnLogin.setImageDrawable(getDrawable(R.drawable.logout_button));
47 54 }
48 55 else{
49   - mBtnLogin.setText("LOGIN");
  56 + mImgBtnLogin.setImageDrawable(getDrawable(R.drawable.login_button));
50 57 }
51 58  
52   - mBtnLogin.setOnClickListener(this);
  59 + mImgBtnLogin.setOnClickListener(this);
  60 +
  61 + mTextHomepageLink = (TextView)findViewById(R.id.text_homepage_link);
  62 + mTextHomepageLink.setOnClickListener(this);
53 63  
54 64 StateContext.getInstance(this).setStateEventListener(this);
55 65 }
... ... @@ -75,8 +85,8 @@ public class ActivityLogin extends AppCompatActivity implements View.OnClickList
75 85 @Override
76 86 public void onClick(View v) {
77 87 switch( v.getId() ){
78   - case R.id.btn_login:
79   - if( mBtnLogin.getText().equals("LOGIN")){
  88 + case R.id.imgbtn_login:
  89 + if( !PreferenceUtil.getInstance(this).getIsLoggedInState() ){
80 90 //Log in handling
81 91 String userid = mEditId.getText().toString();
82 92 String userpwd = mEditPassword.getText().toString();
... ... @@ -91,10 +101,14 @@ public class ActivityLogin extends AppCompatActivity implements View.OnClickList
91 101 // StateContext.getInstance(getActivity()).setWebView(wv);
92 102 StateContext.getInstance(this).processEvent(Action.REQ_LOGIN, null);
93 103 }
94   - else if( mBtnLogin.getText().equals("LOGOFF")){
95   - //Log off handling
  104 + else{ //Log off handling
  105 +
96 106 }
97 107 break;
  108 +
  109 + case R.id.text_homepage_link:
  110 + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://userstorybook.net/")));
  111 + break;
98 112 }
99 113 }
100 114  
... ... @@ -116,6 +130,7 @@ public class ActivityLogin extends AppCompatActivity implements View.OnClickList
116 130 case LOGIN_SUCCESS:
117 131 PreferenceUtil.getInstance(this).putIsLoggedInState(true);
118 132 Toast.makeText(this, "Login Success", Toast.LENGTH_LONG).show();
  133 + startActivity(new Intent(this, MainActivity.class));
119 134 finish();
120 135 break;
121 136 }
... ...
app/src/main/java/net/devfac/userstory/MainActivity.java
... ... @@ -55,6 +55,7 @@ public class MainActivity extends AppCompatActivity
55 55  
56 56 if( PreferenceUtil.getInstance(this).getIsFirstLaunched() ){
57 57 startActivity(new Intent(this, IndexActivitiy.class));
  58 + finish();
58 59 return;
59 60 }
60 61 setContentView(R.layout.activity_main);
... ... @@ -74,7 +75,9 @@ public class MainActivity extends AppCompatActivity
74 75 StateContext.getInstance(this).processEvent(Action.REQ_LOGIN, null);
75 76 }
76 77 else{
77   - mViewPagerMain.setCurrentItem(mViewPagerAdapter.getPosition(Constants.FRAGMENT_TITLE_BOOK_SHELF));
  78 + startActivity(new Intent(MainActivity.this, ActivityLogin.class));
  79 + finish();
  80 +// mViewPagerMain.setCurrentItem(mViewPagerAdapter.getPosition(Constants.FRAGMENT_TITLE_BOOK_SHELF));
78 81 // fragmentReplace(Constants.FRAGMENT_SELECT.FRAG_BOOK_SHELF);
79 82 }
80 83 }
... ...
app/src/main/res/drawable/icon_login_id.png 0 → 100644

3.23 KB

app/src/main/res/drawable/icon_login_pw.png 0 → 100644

3.25 KB

app/src/main/res/drawable/login_button.png 0 → 100644

16.4 KB

app/src/main/res/drawable/logo_user_story_web_beta.png 0 → 100644

47.8 KB

app/src/main/res/drawable/logout_button.png 0 → 100644

17.2 KB

app/src/main/res/layout/activity_index.xml
... ... @@ -23,7 +23,7 @@
23 23 android:gravity="center_horizontal" />
24 24  
25 25 <ImageButton
26   - android:layout_width="103dp"
  26 + android:layout_width="110dp"
27 27 android:layout_height="110dp"
28 28 android:id="@+id/imagebutton_index_start"
29 29 android:layout_gravity="center"
... ...
app/src/main/res/layout/fragment_addbook.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3 android:orientation="vertical" android:layout_width="match_parent"
4   - android:layout_height="match_parent">
  4 + android:layout_height="match_parent"
  5 + android:paddingLeft="10dp"
  6 + android:paddingRight="10dp">
5 7  
6 8 <LinearLayout
7 9 android:orientation="horizontal"
... ... @@ -10,12 +12,15 @@
10 12  
11 13 <EditText
12 14 android:drawableLeft="@drawable/icon_magifying_glass"
  15 + android:drawablePadding="5dp"
13 16 android:layout_width="wrap_content"
14 17 android:layout_height="wrap_content"
15 18 android:id="@+id/edit_book_title_to_add"
16 19 android:imeOptions="actionSearch"
17 20 android:singleLine="true"
18   - android:layout_weight="1" />
  21 + android:layout_weight="1"
  22 + android:layout_marginTop="5dp"
  23 + android:layout_marginBottom="5dp" />
19 24  
20 25 </LinearLayout>
21 26  
... ...
app/src/main/res/layout/fragment_login.xml
... ... @@ -2,13 +2,57 @@
2 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3 3 android:orientation="vertical" android:layout_width="match_parent"
4 4 android:layout_height="match_parent"
5   - android:weightSum="1">
  5 + android:paddingLeft="50dp"
  6 + android:paddingRight="50dp">
  7 +
  8 + <ImageView
  9 + android:layout_width="wrap_content"
  10 + android:layout_height="wrap_content"
  11 + android:id="@+id/imageView2"
  12 + android:src="@drawable/logo_user_story_web_beta"
  13 + android:cropToPadding="false"
  14 + android:baselineAlignBottom="false"
  15 + android:adjustViewBounds="false" />
  16 +
  17 + <LinearLayout
  18 + android:orientation="horizontal"
  19 + android:layout_width="match_parent"
  20 + android:layout_height="wrap_content"
  21 + android:gravity="center">
  22 +
  23 + <TextView
  24 + android:layout_width="wrap_content"
  25 + android:layout_height="wrap_content"
  26 + android:textAppearance="?android:attr/textAppearanceSmall"
  27 + android:text="계정가입, 정보수정 등은 "
  28 + android:id="@+id/textView2"
  29 + android:layout_marginTop="10dp"
  30 + android:layout_marginBottom="10dp" />
  31 +
  32 + <TextView
  33 + android:layout_width="wrap_content"
  34 + android:layout_height="wrap_content"
  35 + android:textAppearance="?android:attr/textAppearanceSmall"
  36 + android:text="홈페이지"
  37 + android:id="@+id/text_homepage_link"
  38 + android:textColor="@color/abc_search_url_text" />
  39 +
  40 + <TextView
  41 + android:layout_width="wrap_content"
  42 + android:layout_height="wrap_content"
  43 + android:textAppearance="?android:attr/textAppearanceSmall"
  44 + android:text="를 이용하세요"
  45 + android:id="@+id/textView13" />
  46 +
  47 + </LinearLayout>
6 48  
7 49 <EditText
8 50 android:layout_width="match_parent"
9 51 android:layout_height="wrap_content"
10 52 android:id="@+id/editId"
11 53 android:layout_gravity="center_horizontal"
  54 + android:drawableLeft="@drawable/icon_login_id"
  55 + android:drawablePadding="5dp"
12 56 android:hint="아이디를 입력하세요" />
13 57  
14 58 <EditText
... ... @@ -18,15 +62,27 @@
18 62 android:ems="10"
19 63 android:id="@+id/editPassword"
20 64 android:layout_gravity="center_horizontal"
  65 + android:drawableLeft="@drawable/icon_login_pw"
  66 + android:drawablePadding="5dp"
21 67 android:hint="암호를 입력하세요" />
22 68  
23   - <Button
24   - style="?android:attr/buttonStyleSmall"
25   - android:layout_width="wrap_content"
26   - android:layout_height="wrap_content"
27   - android:text="Login"
28   - android:id="@+id/btn_login"
29   - android:layout_gravity="center_horizontal" />
  69 + <!--<Button-->
  70 + <!--style="?android:attr/buttonStyleSmall"-->
  71 + <!--android:layout_width="wrap_content"-->
  72 + <!--android:layout_height="wrap_content"-->
  73 + <!--android:text="Login"-->
  74 + <!--android:id="@+id/btn_login"-->
  75 + <!--android:layout_gravity="center_horizontal" />-->
  76 +
  77 + <ImageButton
  78 + android:layout_width="110dp"
  79 + android:layout_height="110dp"
  80 + android:id="@+id/imgbtn_login"
  81 + android:src="@drawable/login_button"
  82 + android:scaleType="centerCrop"
  83 + android:background="@null"
  84 + android:layout_gravity="center_horizontal"
  85 + android:layout_marginTop="20dp" />
30 86  
31 87 <WebView
32 88 android:layout_width="match_parent"
... ...
app/src/main/res/layout/listview_searched_result_item.xml
... ... @@ -20,21 +20,21 @@
20 20 android:layout_gravity="center_vertical">
21 21  
22 22 <TextView
23   - android:layout_width="wrap_content"
  23 + android:layout_width="match_parent"
24 24 android:layout_height="wrap_content"
25 25 android:textAppearance="?android:attr/textAppearanceSmall"
26 26 android:text="Small Text"
27 27 android:id="@+id/text_book_title" />
28 28  
29 29 <TextView
30   - android:layout_width="wrap_content"
  30 + android:layout_width="match_parent"
31 31 android:layout_height="wrap_content"
32 32 android:textAppearance="?android:attr/textAppearanceSmall"
33 33 android:text="Small Text"
34 34 android:id="@+id/text_book_desc" />
35 35  
36 36 <TextView
37   - android:layout_width="wrap_content"
  37 + android:layout_width="match_parent"
38 38 android:layout_height="wrap_content"
39 39 android:textAppearance="?android:attr/textAppearanceSmall"
40 40 android:text="Small Text"
... ...
app/src/main/res/values/styles.xml
... ... @@ -15,6 +15,7 @@
15 15 <item name="windowActionBar">false</item>
16 16 <item name="windowNoTitle">true</item>
17 17 </style>
  18 +
18 19 <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
19 20 <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
20 21  
... ...