From 0915e877fc92a6ba97dceaf02090a04883fcdb36 Mon Sep 17 00:00:00 2001 From: Sadique Ali Date: Sat, 20 Jul 2013 16:10:30 -0700 Subject: [PATCH] Styling: Use spinner, use maximized view. --- ShareWithTitle/src/main/AndroidManifest.xml | 2 +- .../sdqali/sharewithtitle/MainActivity.java | 10 ++-- .../sharewithtitle/UpdateViewCallback.java | 51 ------------------- .../src/main/res/layout/activity_main.xml | 20 +++----- 4 files changed, 12 insertions(+), 71 deletions(-) delete mode 100644 ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/UpdateViewCallback.java diff --git a/ShareWithTitle/src/main/AndroidManifest.xml b/ShareWithTitle/src/main/AndroidManifest.xml index 8aba449..779a110 100644 --- a/ShareWithTitle/src/main/AndroidManifest.xml +++ b/ShareWithTitle/src/main/AndroidManifest.xml @@ -17,7 +17,7 @@ android:theme="@style/AppTheme" > diff --git a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java index 6407639..6fa4116 100644 --- a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java +++ b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/MainActivity.java @@ -7,6 +7,8 @@ import android.app.Activity; import android.util.Log; import android.view.Menu; import android.view.View; +import android.view.Window; +import android.view.WindowManager; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; @@ -16,16 +18,14 @@ public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + this.requestWindowFeature(Window.FEATURE_NO_TITLE); + this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); + setContentView(R.layout.activity_main); Intent intent = getIntent(); - intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); - - String action = intent.getAction(); - final TextView textView = (TextView) findViewById(R.id.greet_text); - textView.setText(""); final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar); diff --git a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/UpdateViewCallback.java b/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/UpdateViewCallback.java deleted file mode 100644 index 8368751..0000000 --- a/ShareWithTitle/src/main/java/in/sdqali/sharewithtitle/UpdateViewCallback.java +++ /dev/null @@ -1,51 +0,0 @@ -package in.sdqali.sharewithtitle; - -import android.content.Context; -import android.view.View; -import android.widget.TextView; -import android.widget.Toast; - -/** -* Created by sdqali on 7/20/13. -*/ -class UpdateViewCallback implements TitleGrabCallback { - private Context mainActivityContext; - private final TextView textView; - private final View progressBar; - - - public UpdateViewCallback(Context context, TextView textView, View progressBar) { - mainActivityContext = context; - this.textView = textView; - this.progressBar = progressBar; - } - - @Override - public void onSuccess(String title) { - textView.setText(title); - progressBar.setVisibility(View.VISIBLE); - } - - @Override - public void onProgress() { - progressBar.animate(); - } - - @Override - public void cleanUp() { - progressBar.setVisibility(View.GONE); - } - - @Override - public void showError(String errorMessage) { - showToast(errorMessage); - } - - - private void showToast(String text) { - int duration = Toast.LENGTH_SHORT; - Toast toast = Toast.makeText(mainActivityContext, text, duration); - toast.show(); - } - -} diff --git a/ShareWithTitle/src/main/res/layout/activity_main.xml b/ShareWithTitle/src/main/res/layout/activity_main.xml index a8b7cd2..0fe76ce 100644 --- a/ShareWithTitle/src/main/res/layout/activity_main.xml +++ b/ShareWithTitle/src/main/res/layout/activity_main.xml @@ -1,4 +1,4 @@ - - - + android:layout_toRightOf="@+id/progressBar" + android:layout_gravity="center"/> - +