Search in sources :

Example 1 with AppInfo

use of com.mikepenz.lollipopshowcase.entity.AppInfo in project LollipopShowcase by mikepenz.

the class DetailActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);
    mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.container);
    mRowContainer = (LinearLayout) findViewById(R.id.row_container);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("");
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    // Handle Back Navigation :D
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            DetailActivity.this.onBackPressed();
        }
    });
    // Fab Button
    FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_normal);
    floatingActionButton.setImageDrawable(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_file_upload).color(Color.WHITE).actionBar());
    floatingActionButton.setOnClickListener(fabClickListener);
    for (int i = 1; i < mRowContainer.getChildCount(); i++) {
        View rowView = mRowContainer.getChildAt(i);
        rowView.animate().setStartDelay(100 + i * SCALE_DELAY).scaleX(1).scaleY(1);
    }
    ComponentName componentName = null;
    if (savedInstanceState != null) {
        componentName = savedInstanceState.getParcelable("appInfo");
    } else if (getIntent() != null && getIntent().getExtras() != null) {
        componentName = (ComponentName) getIntent().getExtras().get("appInfo");
    }
    if (componentName != null) {
        Intent intent = new Intent();
        intent.setComponent(componentName);
        ResolveInfo app = getPackageManager().resolveActivity(intent, 0);
        mAppInfo = new AppInfo(this, app);
    }
    if (mAppInfo != null) {
        //toolbar.setLogo(mAppInfo.getIcon());
        toolbar.setTitle(mAppInfo.getName());
        View view = mRowContainer.findViewById(R.id.row_name);
        fillRow(view, "Application Name", mAppInfo.getName());
        ((ImageView) view.findViewById(R.id.appIcon)).setImageDrawable(mAppInfo.getIcon());
        view = mRowContainer.findViewById(R.id.row_package_name);
        fillRow(view, "Package Name", mAppInfo.getPackageName());
        view = mRowContainer.findViewById(R.id.row_activity);
        fillRow(view, "Activity", mAppInfo.getActivityName());
        view = mRowContainer.findViewById(R.id.row_component_info);
        fillRow(view, "ComponentInfo", mAppInfo.getComponentInfo());
        view = mRowContainer.findViewById(R.id.row_version);
        fillRow(view, "Version", mAppInfo.getVersionName() + " (" + mAppInfo.getVersionCode() + ")");
        view = mRowContainer.findViewById(R.id.row_moments);
        fillRow(view, "Moments", "First installed: " + new Date(mAppInfo.getFirstInstallTime()) + "\nLast updated: " + new Date(mAppInfo.getLastUpdateTime()));
    }
}
Also used : Intent(android.content.Intent) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) Date(java.util.Date) AppInfo(com.mikepenz.lollipopshowcase.entity.AppInfo) ResolveInfo(android.content.pm.ResolveInfo) FloatingActionButton(android.support.design.widget.FloatingActionButton) ComponentName(android.content.ComponentName) ImageView(android.widget.ImageView) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with AppInfo

use of com.mikepenz.lollipopshowcase.entity.AppInfo in project LollipopShowcase by mikepenz.

the class ApplicationAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(final ViewHolder viewHolder, int i) {
    final AppInfo appInfo = applications.get(i);
    viewHolder.name.setText(appInfo.getName());
    viewHolder.image.setImageDrawable(appInfo.getIcon());
    viewHolder.itemView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            mAct.animateActivity(appInfo, viewHolder.image);
        }
    });
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View) AppInfo(com.mikepenz.lollipopshowcase.entity.AppInfo)

Aggregations

View (android.view.View)2 ImageView (android.widget.ImageView)2 TextView (android.widget.TextView)2 AppInfo (com.mikepenz.lollipopshowcase.entity.AppInfo)2 ComponentName (android.content.ComponentName)1 Intent (android.content.Intent)1 ResolveInfo (android.content.pm.ResolveInfo)1 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 RecyclerView (android.support.v7.widget.RecyclerView)1 Toolbar (android.support.v7.widget.Toolbar)1 IconicsDrawable (com.mikepenz.iconics.IconicsDrawable)1 Date (java.util.Date)1