Widespread Augmented Reality

Widespread Augmented Reality
Click on the image to get the Android Augmented Reality Heads up Display

Saturday, December 14, 2013

Text Animation on Android App for Augmented Reality

Two flavors of Widespread Augmented Reality (W.A.R.) or Warmixare
  • Android Jelly Bean+
  • Android Ice Cream Sandwich Tablets
  • Here is the XML layout.

    Here is the slide_in_left layout in the the /res/anim folder

    Here is the Java code


    public class SplashScreen extends Activity {
    private TextSwitcher ts1, ts2, ts3;
    final String wordsToShow[]={"idespread ","ugmented ","eality "};
    int wordCount=wordsToShow.length;
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splashlayout);
    Animation slide =
    AnimationUtils.loadAnimation(getApplicationContext(),android.R.anim.slide_in_left);
    Animation fade =
    AnimationUtils.loadAnimation(getApplicationContext(),android.R.anim.fade_in);
    slide.setDuration(2000);
    fade.setDuration(3000);
    final TextView w = (TextView) findViewById(R.id.w1);
    final TextView a = (TextView) findViewById(R.id.a1);
    final TextView r = (TextView) findViewById(R.id.r1);
    w.setAnimation(fade); a.setAnimation(fade); r.setAnimation(fade);
    ts1 = (TextSwitcher) findViewById(R.id.widespread2);
    ts2 = (TextSwitcher) findViewById(R.id.augmented2);
    ts3 = (TextSwitcher) findViewById(R.id.reality2);
    ts1.setFactory(new ViewFactory() {
    public View makeView() {
    TextView myText = new TextView(SplashScreen.this);
    myText.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    myText.setTextSize(28);
    myText.setTextColor(Color.WHITE);
    return myText;
    }
    });
    ts2.setFactory(new ViewFactory() {
    public View makeView() {
    TextView myText2 = new TextView(SplashScreen.this);
    myText2.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    myText2.setTextSize(28);
    myText2.setTextColor(Color.WHITE);
    return myText2;
    }
    });
    ts3.setFactory(new ViewFactory() {
    public View makeView() {
    TextView myText3 = new TextView(SplashScreen.this);
    myText3.setGravity(Gravity.TOP | Gravity.CENTER_HORIZONTAL);
    myText3.setTextSize(28);
    myText3.setTextColor(Color.WHITE);
    return myText3;
    }
    });
    ts1.setText(wordsToShow[0]);
    ts1.startAnimation(slide);
    ts2.setText(wordsToShow[1]);
    ts2.startAnimation(slide);
    ts3.setText(wordsToShow[2]);
    ts3.startAnimation(slide);

    Thursday, December 5, 2013

    Android 2,2 Fragments

    Since my app at Google Play targets Android 2.2 or higher, there a few things that need to be in place for fragments.

  • import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentActivity;
  • ActivityThatCallsFragment extends FragmentActivity
  • Use getSupportFragmentManager() instead of getFragmentManager()
  • Monday, December 2, 2013

    Android ArrayList, HashMap and Clickable ListView

    I am coding a delete screen for the Android W.A.R. app. Get it here at Google Play before I break it.

    Meanwhile, in order to list the geotags that can be deleted, I will need a list of geotags with "id" as the key.

    So first, I use an Async task to make the HTTP call to my server and select geotags by "id". I will not show that proprietary code here, but I can show the Async's onPostExecute method where the following occurs:

  • Receive a table with two columns: id and title
  • Populate a HashMap with the columns named: "id" and "title"
  • Assign the HashMap values to an ArrayList
  • Send the ArrayList to a clickable ListView that uses android.R.layout.simple_list_item_2
  • Convert the ArrayList row back to a HashMap to retrieve "Id".
  • There must be a more elegant way to do this, but you get what you pay for. I do this for fun and for free.

    Just the bare bones...
    @Override
    protected void onPostExecute(String[][] result)
    {
    final ArrayList> alist = new ArrayList>();
    int size = result.length;
    for (int i = 0; i < size; i++) {
      HashMap cols = new HashMap();
      cols.put("id", result[i][0]);
      cols.put("title",result[i][1]);
      alist.add(cols);
    }
    // release result table
    result = null;
    //Identify the column names
    String[] from = { "id", "title" };
    //Send corresponding values to fields in android.R.layout.simple_list_item_2
    int[] to = { android.R.id.text1, android.R.id.text2 };
    ListView delview = (ListView) findViewById(R.id.list3);
    //Set up the adapter to hold the two column table
    SimpleAdapter adapter = new SimpleAdapter(getBaseContext(), alist,
          android.R.layout.simple_list_item_2, from, to);
    delview.setAdapter(adapter);
    adapter.notifyDataSetChanged();
    //The Click Listener on each row
    delview.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView parent, View view, int position1, long id) {
        Map mid = alist.get(position1);
        String sid = mid.get("id");
        Toast.makeText(getBaseContext(), "Clicked on tag Id: "+sid,
        Toast.LENGTH_SHORT).show();
    });
    return;
    }

    Wednesday, November 6, 2013

    Malware Analysis

    I am compelled to permanently link to this Info Sec article on malware analysis.

    Saturday, October 26, 2013

    Starting Cryptolocker Thread

    Heard this on Leo Laporte, The Tech Guy, radio show. Leo Laporte provided the following link. http://www.computerworld.com/s/article/9243537/Cryptolocker_How_to_avoid_getting_infected_and_what_to_do_if_you_are_

    It's my business to know what to do when customers arrive with this problem.

    Friday, October 18, 2013

    Enhancing W.A.R. - Widespread Augmented Reality

    I have been busy enhancing my Android app on Google Play that uses the camera as a view finder to locate your friends at places that interest them, a.k.a. points of interest.

    There are actually two apps: 1. Ice Cream Sandwich and lower; 2. Jelly Bean and up. This was necessary because version 1 was crashing on the Samsung Galaxy 3.

    Below are typical screen shots of geotags in Los Angeles.

    Note that this Android app also creates the geotags, so points of interest are relevant to your clique or set of friends. You can also create geotags remotely with the companion website at SpiderOnFire. Your W.A.R. handles are anonymous and all content can be deleted at your discretion.