├── .gitignore
├── .idea
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── app
├── .gitignore
├── build.gradle
├── google-services.json
├── libs
│ └── josephdalughut-skout-bd41074eead3.zip
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── example
│ │ └── ekene
│ │ └── blogzone
│ │ └── ExampleInstrumentedTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── example
│ │ │ └── ekene
│ │ │ └── blogzone
│ │ │ ├── Blogzone.java
│ │ │ ├── LoginActivity.java
│ │ │ ├── MainActivity.java
│ │ │ ├── PostActivity.java
│ │ │ ├── ProfileActivity.java
│ │ │ ├── RegisterActivity.java
│ │ │ └── SinglePostActivity.java
│ └── res
│ │ ├── drawable
│ │ ├── action_button_style.xml
│ │ ├── add_img.png
│ │ ├── addicon.png
│ │ ├── bg.jpg
│ │ ├── bgg.jpg
│ │ ├── buttonstyle.xml
│ │ ├── edit_text_styles.xml
│ │ ├── ic_add_black_24dp.xml
│ │ ├── imag.jpg
│ │ ├── layoutstyle.xml
│ │ └── lowres.jpg
│ │ ├── layout
│ │ ├── activity_login.xml
│ │ ├── activity_main.xml
│ │ ├── activity_post.xml
│ │ ├── activity_profile.xml
│ │ ├── activity_register.xml
│ │ ├── activity_single_post.xml
│ │ ├── card_items.xml
│ │ └── content_main.xml
│ │ ├── menu
│ │ └── menu_main.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── example
│ └── ekene
│ └── blogzone
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .externalNativeBuild
10 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 26
5 | buildToolsVersion "26.0.0"
6 | defaultConfig {
7 | applicationId "com.example.ekene.blogzone"
8 | minSdkVersion 16
9 | targetSdkVersion 26
10 | versionCode 1
11 | versionName "1.0"
12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | dependencies {
23 | compile fileTree(dir: 'libs', include: ['*.jar'])
24 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
25 | exclude group: 'com.android.support', module: 'support-annotations'
26 | })
27 | compile 'com.android.support:appcompat-v7:26.+'
28 | compile 'com.android.support:design:26.+'
29 | compile 'com.firebaseui:firebase-ui-database:0.4.4'
30 | compile 'com.google.firebase:firebase-auth:10.0.1'
31 | compile 'com.google.firebase:firebase-core:10.0.1'
32 | compile 'com.google.firebase:firebase-storage:10.0.1'
33 | compile 'com.android.support:cardview-v7:26.0.0-alpha1'
34 | compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
35 | compile 'com.google.firebase:firebase-database:10.0.1'
36 | compile 'com.squareup.picasso:picasso:2.5.2'
37 | compile 'com.theartofdev.edmodo:android-image-cropper:2.5.+'
38 | compile 'com.android.support.constraint:constraint-layout:1.0.2'
39 | testCompile 'junit:junit:4.12'
40 | }
41 | apply plugin: 'com.google.gms.google-services'
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "800594296385",
4 | "firebase_url": "https://myblog-97550.firebaseio.com",
5 | "project_id": "myblog-97550",
6 | "storage_bucket": "myblog-97550.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:800594296385:android:13ecad4fa52ac53a",
12 | "android_client_info": {
13 | "package_name": "com.example.ekene.myblog"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "800594296385-ae23anavb41s9l1tsr5k7ccbftvg635o.apps.googleusercontent.com",
19 | "client_type": 1,
20 | "android_info": {
21 | "package_name": "com.example.ekene.myblog",
22 | "certificate_hash": "89df3f7b512058ac1f255f51d70722c99d8f025d"
23 | }
24 | },
25 | {
26 | "client_id": "800594296385-9fp3npea2jipmhf0i67riqoq82hiu2l4.apps.googleusercontent.com",
27 | "client_type": 3
28 | }
29 | ],
30 | "api_key": [
31 | {
32 | "current_key": "AIzaSyBJem7nAJBfyIo-jMkCwBIdtjWWtEvGSoE"
33 | }
34 | ],
35 | "services": {
36 | "analytics_service": {
37 | "status": 1
38 | },
39 | "appinvite_service": {
40 | "status": 2,
41 | "other_platform_oauth_client": [
42 | {
43 | "client_id": "800594296385-9fp3npea2jipmhf0i67riqoq82hiu2l4.apps.googleusercontent.com",
44 | "client_type": 3
45 | }
46 | ]
47 | },
48 | "ads_service": {
49 | "status": 2
50 | }
51 | }
52 | },
53 | {
54 | "client_info": {
55 | "mobilesdk_app_id": "1:800594296385:android:583ee094a94d9c05",
56 | "android_client_info": {
57 | "package_name": "com.example.ekene.blogzone"
58 | }
59 | },
60 | "oauth_client": [
61 | {
62 | "client_id": "800594296385-r9aokq2l1dmr9tadhggpp08svr4lq4sm.apps.googleusercontent.com",
63 | "client_type": 1,
64 | "android_info": {
65 | "package_name": "com.example.ekene.blogzone",
66 | "certificate_hash": "89df3f7b512058ac1f255f51d70722c99d8f025d"
67 | }
68 | },
69 | {
70 | "client_id": "800594296385-9fp3npea2jipmhf0i67riqoq82hiu2l4.apps.googleusercontent.com",
71 | "client_type": 3
72 | }
73 | ],
74 | "api_key": [
75 | {
76 | "current_key": "AIzaSyBJem7nAJBfyIo-jMkCwBIdtjWWtEvGSoE"
77 | }
78 | ],
79 | "services": {
80 | "analytics_service": {
81 | "status": 1
82 | },
83 | "appinvite_service": {
84 | "status": 2,
85 | "other_platform_oauth_client": [
86 | {
87 | "client_id": "800594296385-9fp3npea2jipmhf0i67riqoq82hiu2l4.apps.googleusercontent.com",
88 | "client_type": 3
89 | }
90 | ]
91 | },
92 | "ads_service": {
93 | "status": 2
94 | }
95 | }
96 | }
97 | ],
98 | "configuration_version": "1"
99 | }
--------------------------------------------------------------------------------
/app/libs/josephdalughut-skout-bd41074eead3.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/libs/josephdalughut-skout-bd41074eead3.zip
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in C:\Android\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
19 | # Uncomment this to preserve the line number information for
20 | # debugging stack traces.
21 | #-keepattributes SourceFile,LineNumberTable
22 |
23 | # If you keep the line number information, uncomment this to
24 | # hide the original source file name.
25 | #-renamesourcefileattribute SourceFile
26 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/ekene/blogzone/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package com.example.ekene.blogzone;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.*;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("com.example.ekene.blogzone", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
15 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
27 |
28 |
29 |
30 |
33 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ekene/blogzone/Blogzone.java:
--------------------------------------------------------------------------------
1 | package com.example.ekene.blogzone;
2 |
3 | /**
4 | * Created by EKENE on 11/4/2017.
5 | */
6 |
7 | public class Blogzone {
8 |
9 | private String title, desc, imageUrl, username;
10 |
11 | public Blogzone(String title, String desc, String imageUrl, String username) {
12 | this.title = title;
13 | this.desc = desc;
14 | this.imageUrl=imageUrl;
15 | this.username = username;
16 | }
17 |
18 | public Blogzone() {
19 | }
20 |
21 | public void setImageUrl(String imageUrl) {
22 | this.imageUrl = imageUrl;
23 | }
24 |
25 | public String getUsername() {
26 | return username;
27 | }
28 |
29 | public void setUsername(String username) {
30 | this.username = username;
31 | }
32 | public void setTitle(String title) {
33 | this.title = title;
34 | }
35 |
36 | public void setDesc(String desc) {
37 | this.desc = desc;
38 | }
39 |
40 | public String getImageUrl() {
41 | return imageUrl;
42 | }
43 |
44 | public String getTitle() {
45 | return title;
46 | }
47 |
48 | public String getDesc() {
49 | return desc;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ekene/blogzone/LoginActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ekene.blogzone;
2 |
3 | import android.content.Intent;
4 | import android.support.annotation.NonNull;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.text.TextUtils;
8 | import android.view.View;
9 | import android.widget.Button;
10 | import android.widget.EditText;
11 | import android.widget.Toast;
12 |
13 | import com.google.android.gms.tasks.OnCompleteListener;
14 | import com.google.android.gms.tasks.Task;
15 | import com.google.firebase.auth.AuthResult;
16 | import com.google.firebase.auth.FirebaseAuth;
17 | import com.google.firebase.database.DataSnapshot;
18 | import com.google.firebase.database.DatabaseError;
19 | import com.google.firebase.database.DatabaseReference;
20 | import com.google.firebase.database.FirebaseDatabase;
21 | import com.google.firebase.database.ValueEventListener;
22 |
23 | public class LoginActivity extends AppCompatActivity {
24 | private EditText loginEmail, loginPass;
25 | private FirebaseAuth mAuth;
26 | private DatabaseReference mDatabase;
27 | private Button loginBtn;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 | setContentView(R.layout.activity_login);
33 |
34 | loginBtn = (Button)findViewById(R.id.loginBtn);
35 | loginEmail = (EditText)findViewById(R.id.login_email);
36 | loginPass = (EditText)findViewById(R.id.login_password);
37 |
38 | mAuth = FirebaseAuth.getInstance();
39 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Users");
40 |
41 | loginBtn.setOnClickListener(new View.OnClickListener() {
42 | @Override
43 | public void onClick(View view) {
44 | Toast.makeText(LoginActivity.this, "PROCESSING....", Toast.LENGTH_LONG).show();
45 | String email = loginEmail.getText().toString().trim();
46 | String password = loginPass.getText().toString().trim();
47 |
48 | if (!TextUtils.isEmpty(email)&& !TextUtils.isEmpty(password)){
49 |
50 | mAuth.signInWithEmailAndPassword(email,password).addOnCompleteListener(new OnCompleteListener() {
51 | @Override
52 | public void onComplete(@NonNull Task task) {
53 | if (task.isSuccessful()){
54 | checkUserExistence();
55 | }else {
56 | Toast.makeText(LoginActivity.this, "Couldn't login, User not found", Toast.LENGTH_SHORT).show();
57 | }
58 | }
59 | });
60 | }else {
61 |
62 | Toast.makeText(LoginActivity.this, "Complete all fields", Toast.LENGTH_SHORT).show();
63 | }
64 | }
65 | });
66 | }
67 |
68 | public void checkUserExistence(){
69 |
70 | final String user_id = mAuth.getCurrentUser().getUid();
71 | mDatabase.addValueEventListener(new ValueEventListener() {
72 | @Override
73 | public void onDataChange(DataSnapshot dataSnapshot) {
74 |
75 | if (dataSnapshot.hasChild(user_id)){
76 | startActivity(new Intent(LoginActivity.this, MainActivity.class));
77 | }else {
78 | Toast.makeText(LoginActivity.this, "User not registered!", Toast.LENGTH_SHORT).show();
79 | }
80 | }
81 |
82 | @Override
83 | public void onCancelled(DatabaseError databaseError) {
84 |
85 | }
86 | });
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ekene/blogzone/MainActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ekene.blogzone;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.support.annotation.NonNull;
7 | import android.support.design.widget.FloatingActionButton;
8 | import android.support.design.widget.Snackbar;
9 | import android.support.v7.app.AppCompatActivity;
10 | import android.support.v7.widget.LinearLayoutManager;
11 | import android.support.v7.widget.RecyclerView;
12 | import android.support.v7.widget.Toolbar;
13 | import android.view.View;
14 | import android.view.Menu;
15 | import android.view.MenuItem;
16 | import android.widget.Button;
17 | import android.widget.ImageButton;
18 | import android.widget.ImageView;
19 | import android.widget.TextView;
20 | import android.widget.Toast;
21 |
22 | import com.firebase.ui.database.FirebaseRecyclerAdapter;
23 | import com.google.firebase.auth.FirebaseAuth;
24 | import com.google.firebase.database.DatabaseReference;
25 | import com.google.firebase.database.FirebaseDatabase;
26 | import com.squareup.picasso.Picasso;
27 | public class MainActivity extends AppCompatActivity {
28 | private RecyclerView recyclerView;
29 | private DatabaseReference mDatabase;
30 | private FirebaseAuth mAuth;
31 | private FirebaseAuth.AuthStateListener mAuthListener;
32 | @Override
33 | protected void onCreate(Bundle savedInstanceState) {
34 | super.onCreate(savedInstanceState);
35 | setContentView(R.layout.activity_main);
36 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
37 | setSupportActionBar(toolbar);
38 | //initialize recyclerview and FIrebase objects
39 | recyclerView = (RecyclerView)findViewById(R.id.recyclerview);
40 | recyclerView.setLayoutManager(new LinearLayoutManager(this));
41 | recyclerView.setHasFixedSize(true);
42 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Blogzone");
43 | mAuth = FirebaseAuth.getInstance();
44 | mAuthListener = new FirebaseAuth.AuthStateListener() {
45 | @Override
46 | public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
47 | if (mAuth.getCurrentUser()==null){
48 | Intent loginIntent = new Intent(MainActivity.this, RegisterActivity.class);
49 | loginIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);startActivity(loginIntent);
50 | }
51 | }
52 | };
53 | }
54 | @Override
55 | protected void onStart() {
56 | super.onStart();
57 | mAuth.addAuthStateListener(mAuthListener);
58 | FirebaseRecyclerAdapter FBRA = new FirebaseRecyclerAdapter(
59 | Blogzone.class,
60 | R.layout.card_items,
61 | BlogzoneViewHolder.class,
62 | mDatabase
63 | ) {
64 | @Override
65 | protected void populateViewHolder(BlogzoneViewHolder viewHolder, Blogzone model, int position) {
66 | final String post_key = getRef(position).getKey().toString();
67 | viewHolder.setTitle(model.getTitle());
68 | viewHolder.setDesc(model.getDesc());
69 | viewHolder.setImageUrl(getApplicationContext(), model.getImageUrl());
70 | viewHolder.setUserName(model.getUsername());
71 | viewHolder.mView.setOnClickListener(new View.OnClickListener() {
72 | @Override
73 | public void onClick(View view) {
74 | Intent singleActivity = new Intent(MainActivity.this, SinglePostActivity.class);
75 | singleActivity.putExtra("PostID", post_key);
76 | startActivity(singleActivity);
77 | }
78 | });
79 | }
80 | };
81 | recyclerView.setAdapter(FBRA);
82 | }
83 | public static class BlogzoneViewHolder extends RecyclerView.ViewHolder{
84 | View mView;
85 | public BlogzoneViewHolder(View itemView) {
86 | super(itemView);
87 | mView = itemView;
88 | }
89 | public void setTitle(String title){
90 | TextView post_title = mView.findViewById(R.id.post_title_txtview);
91 | post_title.setText(title);
92 | }
93 | public void setDesc(String desc){
94 | TextView post_desc = mView.findViewById(R.id.post_desc_txtview);
95 | post_desc.setText(desc);
96 | }
97 | public void setImageUrl(Context ctx, String imageUrl){
98 | ImageView post_image = mView.findViewById(R.id.post_image);
99 | Picasso.with(ctx).load(imageUrl).into(post_image);
100 | }
101 | public void setUserName(String userName){
102 | TextView postUserName = mView.findViewById(R.id.post_user);
103 | postUserName.setText(userName);
104 | }
105 | }
106 | @Override
107 | public boolean onCreateOptionsMenu(Menu menu) {
108 | // Inflate the menu; this adds items to the action bar if it is present.
109 | getMenuInflater().inflate(R.menu.menu_main, menu);
110 | return true;
111 | }
112 | @Override
113 | public boolean onOptionsItemSelected(MenuItem item) {
114 | int id = item.getItemId();
115 | if (id == R.id.action_settings) {
116 | return true;
117 | }
118 | else if (id == R.id.action_add) {
119 | startActivity(new Intent(MainActivity.this, PostActivity.class));
120 | } else if (id == R.id.logout){
121 | mAuth.signOut();
122 | Intent logouIntent = new Intent(MainActivity.this, RegisterActivity.class);
123 | logouIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
124 | startActivity(logouIntent);
125 | }
126 | return super.onOptionsItemSelected(item);
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ekene/blogzone/PostActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ekene.blogzone;
2 |
3 | import android.app.ProgressDialog;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 | import android.support.annotation.NonNull;
7 | import android.support.v7.app.AppCompatActivity;
8 | import android.os.Bundle;
9 | import android.text.TextUtils;
10 | import android.view.View;
11 | import android.widget.Button;
12 | import android.widget.EditText;
13 | import android.widget.ImageButton;
14 | import android.widget.ImageView;
15 | import android.widget.ProgressBar;
16 | import android.widget.Toast;
17 |
18 | import com.google.android.gms.tasks.OnCompleteListener;
19 | import com.google.android.gms.tasks.OnSuccessListener;
20 | import com.google.android.gms.tasks.Task;
21 | import com.google.firebase.FirebaseApp;
22 | import com.google.firebase.auth.FirebaseAuth;
23 | import com.google.firebase.auth.FirebaseUser;
24 | import com.google.firebase.database.DataSnapshot;
25 | import com.google.firebase.database.DatabaseError;
26 | import com.google.firebase.database.DatabaseReference;
27 | import com.google.firebase.database.FirebaseDatabase;
28 | import com.google.firebase.database.ValueEventListener;
29 | import com.google.firebase.storage.FirebaseStorage;
30 | import com.google.firebase.storage.StorageReference;
31 | import com.google.firebase.storage.UploadTask;
32 | import com.squareup.picasso.Picasso;
33 |
34 | public class PostActivity extends AppCompatActivity {
35 | // imports
36 | private ImageButton imageBtn;
37 | private static final int GALLERY_REQUEST_CODE = 2;
38 | private Uri uri = null;
39 | private EditText textTitle;
40 | private EditText textDesc;
41 | private Button postBtn;
42 | private StorageReference storage;
43 | private FirebaseDatabase database;
44 | private DatabaseReference databaseRef;
45 | private FirebaseAuth mAuth;
46 | private DatabaseReference mDatabaseUsers;
47 | private FirebaseUser mCurrentUser;
48 |
49 | @Override
50 | protected void onCreate(Bundle savedInstanceState) {
51 | super.onCreate(savedInstanceState);
52 | setContentView(R.layout.activity_post);
53 | // initializing objects
54 | postBtn = (Button)findViewById(R.id.postBtn);
55 | textDesc = (EditText)findViewById(R.id.textDesc);
56 | textTitle = (EditText)findViewById(R.id.textTitle);
57 | storage = FirebaseStorage.getInstance().getReference();
58 | databaseRef = database.getInstance().getReference().child("Blogzone");
59 | mAuth = FirebaseAuth.getInstance();
60 | mCurrentUser = mAuth.getCurrentUser();
61 | mDatabaseUsers = FirebaseDatabase.getInstance().getReference().child("Users").child(mCurrentUser.getUid());
62 | imageBtn = (ImageButton)findViewById(R.id.imageBtn);
63 | //picking image from gallery
64 | imageBtn.setOnClickListener(new View.OnClickListener() {
65 | @Override
66 | public void onClick(View view) {
67 | Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT);
68 | galleryIntent.setType("image/*");
69 | startActivityForResult(galleryIntent, GALLERY_REQUEST_CODE);
70 | }
71 | });
72 | // posting to Firebase
73 | postBtn.setOnClickListener(new View.OnClickListener() {
74 | @Override
75 | public void onClick(View view) {
76 | Toast.makeText(PostActivity.this, "POSTING...", Toast.LENGTH_LONG).show();
77 | final String PostTitle = textTitle.getText().toString().trim();
78 | final String PostDesc = textDesc.getText().toString().trim();
79 | // do a check for empty fields
80 | if (!TextUtils.isEmpty(PostDesc) && !TextUtils.isEmpty(PostTitle)){
81 | StorageReference filepath = storage.child("post_images").child(uri.getLastPathSegment());
82 | filepath.putFile(uri).addOnSuccessListener(new OnSuccessListener() {
83 | @Override
84 | public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
85 |
86 | @SuppressWarnings("VisibleForTests")
87 | //getting the post image download url
88 | final Uri downloadUrl = taskSnapshot.getDownloadUrl();
89 | Toast.makeText(getApplicationContext(), "Succesfully Uploaded", Toast.LENGTH_SHORT).show();
90 | final DatabaseReference newPost = databaseRef.push();
91 | //adding post contents to database reference
92 | mDatabaseUsers.addValueEventListener(new ValueEventListener() {
93 | @Override
94 | public void onDataChange(DataSnapshot dataSnapshot) {
95 | newPost.child("title").setValue(PostTitle);
96 | newPost.child("desc").setValue(PostDesc);
97 | newPost.child("imageUrl").setValue(downloadUrl.toString());
98 | newPost.child("uid").setValue(mCurrentUser.getUid());
99 | newPost.child("username").setValue(dataSnapshot.child("name").getValue())
100 | .addOnCompleteListener(new OnCompleteListener() {
101 | @Override
102 | public void onComplete(@NonNull Task task) {
103 |
104 | if (task.isSuccessful()){
105 | Intent intent = new Intent(PostActivity.this, MainActivity.class);
106 | startActivity(intent);
107 | }
108 | }
109 | });
110 | }
111 |
112 | @Override
113 | public void onCancelled(DatabaseError databaseError) {
114 |
115 | }
116 | });
117 | }
118 | });
119 |
120 | }
121 | }
122 | });
123 |
124 | }
125 |
126 | @Override
127 | // image from gallery result
128 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
129 | super.onActivityResult(requestCode, resultCode, data);
130 |
131 | if (requestCode == GALLERY_REQUEST_CODE && resultCode == RESULT_OK){
132 | uri = data.getData();
133 | imageBtn.setImageURI(uri);
134 | }
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ekene/blogzone/ProfileActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ekene.blogzone;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 | import android.text.TextUtils;
8 | import android.view.View;
9 | import android.widget.Button;
10 | import android.widget.EditText;
11 | import android.widget.ImageButton;
12 | import android.widget.Toast;
13 |
14 | import com.google.android.gms.tasks.OnSuccessListener;
15 | import com.google.firebase.auth.FirebaseAuth;
16 | import com.google.firebase.database.DatabaseReference;
17 | import com.google.firebase.database.FirebaseDatabase;
18 | import com.google.firebase.storage.FirebaseStorage;
19 | import com.google.firebase.storage.StorageReference;
20 | import com.google.firebase.storage.UploadTask;
21 | import com.theartofdev.edmodo.cropper.CropImage;
22 | import com.theartofdev.edmodo.cropper.CropImageView;
23 | //import com.theartofdev.edmodo.cropper.CropImage;
24 | //import com.theartofdev.edmodo.cropper.CropImageView;
25 |
26 | public class ProfileActivity extends AppCompatActivity {
27 |
28 | private EditText profUserName;
29 | private ImageButton imageButton;
30 | private final static int GALLERY_REQ = 1;
31 | private Button doneBtn;
32 | private Uri mImageUri = null;
33 | private FirebaseAuth mAuth;
34 | private DatabaseReference mDatabaseUsers;
35 | private StorageReference mStorageRef;
36 |
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 | setContentView(R.layout.activity_profile);
41 |
42 | mAuth = FirebaseAuth.getInstance();
43 | mDatabaseUsers = FirebaseDatabase.getInstance().getReference().child("Users");
44 | mStorageRef = FirebaseStorage.getInstance().getReference().child("profile_images");
45 | profUserName = (EditText)findViewById(R.id.profUserName);
46 | imageButton = (ImageButton)findViewById(R.id.imagebutton);
47 | doneBtn = (Button)findViewById(R.id.doneBtn);
48 |
49 | imageButton.setOnClickListener(new View.OnClickListener() {
50 | @Override
51 | public void onClick(View view) {
52 |
53 |
54 | Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT);
55 | galleryIntent.setType("image/*");
56 | startActivityForResult(galleryIntent, GALLERY_REQ);
57 | }
58 | });
59 |
60 | doneBtn.setOnClickListener(new View.OnClickListener() {
61 | @Override
62 | public void onClick(View view) {
63 | final String name = profUserName.getText().toString().trim();
64 | final String userID = mAuth.getCurrentUser().getUid();
65 | if (!TextUtils.isEmpty(name) && mImageUri != null){
66 |
67 | StorageReference filepath = mStorageRef.child(mImageUri.getLastPathSegment());
68 | filepath.putFile(mImageUri).addOnSuccessListener(new OnSuccessListener() {
69 | @Override
70 | public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
71 | @SuppressWarnings("VisibleForTests")
72 | String downloadUrl = taskSnapshot.getDownloadUrl().toString();
73 | mDatabaseUsers.child(userID).child("name").setValue(name);
74 | mDatabaseUsers.child(userID).child("image").setValue(downloadUrl);
75 |
76 | Toast.makeText(ProfileActivity.this, "Successful", Toast.LENGTH_SHORT).show();
77 | Intent i = new Intent(ProfileActivity.this, LoginActivity.class);
78 | startActivity(i);
79 | }
80 | });
81 |
82 | }
83 | }
84 | });
85 |
86 | }
87 | @Override
88 | protected void onActivityResult(int requestCode, int resultCode, Intent data) {
89 | super.onActivityResult(requestCode, resultCode, data);
90 |
91 | if (requestCode == GALLERY_REQ && resultCode == RESULT_OK){
92 |
93 | Uri imageUri = data.getData();
94 | CropImage.activity(imageUri)
95 | .setGuidelines(CropImageView.Guidelines.ON)
96 | .setAspectRatio(1,1)
97 | .start(this);
98 | }
99 | if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE){
100 | CropImage.ActivityResult result = CropImage.getActivityResult(data);
101 | if (resultCode == RESULT_OK){
102 | mImageUri = result.getUri();
103 | imageButton.setImageURI(mImageUri);
104 | }else {
105 | if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE){
106 | Exception err = result.getError();
107 | }
108 | }
109 | }
110 | }
111 |
112 | }
113 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ekene/blogzone/RegisterActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ekene.blogzone;
2 |
3 | import android.content.Intent;
4 | import android.support.annotation.MainThread;
5 | import android.support.annotation.NonNull;
6 | import android.support.v7.app.AppCompatActivity;
7 | import android.os.Bundle;
8 | import android.text.TextUtils;
9 | import android.view.View;
10 | import android.widget.Button;
11 | import android.widget.EditText;
12 | import android.widget.TextView;
13 | import android.widget.Toast;
14 |
15 | import com.google.android.gms.tasks.OnCompleteListener;
16 | import com.google.android.gms.tasks.Task;
17 | import com.google.firebase.auth.AuthResult;
18 | import com.google.firebase.auth.FirebaseAuth;
19 | import com.google.firebase.database.DatabaseReference;
20 | import com.google.firebase.database.FirebaseDatabase;
21 |
22 | public class RegisterActivity extends AppCompatActivity {
23 | private Button registerBtn;
24 | private EditText emailField, usernameField, passwordField;
25 | private FirebaseAuth mAuth;
26 | private DatabaseReference mDatabase;
27 | private TextView loginTxtView;
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.activity_register);
32 |
33 | loginTxtView = (TextView)findViewById(R.id.loginTxtView);
34 | registerBtn = (Button)findViewById(R.id.registerBtn);
35 | emailField = (EditText)findViewById(R.id.emailField);
36 | usernameField = (EditText)findViewById(R.id.usernameField);
37 | passwordField = (EditText)findViewById(R.id.passwordField);
38 | mAuth = FirebaseAuth.getInstance();
39 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Users");
40 | loginTxtView.setOnClickListener(new View.OnClickListener() {
41 | @Override
42 | public void onClick(View view) {
43 | startActivity(new Intent(RegisterActivity.this, LoginActivity.class));
44 | }
45 | });
46 | registerBtn.setOnClickListener(new View.OnClickListener() {
47 | @Override
48 | public void onClick(View view) {
49 | Toast.makeText(RegisterActivity.this, "LOADING...", Toast.LENGTH_LONG).show();
50 | final String username = usernameField.getText().toString().trim();
51 | final String email = emailField.getText().toString().trim();
52 | final String password = passwordField.getText().toString().trim();
53 | if (!TextUtils.isEmpty(email) && !TextUtils.isEmpty(username)&&!TextUtils.isEmpty(password)){
54 | mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(new OnCompleteListener() {
55 | @Override
56 | public void onComplete(@NonNull Task task) {
57 | String user_id = mAuth.getCurrentUser().getUid();
58 | DatabaseReference current_user_db = mDatabase.child(user_id);
59 | current_user_db.child("Username").setValue(username);
60 | current_user_db.child("Image").setValue("Default");
61 | Toast.makeText(RegisterActivity.this, "Registeration Succesful", Toast.LENGTH_SHORT).show();
62 | Intent regIntent = new Intent(RegisterActivity.this, ProfileActivity.class);
63 | regIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
64 | startActivity(regIntent);
65 | }
66 | });
67 | }else {
68 |
69 | Toast.makeText(RegisterActivity.this, "Complete all fields", Toast.LENGTH_SHORT).show();
70 | }
71 | }
72 | });
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/ekene/blogzone/SinglePostActivity.java:
--------------------------------------------------------------------------------
1 | package com.example.ekene.blogzone;
2 |
3 | import android.content.Intent;
4 | import android.support.v7.app.AppCompatActivity;
5 | import android.os.Bundle;
6 | import android.view.View;
7 | import android.widget.Button;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import com.google.firebase.auth.FirebaseAuth;
12 | import com.google.firebase.database.DataSnapshot;
13 | import com.google.firebase.database.DatabaseError;
14 | import com.google.firebase.database.DatabaseReference;
15 | import com.google.firebase.database.FirebaseDatabase;
16 | import com.google.firebase.database.ValueEventListener;
17 | import com.squareup.picasso.Picasso;
18 |
19 | public class SinglePostActivity extends AppCompatActivity {
20 |
21 | private ImageView singelImage;
22 | private TextView singleTitle, singleDesc;
23 | String post_key = null;
24 | private DatabaseReference mDatabase;
25 | private Button deleteBtn;
26 | private FirebaseAuth mAuth;
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.activity_single_post);
32 |
33 | singelImage = (ImageView)findViewById(R.id.singleImageview);
34 | singleTitle = (TextView)findViewById(R.id.singleTitle);
35 | singleDesc = (TextView)findViewById(R.id.singleDesc);
36 | mDatabase = FirebaseDatabase.getInstance().getReference().child("Blogzone");
37 | post_key = getIntent().getExtras().getString("PostID");
38 | deleteBtn = (Button)findViewById(R.id.deleteBtn);
39 | mAuth = FirebaseAuth.getInstance();
40 | deleteBtn.setVisibility(View.INVISIBLE);
41 | deleteBtn.setOnClickListener(new View.OnClickListener() {
42 | @Override
43 | public void onClick(View view) {
44 |
45 | mDatabase.child(post_key).removeValue();
46 |
47 | Intent mainintent = new Intent(SinglePostActivity.this, MainActivity.class);
48 | startActivity(mainintent);
49 | }
50 | });
51 |
52 |
53 | mDatabase.child(post_key).addValueEventListener(new ValueEventListener() {
54 | @Override
55 | public void onDataChange(DataSnapshot dataSnapshot) {
56 | String post_title = (String) dataSnapshot.child("title").getValue();
57 | String post_desc = (String) dataSnapshot.child("desc").getValue();
58 | String post_image = (String) dataSnapshot.child("imageUrl").getValue();
59 | String post_uid = (String) dataSnapshot.child("uid").getValue();
60 |
61 | singleTitle.setText(post_title);
62 | singleDesc.setText(post_desc);
63 | Picasso.with(SinglePostActivity.this).load(post_image).into(singelImage);
64 | if (mAuth.getCurrentUser().getUid().equals(post_uid)){
65 |
66 | deleteBtn.setVisibility(View.VISIBLE);
67 | }
68 | }
69 |
70 | @Override
71 | public void onCancelled(DatabaseError databaseError) {
72 |
73 | }
74 | });
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/action_button_style.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/add_img.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/drawable/add_img.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/addicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/drawable/addicon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/drawable/bg.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bgg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/drawable/bgg.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/buttonstyle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/edit_text_styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_add_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/imag.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/drawable/imag.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/layoutstyle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/lowres.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/drawable/lowres.jpg
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
31 |
32 |
42 |
43 |
53 |
54 |
63 |
64 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_post.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
24 |
36 |
47 |
48 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
19 |
20 |
29 |
30 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_register.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
21 |
22 |
32 |
33 |
42 |
52 |
53 |
63 |
64 |
73 |
74 |
84 |
85 |
86 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_single_post.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
13 |
14 |
19 |
20 |
29 |
30 |
36 |
37 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/card_items.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
20 |
28 |
29 |
35 |
36 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
14 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #000103
4 | #24283e
5 | #FF4081
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 | 16dp
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Blogzone
3 | Settings
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/ekene/blogzone/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package com.example.ekene.blogzone;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.*;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | jcenter()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.3'
9 | classpath 'com.google.gms:google-services:3.0.0'
10 |
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 |
16 | allprojects {
17 | repositories {
18 | jcenter()
19 | }
20 | }
21 |
22 | task clean(type: Delete) {
23 | delete rootProject.buildDir
24 | }
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | org.gradle.jvmargs=-Xmx1536m
13 |
14 | # When configured, Gradle will run in incubating parallel mode.
15 | # This option should only be used with decoupled projects. More details, visit
16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
17 | # org.gradle.parallel=true
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kenny-io/Blogzone/4ed435cde1fc22dd839178023b7f6f508cf741cb/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Nov 02 23:49:25 WAT 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------