Skip to content

Commit

Permalink
Moved fonts into assets folder. tweaking welcome screen
Browse files Browse the repository at this point in the history
  • Loading branch information
vannenc committed Aug 20, 2013
1 parent 8b91e25 commit 1ffa6f1
Show file tree
Hide file tree
Showing 12 changed files with 282 additions and 7 deletions.
Binary file removed res/font/Roboto-Light.ttf
Binary file not shown.
Binary file removed res/font/Roboto-Medium.ttf
Binary file not shown.
Binary file removed res/font/Roboto-Regular.ttf
Binary file not shown.
Binary file removed res/font/Roboto-Thin.ttf
Binary file not shown.
Binary file removed res/font/RobotoCondensed-Light.ttf
Binary file not shown.
Binary file removed res/font/RobotoSpecimenBook.pdf
Binary file not shown.
109 changes: 106 additions & 3 deletions res/layout/fragment_startscreen.xml
@@ -1,7 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollviewWelcome"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:fillViewport="true" >

</LinearLayout>
<RelativeLayout
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/default_screen_padding" >

<TextView
android:id="@+id/textViewWelcomeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Welcometext" />

<RelativeLayout
android:id="@+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textViewWelcomeText"
android:layout_below="@+id/textViewWelcomeText"
android:layout_marginTop="19dp" >

<ImageView
android:id="@+id/imageViewEmtel"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_toRightOf="@id/imageViewEmtel"
android:contentDescription="@string/NULL"
android:src="@color/emtel" />

<TextView
android:id="@+id/textViewEmtelContacts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@id/imageViewEmtel"
android:text="TextView" />
</RelativeLayout>

<RelativeLayout
android:id="@+id/RelativeLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/relativeLayout2"
android:layout_below="@+id/relativeLayout2"
android:layout_marginTop="30dp" >

<ImageView
android:id="@+id/ImageView01"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_toRightOf="@+id/ImageView01"
android:contentDescription="@string/NULL"
android:src="@color/mtml" />

<TextView
android:id="@+id/textViewMtmlContacts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@+id/ImageView01"
android:text="TextView" />
</RelativeLayout>

<RelativeLayout
android:id="@+id/RelativeLayout02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/RelativeLayout01"
android:layout_below="@+id/RelativeLayout01"
android:layout_marginTop="30dp" >

<ImageView
android:id="@+id/ImageView02"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_toRightOf="@+id/ImageView02"
android:contentDescription="@string/NULL"
android:src="@color/orange" />

<TextView
android:id="@+id/textViewOrangeContacts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@+id/ImageView02"
android:text="TextView" />
</RelativeLayout>

<Button
android:id="@+id/buttonConvertAll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/RelativeLayout02"
android:layout_below="@+id/RelativeLayout02"
android:layout_marginTop="24dp"
android:text="@string/buttonConvertAll" />

</RelativeLayout>

</ScrollView>
1 change: 1 addition & 0 deletions res/values/dimens.xml
Expand Up @@ -5,4 +5,5 @@
<dimen name="listitem_textview_phonenumber">14sp</dimen>
<dimen name="listitem_tag">10dp</dimen>
<dimen name="listview_textview_tag">12sp</dimen>
<dimen name="default_screen_padding">16dp</dimen>
</resources>
3 changes: 2 additions & 1 deletion res/values/strings.xml
Expand Up @@ -11,6 +11,7 @@
<string name="textviewEmptyListview">No phone numbers to show.</string>
<string name="TEST_NEWPHONENUMBER">5777-7777</string>
<string name="convert">></string>
<string name="Welcometext">We have found</string>
<string name="Welcometext">We have found these old numbers</string>
<string name="buttonConvertAll">Convert all</string>

</resources>
21 changes: 20 additions & 1 deletion src/ws/vannen/fiver/ui/ContactsUnprocessedFragment.java
Expand Up @@ -33,6 +33,8 @@ public class ContactsUnprocessedFragment extends SherlockFragment {
private ProgressDialog pDialog = null;

private String absMenuProcess = "Convert";
private String absMenuSelectAll = "Select all";
private String absMenuSelectNone = "Select none";

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Expand Down Expand Up @@ -79,6 +81,8 @@ public void onItemClick(AdapterView<?> parent, View view, int position,
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.add(absMenuProcess).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
menu.add(absMenuSelectAll).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
menu.add(absMenuSelectNone).setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
}


Expand All @@ -88,9 +92,24 @@ public boolean onOptionsItemSelected(MenuItem item) {
String itemTitle = item.getTitle().toString();

if(itemTitle.equals(absMenuProcess)){

new ProcessContactsAsyncTask().execute();
return true;
}

if(itemTitle.equals(absMenuSelectAll)){

int contactSize = MainFragmentActivity.unProcessedContacts.size();

if(contactSize > 0){

for(int i = 0; i <contactSize; i++){

}
}
return true;
}

if(itemTitle.equals(absMenuSelectNone)){
return true;
}

Expand Down
37 changes: 35 additions & 2 deletions src/ws/vannen/fiver/ui/MainFragmentActivity.java
Expand Up @@ -11,6 +11,7 @@
import ws.vannen.fiver.utils.MruPhoneNumberUtils;
import android.app.ProgressDialog;
import android.database.Cursor;
import android.graphics.Typeface;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
Expand Down Expand Up @@ -39,19 +40,30 @@ public class MainFragmentActivity extends SherlockFragmentActivity
public static ContactAdapter contactUnprocessedAdapter = null;
public static ContactAdapter contactProcessedAdapter = null;

public static Typeface robotoFontTypeface = null;
public static int totalEmtelContacts = 0;
public static int totalMtmlContacts = 0;
public static int totalCellplusContacts = 0;

private StartScreenFragment startScreenFragment = new StartScreenFragment();


@Override
protected void onCreate(Bundle bundle) {
setTheme(R.style.Theme_Fiver);
super.onCreate(bundle);
setContentView(R.layout.fragmentactivity_main);

robotoFontTypeface = Typeface.createFromAsset(getAssets(), "font/Roboto-Light.ttf");

ArrayList<Contact> t = new ArrayList<Contact>();
t.add(new Contact("1", "hhe", "ewre"));
t.add(new Contact("2", "hhe", "ewre"));

fragmentManager = getSupportFragmentManager();
List<Fragment> allFragments = new ArrayList<Fragment>();
allFragments.add(new StartScreenFragment());

allFragments.add(startScreenFragment);
allFragments.add(new ContactsUnprocessedFragment());
allFragments.add(new ContactsProcessedFragment());

Expand Down Expand Up @@ -104,6 +116,10 @@ public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
processedContacts.clear();
unProcessedContacts.clear();

totalEmtelContacts = 0;
totalMtmlContacts = 0;
totalCellplusContacts = 0;

if(contactUnprocessedAdapter != null){
contactUnprocessedAdapter.notifyDataSetChanged();
}
Expand All @@ -115,10 +131,26 @@ public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
String contactPhoneNumber = data.getString(2);

if(MruPhoneNumberUtils.isMobilePhoneNumber(contactPhoneNumber)){
contact.setPhoneNumberType(MruPhoneNumberUtils.detectPhoneNumber(contactPhoneNumber));

PhoneNumberType phoneNumberType = MruPhoneNumberUtils.detectPhoneNumber(contactPhoneNumber);
contact.setPhoneNumberType(phoneNumberType);
contact.setNewPhoneNumber(data.getString(2).replaceAll(
MruPhoneNumberUtils.patternPhoneNumberConvert, "5$0"));

switch (phoneNumberType) {
case Emtel:
totalEmtelContacts +=1;
break;

case Cellplus:
totalCellplusContacts +=1;
break;

case Mtml:
totalMtmlContacts += 1;
break;
}

if(contact.getPhoneNumberType() != PhoneNumberType.Unknown){
contact.setSelectedToProcess(true);
unProcessedContacts.add(contact);
Expand Down Expand Up @@ -147,6 +179,7 @@ public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
}
contactUnprocessedAdapter.notifyDataSetChanged();
contactProcessedAdapter.notifyDataSetChanged();
startScreenFragment.updateNumbers();
//data.moveToFirst();
Log.e("test rpocessed", processedContacts.size() + "");

Expand Down

0 comments on commit 1ffa6f1

Please sign in to comment.