-
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.
Showing
47 changed files
with
388 additions
and
44 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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
/local.properties | ||
/.idea/workspace.xml | ||
.DS_Store | ||
*.apk |
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
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
Binary file not shown.
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
165 changes: 165 additions & 0 deletions
165
app/src/main/java/org/techniche/technothlon/katana/TCDSingleViewer.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,165 @@ | ||
package org.techniche.technothlon.katana; | ||
|
||
import android.os.Bundle; | ||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
import android.support.v4.view.ViewPager; | ||
import android.support.v7.app.ActionBarActivity; | ||
import android.view.*; | ||
import android.widget.TextView; | ||
import org.techniche.technothlon.katana.tcd.TCDContent; | ||
|
||
import java.util.Locale; | ||
|
||
public class TCDSingleViewer extends ActionBarActivity implements ViewPager.OnPageChangeListener { | ||
private static int pages; | ||
/** | ||
* The {@link android.support.v4.view.PagerAdapter} that will provide | ||
* fragments for each of the sections. We use a | ||
* {@link FragmentPagerAdapter} derivative, which will keep every | ||
* loaded fragment in memory. If this becomes too memory intensive, it | ||
* may be best to switch to a | ||
* {@link android.support.v4.app.FragmentStatePagerAdapter}. | ||
*/ | ||
SectionsPagerAdapter mSectionsPagerAdapter; | ||
|
||
/** | ||
* The {@link ViewPager} that will host the section contents. | ||
*/ | ||
ViewPager mViewPager; | ||
private int activePage; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_tcdsingle_viewer); | ||
// Create the adapter that will return a fragment for each of the three | ||
// primary sections of the activity. | ||
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); | ||
|
||
pages = TCDContent.ITEMS.size(); | ||
// Set up the ViewPager with the sections adapter. | ||
mViewPager = (ViewPager) findViewById(R.id.pager); | ||
mViewPager.setAdapter(mSectionsPagerAdapter); | ||
activePage = getIntent().getExtras().getInt("open"); | ||
mViewPager.setCurrentItem(activePage); | ||
} | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
|
||
// Inflate the menu; this adds items to the action bar if it is present. | ||
getMenuInflater().inflate(R.menu.tcdsingle_viewer, menu); | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean onOptionsItemSelected(MenuItem item) { | ||
// Handle action bar item clicks here. The action bar will | ||
// automatically handle clicks on the Home/Up button, so long | ||
// as you specify a parent activity in AndroidManifest.xml. | ||
int id = item.getItemId(); | ||
if (id == R.id.action_settings) { | ||
return true; | ||
} | ||
return super.onOptionsItemSelected(item); | ||
} | ||
|
||
@Override | ||
public void onPageScrolled(int i, float v, int i2) { | ||
|
||
} | ||
|
||
@Override | ||
public void onPageSelected(int i) { | ||
activePage = i; | ||
} | ||
|
||
@Override | ||
public void onPageScrollStateChanged(int i) { | ||
|
||
} | ||
|
||
|
||
/** | ||
* A {@link FragmentPagerAdapter} that returns a fragment corresponding to | ||
* one of the sections/tabs/pages. | ||
*/ | ||
public class SectionsPagerAdapter extends FragmentPagerAdapter { | ||
|
||
public SectionsPagerAdapter(FragmentManager fm) { | ||
super(fm); | ||
} | ||
|
||
@Override | ||
public Fragment getItem(int position) { | ||
// getItem is called to instantiate the fragment for the given page. | ||
// Return a PlaceholderFragment (defined as a static inner class below). | ||
return PlaceholderFragment.newInstance((position)); | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
// Show 3 total pages. | ||
return pages; | ||
} | ||
|
||
@Override | ||
public CharSequence getPageTitle(int position) { | ||
Locale l = Locale.getDefault(); | ||
TCDContent.TCDQuestion q = TCDContent.ITEM_MAP.get(TCDContent.ITEMS.get(position).id); | ||
String title = "#"+q.id+" - "+q.title; | ||
return title; | ||
} | ||
} | ||
|
||
/** | ||
* A placeholder fragment containing a simple view. | ||
*/ | ||
public static class PlaceholderFragment extends Fragment { | ||
/** | ||
* The fragment argument representing the section number for this | ||
* fragment. | ||
*/ | ||
private static final String ARG_SECTION_NUMBER = "section_number"; | ||
|
||
/** | ||
* Returns a new instance of this fragment for the given section | ||
* number. | ||
*/ | ||
public static PlaceholderFragment newInstance(int sectionNumber) { | ||
PlaceholderFragment fragment = new PlaceholderFragment(); | ||
Bundle args = new Bundle(); | ||
args.putInt(ARG_SECTION_NUMBER, sectionNumber); | ||
fragment.setArguments(args); | ||
return fragment; | ||
} | ||
|
||
public PlaceholderFragment() { | ||
} | ||
|
||
// TODO create view here | ||
|
||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, | ||
Bundle savedInstanceState) { | ||
View rootView = inflater.inflate(R.layout.fragment_tcdsingle_viewer, container, false); | ||
TextView id = (TextView) rootView.findViewById(R.id.tcd_id), | ||
title = (TextView) rootView.findViewById(R.id.tcd_title), | ||
question = (TextView) rootView.findViewById(R.id.tcd_question), | ||
by = (TextView) rootView.findViewById(R.id.tcd_posted_by), | ||
status = (TextView) rootView.findViewById(R.id.tcd_status); | ||
int position = getArguments().getInt(ARG_SECTION_NUMBER); | ||
TCDContent.TCDQuestion q = TCDContent.ITEM_MAP.get(TCDContent.ITEMS.get(position).id); | ||
id.setText("#"+q.id); | ||
id.setBackgroundResource(q.color); | ||
title.setText(q.title); | ||
question.setText(q.question); | ||
by.setText(q.by); | ||
status.setText(q.getStatus()); | ||
return rootView; | ||
} | ||
} | ||
|
||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+4.61 KB
(320%)
app/src/main/res/drawable-hdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+2.38 KB
(280%)
app/src/main/res/drawable-mdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7.29 KB
(350%)
app/src/main/res/drawable-xhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+14.3 KB
(400%)
app/src/main/res/drawable-xxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > | ||
<solid android:color="#9933cc" /> | ||
<stroke android:width="1dip" android:color="#aa66cc"/> | ||
</shape> |
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,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > | ||
<solid android:color="#99cc00" /> | ||
<stroke android:width="1dip" android:color="#669900"/> | ||
</shape> |
Oops, something went wrong.