-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from KostyaBakay/dev
Code refactoring
- Loading branch information
Showing
40 changed files
with
1,161 additions
and
1,168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,46 @@ | ||
# Built application files | ||
*.apk | ||
*.ap_ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Intellij | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea | ||
.idea/ | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
/.externalNativeBuild | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
google-services.json | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
.DS_Store | ||
/build | ||
/captures | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ | |
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
app/src/main/java/com/kostyabakay/braintraininggame/AppData.java
This file was deleted.
Oops, something went wrong.
92 changes: 33 additions & 59 deletions
92
app/src/main/java/com/kostyabakay/braintraininggame/activity/AuthorActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,52 @@ | ||
package com.kostyabakay.braintraininggame.activity; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.widget.ImageView; | ||
import android.support.annotation.NonNull; | ||
|
||
import com.kostyabakay.braintraininggame.R; | ||
import com.kostyabakay.braintraininggame.common.constant.SocialUrl; | ||
|
||
/** | ||
* Created by Kostya on 08.03.2016. | ||
* This class represents Activity with information about author of this application. | ||
*/ | ||
public class AuthorActivity extends AppCompatActivity { | ||
private static final String TWITTER_URL = "https://twitter.com/Kostya_Bakay"; | ||
private static final String INSTAGRAM_URL = "https://instagram.com/kostya_bakay"; | ||
private static final String GITHUB_URL = "https://github.com/kostyabak"; | ||
private static final String LINKEDIN_URL = "https://ua.linkedin.com/in/kostyabakay"; | ||
import butterknife.ButterKnife; | ||
import butterknife.OnClick; | ||
|
||
public class AuthorActivity extends BaseActivity { | ||
|
||
public static void start(@NonNull Context context) { | ||
Intent starter = new Intent(context, AuthorActivity.class); | ||
context.startActivity(starter); | ||
} | ||
|
||
//region BaseActivity | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_author); | ||
initView(); | ||
ButterKnife.bind(this); | ||
} | ||
//endregion | ||
|
||
/** | ||
* Initialization view elements on the screen. | ||
*/ | ||
private void initView() { | ||
ImageView twitterImageView = (ImageView) findViewById(R.id.twitter_image); | ||
ImageView instagramImageView = (ImageView) findViewById(R.id.instagram_image); | ||
ImageView githubImageView = (ImageView) findViewById(R.id.github_image); | ||
ImageView linkedinImageView = (ImageView) findViewById(R.id.linkedin_image); | ||
|
||
twitterImageView.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View v) { | ||
Intent twitterIntent = new Intent(); | ||
twitterIntent.setAction(Intent.ACTION_VIEW); | ||
twitterIntent.addCategory(Intent.CATEGORY_BROWSABLE); | ||
twitterIntent.setData(Uri.parse(TWITTER_URL)); | ||
startActivity(twitterIntent); | ||
} | ||
}); | ||
//region ButterKnife | ||
@OnClick(R.id.twitter_image) | ||
void onTwitterClick() { | ||
openWebPage(Uri.parse(SocialUrl.TWITTER)); | ||
} | ||
|
||
instagramImageView.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View v) { | ||
Intent instagramIntent = new Intent(); | ||
instagramIntent.setAction(Intent.ACTION_VIEW); | ||
instagramIntent.addCategory(Intent.CATEGORY_BROWSABLE); | ||
instagramIntent.setData(Uri.parse(INSTAGRAM_URL)); | ||
startActivity(instagramIntent); | ||
} | ||
}); | ||
@OnClick(R.id.instagram_image) | ||
void onInstagramClick() { | ||
openWebPage(Uri.parse(SocialUrl.INSTAGRAM)); | ||
} | ||
|
||
githubImageView.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View v) { | ||
Intent githubIntent = new Intent(); | ||
githubIntent.setAction(Intent.ACTION_VIEW); | ||
githubIntent.addCategory(Intent.CATEGORY_BROWSABLE); | ||
githubIntent.setData(Uri.parse(GITHUB_URL)); | ||
startActivity(githubIntent); | ||
} | ||
}); | ||
@OnClick(R.id.github_image) | ||
void onGitHubClick() { | ||
openWebPage(Uri.parse(SocialUrl.GITHUB)); | ||
} | ||
|
||
linkedinImageView.setOnClickListener(new View.OnClickListener() { | ||
public void onClick(View v) { | ||
Intent linkedinIntent = new Intent(); | ||
linkedinIntent.setAction(Intent.ACTION_VIEW); | ||
linkedinIntent.addCategory(Intent.CATEGORY_BROWSABLE); | ||
linkedinIntent.setData(Uri.parse(LINKEDIN_URL)); | ||
startActivity(linkedinIntent); | ||
} | ||
}); | ||
@OnClick(R.id.linkedin_image) | ||
void onLinkedInClick() { | ||
openWebPage(Uri.parse(SocialUrl.LINKED_IN)); | ||
} | ||
} | ||
//endregion | ||
} |
26 changes: 26 additions & 0 deletions
26
app/src/main/java/com/kostyabakay/braintraininggame/activity/BaseActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.kostyabakay.braintraininggame.activity; | ||
|
||
import android.app.Fragment; | ||
import android.app.FragmentTransaction; | ||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.support.annotation.IdRes; | ||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
import android.support.v7.app.AppCompatActivity; | ||
|
||
public class BaseActivity extends AppCompatActivity { | ||
public void replaceFragment(@IdRes int containerViewId, @NonNull Fragment fragment) { | ||
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction(); | ||
fragmentTransaction.replace(containerViewId, fragment); | ||
fragmentTransaction.commit(); | ||
} | ||
|
||
public void openWebPage(@Nullable Uri webPageUri) { | ||
Intent intent = new Intent(); | ||
intent.setAction(Intent.ACTION_VIEW); | ||
intent.addCategory(Intent.CATEGORY_BROWSABLE); | ||
intent.setData(webPageUri); | ||
startActivity(intent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.