Fifth Alpha Release (actually fifth this time)
This commit is contained in:
parent
b62463f832
commit
dab6807bff
10 changed files with 43 additions and 30 deletions
|
@ -7,8 +7,8 @@ android {
|
||||||
applicationId "com.keylesspalace.tusky"
|
applicationId "com.keylesspalace.tusky"
|
||||||
minSdkVersion 15
|
minSdkVersion 15
|
||||||
targetSdkVersion 25
|
targetSdkVersion 25
|
||||||
versionCode 4
|
versionCode 5
|
||||||
versionName "1.0.0-alpha.4"
|
versionName "1.0.0-alpha.5"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary true
|
vectorDrawables.useSupportLibrary true
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class AccountActivity extends BaseActivity {
|
||||||
private String accountId;
|
private String accountId;
|
||||||
private boolean following = false;
|
private boolean following = false;
|
||||||
private boolean blocking = false;
|
private boolean blocking = false;
|
||||||
private boolean isSelf = false;
|
private boolean isSelf;
|
||||||
private String openInWebUrl;
|
private String openInWebUrl;
|
||||||
private TabLayout tabLayout;
|
private TabLayout tabLayout;
|
||||||
|
|
||||||
|
@ -86,6 +86,7 @@ public class AccountActivity extends BaseActivity {
|
||||||
|
|
||||||
obtainAccount();
|
obtainAccount();
|
||||||
if (!accountId.equals(loggedInAccountId)) {
|
if (!accountId.equals(loggedInAccountId)) {
|
||||||
|
isSelf = false;
|
||||||
obtainRelationships();
|
obtainRelationships();
|
||||||
} else {
|
} else {
|
||||||
/* Cause the options menu to update and instead show an options menu for when the
|
/* Cause the options menu to update and instead show an options menu for when the
|
||||||
|
|
|
@ -18,12 +18,11 @@ package com.keylesspalace.tusky;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.LinearLayout;
|
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
public class FooterViewHolder extends RecyclerView.ViewHolder {
|
public class FooterViewHolder extends RecyclerView.ViewHolder {
|
||||||
private LinearLayout retryBar;
|
private View retryBar;
|
||||||
private TextView retryMessage;
|
private TextView retryMessage;
|
||||||
private Button retry;
|
private Button retry;
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
@ -37,7 +36,7 @@ public class FooterViewHolder extends RecyclerView.ViewHolder {
|
||||||
|
|
||||||
public FooterViewHolder(View itemView) {
|
public FooterViewHolder(View itemView) {
|
||||||
super(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);
|
retryMessage = (TextView) itemView.findViewById(R.id.footer_retry_message);
|
||||||
retry = (Button) itemView.findViewById(R.id.footer_retry_button);
|
retry = (Button) itemView.findViewById(R.id.footer_retry_button);
|
||||||
progressBar = (ProgressBar) itemView.findViewById(R.id.footer_progress_bar);
|
progressBar = (ProgressBar) itemView.findViewById(R.id.footer_progress_bar);
|
||||||
|
|
|
@ -115,9 +115,11 @@ public class LoginActivity extends BaseActivity {
|
||||||
* (such as in the case that the domain has never been accessed before)
|
* (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
|
* authenticate with the server and store the received credentials to use next
|
||||||
* time. */
|
* time. */
|
||||||
clientId = preferences.getString(domain + "/client_id", null);
|
String prefClientId = preferences.getString(domain + "/client_id", null);
|
||||||
clientSecret = preferences.getString(domain + "/client_secret", null);
|
String prefClientSecret = preferences.getString(domain + "/client_secret", null);
|
||||||
if (clientId != null && clientSecret != null) {
|
if (prefClientId != null && prefClientSecret != null) {
|
||||||
|
clientId = prefClientId;
|
||||||
|
clientSecret = prefClientSecret;
|
||||||
redirectUserToAuthorizeAndLogin();
|
redirectUserToAuthorizeAndLogin();
|
||||||
} else {
|
} else {
|
||||||
String endpoint = getString(R.string.endpoint_apps);
|
String endpoint = getString(R.string.endpoint_apps);
|
||||||
|
@ -137,13 +139,17 @@ public class LoginActivity extends BaseActivity {
|
||||||
new Response.Listener<JSONObject>() {
|
new Response.Listener<JSONObject>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(JSONObject response) {
|
public void onResponse(JSONObject response) {
|
||||||
|
String obtainedClientId;
|
||||||
|
String obtainedClientSecret;
|
||||||
try {
|
try {
|
||||||
clientId = response.getString("client_id");
|
obtainedClientId = response.getString("client_id");
|
||||||
clientSecret = response.getString("client_secret");
|
obtainedClientSecret = response.getString("client_secret");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
Log.e(TAG, "Couldn't get data from the authentication response.");
|
Log.e(TAG, "Couldn't get data from the authentication response.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
clientId = obtainedClientId;
|
||||||
|
clientSecret = obtainedClientSecret;
|
||||||
SharedPreferences.Editor editor = preferences.edit();
|
SharedPreferences.Editor editor = preferences.edit();
|
||||||
editor.putString(domain + "/client_id", clientId);
|
editor.putString(domain + "/client_id", clientId);
|
||||||
editor.putString(domain + "/client_secret", clientSecret);
|
editor.putString(domain + "/client_secret", clientSecret);
|
||||||
|
@ -167,6 +173,11 @@ public class LoginActivity extends BaseActivity {
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_login);
|
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);
|
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
preferences = getSharedPreferences(
|
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
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
|
@ -79,12 +79,6 @@ public class MainActivity extends BaseActivity {
|
||||||
viewPager.setAdapter(adapter);
|
viewPager.setAdapter(adapter);
|
||||||
TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
|
TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
|
||||||
tabLayout.setupWithViewPager(viewPager);
|
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.
|
// Retrieve notification update preference.
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
|
|
|
@ -63,11 +63,4 @@ public class TimelinePagerAdapter extends FragmentPagerAdapter {
|
||||||
public CharSequence getPageTitle(int position) {
|
public CharSequence getPageTitle(int position) {
|
||||||
return pageTitles[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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/activity_main"
|
android:id="@+id/activity_main"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -29,8 +30,11 @@
|
||||||
|
|
||||||
<android.support.design.widget.TabLayout
|
<android.support.design.widget.TabLayout
|
||||||
android:id="@+id/tab_layout"
|
android:id="@+id/tab_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
app:tabTextAppearance="@style/TabLayoutTextStyle"
|
||||||
|
app:tabPaddingStart="1dp"
|
||||||
|
app:tabPaddingEnd="1dp">
|
||||||
|
|
||||||
<android.support.design.widget.TabItem
|
<android.support.design.widget.TabItem
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_gravity="center">
|
android:layout_gravity="center">
|
||||||
|
|
||||||
<LinearLayout
|
<com.keylesspalace.tusky.FlowLayout
|
||||||
android:id="@+id/footer_retry_bar"
|
android:id="@+id/footer_retry_bar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
android:id="@+id/footer_retry_button"
|
android:id="@+id/footer_retry_button"
|
||||||
android:text="@string/action_retry" />
|
android:text="@string/action_retry" />
|
||||||
|
|
||||||
</LinearLayout>
|
</com.keylesspalace.tusky.FlowLayout>
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/footer_progress_bar"
|
android:id="@+id/footer_progress_bar"
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
android:id="@+id/title"
|
android:id="@+id/title"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
android:textStyle="normal|bold"
|
android:textStyle="normal|bold" />
|
||||||
android:textSize="12sp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
|
@ -4,6 +4,10 @@
|
||||||
<item name="android:windowBackground">@drawable/splash_background</item>
|
<item name="android:windowBackground">@drawable/splash_background</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TabLayoutTextStyle" parent="TextAppearance.Design.Tab">
|
||||||
|
<item name="android:textStyle">normal|bold</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!--Base Application Theme Styles (Dark)-->
|
<!--Base Application Theme Styles (Dark)-->
|
||||||
|
|
||||||
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
|
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
|
||||||
|
|
Loading…
Reference in a new issue