Skip to content

Commit 53a6f35

Browse files
committed
Code reorganized
1 parent 76586fd commit 53a6f35

File tree

14 files changed

+74
-118
lines changed

14 files changed

+74
-118
lines changed

.idea/compiler.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.idea/copyright/profiles_settings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.idea/encodings.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

.idea/gradle.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 5 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
Android Application Development : Genuine Inspiration (Inspirational Quote Application)
1+
# Android Application Development Tutorial: Inspirational Quote Application
22

3-
Watch Tutorial videos at http://www.youtube.com/GenuineCoder
3+
<p align="center">
4+
<img width=300 src=https://i.imgur.com/4iiJRG8.gif>
5+
</p>
6+
7+
Watch Tutorial at https://www.youtube.com/watch?v=T3v6WxpUnBI&list=PLhs1urmduZ2_BM4B3mC3q3c20khS1YWe2

app/build.gradle

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 25
5-
buildToolsVersion "24.0.2"
4+
compileSdkVersion 27
5+
buildToolsVersion "27.0.3"
66
defaultConfig {
77
applicationId "inspiration.coder.genuine.com.genuineinspiration"
88
minSdkVersion 16
9-
targetSdkVersion 25
9+
targetSdkVersion 27
1010
versionCode 1
1111
versionName "1.0"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -20,11 +20,8 @@ android {
2020
}
2121

2222
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:25.0.0'
28-
compile 'com.android.support:cardview-v7:25.0.0'
29-
testCompile 'junit:junit:4.12'
23+
implementation fileTree(dir: 'libs', include: ['*.jar'])
24+
implementation 'com.android.support:appcompat-v7:27.1.1'
25+
implementation 'com.android.support:cardview-v7:27.1.1'
26+
testImplementation 'junit:junit:4.12'
3027
}

app/src/main/java/inspiration/coder/genuine/com/genuineinspiration/MainActivity.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,50 @@
11
package inspiration.coder.genuine.com.genuineinspiration;
22

33
import android.content.res.AssetManager;
4+
import android.os.Bundle;
45
import android.support.v4.view.ViewPager;
56
import android.support.v7.app.AppCompatActivity;
6-
import android.os.Bundle;
77
import android.util.Log;
8-
import android.view.View;
98

109
import java.io.IOException;
1110
import java.io.InputStream;
1211
import java.util.ArrayList;
1312
import java.util.Scanner;
1413

14+
import inspiration.coder.genuine.com.genuineinspiration.adapters.QuotePagerAdapter;
15+
import inspiration.coder.genuine.com.genuineinspiration.model.Quote;
16+
1517
public class MainActivity extends AppCompatActivity {
1618

19+
public static final String QUOTE_STORE = "data.txt";
20+
1721
@Override
1822
protected void onCreate(Bundle savedInstanceState) {
1923
super.onCreate(savedInstanceState);
2024
setContentView(R.layout.activity_main);
2125

22-
2326
ArrayList<Quote> list = new ArrayList<>();
2427
AssetManager manager = getAssets();
2528
try {
26-
InputStream in = manager.open("data.txt");
29+
InputStream in = manager.open(QUOTE_STORE);
2730
Scanner scn = new Scanner(in);
28-
while(scn.hasNext()){
31+
while (scn.hasNext()) {
2932
String temp = scn.nextLine();
3033
int quoteID = Integer.parseInt(temp.split("[|]")[0]);
3134
String quote = temp.split("[|]")[1];
3235
String author = temp.split("[|]")[2];
33-
Log.d("MainActivity",quote + "---by " + author + " at " + quoteID);
36+
Log.d("MainActivity", quote + "---by " + author + " at " + quoteID);
3437

35-
Quote qt = new Quote(quoteID,quote,author);
38+
Quote qt = new Quote(quoteID, quote, author);
3639
list.add(qt);
3740
}
3841

3942
} catch (IOException e) {
4043
e.printStackTrace();
4144
}
4245

43-
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
44-
QuotePagerAdapter adapter = new QuotePagerAdapter(list,this);
46+
ViewPager viewPager = findViewById(R.id.viewpager);
47+
QuotePagerAdapter adapter = new QuotePagerAdapter(list, this);
4548
viewPager.setAdapter(adapter);
4649
}
4750

0 commit comments

Comments
 (0)