Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5f6f802 authored by Winson Chung's avatar Winson Chung
Browse files

Extracting default loading view definition into XML resource.

Change-Id: Ie5ba936d014f82a2b4df0d803b7553bfc8c25ae7
parent 2a21e73a
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -26,13 +26,12 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.Color;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewGroup;
@@ -49,6 +48,7 @@ public class RemoteViewsAdapter extends BaseAdapter {

    private Context mContext;
    private Intent mIntent;
    private LayoutInflater mLayoutInflater;
    private RemoteViewsAdapterServiceConnection mServiceConnection;
    private WeakReference<RemoteAdapterConnectionCallback> mCallback;
    private FixedSizeRemoteViewsCache mCache;
@@ -334,16 +334,13 @@ public class RemoteViewsAdapter extends BaseAdapter {
                    }

                    // Compose the loading view text
                    TextView textView = new TextView(parent.getContext());
                    textView.setText(com.android.internal.R.string.loading);
                    textView.setHeight(mFirstViewHeight);
                    textView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
                    textView.setTextSize(18.0f);
                    textView.setTextColor(Color.argb(96, 255, 255, 255));
                    textView.setShadowLayer(2.0f, 0.0f, 1.0f, Color.BLACK);
                    textView.setTag(new Integer(0));
                    TextView loadingTextView = (TextView) mLayoutInflater.inflate(
				com.android.internal.R.layout.remote_views_adapter_default_loading_view,
				layout, false);
                    loadingTextView.setHeight(mFirstViewHeight);
                    loadingTextView.setTag(new Integer(0));

                    layout.addView(textView);
                    layout.addView(loadingTextView);
                }
            }

@@ -579,6 +576,7 @@ public class RemoteViewsAdapter extends BaseAdapter {
    public RemoteViewsAdapter(Context context, Intent intent, RemoteAdapterConnectionCallback callback) {
        mContext = context;
        mIntent = intent;
        mLayoutInflater = LayoutInflater.from(context);
        if (mIntent == null) {
            throw new IllegalArgumentException("Non-null Intent must be specified.");
        }
+31 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2010 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"

    android:id="@+id/default_loading_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal|center_vertical"

    android:text="@string/loading"
    android:textColor="#60FFFFFF"
    android:textSize="18sp"
    android:shadowColor="#FF000000"
    android:shadowDx="0.0"
    android:shadowDy="1.0"
    android:shadowRadius="1.0" />