mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 02:39:05 +01:00
WIP: Converts the splash screen to XML format
Removes all programatic calls that modify the layout and uses the XML resource instead.
This commit is contained in:
50
briar-android/res/layout/activity_create_forum.xml
Normal file
50
briar-android/res/layout/activity_create_forum.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:background="@color/conversation_background"
|
||||
android:padding="20dp" >
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/text_size_medium"
|
||||
android:text="@string/choose_forum_name" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/createForumNameEntry"
|
||||
android:maxLines="1"
|
||||
android:inputType="text|textCapSentences" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/createForumFeedback"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="50dp"
|
||||
android:paddingRight="50dp" />
|
||||
|
||||
<Button
|
||||
style="@style/BriarButton"
|
||||
android:id="@+id/createForumButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:text="@string/create_forum_button" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/createForumProgressBar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
15
briar-android/res/layout/splash.xml
Normal file
15
briar-android/res/layout/splash.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFFFFF" >
|
||||
|
||||
<ImageView
|
||||
android:src="@drawable/briar_logo_large"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="@dimen/margin_xxlarge" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -10,6 +10,7 @@
|
||||
<dimen name="margin_medium">8dp</dimen>
|
||||
<dimen name="margin_large">16dp</dimen>
|
||||
<dimen name="margin_xlarge">32dp</dimen>
|
||||
<dimen name="margin_xxlarge">64dp</dimen>
|
||||
|
||||
<!-- v2 dimens -->
|
||||
<dimen name="text_size_tiny">12sp</dimen>
|
||||
|
||||
@@ -45,21 +45,9 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
public void onCreate(Bundle state) {
|
||||
super.onCreate(state);
|
||||
|
||||
LinearLayout layout = new LinearLayout(this);
|
||||
layout.setLayoutParams(MATCH_MATCH);
|
||||
layout.setGravity(CENTER);
|
||||
layout.setBackgroundColor(Color.WHITE);
|
||||
|
||||
int pad = LayoutUtils.getLargeItemPadding(this);
|
||||
|
||||
ImageView logo = new ImageView(this);
|
||||
logo.setPadding(pad, pad, pad, pad);
|
||||
logo.setImageResource(R.drawable.briar_logo_large);
|
||||
layout.addView(logo);
|
||||
|
||||
setPreferencesDefaults();
|
||||
|
||||
setContentView(layout);
|
||||
setContentView(R.layout.splash);
|
||||
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -26,6 +26,9 @@ import java.util.logging.Logger;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import android.text.TextWatcher;
|
||||
import android.text.Editable;
|
||||
|
||||
import static android.text.InputType.TYPE_CLASS_TEXT;
|
||||
import static android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||
import static android.view.Gravity.CENTER;
|
||||
@@ -58,50 +61,34 @@ implements OnEditorActionListener, OnClickListener {
|
||||
@Override
|
||||
public void onCreate(Bundle state) {
|
||||
super.onCreate(state);
|
||||
LinearLayout layout = new LinearLayout(this);
|
||||
layout.setLayoutParams(MATCH_MATCH);
|
||||
layout.setOrientation(VERTICAL);
|
||||
layout.setGravity(CENTER_HORIZONTAL);
|
||||
int pad = LayoutUtils.getPadding(this);
|
||||
layout.setPadding(pad, pad, pad, pad);
|
||||
|
||||
TextView chooseName = new TextView(this);
|
||||
chooseName.setGravity(CENTER);
|
||||
chooseName.setTextSize(18);
|
||||
chooseName.setText(R.string.choose_forum_name);
|
||||
layout.addView(chooseName);
|
||||
setContentView(R.layout.activity_create_forum);
|
||||
|
||||
nameEntry = (EditText) findViewById(R.id.createForumNameEntry);
|
||||
TextWatcher nameEntryWatcher = new TextWatcher() {
|
||||
|
||||
nameEntry = new EditText(this) {
|
||||
@Override
|
||||
protected void onTextChanged(CharSequence text, int start,
|
||||
public void afterTextChanged(Editable s) {}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence text, int start,
|
||||
int lengthBefore, int lengthAfter) {
|
||||
enableOrDisableCreateButton();
|
||||
}
|
||||
};
|
||||
nameEntry.setId(1);
|
||||
nameEntry.setMaxLines(1);
|
||||
nameEntry.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_FLAG_CAP_SENTENCES);
|
||||
nameEntry.setOnEditorActionListener(this);
|
||||
layout.addView(nameEntry);
|
||||
nameEntry.addTextChangedListener(nameEntryWatcher);
|
||||
|
||||
feedback = new TextView(this);
|
||||
feedback.setGravity(CENTER);
|
||||
feedback.setPadding(0, pad, 0, pad);
|
||||
layout.addView(feedback);
|
||||
feedback = (TextView) findViewById(R.id.createForumFeedback);
|
||||
|
||||
createForumButton = new Button(this);
|
||||
createForumButton.setLayoutParams(WRAP_WRAP);
|
||||
createForumButton.setText(R.string.create_forum_button);
|
||||
createForumButton = (Button) findViewById(R.id.createForumButton);
|
||||
createForumButton.setOnClickListener(this);
|
||||
layout.addView(createForumButton);
|
||||
|
||||
progress = new ProgressBar(this);
|
||||
progress.setLayoutParams(WRAP_WRAP);
|
||||
progress.setIndeterminate(true);
|
||||
progress.setVisibility(GONE);
|
||||
layout.addView(progress);
|
||||
progress = (ProgressBar) findViewById(R.id.createForumProgressBar);
|
||||
|
||||
setContentView(layout);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user