-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated sdk and added RecyclerView sample (available via the menu).
- Loading branch information
1 parent
84091f0
commit 7520a06
Showing
16 changed files
with
310 additions
and
217 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.autofittextviewsample" | ||
android:installLocation="auto" | ||
> | ||
<manifest package="com.example.autofittextviewsample" | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:installLocation="auto"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@android:style/Theme.Holo.Light" > | ||
android:theme="@style/Theme.AppCompat.Light"> | ||
<activity | ||
android:name="com.example.autofittextviewsample.MainActivity" | ||
android:label="@string/app_name" > | ||
android:name=".MainActivity" | ||
android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<action android:name="android.intent.action.MAIN"/> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
<category android:name="android.intent.category.LAUNCHER"/> | ||
</intent-filter> | ||
</activity> | ||
<activity android:name=".Main2Activity"> | ||
</activity> | ||
</application> | ||
|
||
</manifest> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout | ||
android:id="@+id/activity_main2" | ||
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="com.example.autofittextviewsample.Main2Activity"> | ||
|
||
<android.support.v7.widget.RecyclerView | ||
android:layout_width="match_parent" android:id="@android:id/list" | ||
android:layout_height="match_parent"></android.support.v7.widget.RecyclerView> | ||
|
||
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="50dp"> | ||
|
||
<com.lb.auto_fit_textview.AutoResizeTextView | ||
android:id="@android:id/text1" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:gravity="center_vertical" | ||
android:text="hi" | ||
android:textSize="1000dp"/> | ||
</FrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
|
||
<item android:icon="@android:drawable/ic_menu_info_details" | ||
android:title="@string/more_info" android:showAsAction="always"> | ||
<menu> | ||
<group android:menuCategory="container" | ||
android:checkableBehavior="none"> | ||
<item android:id="@+id/menuItem_current_repository_website" | ||
android:title="@string/repository_website"></item> | ||
<item android:id="@+id/menuItem_all_my_repositories" | ||
android:title="@string/all_my_repositories"></item> | ||
<item android:id="@+id/menuItem_all_my_apps" | ||
android:title="@string/all_my_apps"></item> | ||
</group> | ||
</menu> | ||
</item> | ||
<item | ||
android:icon="@android:drawable/ic_menu_info_details" | ||
android:title="@string/more_info" | ||
app:showAsAction="always"> | ||
<menu> | ||
<group | ||
android:checkableBehavior="none" | ||
android:menuCategory="container"> | ||
<item | ||
android:id="@+id/menuItem_show_recyclerViewSample" | ||
android:title="show RecyclerView sample"/> | ||
<item | ||
android:id="@+id/menuItem_current_repository_website" | ||
android:title="@string/repository_website"></item> | ||
<item | ||
android:id="@+id/menuItem_all_my_repositories" | ||
android:title="@string/all_my_repositories"></item> | ||
<item | ||
android:id="@+id/menuItem_all_my_apps" | ||
android:title="@string/all_my_apps"></item> | ||
</group> | ||
</menu> | ||
</item> | ||
|
||
</menu> | ||
</menu> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<resources> | ||
<!-- Example customization of dimensions originally defined in res/values/dimens.xml | ||
(such as screen margins) for screens with more than 820dp of available width. This | ||
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). --> | ||
<dimen name="activity_horizontal_margin">64dp</dimen> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<resources> | ||
<!-- Default screen margins, per the Android Design guidelines. --> | ||
<dimen name="activity_horizontal_margin">16dp</dimen> | ||
<dimen name="activity_vertical_margin">16dp</dimen> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
AutoFitTextViewSample/src/com/example/autofittextviewsample/Main2Activity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.example.autofittextviewsample; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.LinearLayoutManager; | ||
import android.support.v7.widget.RecyclerView; | ||
import android.support.v7.widget.RecyclerView.Adapter; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.widget.TextView; | ||
|
||
public class Main2Activity extends AppCompatActivity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main2); | ||
RecyclerView recyclerView = (RecyclerView) findViewById(android.R.id.list); | ||
recyclerView.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ||
recyclerView.setAdapter(new Adapter<ViewHolder>() { | ||
@Override | ||
public ViewHolder onCreateViewHolder(final ViewGroup parent, final int viewType) { | ||
return new ViewHolder(LayoutInflater.from(Main2Activity.this).inflate(R.layout.item, parent, false)) { | ||
}; | ||
} | ||
|
||
@Override | ||
public void onBindViewHolder(final ViewHolder holder, final int position) { | ||
StringBuilder sb = new StringBuilder("item:"); | ||
for (int i = 0; i <= position; ++i) | ||
sb.append(Integer.toString(position)); | ||
holder.textView.setText(sb); | ||
} | ||
|
||
@Override | ||
public int getItemCount() { | ||
return 50; | ||
} | ||
}); | ||
} | ||
|
||
private static class ViewHolder extends RecyclerView.ViewHolder { | ||
final TextView textView; | ||
|
||
public ViewHolder(final View itemView) { | ||
super(itemView); | ||
textView = (TextView) itemView.findViewById(android.R.id.text1); | ||
} | ||
} | ||
} |
Oops, something went wrong.