Skip to content

Commit d4e5c58

Browse files
author
saurav
committed
Added one new category INDIA and sorted the rest
0 parents  commit d4e5c58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1229
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.iml
2+
local.properties
3+
.idea
4+
.gradle
5+
App/*iml

App/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

App/App.apk

688 KB
Binary file not shown.

App/build.gradle

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
buildscript {
2+
repositories {
3+
mavenCentral()
4+
}
5+
dependencies {
6+
classpath 'com.android.tools.build:gradle:0.6.+'
7+
}
8+
}
9+
apply plugin: 'android'
10+
11+
repositories {
12+
mavenCentral()
13+
}
14+
15+
android {
16+
compileSdkVersion 19
17+
buildToolsVersion "18.1.1"
18+
19+
defaultConfig {
20+
minSdkVersion 7
21+
targetSdkVersion 19
22+
}
23+
buildTypes {
24+
release {
25+
runProguard true
26+
proguardFile getDefaultProguardFile('proguard-android-optimize.txt')
27+
}
28+
}
29+
productFlavors {
30+
defaultFlavor {
31+
proguardFile 'proguard-rules.txt'
32+
}
33+
}
34+
}
35+
36+
dependencies {
37+
compile 'com.android.support:support-v4:19.0.0'
38+
compile 'com.android.support:appcompat-v7:+'
39+
}

App/proguard-rules.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /home/omerjerk/android-studio/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the ProGuard
5+
# include property in project.properties.
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+
#}

App/src/main/AndroidManifest.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="in.ac.dtu.subtlenews"
4+
android:versionCode="1"
5+
android:versionName="0.1" >
6+
7+
<uses-permission android:name="android.permission.INTERNET" />
8+
9+
<uses-sdk
10+
android:minSdkVersion="11"
11+
android:targetSdkVersion="19" />
12+
13+
<application
14+
android:allowBackup="true"
15+
android:icon="@drawable/ic_launcher"
16+
android:label="@string/app_name"
17+
android:theme="@style/AppTheme" >
18+
<activity
19+
android:name="in.ac.dtu.subtlenews.MainActivity"
20+
android:label="@string/app_name" >
21+
<intent-filter>
22+
<action android:name="android.intent.action.MAIN" />
23+
24+
<category android:name="android.intent.category.LAUNCHER" />
25+
</intent-filter>
26+
</activity>
27+
</application>
28+
29+
</manifest>

App/src/main/ic_launcher-web.png

2.71 KB
Loading
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
package in.ac.dtu.subtlenews;
2+
3+
import android.os.Bundle;
4+
import android.support.v4.app.Fragment;
5+
import android.support.v4.app.FragmentManager;
6+
import android.support.v4.widget.DrawerLayout;
7+
import android.support.v7.app.ActionBar;
8+
import android.support.v7.app.ActionBarActivity;
9+
import android.view.Menu;
10+
import android.view.MenuItem;
11+
12+
public class MainActivity extends ActionBarActivity
13+
implements NavigationDrawerFragment.NavigationDrawerCallbacks {
14+
15+
/**
16+
* Fragment managing the behaviors, interactions and presentation of the navigation drawer.
17+
*/
18+
private NavigationDrawerFragment mNavigationDrawerFragment;
19+
20+
/**
21+
* Used to store the last screen title. For use in {@link #restoreActionBar()}.
22+
*/
23+
private CharSequence mTitle;
24+
25+
@Override
26+
protected void onCreate(Bundle savedInstanceState) {
27+
super.onCreate(savedInstanceState);
28+
setContentView(R.layout.activity_main);
29+
30+
mNavigationDrawerFragment = (NavigationDrawerFragment)
31+
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
32+
mTitle = getTitle();
33+
34+
// Set up the drawer.
35+
mNavigationDrawerFragment.setUp(
36+
R.id.navigation_drawer,
37+
(DrawerLayout) findViewById(R.id.drawer_layout));
38+
}
39+
40+
@Override
41+
public void onNavigationDrawerItemSelected(int position) {
42+
// update the main content by replacing fragments
43+
FragmentManager fragmentManager = getSupportFragmentManager();
44+
fragmentManager.beginTransaction()
45+
.replace(R.id.container, MainFragment.newInstance(position + 1))
46+
.commit();
47+
}
48+
49+
public void onSectionAttached(int number) {
50+
switch (number) {
51+
case 1:
52+
mTitle = "India";
53+
break;
54+
case 2:
55+
mTitle = "World";
56+
break;
57+
case 3:
58+
mTitle = "Entertainment";
59+
break;
60+
case 4:
61+
mTitle = "Technology";
62+
break;
63+
case 5:
64+
mTitle = "Business";
65+
break;
66+
case 6:
67+
mTitle = "Science";
68+
break;
69+
case 7:
70+
mTitle = "Sports";
71+
break;
72+
case 8:
73+
mTitle = "Health";
74+
break;
75+
}
76+
}
77+
78+
public void restoreActionBar() {
79+
ActionBar actionBar = getSupportActionBar();
80+
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
81+
actionBar.setDisplayShowTitleEnabled(true);
82+
actionBar.setTitle(mTitle);
83+
}
84+
85+
86+
@Override
87+
public boolean onCreateOptionsMenu(Menu menu) {
88+
if (!mNavigationDrawerFragment.isDrawerOpen()) {
89+
// Only show items in the action bar relevant to this screen
90+
// if the drawer is not showing. Otherwise, let the drawer
91+
// decide what to show in the action bar.
92+
getMenuInflater().inflate(R.menu.main, menu);
93+
restoreActionBar();
94+
return true;
95+
}
96+
return super.onCreateOptionsMenu(menu);
97+
}
98+
99+
@Override
100+
public boolean onOptionsItemSelected(MenuItem item) {
101+
// Handle action bar item clicks here. The action bar will
102+
// automatically handle clicks on the Home/Up button, so long
103+
// as you specify a parent activity in AndroidManifest.xml.
104+
int id = item.getItemId();
105+
switch (id){
106+
case R.id.action_refresh:
107+
new UpdateNews(MainActivity.this).execute();
108+
return true;
109+
case R.id.action_settings:
110+
return true;
111+
}
112+
return super.onOptionsItemSelected(item);
113+
}
114+
115+
/**
116+
* A placeholder fragment containing a simple view.
117+
*/
118+
public static class PlaceholderFragment extends Fragment {
119+
120+
}
121+
122+
}

0 commit comments

Comments
 (0)