Showing
2 changed files
with
259 additions
and
21 deletions
.idea/codeStyleSettings.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project version="4"> | ||
3 | + <component name="ProjectCodeStyleSettingsManager"> | ||
4 | + <option name="PER_PROJECT_SETTINGS"> | ||
5 | + <value> | ||
6 | + <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" /> | ||
7 | + <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" /> | ||
8 | + <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND"> | ||
9 | + <value /> | ||
10 | + </option> | ||
11 | + <option name="IMPORT_LAYOUT_TABLE"> | ||
12 | + <value> | ||
13 | + <package name="android" withSubpackages="true" static="false" /> | ||
14 | + <emptyLine /> | ||
15 | + <package name="com" withSubpackages="true" static="false" /> | ||
16 | + <emptyLine /> | ||
17 | + <package name="junit" withSubpackages="true" static="false" /> | ||
18 | + <emptyLine /> | ||
19 | + <package name="net" withSubpackages="true" static="false" /> | ||
20 | + <emptyLine /> | ||
21 | + <package name="org" withSubpackages="true" static="false" /> | ||
22 | + <emptyLine /> | ||
23 | + <package name="java" withSubpackages="true" static="false" /> | ||
24 | + <emptyLine /> | ||
25 | + <package name="javax" withSubpackages="true" static="false" /> | ||
26 | + <emptyLine /> | ||
27 | + <package name="" withSubpackages="true" static="false" /> | ||
28 | + <emptyLine /> | ||
29 | + <package name="" withSubpackages="true" static="true" /> | ||
30 | + <emptyLine /> | ||
31 | + </value> | ||
32 | + </option> | ||
33 | + <option name="RIGHT_MARGIN" value="100" /> | ||
34 | + <AndroidXmlCodeStyleSettings> | ||
35 | + <option name="USE_CUSTOM_SETTINGS" value="true" /> | ||
36 | + </AndroidXmlCodeStyleSettings> | ||
37 | + <Objective-C-extensions> | ||
38 | + <file> | ||
39 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" /> | ||
40 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" /> | ||
41 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" /> | ||
42 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" /> | ||
43 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" /> | ||
44 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" /> | ||
45 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" /> | ||
46 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" /> | ||
47 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" /> | ||
48 | + </file> | ||
49 | + <class> | ||
50 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" /> | ||
51 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" /> | ||
52 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" /> | ||
53 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" /> | ||
54 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" /> | ||
55 | + <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" /> | ||
56 | + </class> | ||
57 | + <extensions> | ||
58 | + <pair source="cpp" header="h" /> | ||
59 | + <pair source="c" header="h" /> | ||
60 | + </extensions> | ||
61 | + </Objective-C-extensions> | ||
62 | + <XML> | ||
63 | + <option name="XML_KEEP_LINE_BREAKS" value="false" /> | ||
64 | + <option name="XML_ALIGN_ATTRIBUTES" value="false" /> | ||
65 | + <option name="XML_SPACE_INSIDE_EMPTY_TAG" value="true" /> | ||
66 | + </XML> | ||
67 | + <codeStyleSettings language="XML"> | ||
68 | + <option name="FORCE_REARRANGE_MODE" value="1" /> | ||
69 | + <indentOptions> | ||
70 | + <option name="CONTINUATION_INDENT_SIZE" value="4" /> | ||
71 | + </indentOptions> | ||
72 | + <arrangement> | ||
73 | + <rules> | ||
74 | + <section> | ||
75 | + <rule> | ||
76 | + <match> | ||
77 | + <AND> | ||
78 | + <NAME>xmlns:android</NAME> | ||
79 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | ||
80 | + </AND> | ||
81 | + </match> | ||
82 | + </rule> | ||
83 | + </section> | ||
84 | + <section> | ||
85 | + <rule> | ||
86 | + <match> | ||
87 | + <AND> | ||
88 | + <NAME>xmlns:.*</NAME> | ||
89 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | ||
90 | + </AND> | ||
91 | + </match> | ||
92 | + <order>BY_NAME</order> | ||
93 | + </rule> | ||
94 | + </section> | ||
95 | + <section> | ||
96 | + <rule> | ||
97 | + <match> | ||
98 | + <AND> | ||
99 | + <NAME>.*:id</NAME> | ||
100 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | ||
101 | + </AND> | ||
102 | + </match> | ||
103 | + </rule> | ||
104 | + </section> | ||
105 | + <section> | ||
106 | + <rule> | ||
107 | + <match> | ||
108 | + <AND> | ||
109 | + <NAME>.*:name</NAME> | ||
110 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | ||
111 | + </AND> | ||
112 | + </match> | ||
113 | + </rule> | ||
114 | + </section> | ||
115 | + <section> | ||
116 | + <rule> | ||
117 | + <match> | ||
118 | + <AND> | ||
119 | + <NAME>name</NAME> | ||
120 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | ||
121 | + </AND> | ||
122 | + </match> | ||
123 | + </rule> | ||
124 | + </section> | ||
125 | + <section> | ||
126 | + <rule> | ||
127 | + <match> | ||
128 | + <AND> | ||
129 | + <NAME>style</NAME> | ||
130 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | ||
131 | + </AND> | ||
132 | + </match> | ||
133 | + </rule> | ||
134 | + </section> | ||
135 | + <section> | ||
136 | + <rule> | ||
137 | + <match> | ||
138 | + <AND> | ||
139 | + <NAME>.*</NAME> | ||
140 | + <XML_NAMESPACE>^$</XML_NAMESPACE> | ||
141 | + </AND> | ||
142 | + </match> | ||
143 | + <order>BY_NAME</order> | ||
144 | + </rule> | ||
145 | + </section> | ||
146 | + <section> | ||
147 | + <rule> | ||
148 | + <match> | ||
149 | + <AND> | ||
150 | + <NAME>.*:layout_width</NAME> | ||
151 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | ||
152 | + </AND> | ||
153 | + </match> | ||
154 | + </rule> | ||
155 | + </section> | ||
156 | + <section> | ||
157 | + <rule> | ||
158 | + <match> | ||
159 | + <AND> | ||
160 | + <NAME>.*:layout_height</NAME> | ||
161 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | ||
162 | + </AND> | ||
163 | + </match> | ||
164 | + </rule> | ||
165 | + </section> | ||
166 | + <section> | ||
167 | + <rule> | ||
168 | + <match> | ||
169 | + <AND> | ||
170 | + <NAME>.*:layout_.*</NAME> | ||
171 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | ||
172 | + </AND> | ||
173 | + </match> | ||
174 | + <order>BY_NAME</order> | ||
175 | + </rule> | ||
176 | + </section> | ||
177 | + <section> | ||
178 | + <rule> | ||
179 | + <match> | ||
180 | + <AND> | ||
181 | + <NAME>.*:width</NAME> | ||
182 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | ||
183 | + </AND> | ||
184 | + </match> | ||
185 | + <order>BY_NAME</order> | ||
186 | + </rule> | ||
187 | + </section> | ||
188 | + <section> | ||
189 | + <rule> | ||
190 | + <match> | ||
191 | + <AND> | ||
192 | + <NAME>.*:height</NAME> | ||
193 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | ||
194 | + </AND> | ||
195 | + </match> | ||
196 | + <order>BY_NAME</order> | ||
197 | + </rule> | ||
198 | + </section> | ||
199 | + <section> | ||
200 | + <rule> | ||
201 | + <match> | ||
202 | + <AND> | ||
203 | + <NAME>.*</NAME> | ||
204 | + <XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE> | ||
205 | + </AND> | ||
206 | + </match> | ||
207 | + <order>BY_NAME</order> | ||
208 | + </rule> | ||
209 | + </section> | ||
210 | + <section> | ||
211 | + <rule> | ||
212 | + <match> | ||
213 | + <AND> | ||
214 | + <NAME>.*</NAME> | ||
215 | + <XML_NAMESPACE>.*</XML_NAMESPACE> | ||
216 | + </AND> | ||
217 | + </match> | ||
218 | + <order>BY_NAME</order> | ||
219 | + </rule> | ||
220 | + </section> | ||
221 | + </rules> | ||
222 | + </arrangement> | ||
223 | + </codeStyleSettings> | ||
224 | + </value> | ||
225 | + </option> | ||
226 | + <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" /> | ||
227 | + </component> | ||
228 | +</project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -25,7 +25,8 @@ import com.squareup.picasso.Picasso; | ... | @@ -25,7 +25,8 @@ import com.squareup.picasso.Picasso; |
25 | * Created by HYB on 2017. 10. 11.. | 25 | * Created by HYB on 2017. 10. 11.. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | -public class Community extends Fragment { | 28 | +public class Community extends Fragment |
29 | +{ | ||
29 | 30 | ||
30 | private RecyclerView mBlogList; | 31 | private RecyclerView mBlogList; |
31 | private RecyclerView.LayoutManager layoutManager; | 32 | private RecyclerView.LayoutManager layoutManager; |
... | @@ -33,7 +34,8 @@ public class Community extends Fragment { | ... | @@ -33,7 +34,8 @@ public class Community extends Fragment { |
33 | 34 | ||
34 | @Nullable | 35 | @Nullable |
35 | @Override | 36 | @Override |
36 | - public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) { | 37 | + public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) |
38 | + { | ||
37 | setHasOptionsMenu(true); | 39 | setHasOptionsMenu(true); |
38 | 40 | ||
39 | View view = inflater.inflate(R.layout.community, container, false); | 41 | View view = inflater.inflate(R.layout.community, container, false); |
... | @@ -48,18 +50,17 @@ public class Community extends Fragment { | ... | @@ -48,18 +50,17 @@ public class Community extends Fragment { |
48 | } | 50 | } |
49 | 51 | ||
50 | @Override | 52 | @Override |
51 | - public void onStart() { | 53 | + public void onStart() |
54 | + { | ||
52 | super.onStart(); | 55 | super.onStart(); |
53 | 56 | ||
54 | FirebaseRecyclerAdapter<Blog, BlogViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Blog, BlogViewHolder>( | 57 | FirebaseRecyclerAdapter<Blog, BlogViewHolder> firebaseRecyclerAdapter = new FirebaseRecyclerAdapter<Blog, BlogViewHolder>( |
55 | 58 | ||
56 | - Blog.class, | 59 | + Blog.class, R.layout.blog_row, BlogViewHolder.class, mDatabase) |
57 | - R.layout.blog_row, | 60 | + { |
58 | - BlogViewHolder.class, | ||
59 | - mDatabase | ||
60 | - ) { | ||
61 | @Override | 61 | @Override |
62 | - protected void populateViewHolder(BlogViewHolder viewHolder, Blog model, int position) { | 62 | + protected void populateViewHolder(BlogViewHolder viewHolder, Blog model, int position) |
63 | + { | ||
63 | viewHolder.setTitle(model.getTitle()); | 64 | viewHolder.setTitle(model.getTitle()); |
64 | viewHolder.setDesc(model.getDesc()); | 65 | viewHolder.setDesc(model.getDesc()); |
65 | viewHolder.setImage(getActivity().getApplicationContext(), model.getImage()); | 66 | viewHolder.setImage(getActivity().getApplicationContext(), model.getImage()); |
... | @@ -68,19 +69,23 @@ public class Community extends Fragment { | ... | @@ -68,19 +69,23 @@ public class Community extends Fragment { |
68 | mBlogList.setAdapter(firebaseRecyclerAdapter); | 69 | mBlogList.setAdapter(firebaseRecyclerAdapter); |
69 | } | 70 | } |
70 | 71 | ||
71 | - public static class BlogViewHolder extends RecyclerView.ViewHolder{ | 72 | + public static class BlogViewHolder extends RecyclerView.ViewHolder |
73 | + { | ||
72 | 74 | ||
73 | View mView; | 75 | View mView; |
74 | 76 | ||
75 | - public BlogViewHolder(View itemView) { | 77 | + public BlogViewHolder(View itemView) |
78 | + { | ||
76 | super(itemView); | 79 | super(itemView); |
77 | mView = itemView; | 80 | mView = itemView; |
78 | } | 81 | } |
79 | - public void setTitle(String title){ | 82 | + |
83 | + public void setTitle(String title) | ||
84 | + { | ||
80 | TextView post_title = (TextView) mView.findViewById(R.id.post_title); | 85 | TextView post_title = (TextView) mView.findViewById(R.id.post_title); |
81 | - if(title.length()>30) | 86 | + if (title.length() > 30) |
82 | { | 87 | { |
83 | - post_title.setText(title.substring(0,30)); | 88 | + post_title.setText(title.substring(0, 30)); |
84 | } | 89 | } |
85 | else | 90 | else |
86 | { | 91 | { |
... | @@ -88,11 +93,12 @@ public class Community extends Fragment { | ... | @@ -88,11 +93,12 @@ public class Community extends Fragment { |
88 | } | 93 | } |
89 | } | 94 | } |
90 | 95 | ||
91 | - public void setDesc(String desc){ | 96 | + public void setDesc(String desc) |
97 | + { | ||
92 | TextView post_desc = (TextView) mView.findViewById(R.id.post_desc); | 98 | TextView post_desc = (TextView) mView.findViewById(R.id.post_desc); |
93 | - if(desc.length()>50) | 99 | + if (desc.length() > 50) |
94 | { | 100 | { |
95 | - post_desc.setText(desc.substring(0,50)); | 101 | + post_desc.setText(desc.substring(0, 50)); |
96 | } | 102 | } |
97 | else | 103 | else |
98 | { | 104 | { |
... | @@ -100,7 +106,8 @@ public class Community extends Fragment { | ... | @@ -100,7 +106,8 @@ public class Community extends Fragment { |
100 | } | 106 | } |
101 | } | 107 | } |
102 | 108 | ||
103 | - public void setImage(Context ctx, String image){ | 109 | + public void setImage(Context ctx, String image) |
110 | + { | ||
104 | ImageView post_image = (ImageView) mView.findViewById(R.id.post_image); | 111 | ImageView post_image = (ImageView) mView.findViewById(R.id.post_image); |
105 | Picasso.with(ctx).load(image).into(post_image); | 112 | Picasso.with(ctx).load(image).into(post_image); |
106 | 113 | ||
... | @@ -109,16 +116,19 @@ public class Community extends Fragment { | ... | @@ -109,16 +116,19 @@ public class Community extends Fragment { |
109 | } | 116 | } |
110 | 117 | ||
111 | @Override | 118 | @Override |
112 | - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { | 119 | + public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) |
120 | + { | ||
113 | inflater.inflate(R.menu.community_menu, menu); | 121 | inflater.inflate(R.menu.community_menu, menu); |
114 | super.onCreateOptionsMenu(menu, inflater); | 122 | super.onCreateOptionsMenu(menu, inflater); |
115 | 123 | ||
116 | } | 124 | } |
117 | 125 | ||
118 | @Override | 126 | @Override |
119 | - public boolean onOptionsItemSelected(MenuItem item) { | 127 | + public boolean onOptionsItemSelected(MenuItem item) |
128 | + { | ||
120 | 129 | ||
121 | - if(item.getItemId() == R.id.action_add){ | 130 | + if (item.getItemId() == R.id.action_add) |
131 | + { | ||
122 | Intent intent = new Intent(getActivity(), PostActivity.class); | 132 | Intent intent = new Intent(getActivity(), PostActivity.class); |
123 | startActivity(intent); | 133 | startActivity(intent); |
124 | } | 134 | } | ... | ... |
-
Please register or login to post a comment