GDK を使用して (または他の方法で)、Glass で WiFi ネットワークに接続するときに表示されるものと同様の進行状況インジケーターを表示する方法はありますか? (このビデオの最後にあるような、ディスプレイの下部にある「回転する」線: https://www.youtube.com/watch?v=g3ncmeGaKN0 )
ありがとう!
GDK を使用して (または他の方法で)、Glass で WiFi ネットワークに接続するときに表示されるものと同様の進行状況インジケーターを表示する方法はありますか? (このビデオの最後にあるような、ディスプレイの下部にある「回転する」線: https://www.youtube.com/watch?v=g3ncmeGaKN0 )
ありがとう!
私は遅れていることを知っていますが、これが私のバージョンです:)
https://github.com/prt2121/glass-gdk-progressbar
gradle ファイルでプロジェクトに追加する
compile 'com.github.prt2121:ProgressBar:1.0@aar'
スクリーンショット:
色を変える
app:progress_color="@android:color/holo_blue_bright"
これはかなり近いですが、色がずれています (白ではなく青/ティール/その他)。
style="?android:attr/progressBarStyleHorizontal"
サンプル ( OkGlassFindACat経由):
<ProgressBar
android:id="@+id/someProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
ただし、その色をオーバーライドする方法がわかりません。
上記の回答をまとめて、カード リスト ローダー アクティビティの一般的なレイアウトを作成しました。レイアウトファイルは次のcard_scroll_with_progress_layout.xml
とおりです。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<com.google.android.glass.widget.CardScrollView
android:id="@+id/card_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:indeterminate="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</FrameLayout>
次に、onCreate でプログレス バーを取得し、ローリングを設定します。
View rootLayout = getLayoutInflater()
.inflate(R.layout.card_scroll_with_progress_layout, null);
mProgressBar = (ProgressBar)rootLayout.findViewById(R.id.progress_bar);
mProgressBar.setVisibility(View.VISIBLE);
mCardScrollView = (CardScrollView)rootLayout
.findViewById(R.id.card_scroll_view);
mCardScrollView.setAdapter(mAdapter);
setContentView(rootLayout);
後のローダー コールバックで、プログレス バーを非表示にして、カード スクロール ビューを有効にします。
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (loader.getId() == mLoaderId) {
mAdapter.swapCursor(data);
mProgressBar.setVisibility(View.GONE);
mCardScrollView.activate();
}
}
これは、GDK 内のカードのリストへのさまざまな json の読み込みを処理するためのパラダイムとしてうまく機能しているようです。
私たちは同様の問題を抱えており、私たちに適したハイブリッドアプローチを見つけました. 以前の投稿で説明した標準のプログレス バー @patridge を使用し、Android Holo Colorsによって提供される生成された Holo スタイルを適用します。
組み込みの GDK バージョンと非常によく似た、白いプログレス バーの画像、アニメーション、レイヤー、およびスタイルを生成することができました。Holo Color で生成された png 画像のサイズを編集することで、GDK に合わせてバーの高さを増やすことができます。
生成されたファイルをプロジェクトに含める必要がありますが、その後のテーマは次のようになります。
<style name="OurGlassTheme" parent="@android:style/Theme.DeviceDefault.NoActionBar.Fullscreen">
<item name="android:progressBarStyleHorizontal">@style/ProgressBarGlass</item>
</style>
<style name="ProgressBarGlass" parent="android:Widget.ProgressBar.Horizontal">
<item name="android:progressDrawable">@drawable/glass_progress_horizontal_holo_light</item>
<item name="android:indeterminateDrawable">@drawable/glass_progress_indeterminate_horizontal_holo_light</item>
<item name="android:minHeight">16dip</item>
<item name="android:maxHeight">16dip</item>
</style>
非常に面倒な作業であることは承知していますが、GDK プログレス バーを提供するという @giladgo の承認済みの Glass 開発者への提出が完了している間に、そこにたどり着きます。