Skip to content

Commit

Permalink
Technocoupdoeil completed - M1
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul Kadyan authored and znck-graveyard committed Dec 26, 2013
1 parent e9dfccd commit 3123019
Show file tree
Hide file tree
Showing 20 changed files with 674 additions and 124 deletions.
33 changes: 0 additions & 33 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,27 @@
android:theme="@style/AppTheme" >
<activity
android:name="org.techniche.technothlon.katana.SplashScreen"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen"
android:clearTaskOnLaunch="true"
android:hardwareAccelerated="true" >
android:hardwareAccelerated="true"
android:label="@string/app_name"
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

</activity>
<activity
android:name="org.techniche.technothlon.katana.MainActivity"
android:excludeFromRecents="true"
android:hardwareAccelerated="true"
android:label="@string/title_activity_main"
android:launchMode="singleTask"
android:taskAffinity=""
android:excludeFromRecents="true"
>
android:taskAffinity="" >
</activity>
</application>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

</manifest>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.techniche.technothlon.katana;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
Expand All @@ -9,10 +10,13 @@
import android.support.v7.app.ActionBarActivity;
import android.view.*;
import android.widget.TextView;
import android.widget.Toast;
import org.techniche.technothlon.katana.tcd.TCDContent;

public class MainActivity extends ActionBarActivity
implements NavigationDrawerFragment.NavigationDrawerCallbacks, TCDFragment.OnTCDInteractionListener, TechnopediaFragment.OnTechnopediaInteractionListener {

public static Context context;
/**
* Fragment managing the behaviors, interactions and presentation of the navigation drawer.
*/
Expand All @@ -25,6 +29,7 @@ public class MainActivity extends ActionBarActivity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
context = getApplicationContext();
setContentView(R.layout.activity_main);

mNavigationDrawerFragment = (NavigationDrawerFragment)
Expand Down Expand Up @@ -88,6 +93,15 @@ public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
} else if (id == R.id.action_example) {
TCDContent.TCDLoader loader = new TCDContent.TCDLoader() {
@Override
public void finished() {

}
};
loader.execute(MainActivity.context.getApplicationContext());
Toast.makeText(this, "Syncing", Toast.LENGTH_SHORT).show();
}
return super.onOptionsItemSelected(item);
}
Expand Down Expand Up @@ -122,10 +136,10 @@ public PlaceholderFragment() {
public static Fragment newInstance(int sectionNumber) {
Fragment fragment;
switch (sectionNumber) {
case 2:
case 3:
fragment = new TCDFragment();
break;
case 3:
case 2:
fragment = new TechnopediaFragment();
break;
default:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
package org.techniche.technothlon.katana;

import android.support.v7.app.ActionBarActivity;;
import android.app.Activity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.app.Fragment;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import android.view.*;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

/**
* Fragment used for managing interactions for and presentation of a navigation drawer.
Expand All @@ -33,27 +27,22 @@ public class NavigationDrawerFragment extends Fragment {
* Remember the position of the selected item.
*/
private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position";

/**
* Per the design guidelines, you should show the drawer on launch until the user manually
* expands it. This shared preference tracks this.
*/
private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned";

/**
* A pointer to the current callbacks instance (the Activity).
*/
private NavigationDrawerCallbacks mCallbacks;

/**
* Helper component that ties the action bar to the navigation drawer.
*/
private ActionBarDrawerToggle mDrawerToggle;

private DrawerLayout mDrawerLayout;
private ListView mDrawerListView;
private View mFragmentContainerView;

private int mCurrentSelectedPosition = 0;
private boolean mFromSavedInstanceState;
private boolean mUserLearnedDrawer;
Expand All @@ -80,15 +69,15 @@ public void onCreate(Bundle savedInstanceState) {
}

@Override
public void onActivityCreated (Bundle savedInstanceState) {
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// Indicate that this fragment would like to influence the set of actions in the action bar.
setHasOptionsMenu(true);
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Bundle savedInstanceState) {
mDrawerListView = (ListView) inflater.inflate(
R.layout.fragment_navigation_drawer, container, false);
mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
Expand Down Expand Up @@ -248,7 +237,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
}

if (item.getItemId() == R.id.action_example) {
Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show();
switch (mCurrentSelectedPosition) {
case 3:

break;
}
return true;
}

Expand All @@ -263,7 +256,6 @@ private void showGlobalContextActionBar() {
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setTitle(R.string.app_name);
}

private ActionBar getActionBar() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import org.techniche.technothlon.katana.tcd.TCDContent;

import java.util.Date;

public class SplashScreen extends Activity {

Expand All @@ -23,35 +26,48 @@ protected void onCreate(Bundle savedInstanceState) {
tag = (ImageView) findViewById(R.id.logo_tag);

Animation anim = AnimationUtils.loadAnimation(this, R.anim.anim_fly_in_top);
assert anim != null;
head.startAnimation(anim);

anim = AnimationUtils.loadAnimation(this, R.anim.anim_fly_in_left);
assert anim != null;
text.startAnimation(anim);

anim = AnimationUtils.loadAnimation(this, R.anim.anim_fly_in_right);
assert anim != null;
tag.startAnimation(anim);
}

@Override
protected void onStart() {
super.onStart();
(new AsyncTask<Object, Object, Object>() {
final long timeStart = (new Date()).getTime();
(new TCDContent.TCDLoader() {
@Override
protected Object doInBackground(Object... params) {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return null;
}
public void finished() {
long timeEnd = (new Date()).getTime();
long timeTaken = Math.abs(timeEnd - timeStart);
if(timeTaken < 4000) {
(new AsyncTask<Object, Integer, String>(){
@Override
protected String doInBackground(Object... params) {
try {
Thread.sleep((Long) params[0], 0);
} catch (InterruptedException e) {
e.printStackTrace();
}
return null;
}

@Override
protected void onPostExecute(Object o) {
super.onPostExecute(o);
SplashScreen.this.proceed();
@Override
protected void onPostExecute(String s) {
super.onPostExecute(s);
proceed();
}
}).execute(4000 - timeTaken);
}
}
}).execute();
}).execute(getApplicationContext());
}

private void proceed() {
Expand Down
Loading

0 comments on commit 3123019

Please sign in to comment.