Added logo and made login page slightly more clear.

main
Vavassor 7 years ago
parent 86623c634a
commit 0a45b72391
  1. 2
      app/src/main/AndroidManifest.xml
  2. 29
      app/src/main/java/com/keylesspalace/tusky/LoginActivity.java
  3. 7
      app/src/main/java/com/keylesspalace/tusky/SplashActivity.java
  4. 15
      app/src/main/res/drawable/ic_logo.xml
  5. 6
      app/src/main/res/drawable/splash_background.xml
  6. 5
      app/src/main/res/layout/activity_compose.xml
  7. 11
      app/src/main/res/layout/activity_login.xml
  8. 14
      app/src/main/res/values/strings.xml

@ -8,7 +8,7 @@
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:icon="@drawable/ic_logo"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">

@ -15,13 +15,16 @@
package com.keylesspalace.tusky;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
@ -41,6 +44,7 @@ import java.util.HashMap;
import java.util.Map;
public class LoginActivity extends AppCompatActivity {
private static final String TAG = "LoginActivity";
private static String OAUTH_SCOPES = "read write follow";
private SharedPreferences preferences;
@ -94,7 +98,7 @@ public class LoginActivity extends AppCompatActivity {
queryParameters = toQueryString(parameters);
} catch (UnsupportedEncodingException e) {
//TODO: No clue how to handle this error case??
assert(false);
Log.e(TAG, "Was not able to build the authorization URL.");
return;
}
String url = "https://" + domain + endpoint + "?" + queryParameters;
@ -109,7 +113,6 @@ public class LoginActivity extends AppCompatActivity {
*/
private void onButtonClick(final EditText editText) {
domain = validateDomain(editText.getText().toString());
assert(domain != null);
/* Attempt to get client credentials from SharedPreferences, and if not present
* (such as in the case that the domain has never been accessed before)
* authenticate with the server and store the received credentials to use next
@ -127,7 +130,7 @@ public class LoginActivity extends AppCompatActivity {
parameters.put("redirect_uris", getOauthRedirectUri());
parameters.put("scopes", OAUTH_SCOPES);
} catch (JSONException e) {
//TODO: error text????
Log.e(TAG, "Unable to build the form data for the authentication request.");
return;
}
JsonObjectRequest request = new JsonObjectRequest(
@ -139,7 +142,7 @@ public class LoginActivity extends AppCompatActivity {
clientId = response.getString("client_id");
clientSecret = response.getString("client_secret");
} catch (JSONException e) {
//TODO: Heck
Log.e(TAG, "Couldn't get data from the authentication response.");
return;
}
SharedPreferences.Editor editor = preferences.edit();
@ -177,6 +180,23 @@ public class LoginActivity extends AppCompatActivity {
onButtonClick(editText);
}
});
TextView noAccount = (TextView) findViewById(R.id.no_account);
final Context context = this;
noAccount.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new AlertDialog.Builder(context)
.setMessage(R.string.dialog_no_account)
.setPositiveButton(R.string.action_close,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
})
.show();
}
});
}
@Override
@ -258,7 +278,6 @@ public class LoginActivity extends AppCompatActivity {
* can try again. */
errorText.setText(error);
} else {
assert(false);
// This case means a junk response was received somehow.
errorText.setText("An unidentified authorization error occurred.");
}

@ -21,13 +21,6 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.toolbox.JsonObjectRequest;
import org.json.JSONException;
import org.json.JSONObject;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {

@ -0,0 +1,15 @@
<vector android:height="96dp" android:viewportHeight="708.66144"
android:viewportWidth="708.66144" android:width="96dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillAlpha="1" android:fillColor="#ffffff"
android:pathData="M52.6,83.3L658.5,83.3A35.6,35.6 0,0 1,694.1 118.8L694.1,601.5A35.6,35.6 0,0 1,658.5 637L52.6,637A35.6,35.6 0,0 1,17.1 601.5L17.1,118.8A35.6,35.6 0,0 1,52.6 83.3z"
android:strokeAlpha="1" android:strokeColor="#000000"
android:strokeLineCap="round" android:strokeLineJoin="round" android:strokeWidth="29.10281563"/>
<path android:fillAlpha="1" android:fillColor="#000000"
android:pathData="m207.1,180.8c0,0 -68.4,34.6 -87.7,112.3 -19.3,77.7 10.6,194.8 152,198.1 199.2,4.7 231.9,-233.1 236.1,-239.7 4.2,-6.7 34.9,-17.5 41.3,5.5 6.4,23 -38.9,303.9 -285.7,281.1C74.8,520.6 66.1,372.8 67.5,344.3 70,293 107.6,232.8 141.9,204.8c34.3,-28.1 65.2,-24 65.2,-24z"
android:strokeAlpha="1" android:strokeColor="#00000000"
android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="1"/>
<path android:fillAlpha="1" android:fillColor="#000000"
android:pathData="m277.8,176.2c0,0 68.9,43.2 93.7,97.4 24.8,54.2 65.3,243.9 163.5,238.8 71.2,-3.7 94.4,-42 105.3,-101.7C651.2,350.9 649.8,269.9 624.1,243.2 609.3,228 583.2,250.3 592.9,270.8 617.7,403.1 582.8,472.4 517.6,443.5 452.3,414.5 453.2,328.5 392.6,234 350.9,168.9 277.8,176.2 277.8,176.2Z"
android:strokeAlpha="1" android:strokeColor="#00000000"
android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="1"/>
</vector>

@ -1,9 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/gray" />
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/ic_launcher" />
</item>
<item android:drawable="@drawable/ic_logo" android:gravity="center" />
</layer-list>

@ -43,7 +43,8 @@
android:layout_height="wrap_content"
android:inputType="text"
android:ems="10"
android:id="@+id/field_content_warning" />
android:id="@+id/field_content_warning"
android:hint="@string/hint_content_warning" />
</LinearLayout>
@ -59,7 +60,7 @@
android:ems="10"
android:gravity="top|start"
android:id="@+id/field_status"
android:contentDescription="@string/description_compose" />
android:hint="@string/hint_compose" />
<LinearLayout
android:layout_width="match_parent"

@ -29,8 +29,8 @@
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:contentDescription="@string/description_domain"
android:inputType="textUri"
android:hint="@string/hint_domain"
android:ems="10"
android:id="@+id/edit_text_domain" />
@ -45,7 +45,14 @@
android:layout_height="wrap_content"
android:id="@+id/text_error" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/no_account"
android:text="@string/link_no_account" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>

@ -92,14 +92,24 @@
<string name="action_hide_text">Hide text behind warning</string>
<string name="action_ok">Ok</string>
<string name="action_cancel">Cancel</string>
<string name="action_close">Close</string>
<string name="action_back">Back</string>
<string name="action_profile">Profile</string>
<string name="action_open_in_web">Open In Web</string>
<string name="confirmation_send">Toot!</string>
<string name="description_domain">Domain</string>
<string name="description_compose">What\'s Happening?</string>
<string name="hint_domain">example.com</string>
<string name="hint_compose">What\'s Happening?</string>
<string name="hint_content_warning">Beware, folks</string>
<string name="link_no_account">No account?</string>
<string name="dialog_no_account">
Similar to an email address, a Mastodon account can be provided by any one of many
websites.\n\nSo, find the address of one you\'d like to join and enter it here. This will
direct you there to either make an account or log in.
</string>
<string name="visibility_public">Show on public timeline</string>
<string name="visibility_unlisted">Do not display on public timeline</string>

Loading…
Cancel
Save