Fifth Alpha Release (actually fifth this time)

This commit is contained in:
Vavassor 2017-02-19 19:27:15 -05:00
parent b62463f832
commit dab6807bff
10 changed files with 43 additions and 30 deletions

View File

@ -7,8 +7,8 @@ android {
applicationId "com.keylesspalace.tusky"
minSdkVersion 15
targetSdkVersion 25
versionCode 4
versionName "1.0.0-alpha.4"
versionCode 5
versionName "1.0.0-alpha.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
}

View File

@ -57,7 +57,7 @@ public class AccountActivity extends BaseActivity {
private String accountId;
private boolean following = false;
private boolean blocking = false;
private boolean isSelf = false;
private boolean isSelf;
private String openInWebUrl;
private TabLayout tabLayout;
@ -86,6 +86,7 @@ public class AccountActivity extends BaseActivity {
obtainAccount();
if (!accountId.equals(loggedInAccountId)) {
isSelf = false;
obtainRelationships();
} else {
/* Cause the options menu to update and instead show an options menu for when the

View File

@ -18,12 +18,11 @@ package com.keylesspalace.tusky;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
public class FooterViewHolder extends RecyclerView.ViewHolder {
private LinearLayout retryBar;
private View retryBar;
private TextView retryMessage;
private Button retry;
private ProgressBar progressBar;
@ -37,7 +36,7 @@ public class FooterViewHolder extends RecyclerView.ViewHolder {
public FooterViewHolder(View itemView) {
super(itemView);
retryBar = (LinearLayout) itemView.findViewById(R.id.footer_retry_bar);
retryBar = itemView.findViewById(R.id.footer_retry_bar);
retryMessage = (TextView) itemView.findViewById(R.id.footer_retry_message);
retry = (Button) itemView.findViewById(R.id.footer_retry_button);
progressBar = (ProgressBar) itemView.findViewById(R.id.footer_progress_bar);

View File

@ -115,9 +115,11 @@ public class LoginActivity extends BaseActivity {
* (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
* time. */
clientId = preferences.getString(domain + "/client_id", null);
clientSecret = preferences.getString(domain + "/client_secret", null);
if (clientId != null && clientSecret != null) {
String prefClientId = preferences.getString(domain + "/client_id", null);
String prefClientSecret = preferences.getString(domain + "/client_secret", null);
if (prefClientId != null && prefClientSecret != null) {
clientId = prefClientId;
clientSecret = prefClientSecret;
redirectUserToAuthorizeAndLogin();
} else {
String endpoint = getString(R.string.endpoint_apps);
@ -137,13 +139,17 @@ public class LoginActivity extends BaseActivity {
new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
String obtainedClientId;
String obtainedClientSecret;
try {
clientId = response.getString("client_id");
clientSecret = response.getString("client_secret");
obtainedClientId = response.getString("client_id");
obtainedClientSecret = response.getString("client_secret");
} catch (JSONException e) {
Log.e(TAG, "Couldn't get data from the authentication response.");
return;
}
clientId = obtainedClientId;
clientSecret = obtainedClientSecret;
SharedPreferences.Editor editor = preferences.edit();
editor.putString(domain + "/client_id", clientId);
editor.putString(domain + "/client_secret", clientSecret);
@ -167,6 +173,11 @@ public class LoginActivity extends BaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
if (savedInstanceState != null) {
domain = savedInstanceState.getString("domain");
clientId = savedInstanceState.getString("clientId");
clientSecret = savedInstanceState.getString("clientSecret");
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
preferences = getSharedPreferences(
@ -198,6 +209,14 @@ public class LoginActivity extends BaseActivity {
});
}
@Override
protected void onSaveInstanceState(Bundle outState) {
outState.putString("domain", domain);
outState.putString("clientId", clientId);
outState.putString("clientSecret", clientSecret);
super.onSaveInstanceState(outState);
}
@Override
protected void onPause() {
super.onPause();

View File

@ -79,12 +79,6 @@ public class MainActivity extends BaseActivity {
viewPager.setAdapter(adapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
tabLayout.setupWithViewPager(viewPager);
for (int i = 0; i < tabLayout.getTabCount(); i++) {
TabLayout.Tab tab = tabLayout.getTabAt(i);
if (tab != null) {
tab.setCustomView(adapter.getTabView(i));
}
}
// Retrieve notification update preference.
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

View File

@ -63,11 +63,4 @@ public class TimelinePagerAdapter extends FragmentPagerAdapter {
public CharSequence getPageTitle(int position) {
return pageTitles[position];
}
public View getTabView(int position) {
View view = LayoutInflater.from(context).inflate(R.layout.tab_main, null);
TextView title = (TextView) view.findViewById(R.id.title);
title.setText(pageTitles[position]);
return view;
}
}

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -29,8 +30,11 @@
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:tabTextAppearance="@style/TabLayoutTextStyle"
app:tabPaddingStart="1dp"
app:tabPaddingEnd="1dp">
<android.support.design.widget.TabItem
android:layout_width="wrap_content"

View File

@ -11,7 +11,7 @@
android:orientation="horizontal"
android:layout_gravity="center">
<LinearLayout
<com.keylesspalace.tusky.FlowLayout
android:id="@+id/footer_retry_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -29,7 +29,7 @@
android:id="@+id/footer_retry_button"
android:text="@string/action_retry" />
</LinearLayout>
</com.keylesspalace.tusky.FlowLayout>
<ProgressBar
android:id="@+id/footer_progress_bar"

View File

@ -9,7 +9,6 @@
android:id="@+id/title"
android:layout_centerInParent="true"
android:textAllCaps="true"
android:textStyle="normal|bold"
android:textSize="12sp" />
android:textStyle="normal|bold" />
</RelativeLayout>

View File

@ -4,6 +4,10 @@
<item name="android:windowBackground">@drawable/splash_background</item>
</style>
<style name="TabLayoutTextStyle" parent="TextAppearance.Design.Tab">
<item name="android:textStyle">normal|bold</item>
</style>
<!--Base Application Theme Styles (Dark)-->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">