Styling: Use spinner, use maximized view.

This commit is contained in:
Sadique Ali 2013-07-20 16:10:30 -07:00
parent db10f0d860
commit 0915e877fc
4 changed files with 12 additions and 71 deletions

View File

@ -17,7 +17,7 @@
android:theme="@style/AppTheme" >
<activity
android:name="in.sdqali.sharewithtitle.MainActivity"
android:label="@string/app_name"
android:label=""
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />

View File

@ -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);

View File

@ -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();
}
}

View File

@ -1,4 +1,4 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -8,22 +8,14 @@
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity">
<TextView
android:id="@+id/greet_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:layout_marginTop="69dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"/>
<ProgressBar
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
style="?android:attr/progressBarStyleLarge"
android:layout_width="269dp"
android:layout_height="wrap_content"
android:indeterminate="true"
android:id="@+id/progressBar"
android:layout_below="@+id/progressBar"
android:layout_toRightOf="@+id/progressBar"/>
android:layout_toRightOf="@+id/progressBar"
android:layout_gravity="center"/>
</RelativeLayout>
</FrameLayout>