bug fixes

This commit is contained in:
Mariotaku Lee 2016-05-12 09:37:56 +08:00
parent c2eb5b0eac
commit 08513c450d
20 changed files with 219 additions and 61 deletions

View File

@ -9,6 +9,7 @@ buildscript {
dependencies {
classpath 'com.github.ben-manes:gradle-versions-plugin:0.12.0'
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:2.1.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath('fr.avianey.androidsvgdrawable:gradle-plugin:3.0.0') {
// should be excluded to avoid conflict

View File

@ -15,4 +15,5 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2048M

3
twidere/.gitignore vendored
View File

@ -1,2 +1,3 @@
/build
fabric.properties
fabric.properties
google-services.json

View File

@ -1,10 +1,13 @@
import fr.avianey.androidsvgdrawable.gradle.SvgDrawableTask
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'androidsvgdrawable'
// START Non-free services
apply plugin: 'io.fabric'
// END Non-free services
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
@ -93,6 +96,8 @@ dependencies {
compile project(':twidere.component.nyan')
googleCompile 'com.google.android.gms:play-services-maps:8.4.0'
googleCompile 'com.google.android.gms:play-services-auth:8.4.0'
googleCompile 'com.google.android.gms:play-services-measurement:8.4.0'
googleCompile 'com.google.maps.android:android-maps-utils:0.4.3'
googleCompile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') { transitive = true }
googleCompile ':YouTubeAndroidPlayerApi:1.2.2@jar'
@ -186,3 +191,7 @@ task svgToMipmap(type: SvgDrawableTask) {
outputType = 'mipmap'
}
// START Non-free services
apply plugin: 'com.google.gms.google-services'
// END Non-free services

View File

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="min_database_item_limit">10</integer>
<bool name="is_debug">true</bool>
</resources>

View File

@ -395,7 +395,6 @@
<intent-filter>
<data android:scheme="http"/>
<data android:scheme="https"/>
<data android:host="twitter.com"/>
<data android:host="www.twitter.com"/>
<data android:host="mobile.twitter.com"/>
@ -451,6 +450,14 @@
android:name=".activity.IncompatibleAlertActivity"
android:label="@string/error_title_device_incompatible"
android:theme="@android:style/Theme.DeviceDefault.Dialog"/>
<activity
android:name=".activity.PlusServiceDashboardActivity"
android:label="@string/plus_service_name"
android:theme="@style/Theme.Twidere"/>
<activity
android:name=".activity.PlusServiceSignInActivity"
android:label="@string/sign_in"
android:theme="@style/Theme.Twidere"/>
<service
android:name=".service.RefreshService"
@ -543,6 +550,7 @@
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
</intent-filter>
</receiver>
</application>
</manifest>

View File

@ -105,4 +105,5 @@ public interface Constants extends TwidereConstants {
@Preference(type = STRING, exportable = false)
String KEY_DEVICE_SERIAL = "device_serial";
String GOOGLE_APIS_SERVER_CLIENT_ID = "223623398518-1p34hsndj7couh2c9c2f8909amh9euhf.apps.googleusercontent.com";
}

View File

@ -0,0 +1,16 @@
package org.mariotaku.twidere.activity;
import android.content.Intent;
import android.os.Bundle;
import org.mariotaku.twidere.R;
public class PlusServiceDashboardActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_plus_service_dashboard);
startActivity(new Intent(this, PlusServiceSignInActivity.class));
}
}

View File

@ -0,0 +1,98 @@
package org.mariotaku.twidere.activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.View;
import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import org.mariotaku.twidere.R;
/**
* Created by mariotaku on 16/5/11.
*/
public class PlusServiceSignInActivity extends BaseActivity implements GoogleApiClient.OnConnectionFailedListener, View.OnClickListener {
private static final int REQUEST_GOOGLE_SIGN_IN = 101;
private GoogleApiClient mGoogleApiClient;
private View mGoogleSignInButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_plus_service_sign_in);
// Configure sign-in to request the user's ID, email address, and basic
// profile. ID and basic profile are included in DEFAULT_SIGN_IN.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestIdToken(GOOGLE_APIS_SERVER_CLIENT_ID)
.build();
// Build a GoogleApiClient with access to the Google Sign-In API and the
// options specified by gso.
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this, this)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
mGoogleSignInButton.setOnClickListener(this);
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == REQUEST_GOOGLE_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
}
}
@Override
public void onContentChanged() {
super.onContentChanged();
mGoogleSignInButton = findViewById(R.id.google_sign_in);
}
@Override
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.google_sign_in: {
signInWithGoogle();
break;
}
}
}
private void signInWithGoogle() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, REQUEST_GOOGLE_SIGN_IN);
}
private void handleSignInResult(GoogleSignInResult result) {
Log.d(LOGTAG, "handleSignInResult:" + result.isSuccess());
if (result.isSuccess()) {
// TODO Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();
acct.getIdToken();
Log.d(LOGTAG, "sign in name:" + acct.getDisplayName());
} else {
// TODO Signed out, show unauthenticated UI.
}
}
}

View File

@ -73,6 +73,7 @@ import org.mariotaku.sqliteqb.library.Expression;
import org.mariotaku.twidere.R;
import org.mariotaku.twidere.activity.ComposeActivity;
import org.mariotaku.twidere.activity.HomeActivity;
import org.mariotaku.twidere.activity.PlusServiceDashboardActivity;
import org.mariotaku.twidere.activity.QuickSearchBarActivity;
import org.mariotaku.twidere.activity.SettingsActivity;
import org.mariotaku.twidere.annotation.CustomTabType;
@ -703,6 +704,12 @@ public class AccountsDashboardFragment extends BaseSupportFragment implements Lo
closeAccountsDrawer();
break;
}
case R.id.plus_service: {
final Intent intent = new Intent(getActivity(), PlusServiceDashboardActivity.class);
startActivity(intent);
closeAccountsDrawer();
break;
}
case R.id.settings: {
final Intent intent = new Intent(getActivity(), SettingsActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);

View File

@ -6,6 +6,7 @@ import android.os.Bundle;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.LoaderManager.LoaderCallbacks;
import android.support.v4.content.AsyncTaskLoader;
import android.support.v4.content.Loader;
@ -95,6 +96,16 @@ public class ItemsListFragment extends AbsContentListRecyclerViewFragment<Variou
HotMobiLogger.getInstance(getActivity()).log(status.account_key, event);
// END HotMobi
}
@Override
public void onUserProfileClick(IStatusViewHolder holder, int position) {
final FragmentActivity activity = getActivity();
final ParcelableStatus status = dummyItemAdapter.getStatus(position);
if (status == null) return;
IntentUtils.openUserProfile(activity, status.account_key, status.user_key,
status.user_screen_name, null, mPreferences.getBoolean(KEY_NEW_DOCUMENT_API),
UserFragment.Referral.TIMELINE_STATUS);
}
});
dummyItemAdapter.setUserClickListener(new IUsersAdapter.SimpleUserClickListener() {
@Override

View File

@ -1602,15 +1602,8 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
@Override
public boolean onLinkClick(final String link, final String orig, final UserKey accountKey,
long extraId, int type, boolean sensitive, int start, int end) {
final ParcelableStatus status = adapter.getStatus();
ParcelableMedia current;
if ((current = ParcelableMediaUtils.findByUrl(status.media, link)) != null &&
!current.open_browser) {
expandOrOpenMedia(current);
return true;
}
if ((current = ParcelableMediaUtils.findByUrl(status.quoted_media, link)) != null &&
!current.open_browser) {
ParcelableMedia current = getCurrentMedia(link, (int) extraId);
if (current != null && !current.open_browser) {
expandOrOpenMedia(current);
return true;
}
@ -1625,6 +1618,18 @@ public class StatusFragment extends BaseSupportFragment implements LoaderCallbac
}
adapter.setDetailMediaExpanded(true);
}
@Override
protected boolean isMedia(String link, long extraId) {
final ParcelableMedia current = getCurrentMedia(link, (int) extraId);
return current != null && !current.open_browser;
}
private ParcelableMedia getCurrentMedia(String link, int extraId) {
final ParcelableStatus status = adapter.getStatus(extraId);
final ParcelableMedia[] media = ParcelableMediaUtils.getAllMedia(status);
return StatusLinkClickHandler.findByLink(media, link);
}
}
private static class SpacingItemDecoration extends RecyclerView.ItemDecoration {

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="org.mariotaku.twidere.activity.PlusServiceDashboardActivity">
</RelativeLayout>

View File

@ -0,0 +1,13 @@
<?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">
<com.google.android.gms.common.SignInButton
android:id="@+id/google_sign_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
</RelativeLayout>

View File

@ -47,6 +47,12 @@
android:id="@id/filters"
android:icon="@drawable/ic_action_speaker_muted"
android:title="@string/filters"/>
<item
android:id="@id/plus_service"
android:enabled="@bool/is_debug"
android:icon="@drawable/ic_action_infinity"
android:title="@string/plus_service_name"
android:visible="@bool/is_debug"/>
<item
android:id="@id/settings"
android:icon="@drawable/ic_action_settings"

View File

@ -1,48 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Twidere - Twitter client for Android
~
~ Copyright (C) 2012-2015 Mariotaku Lee <mariotaku.lee@gmail.com>
~
~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="AlwaysShowAction">
<item
android:id="@id/settings"
android:layout_weight="0"
android:icon="@drawable/ic_action_settings"
android:title="@string/settings"
app:showAsAction="always"/>
<item
android:id="@id/accounts"
android:layout_weight="0"
android:icon="@drawable/ic_action_accounts"
android:title="@string/accounts"
app:showAsAction="always"/>
<item
android:layout_weight="1"
android:enabled="false"
android:title=""
app:showAsAction="always|withText"/>
<item
android:layout_weight="0"
android:enabled="false"
android:icon="@android:color/transparent"
android:title="@null"
app:showAsAction="always"/>
</menu>

View File

@ -6,5 +6,6 @@
<string name="default_profile_image_style">round</string>
<integer name="default_tab_columns">1</integer>
<integer name="min_database_item_limit">50</integer>
<bool name="is_debug">false</bool>
</resources>

View File

@ -82,4 +82,5 @@
<item name="info" type="id"/>
<item name="messages" type="id"/>
<item name="interactions" type="id"/>
<item name="plus_service" type="id"/>
</resources>

View File

@ -798,4 +798,5 @@
<string name="error_message_device_incompatible">This device is not compatible with Twidere, upgrade to latest Android OS is recommended.\nYou can send information below to help me report this issue to device manufacturer.</string>
<string name="password_sign_in_twitter_only">Password sign in (Twitter only)</string>
<string name="direct_messages_next">DM next</string>
<string name="plus_service_name">Twidere ∞</string>
</resources>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="32px" height="32px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 3.7.2 (28276) - http://www.bohemiancoding.com/sketch -->
<title>ic_action_infinity-mdpi</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Action-Icons" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="ic_action_infinity-mdpi" fill="#FFFFFF">
<path d="M27,15.8192371 C27,17.4488749 26.4892257,18.8231011 25.4676617,19.9419569 C24.4460977,21.0608127 23.15092,21.6202322 21.5820896,21.6202322 C19.3322165,21.6202322 17.4532967,20.3007318 15.9452736,17.6616915 C14.4250891,20.2399244 12.6069758,21.5290216 10.4908789,21.5290216 C8.83691821,21.5290216 7.50829689,20.9939246 6.50497512,19.9237148 C5.50165336,18.8535049 5,17.4610368 5,15.7462687 C5,14.0801465 5.51381465,12.7059203 6.54145937,11.6235489 C7.56910409,10.5411776 8.88556411,10 10.4908789,10 C12.6799446,10 14.5102193,11.3073391 15.9817579,13.9220564 C17.4897809,11.355985 19.3565395,10.0729685 21.5820896,10.0729685 C23.1874044,10.0729685 24.4917031,10.6019848 25.4950249,11.6600332 C26.4983466,12.7180816 27,14.104469 27,15.8192371 L27,15.8192371 Z M10.6368159,19.1028192 C11.4029889,19.1028192 12.1144246,18.8383111 12.7711443,18.3092869 C13.427864,17.7802627 14.0724125,16.9259318 14.7048093,15.7462687 C14.108897,14.6030899 13.4856307,13.75788 12.8349917,13.2106136 C12.1843527,12.6633472 11.4394735,12.3897181 10.6003317,12.3897181 C9.66389803,12.3897181 8.9068575,12.708952 8.3291874,13.3474295 C7.75151729,13.985907 7.46268657,14.7976733 7.46268657,15.7827529 C7.46268657,16.7678325 7.74847697,17.5674375 8.32006633,18.181592 C8.8916557,18.7957466 9.66389784,19.1028192 10.6368159,19.1028192 L10.6368159,19.1028192 Z M21.3631841,12.4626866 C20.5970111,12.4626866 19.8886157,12.7332753 19.2379768,13.274461 C18.5873378,13.8156467 17.9397489,14.6638969 17.2951907,15.8192371 C17.891103,16.9624159 18.5174097,17.8076258 19.1741294,18.3548922 C19.8308491,18.9021586 20.572688,19.1757877 21.3996683,19.1757877 C22.3239405,19.1757877 23.0779407,18.8595941 23.6616915,18.2271973 C24.2454424,17.5948006 24.5373134,16.7921552 24.5373134,15.8192371 C24.5373134,14.870642 24.2484827,14.0740773 23.6708126,13.4295191 C23.0931425,12.7849608 22.3239407,12.4626866 21.3631841,12.4626866 L21.3631841,12.4626866 Z" id="∞"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB