Commit efa2f6cf2e72f5077a2ccfa729b8c1e9c97ed8b7

Authored by transpine
1 parent ef2ddd88

- add about layout

app/src/main/AndroidManifest.xml
... ... @@ -30,11 +30,11 @@
30 30 <activity android:name=".IndexActivitiy"
31 31 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
32 32  
33   - <activity android:name=".ActivityLogin"
34   - android:label="LOGIN"
  33 + <activity android:name=".ActivityLogin" android:label="LOGIN"
35 34 android:theme="@style/AppTheme.UserstoryNoActionBar" />
36 35  
37   - <activity android:name=".ActivityAbout"/>
  36 + <activity android:name=".ActivityAbout" android:label="ABOUT"
  37 + android:theme="@style/AppTheme.UserstoryNoActionBar"/>
38 38 </application>
39 39  
40 40 </manifest>
... ...
app/src/main/java/net/devfac/userstory/ActivityAbout.java
... ... @@ -9,6 +9,7 @@ import android.os.IBinder;
9 9 import android.os.PersistableBundle;
10 10 import android.os.RemoteException;
11 11 import android.support.v7.app.AppCompatActivity;
  12 +import android.support.v7.widget.Toolbar;
12 13 import android.view.View;
13 14 import android.widget.Button;
14 15 import android.widget.Toast;
... ... @@ -23,6 +24,7 @@ import net.devfac.userstory.Utils.iab.Inventory;
23 24 import org.json.JSONException;
24 25 import org.json.JSONObject;
25 26  
  27 +import java.lang.reflect.Array;
26 28 import java.util.ArrayList;
27 29  
28 30 /**
... ... @@ -31,6 +33,9 @@ import java.util.ArrayList;
31 33 public class ActivityAbout extends AppCompatActivity {
32 34 private IInAppBillingService mIabService;
33 35 private IabHelper mIabHelper;
  36 + private ArrayList<String> mSkuList;
  37 +
  38 + private Toolbar mToolbarAbout;
34 39  
35 40  
36 41 private final ServiceConnection mIabServiceConnection = new ServiceConnection(){
... ... @@ -55,6 +60,14 @@ public class ActivityAbout extends AppCompatActivity {
55 60  
56 61 setContentView(R.layout.activity_about);
57 62  
  63 + mToolbarAbout = (Toolbar)findViewById(R.id.toolbar_about);
  64 + setSupportActionBar(mToolbarAbout);
  65 +
  66 + //PAYMENT_TARGET
  67 + mSkuList = new ArrayList<>();
  68 + mSkuList.add(Constants.PAYMENT_SKU_COFFEE_1);
  69 + mSkuList.add(Constants.PAYMENT_SKU_COFFEE_2);
  70 + mSkuList.add(Constants.PAYMENT_SKU_COFFEE_3);
58 71  
59 72 //explicit intent
60 73 Intent billingServiceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
... ... @@ -62,78 +75,18 @@ public class ActivityAbout extends AppCompatActivity {
62 75 bindService(billingServiceIntent, mIabServiceConnection,
63 76 Context.BIND_AUTO_CREATE);
64 77  
65   -
66 78 String base64EncodePublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzvF/+kU40VVRtZOC/EvQ8Xz1qblRFEUmwnzH3570L1P6/pvbYnxrJc2TPi7iR3OMpmMQbpHgJbGEYBpNd5p5othiwO0JzDfX6SoUsdLJZWMkVW7ToBTHCoMtDURj+8wXv77Da/41GX8N0/83JLW5fYyl9dgExuUkXlt6j3IyjFJIcznKbyulPIg7BtvusKwM7TKcRUFLGe5CDWkbK3lraH0XIUs29ZTuVIYMmbs9u+aWwcWKrb9drkQTYwwrb0yQo/YQ0pAGGqA0UHJQWMllrpHb6spo+HXnVHBco9tq6p9zA6MKALcMiPS7LKBFKw2y1yVQ4OIa5oAITvNnCFkjTwIDAQAB";
67 79  
68 80 mIabHelper = new IabHelper(this, base64EncodePublicKey);
69 81 mIabHelper.enableDebugLogging(true);
70 82  
71   - Button test = (Button)findViewById(R.id.btn_about_iab_test);
72   - test.setOnClickListener(new View.OnClickListener() {
73   - @Override
74   - public void onClick(View v) {
75   -
76   - mIabHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
77   - @Override
78   - public void onIabSetupFinished(IabResult result) {
79   - if( !result.isSuccess() ){
80   - Toast.makeText(ActivityAbout.this, "Transjaction error", Toast.LENGTH_LONG).show();
81   - }
82   -
83   - else{
84   - ArrayList<String> skuList = new ArrayList<String>();
85   - skuList.add("coffee_1");
86   - skuList.add("coffee_2");
87   - skuList.add("coffee_3");
88   -
89   - mIabHelper.queryInventoryAsync(true, skuList, new IabHelper.QueryInventoryFinishedListener() {
90   - @Override
91   - public void onQueryInventoryFinished(IabResult result, Inventory inv) {
92   - if( result.isFailure()){
93   - return;
94   -
95   - }
96   -
97   - if( inv.getSkuDetails("coffee_1") != null ) {
98   - Logger.i("coffee_1 price : " + inv.getSkuDetails("coffee_1").getPrice());
99   - }
100   - }
101   - });
102   -
103   - Bundle querySkus = new Bundle();
104   - querySkus.putStringArrayList("ITEM_ID_LIST", skuList);
105   -
106   - if( mIabService == null) return;
107   -
108   - try {
109   - Bundle skuDetails = mIabService.getSkuDetails(3, getPackageName(), "inapp", querySkus);
110   -
111   - int response = skuDetails.getInt("RESPONSE_CODE");
112   -
113   - if( response == IabHelper.BILLING_RESPONSE_RESULT_OK ){
114   - ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
115   -
116   - for(String thisResponse:responseList){
117   - JSONObject object = new JSONObject(thisResponse);
118   - String sku = object.getString("productId");
119   - String price = object.getString("price");
120   - Logger.i("SKU : " + sku + " | PRICE : " + price);
121   - }
122   -
123   - }
124   - else{
125   - Logger.e("Response code : " + String.valueOf(response));
126   - }
127   - } catch (RemoteException e) {
128   - e.printStackTrace();
129   - } catch (JSONException e) {
130   - e.printStackTrace();
131   - }
132   - }
133   - }
134   - });
135   - }
136   - });
  83 +// Button test = (Button)findViewById(R.id.btn_about_iab_test);
  84 +// test.setOnClickListener(new View.OnClickListener() {
  85 +// @Override
  86 +// public void onClick(View v) {
  87 +// mIabHelper.startSetup(mOnIabSetupFinishedListener);
  88 +// }
  89 +// });
137 90 }
138 91  
139 92 @Override
... ... @@ -144,4 +97,58 @@ public class ActivityAbout extends AppCompatActivity {
144 97 unbindService(mIabServiceConnection);
145 98 }
146 99 }
  100 +
  101 + private IabHelper.OnIabSetupFinishedListener mOnIabSetupFinishedListener = new IabHelper.OnIabSetupFinishedListener() {
  102 + @Override
  103 + public void onIabSetupFinished(IabResult result) {
  104 + if( !result.isSuccess() ){
  105 + Toast.makeText(ActivityAbout.this, "Transaction error", Toast.LENGTH_LONG).show();
  106 + }
  107 +
  108 + else{
  109 + mIabHelper.queryInventoryAsync(true, mSkuList, new IabHelper.QueryInventoryFinishedListener() {
  110 + @Override
  111 + public void onQueryInventoryFinished(IabResult result, Inventory inv) {
  112 + if( result.isFailure()){
  113 + return;
  114 + }
  115 +
  116 + if( inv.getSkuDetails("coffee_1") != null ) {
  117 + Logger.i("coffee_1 price : " + inv.getSkuDetails("coffee_1").getPrice());
  118 + }
  119 + }
  120 + });
  121 +
  122 + Bundle querySkus = new Bundle();
  123 + querySkus.putStringArrayList("ITEM_ID_LIST", mSkuList);
  124 +
  125 + if( mIabService == null) return;
  126 +
  127 + try {
  128 + Bundle skuDetails = mIabService.getSkuDetails(3, getPackageName(), "inapp", querySkus);
  129 +
  130 + int response = skuDetails.getInt("RESPONSE_CODE");
  131 +
  132 + if( response == IabHelper.BILLING_RESPONSE_RESULT_OK ){
  133 + ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
  134 +
  135 + for(String thisResponse:responseList){
  136 + JSONObject object = new JSONObject(thisResponse);
  137 + String sku = object.getString("productId");
  138 + String price = object.getString("price");
  139 + Logger.i("SKU : " + sku + " | PRICE : " + price);
  140 + }
  141 +
  142 + }
  143 + else{
  144 + Logger.e("Response code : " + String.valueOf(response));
  145 + }
  146 + } catch (RemoteException e) {
  147 + e.printStackTrace();
  148 + } catch (JSONException e) {
  149 + e.printStackTrace();
  150 + }
  151 + }
  152 + }
  153 + };
147 154 }
... ...
app/src/main/java/net/devfac/userstory/ActivityLogin.java
... ... @@ -75,7 +75,7 @@ public class ActivityLogin extends AppCompatActivity implements View.OnClickList
75 75 @Override
76 76 public boolean onOptionsItemSelected(MenuItem item) {
77 77 switch( item.getItemId() ){
78   - case R.id.cancel:
  78 + case R.id.action_login_cancel:
79 79 finish();
80 80 break;
81 81 }
... ...
app/src/main/java/net/devfac/userstory/Constants.java
... ... @@ -74,4 +74,10 @@ public class Constants {
74 74  
75 75 //Acitvity
76 76 public static final String EXTRA_LOGIN_COMPLETED = "extra_login_completed";
  77 +
  78 + //Payment
  79 + public static final String PAYMENT_SKU_COFFEE_1 = "coffee_1";
  80 + public static final String PAYMENT_SKU_COFFEE_2 = "coffee_2";
  81 + public static final String PAYMENT_SKU_COFFEE_3 = "coffee_3";
  82 +
77 83 }
... ...
app/src/main/res/drawable/about_bear.png 0 → 100644

74.7 KB

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

12.6 KB

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

10.6 KB

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

4.84 KB

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

4.88 KB

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

5.44 KB

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

5.47 KB

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

5.75 KB

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

5.85 KB

app/src/main/res/layout/activity_about.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3   - android:orientation="vertical" android:layout_width="match_parent"
4   - android:layout_height="match_parent">
  3 + xmlns:app="http://schemas.android.com/apk/res-auto"
  4 + android:orientation="vertical"
  5 + android:layout_width="match_parent"
  6 + android:layout_height="match_parent"
  7 + android:gravity="center_horizontal"
  8 + android:weightSum="10">
5 9  
6   - <Button
  10 + <android.support.design.widget.AppBarLayout android:layout_height="wrap_content"
  11 + android:layout_width="match_parent" android:theme="@style/AppTheme.AppBarOverlay">
  12 + <android.support.v7.widget.Toolbar android:id="@+id/toolbar_about"
  13 + android:layout_width="match_parent" android:layout_height="?attr/actionBarSize"
  14 + android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" >
  15 + </android.support.v7.widget.Toolbar>
  16 + </android.support.design.widget.AppBarLayout>
  17 +
  18 + <ImageView
  19 + android:layout_width="wrap_content"
  20 + android:layout_height="0dp"
  21 + android:id="@+id/imageView3"
  22 + android:src="@drawable/about_main_icon_coffee"
  23 + android:layout_weight="2"
  24 + android:layout_marginTop="10dp"
  25 + android:layout_marginBottom="10dp" />
  26 +
  27 + <TextView
7 28 android:layout_width="wrap_content"
8   - android:layout_height="wrap_content"
9   - android:text="New Button"
10   - android:id="@+id/btn_about_iab_test"
11   - android:layout_gravity="center_horizontal" />
  29 + android:layout_height="0dp"
  30 + android:textAppearance="?android:attr/textAppearanceSmall"
  31 + android:text="@string/about_description"
  32 + android:id="@+id/textView12"
  33 + android:gravity="center"
  34 + android:layout_weight="4.5" />
  35 +
  36 + <LinearLayout
  37 + android:orientation="vertical"
  38 + android:layout_width="match_parent"
  39 + android:layout_height="0dp"
  40 + android:layout_marginLeft="30dp"
  41 + android:layout_marginRight="30dp"
  42 + android:layout_weight="3.5">
  43 +
  44 + <LinearLayout
  45 + android:orientation="horizontal"
  46 + android:layout_width="match_parent"
  47 + android:layout_height="wrap_content"
  48 + android:weightSum="10"
  49 + android:gravity="center_vertical">
  50 +
  51 + <ImageView
  52 + android:layout_width="0dp"
  53 + android:layout_height="wrap_content"
  54 + android:id="@+id/imageView4"
  55 + android:src="@drawable/about_pay_coffee_3"
  56 + android:layout_weight="3"
  57 + android:adjustViewBounds="true" />
  58 +
  59 + <TextView
  60 + android:layout_width="0dp"
  61 + android:layout_height="wrap_content"
  62 + android:textAppearance="?android:attr/textAppearanceSmall"
  63 + android:text="1000원"
  64 + android:id="@+id/textView14"
  65 + android:layout_weight="1.8"
  66 + android:gravity="right"
  67 + android:layout_marginRight="10dp" />
  68 +
  69 + <FrameLayout
  70 + android:layout_width="0dp"
  71 + android:layout_height="match_parent"
  72 + android:layout_weight="5">
  73 +
  74 + <TextView
  75 + android:layout_width="match_parent"
  76 + android:layout_height="wrap_content"
  77 + android:textAppearance="?android:attr/textAppearanceSmall"
  78 + android:text="감사합니다"
  79 + android:id="@+id/textView15"
  80 + android:layout_gravity="center_vertical"
  81 + android:gravity="left"
  82 + android:paddingLeft="10dp" />
  83 +
  84 + <ImageView
  85 + android:layout_width="match_parent"
  86 + android:layout_height="match_parent"
  87 + android:id="@+id/imageView5"
  88 + android:background="#333333"
  89 + android:layout_marginTop="17dp"
  90 + android:layout_marginBottom="20dp"
  91 + android:layout_marginLeft="10dp"
  92 + android:layout_marginRight="90dp" />
  93 + </FrameLayout>
  94 +
  95 + </LinearLayout>
  96 +
  97 + <LinearLayout
  98 + android:orientation="horizontal"
  99 + android:layout_width="match_parent"
  100 + android:layout_height="wrap_content"
  101 + android:weightSum="10"
  102 + android:gravity="center_vertical" >
  103 +
  104 + <ImageView
  105 + android:layout_width="0dp"
  106 + android:layout_height="wrap_content"
  107 + android:id="@+id/imageView6"
  108 + android:src="@drawable/about_pay_coffee_3"
  109 + android:layout_weight="3"
  110 + android:adjustViewBounds="true" />
  111 +
  112 + <TextView
  113 + android:layout_width="0dp"
  114 + android:layout_height="wrap_content"
  115 + android:textAppearance="?android:attr/textAppearanceSmall"
  116 + android:text="1000원"
  117 + android:id="@+id/textView16"
  118 + android:layout_weight="1.8"
  119 + android:gravity="right"
  120 + android:layout_marginRight="10dp" />
  121 +
  122 + <FrameLayout
  123 + android:layout_width="0dp"
  124 + android:layout_height="match_parent"
  125 + android:layout_weight="5" >
  126 +
  127 + <TextView
  128 + android:layout_width="match_parent"
  129 + android:layout_height="wrap_content"
  130 + android:textAppearance="?android:attr/textAppearanceSmall"
  131 + android:text="작은 감사가 큰 감사를 낳는다-알렉스 헤일리\n“크게 감사합니다.!!”"
  132 + android:id="@+id/textView17"
  133 + android:layout_gravity="center_vertical"
  134 + android:gravity="left"
  135 + android:paddingLeft="10dp" />
  136 +
  137 + <ImageView
  138 + android:layout_width="match_parent"
  139 + android:layout_height="match_parent"
  140 + android:id="@+id/imageView7"
  141 + android:background="#BBBBBB"
  142 + android:layout_marginBottom="1dp"
  143 + android:layout_marginLeft="12dp"
  144 + android:layout_marginRight="0dp"
  145 + android:layout_marginTop="4dp" />
  146 + </FrameLayout>
  147 + </LinearLayout>
  148 +
  149 + <LinearLayout
  150 + android:orientation="horizontal"
  151 + android:layout_width="match_parent"
  152 + android:layout_height="wrap_content"
  153 + android:weightSum="10"
  154 + android:gravity="top" >
  155 +
  156 + <ImageView
  157 + android:layout_width="0dp"
  158 + android:layout_height="wrap_content"
  159 + android:id="@+id/imageView8"
  160 + android:src="@drawable/about_pay_coffee_3"
  161 + android:layout_weight="3"
  162 + android:adjustViewBounds="true" />
  163 +
  164 + <TextView
  165 + android:layout_width="0dp"
  166 + android:layout_height="wrap_content"
  167 + android:textAppearance="?android:attr/textAppearanceSmall"
  168 + android:text="1000원"
  169 + android:id="@+id/textView18"
  170 + android:layout_weight="1.8"
  171 + android:gravity="right"
  172 + android:layout_marginRight="10dp"
  173 + android:layout_marginTop="20dp" />
  174 +
  175 + <FrameLayout
  176 + android:layout_width="0dp"
  177 + android:layout_height="wrap_content"
  178 + android:layout_weight="5">
  179 +
  180 + <LinearLayout
  181 + android:orientation="vertical"
  182 + android:layout_width="match_parent"
  183 + android:layout_height="wrap_content"
  184 + android:layout_weight="5">
  185 +
  186 + <ImageView
  187 + android:layout_width="wrap_content"
  188 + android:layout_height="wrap_content"
  189 + android:id="@+id/imageView10"
  190 + android:src="@drawable/about_bear_small"
  191 + android:adjustViewBounds="true"
  192 + android:layout_gravity="center_horizontal" />
  193 +
  194 + <TextView
  195 + android:layout_width="match_parent"
  196 + android:layout_height="wrap_content"
  197 + android:textAppearance="?android:attr/textAppearanceSmall"
  198 + android:text="감격의 눈물이.!!\n업데이트로 보답드리겠습니다."
  199 + android:id="@+id/textView19"
  200 + android:layout_gravity="center_vertical"
  201 + android:gravity="center" />
  202 + </LinearLayout>
  203 +
  204 + <ImageView
  205 + android:layout_width="match_parent"
  206 + android:layout_height="match_parent"
  207 + android:id="@+id/imageView9"
  208 + android:background="#444444"
  209 + android:layout_marginLeft="9dp"
  210 + android:layout_marginTop="12dp"
  211 + android:layout_marginRight="10dp" />
  212 +
  213 + </FrameLayout>
  214 +
  215 + </LinearLayout>
  216 + </LinearLayout>
12 217 </LinearLayout>
13 218 \ No newline at end of file
... ...
app/src/main/res/menu/about.xml 0 → 100644
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<menu xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:app="http://schemas.android.com/apk/res-auto">
  4 + <item android:id="@+id/action_about_cancel" android:title="CANCEL"
  5 + app:showAsAction="ifRoom" android:orderInCategory="100"/>
  6 +</menu>
0 7 \ No newline at end of file
... ...
app/src/main/res/menu/login.xml
... ... @@ -5,8 +5,7 @@
5 5 xmlns:tools="http://schemas.android.com/tools"
6 6 tools:context=".ActivityLogin">
7 7  
8   - <item android:id="@+id/cancel"
9   - android:title="CANCEL"
  8 + <item android:id="@+id/action_login_cancel" android:title="CANCEL"
10 9 app:showAsAction="ifRoom"/>
11 10  
12 11 </menu>
13 12 \ No newline at end of file
... ...
app/src/main/res/values/strings.xml
... ... @@ -6,4 +6,8 @@
6 6  
7 7 <string name="action_main_settings">Settings</string>
8 8 <string name="action_main_about">About</string>
  9 +
  10 + <string name="about_description">책을 사랑하는 개인 개발자입니다.\n아무리 기다려도 UserStory의\n클라이언트 소식이 없어 직접 개발에 나섰습니다.\n
  11 +\n사무실이 없어 마땅한 작업공간이 없는 관계로 커피샵을\n전전하며 작업을 이어가고 있습니다.\n\n...\n\n이제는 향기로운 커피 향기와 함께\n새로운 기능을 개발하는 일에 익숙해지고 말았습니다.\n
  12 +\n업데이트를 위해 커피한잔 대접해 주실래요?</string>
9 13 </resources>
... ...