mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +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_medium">8dp</dimen>
|
||||||
<dimen name="margin_large">16dp</dimen>
|
<dimen name="margin_large">16dp</dimen>
|
||||||
<dimen name="margin_xlarge">32dp</dimen>
|
<dimen name="margin_xlarge">32dp</dimen>
|
||||||
|
<dimen name="margin_xxlarge">64dp</dimen>
|
||||||
|
|
||||||
<!-- v2 dimens -->
|
<!-- v2 dimens -->
|
||||||
<dimen name="text_size_tiny">12sp</dimen>
|
<dimen name="text_size_tiny">12sp</dimen>
|
||||||
|
|||||||
@@ -45,21 +45,9 @@ public class SplashScreenActivity extends BaseActivity {
|
|||||||
public void onCreate(Bundle state) {
|
public void onCreate(Bundle state) {
|
||||||
super.onCreate(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();
|
setPreferencesDefaults();
|
||||||
|
|
||||||
setContentView(layout);
|
setContentView(R.layout.splash);
|
||||||
|
|
||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ import java.util.logging.Logger;
|
|||||||
|
|
||||||
import javax.inject.Inject;
|
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_CLASS_TEXT;
|
||||||
import static android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
import static android.text.InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
|
||||||
import static android.view.Gravity.CENTER;
|
import static android.view.Gravity.CENTER;
|
||||||
@@ -58,50 +61,34 @@ implements OnEditorActionListener, OnClickListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle state) {
|
public void onCreate(Bundle state) {
|
||||||
super.onCreate(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);
|
setContentView(R.layout.activity_create_forum);
|
||||||
chooseName.setGravity(CENTER);
|
|
||||||
chooseName.setTextSize(18);
|
nameEntry = (EditText) findViewById(R.id.createForumNameEntry);
|
||||||
chooseName.setText(R.string.choose_forum_name);
|
TextWatcher nameEntryWatcher = new TextWatcher() {
|
||||||
layout.addView(chooseName);
|
|
||||||
|
|
||||||
nameEntry = new EditText(this) {
|
|
||||||
@Override
|
@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) {
|
int lengthBefore, int lengthAfter) {
|
||||||
enableOrDisableCreateButton();
|
enableOrDisableCreateButton();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
nameEntry.setId(1);
|
|
||||||
nameEntry.setMaxLines(1);
|
|
||||||
nameEntry.setInputType(TYPE_CLASS_TEXT | TYPE_TEXT_FLAG_CAP_SENTENCES);
|
|
||||||
nameEntry.setOnEditorActionListener(this);
|
nameEntry.setOnEditorActionListener(this);
|
||||||
layout.addView(nameEntry);
|
nameEntry.addTextChangedListener(nameEntryWatcher);
|
||||||
|
|
||||||
feedback = new TextView(this);
|
feedback = (TextView) findViewById(R.id.createForumFeedback);
|
||||||
feedback.setGravity(CENTER);
|
|
||||||
feedback.setPadding(0, pad, 0, pad);
|
|
||||||
layout.addView(feedback);
|
|
||||||
|
|
||||||
createForumButton = new Button(this);
|
createForumButton = (Button) findViewById(R.id.createForumButton);
|
||||||
createForumButton.setLayoutParams(WRAP_WRAP);
|
|
||||||
createForumButton.setText(R.string.create_forum_button);
|
|
||||||
createForumButton.setOnClickListener(this);
|
createForumButton.setOnClickListener(this);
|
||||||
layout.addView(createForumButton);
|
|
||||||
|
|
||||||
progress = new ProgressBar(this);
|
progress = (ProgressBar) findViewById(R.id.createForumProgressBar);
|
||||||
progress.setLayoutParams(WRAP_WRAP);
|
|
||||||
progress.setIndeterminate(true);
|
|
||||||
progress.setVisibility(GONE);
|
|
||||||
layout.addView(progress);
|
|
||||||
|
|
||||||
setContentView(layout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user